Example #1
0
    def post(self):
        current_user = users.get_current_user()
        userid = current_user.user_id()
        
        if self.request.POST['time']:
            d = datetime.strptime(self.request.POST['time'],'%m/%d/%Y')
            t = datetime.time(datetime.now())
            dt = datetime.combine(d,t)
        else:
            dt = datetime.now()

        account = Account(
                    user=current_user, 
                    item=self.request.POST['item'],
                    type=self.request.POST['type'],
                    amount=float(self.request.POST['amount']),
                    created=dt,
                    description=cgi.escape(self.request.POST['description'])
                    )
        account.put()

        template_values = {'user': current_user}

        path = os.path.join(os.path.dirname(__file__), 'templates', 'result.html')
        self.response.out.write(template.render(path,template_values))
Example #2
0
 def whenPressed(self):
     try:
         ano = int(self.parent.accoutno.value)
         amount = float(self.parent.AmountView.value) * -1
         Account.deposit(int(ano), amount)
     except:
         npyscreen.notify_wait("Please enter account nubmer")
Example #3
0
 def whenPressed(self):
     try:
         ano = int(self.parent.accoutno.value)
         val = Account.balenquiry(ano)
         reslist = Account.showTransactions(int(ano))
         self.parent.ResView.values = reslist
         self.parent.display()
     except:
         npyscreen.notify_wait("Please enter account nubmer")
Example #4
0
def add_new_account_func():
    print(" wer are going to add new account")
    newuser = User()
    uname = input("Please enter your name:")
    newuser.Name = uname
    print(f"Entered name is {uname}")

    uadress = input("please enter your adress:")
    newuser.Address = uadress
    print(f"entered adress is {uadress}")

    DOB = input("please enter your DOB:")  # string
    newuser.DOB = DOB  # convert DOB to datetime datatime
    print(f"entered DOB is {DOB}")

    umodel = newuser.AddToDB()
    typ = uaccounttypefunc()
    amodel = Account.AccountAddToDB(umodel, typ)

    uinitialdeposit = input(
        "please enter your initial amount of deposit (not less than 500):")
    print(f"entered initial amount of deposit is {uinitialdeposit}")
    t0 = Transaction()
    t0.amount = float(uinitialdeposit)
    t0.addTransactionToDB(amodel)
Example #5
0
 def whenPressed(self):
     try:
         ano = int(self.parent.accoutno.value)
         val = Account.balenquiry(ano)
         self.parent.ResView.values  = [f"Balance     {val:0.3f}"]
         
         self.parent.display()
     except :
         npyscreen.notify_wait("Please enter account nubmer")
Example #6
0
def get_accounts(userid):
    conn = mysql.connect()
    cursor = conn.cursor()
    cursor.execute('select * from account where userid = %s', (userid))
    data = cursor.fetchall()

    accounts = []
    for d in data:
        account = Account(accountno=d[0], creationdate=d[1], creditcard=d[2], cardtype=d[3], userid=d[4])
        accounts.append(account)
    return accounts
Example #7
0
    def whenPressed(self):

        u = User()
        u.Name = self.parent.uname.value
        u.Address = self.parent.address.value
        u.DOB = self.parent.dob.value

        umodel = u.AddToDB()

        amt = float(self.parent.initamount.value)

        atype = "SAVINGS"
        if self.parent.aType.values[0] == 0:
            atype = "SAVINGS"
        if self.parent.aType.values[0] == 1:
            atype = "CURRENTS"

        amodel = Account.AccountAddToDB(umodel, atype)

        # amt = float(self.initamount.value)
        t0 = Transaction()

        t0.amount = float(amt)
        t0.addTransactionToDB(amodel)
Example #8
0
def show_transactions_func():
    accountno = input("enter your account number :")
    Account.showTransactions(int(accountno))
Example #9
0
def withdrawal_func():
    accountno = input("enter your account number :")
    wamount = input("enter amount of withdrawal :")
    #amount = input("enter amount of deposit :")
    Account.deposit(int(accountno), -1* float(wamount))
    print(f"you have withdrawed {wamount}")
Example #10
0
def deposit_func():
    daccountno = input("enter your account number :")
    amount = input("enter amount of deposit :")
    Account.deposit(int(daccountno), abs(float(amount)))
    print(f"you have deposited {amount}")
Example #11
0
def balance_enquiry_func():
    
    daccountno = input("enter your account number :")
    Account.balenquiry(int(daccountno))