示例#1
0
def transaction():
    list = MainProcess.ProcessTransaction(session["userid"])
    prev = datetime.datetime.now()
    prevmonth = prev.month - 1
    if prevmonth == 0:
        prevmonth = "Dec" + " " + str(prev.year - 1)
    elif prevmonth == 1:
        prevmonth = "Jan " + str(prev.year)
    elif prevmonth == 2:
        prevmonth = "Feb " + str(prev.year)
    elif prevmonth == 3:
        prevmonth = "Mar " + str(prev.year)
    elif prevmonth == 4:
        prevmonth = "Apr " + str(prev.year)
    elif prevmonth == 5:
        prevmonth = "May " + str(prev.year)
    now = datetime.datetime.now()
    month = now.month
    if month == 1:
        month = "Jan " + str(now.year)
    elif month == 2:
        month = "Feb " + str(now.year)
    elif month == 3:
        month = "Mar " + str(now.year)
    elif month==4:
        month="Apr " + str(now.year)
    elif month==5:
        month="May " + str(now.year)
    totalprevdeposit = float("{0:.2f}".format(MainProcess.CurrentTransaction(session["userid"],prevmonth,"Deposit")))
    totalprevwithdraw = float("{0:.2f}".format(MainProcess.CurrentTransaction(session["userid"], prevmonth, "Withdraw")))
    totaldeposit=float("{0:.2f}".format(MainProcess.CurrentTransaction(session["userid"],month,"Deposit")))
    totalwithdraw=float("{0:.2f}".format(MainProcess.CurrentTransaction(session["userid"],month,"Withdraw")))
    return render_template("transaction.html",Transaction=list,totalprevdeposit=totalprevdeposit,totalprevwithdraw=totalprevwithdraw,totaldeposit=totaldeposit,totalwithdraw=totalwithdraw,month=month,prevmonth=prevmonth)
示例#2
0
def spendinganalytics():
    prev = datetime.datetime.now()
    prevmonth = prev.month-1
    if prevmonth==0:
        prevmonth="Dec "+ str(prev.year-1)
    elif prevmonth==1:
        prevmonth="Jan "+ str(prev.year)
    elif prevmonth==2:
        prevmonth="Feb "+ str(prev.year)
    elif prevmonth==3:
        prevmonth="Mar "+ str(prev.year)
    elif prevmonth==4:
        prevmonth="Apr "+ str(prev.year)
    elif prevmonth==5:
        prevmonth="May "+ str(prev.year)
    now = datetime.datetime.now()
    month=now.month
    if month==1:
        month="Jan " + str(now.year)
    elif month==2:
        month="Feb " + str(now.year)
    elif month==3:
        month="Mar" + " " + str(now.year)
    elif month==4:
        month="Apr" + " " + str(now.year)
    elif month==5:
        month="May " + str(now.year)
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"],prevmonth,"Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session["userid"], prevmonth, "Withdraw")
    totaldeposit=MainProcess.CurrentTransaction(session["userid"],month,"Deposit")
    totalwithdraw=MainProcess.CurrentTransaction(session["userid"],month,"Withdraw")
    depositdifference = float("{0:.2f}".format(totaldeposit - totalwithdraw))
    withdrawdifference = float("{0:.2f}".format(totalwithdraw - totaldeposit))
    return render_template('spendinganalytics.html',totalprevdeposit=totalprevdeposit,totalprevwithdraw=totalprevwithdraw,totaldeposit=totaldeposit,totalwithdraw=totalwithdraw,depositdifference=depositdifference,withdrawdifference=withdrawdifference,prevmonth=prevmonth,month=month)
示例#3
0
def home():
    session['userid'] = 'John'
    form = RegisterUser(request.form)
    if request.method == 'POST' and form.validate():
        MainProcess.registerNewUser(form.firstname.data, form.lastname.data,
                                    form.age.data)
        print("User Successfully Register")

    return render_template('home.html', form=form)
示例#4
0
                                    def convert(self):
                                        pw = self.entry.get()
                                        if pw == "55776688G":
                                            self.value.set("Correct Password")
                                            MainProcess.newTransaction(session["userid"], todaydate,form.bank_details.data,form.transaction_details.data, "None",form.withdraw.data)
                                            tkinter.messagebox.showinfo("Success","You have just transfer $%.2f from %s" % (float(form.withdraw.data),form.bank_details.data))
                                            return "Correct password"

                                        else:
                                            self.value.set("Wrong Password")
示例#5
0
def graph():
    totalDeposit = 0
    totalWithdrawal = 0
    totalDeposit = MainProcess.processTransaction(session['userid'], 'Dec',
                                                  'deposit')
    totalWithdrawal = MainProcess.processTransaction(session['userid'], 'Dec',
                                                     'withdraw')

    return render_template('Graph.html',
                           totalDepositAmount=totalDeposit,
                           totalWithdrawalAmount=totalWithdrawal)
示例#6
0
def rebates():
    userlist=[]
    userlists=[]
    userlist=MainProcess.processAccounts()
    userlists=MainProcess.processAccountss() #secondcard
    totalCiti = 0
    totalOcbc = 0
    totalCiti = MainProcess.rebatesTransaction
    totalOcbc = MainProcess.rebatesTransaction

    return render_template('rebates.html', citiAmount = totalCiti, ocbcAmount = totalOcbc,users=userlist, user=userlists)
示例#7
0
def graph():
    totalPaid = 0
    totalUnpaid = 0
    totalOverdue = 0
    totalPaid = MainProcess.processTransaction(session['userid'], 'Dec',
                                               'paid')
    totalUnpaid = MainProcess.processTransaction('John', 'Dec', 'unpaid')
    totalOverdue = MainProcess.processTransaction('John', 'Dec', 'overdue')

    return render_template('loans.html',
                           totalPaidAmount=totalPaid,
                           totalUnpaidAmount=totalUnpaid,
                           totalOverdueAmount=totalOverdue)
示例#8
0
def spendinganalytics():
    session['userid'] = "Audrey"
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"], "Dec",
                                                      "Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session["userid"],
                                                       "Dec", "Withdraw")
    totaldeposit = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                  "Deposit")
    totalwithdraw = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                   "Withdraw")
    return render_template('spendinganalytics.html',
                           totalprevdeposit=totalprevdeposit,
                           totalprevwithdraw=totalprevwithdraw,
                           totaldeposit=totaldeposit,
                           totalwithdraw=totalwithdraw)
示例#9
0
def savings():
    savingsList = []
    savingsList = MainProcess.processSaving()

    return render_template('savings.html',
                           savings=savingsList,
                           count=len(savingsList))
示例#10
0
def transaction():
    session['userid'] = 'Audrey'
    list = MainProcess.processTransaction(session["userid"])
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"], "Dec",
                                                      "Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session["userid"],
                                                       "Dec", "Withdraw")
    totaldeposit = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                  "Deposit")
    totalwithdraw = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                   "Withdraw")
    return render_template("transaction.html",
                           Transaction=list,
                           totalprevdeposit=totalprevdeposit,
                           totalprevwithdraw=totalprevwithdraw,
                           totaldeposit=totaldeposit,
                           totalwithdraw=totalwithdraw)
示例#11
0
def Keyboard():
    global mainProcess
    mainProcess = MainProcess.MainProcess()
    dataSend = {
        "type" : "buttons",
        "buttons" : ["챗봇 시작하기"]
    }
    return jsonify(dataSend)
示例#12
0
def spendinganalytics():
    session['userid'] = "Yonglin"
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"], "Dec",
                                                      "Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session["userid"],
                                                       "Dec", "Withdraw")
    totaldeposit = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                  "Deposit")
    totalwithdraw = MainProcess.CurrentTransaction(session["userid"], "Jan",
                                                   "Withdraw")
    depositdifference = float("{0:.2f}".format(totaldeposit - totalwithdraw))
    withdrawdifference = float("{0:.2f}".format(totalwithdraw - totaldeposit))
    return render_template('spendinganalytics.html',
                           totalprevdeposit=totalprevdeposit,
                           totalprevwithdraw=totalprevwithdraw,
                           totaldeposit=totaldeposit,
                           totalwithdraw=totalwithdraw,
                           depositdifference=depositdifference,
                           withdrawdifference=withdrawdifference)
示例#13
0
def fundtransfer():
    session['userid'] = 'Audrey'
    form = newTransaction(request.form)
    if request.method == 'POST' and form.validate():
        now = datetime.datetime.now()
        todaydate = str(now.day) + " " + "Jan" + " " + str(now.year)
        try:
            float(form.withdraw.data)
            if float(form.withdraw.data) > 0:
                MainProcess.newTransaction(session["userid"], todaydate,
                                           form.bank_details.data,
                                           form.transaction_details.data,
                                           "None", form.withdraw.data)
            else:

                class HelloGUI:
                    def __init__(self):
                        self.main_window = tkinter.Tk()
                        self.label = tkinter.Label(
                            self.main_window, text="Invalid Transfer Amount")
                        self.label.pack()
                        tkinter.mainloop()

                gui = HelloGUI()
        except ValueError:

            class HelloGUI:
                def __init__(self):
                    self.main_window = tkinter.Tk()
                    self.label = tkinter.Label(self.main_window,
                                               text="Invalid Transfer Amount")
                    self.label.pack()
                    tkinter.mainloop()

            gui = HelloGUI()
    userlist = MainProcess.processTransaction(session["userid"])
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"], "Dec",
                                                      "Deposit")
    totaldeposit = MainProcess.CurrentTransaction(session['userid'], "Jan",
                                                  "Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session['userid'],
                                                       "Dec", "Withdraw")
    totalwithdraw = MainProcess.CurrentTransaction(session['userid'], "Jan",
                                                   "Withdraw")
    totald = totalprevdeposit + totaldeposit
    totalw = totalwithdraw + totalprevwithdraw
    return render_template('fundtransfer.html',
                           Transaction=userlist,
                           form=form,
                           totaldeposit=totald,
                           totalwithdraw=totalw)
示例#14
0
def savings():
    savingsList = []
    savingsList = MainProcess.processSaving()
    #print the saving list
    for i in savingsList:


    return render_template('savings.html', savings=savingsList, count=len(savingsList))

@app.route('/layout')
def layout():
    return render_template('layout.html')

@app.route('/layout1')
def layout1():
    return render_template('layout1.html')

if __name__ == '__main__':
    app.run()
示例#15
0
def fundtransfer():
    session['userid'] = 'Yonglin'
    form = newTransaction(request.form)
    if request.method == 'POST' and form.validate():
        now = datetime.datetime.now()
        todaydate = str(now.day) + " " + "Jan" + " " + str(now.year)
        try:
            float(form.withdraw.data)
            if float(form.withdraw.data) > 0:
                MainProcess.newTransaction(session["userid"], todaydate,
                                           form.bank_details.data,
                                           form.transaction_details.data,
                                           "None", form.withdraw.data)
            else:
                tkinter.messagebox.showinfo("ALERT",
                                            "Amount cannot be less than 0")
        except ValueError:
            tkinter.messagebox.showinfo("ALERT",
                                        "Invalid fund transfer amount")

    userlist = MainProcess.processTransaction(session["userid"])
    totalprevdeposit = MainProcess.CurrentTransaction(session["userid"], "Dec",
                                                      "Deposit")
    totaldeposit = MainProcess.CurrentTransaction(session['userid'], "Jan",
                                                  "Deposit")
    totalprevwithdraw = MainProcess.CurrentTransaction(session['userid'],
                                                       "Dec", "Withdraw")
    totalwithdraw = MainProcess.CurrentTransaction(session['userid'], "Jan",
                                                   "Withdraw")
    totald = float("{0:.2f}".format(totalprevdeposit + totaldeposit))
    totalw = float("{0:.2f}".format(totalwithdraw + totalprevwithdraw))
    return render_template('fundtransfer.html',
                           Transaction=userlist,
                           form=form,
                           totaldeposit=totald,
                           totalwithdraw=totalw)
示例#16
0
def accounts():
    detailsList = MainProcess.processUserDetails()
    return render_template('accounts.html', users=detailsList)
示例#17
0
def details():
    userslist = []
    userslist = MainProcess.processUser()
    return render_template('Details.html',
                           users=userslist,
                           count=len(userslist))
示例#18
0
def fundtransfer():
    class newTransaction(Form):
        transaction_details = StringField("Recipient's name:",[validators.Length(min=1, max=150), validators.DataRequired()])
        userlist = []
        user_file = open("file/" + session['userid'].capitalize() , 'r')
        for ulist in user_file:
            list = ulist.split(',')
            if list[2]=="fixed deposit":
                pass
            else:
                s =list[0] + " " + list[2] + " " + list[1]
                userlist.append(s)

        if len(userlist) == 0:
            bank_details = SelectField('Bank Details:', [validators.DataRequired()],choices=[('', 'Select'), ("No accounts", "No accounts")], default='')

        elif len(userlist) == 1:
            bank_details = SelectField('Bank Details:', [validators.DataRequired()],choices=[('', 'Select'), (userlist[0], userlist[0])], default='')

        elif len(userlist) == 2:
            bank_details = SelectField('Bank Details:', [validators.DataRequired()],choices=[('', 'Select'), (userlist[0], userlist[0]), (userlist[1], userlist[1])],default='')

        elif len(userlist) == 3:
            bank_details = SelectField('Bank Details:', [validators.DataRequired()],choices=[('', 'Select'), (userlist[0], userlist[0]), (userlist[1], userlist[1]),(userlist[2], userlist[2])], default='')

        elif len(userlist) == 4:
            bank_details = SelectField('Bank Details:', [validators.DataRequired()],choices=[('', 'Select'), (userlist[0], userlist[0]), (userlist[1], userlist[1]),(userlist[2], userlist[2]), (userlist[3], userlist[3])], default='')

        withdraw = StringField("Amount:", [validators.Length(min=1, max=150), validators.DataRequired()])
        account_type = SelectField('Account Type:', [validators.DataRequired()],choices=[('', 'Select'), ("Posb", "Posb"), ("Ocbc", "Ocbc"), ("Uob", "Uob"),("Maybank", "Maybank")], default='')
        account_number = StringField("Account number(Please omit dash):",[validators.Length(min=1, max=150), validators.DataRequired()])

    form = newTransaction(request.form)
    prev = datetime.datetime.now()
    prevmonth = prev.month-1
    if prevmonth == 0:
        prevmonth = "Dec " + str(prev.year - 1)
    elif prevmonth == 1:
        prevmonth = "Jan " + str(prev.year)
    elif prevmonth == 2:
        prevmonth = "Feb " + str(prev.year)
    elif prevmonth == 3:
        prevmonth = "Mar" + " "  + str(prev.year)
    elif prevmonth == 4:
        prevmonth = "Apr" + " " + str(prev.year)
    elif prevmonth == 5:
        prevmonth = "May " + str(prev.year)
    now = datetime.datetime.now()
    month = now.month
    if month == 1:
        month = "Jan " + str(now.year)
    elif month == 2:
        month = "Feb " + str(now.year)
    elif month == 3:
        month = "Mar " + str(now.year)
    elif month==4:
        month="Apr " + str(now.year)
    elif month==5:
        month="May " + str(now.year)
    todaydate = str(now.day) + " " + month
    if request.method == 'POST' and form.validate():
        try:
            detailsList = []
            user_file = open('file/' + session['userid'].capitalize(), 'r')
            for dlist in user_file:
                list = dlist.split(',')
                s = float(list[5])
                detailsList.append(s)
            float(form.withdraw.data)
            if float(form.withdraw.data)>0:
                if (form.account_number.data.isdigit()):
                    if len(form.withdraw.data.rsplit(".")[-1])==2:
                        if form.bank_details.data.endswith("010-4-444444"):
                            if float(form.withdraw.data)<=detailsList[0]:
                                class Password:
                                    def __init__(self):
                                        self.main_window = tkinter.Tk()
                                        self.top_frame = tkinter.Frame(self.main_window)
                                        self.bottom_frame = tkinter.Frame(self.main_window)
                                        self.label = tkinter.Label(self.top_frame, text="Enter your password: "******"Enter",
                                                                     command=self.convert)
                                        self.value = tkinter.StringVar()
                                        self.miles = tkinter.Label(self.bottom_frame, textvariable=self.value)

                                        self.button.pack(side='left')
                                        self.miles.pack(side='left')
                                        self.label.pack(side='left')
                                        self.entry.pack(side='left')
                                        self.top_frame.pack()
                                        self.bottom_frame.pack()

                                        tkinter.mainloop()

                                    def convert(self):
                                        pw = self.entry.get()
                                        if pw == "55776688G":
                                            self.value.set("Correct Password")
                                            MainProcess.newTransaction(session["userid"], todaydate,form.bank_details.data,form.transaction_details.data, "None",form.withdraw.data)
                                            tkinter.messagebox.showinfo("Success","You have just transfer $%.2f from %s" % (float(form.withdraw.data),form.bank_details.data))
                                            return "Correct password"

                                        else:
                                            self.value.set("Wrong Password")

                                password = Password()

                            else:
                                tkinter.messagebox.showerror("ALERT","Withdraw amount($%0.2f) is more than account balance($%0.2f)." %(float(form.withdraw.data), detailsList[0]))
                        else:
                            if form.bank_details.data.endswith("010-1-111111"):
                                if float(form.withdraw.data) <= detailsList[1]:
                                    class Password:
                                        def __init__(self):
                                            self.main_window = tkinter.Tk()
                                            self.top_frame = tkinter.Frame(self.main_window)
                                            self.bottom_frame = tkinter.Frame(self.main_window)
                                            self.label = tkinter.Label(self.top_frame, text="Enter your password: "******"Enter",
                                                                         command=self.convert)
                                            self.value = tkinter.StringVar()
                                            self.miles = tkinter.Label(self.bottom_frame, textvariable=self.value)

                                            self.button.pack(side='left')
                                            self.miles.pack(side='left')
                                            self.label.pack(side='left')
                                            self.entry.pack(side='left')
                                            self.top_frame.pack()
                                            self.bottom_frame.pack()

                                            tkinter.mainloop()

                                        def convert(self):
                                            pw = self.entry.get()
                                            if pw == "55776688G":
                                                self.value.set("Correct Password")
                                                MainProcess.newTransaction(session["userid"], todaydate,
                                                                           form.bank_details.data,
                                                                           form.transaction_details.data, "None",
                                                                           form.withdraw.data)
                                                tkinter.messagebox.showinfo("Success",
                                                                            "You have just transfer $%.2f from %s" % (
                                                                            float(form.withdraw.data),
                                                                            form.bank_details.data))
                                                return "Correct password"

                                            else:
                                                self.value.set("Wrong Password")

                                    password = Password()
                                else:
                                    tkinter.messagebox.showerror("ALERT","Withdraw amount($%0.2f) is more than account balance($%0.2f)."%(float(form.withdraw.data),detailsList[1]))
                            else:
                                if form.bank_details.data.endswith("550-10-89550"):
                                    if float(form.withdraw.data) <= detailsList[2]:
                                        class Password:
                                            def __init__(self):
                                                self.main_window = tkinter.Tk()
                                                self.top_frame = tkinter.Frame(self.main_window)
                                                self.bottom_frame = tkinter.Frame(self.main_window)
                                                self.label = tkinter.Label(self.top_frame, text="Enter your password: "******"Enter",
                                                                             command=self.convert)
                                                self.value = tkinter.StringVar()
                                                self.miles = tkinter.Label(self.bottom_frame, textvariable=self.value)

                                                self.button.pack(side='left')
                                                self.miles.pack(side='left')
                                                self.label.pack(side='left')
                                                self.entry.pack(side='left')
                                                self.top_frame.pack()
                                                self.bottom_frame.pack()

                                                tkinter.mainloop()

                                            def convert(self):
                                                pw = self.entry.get()
                                                if pw == "55776688G":
                                                    self.value.set("Correct Password")
                                                    MainProcess.newTransaction(session["userid"], todaydate,
                                                                               form.bank_details.data,
                                                                               form.transaction_details.data, "None",
                                                                               form.withdraw.data)
                                                    tkinter.messagebox.showinfo("Success",
                                                                                "You have just transfer $%.2f from %s" % (
                                                                                float(form.withdraw.data),
                                                                                form.bank_details.data))
                                                    return "Correct password"

                                                else:
                                                    self.value.set("Wrong Password")

                                        password = Password()
                                    else:
                                        tkinter.messagebox.showerror("ALERT","Withdraw amount($%0.2f) is more than account balance($%0.2f)." %(float(form.withdraw.data), detailsList[2]))
                                else:
                                    if form.bank_details.data.endswith("910-20-31012"):
                                        if float(form.withdraw.data) <= detailsList[0]:
                                            class Password:
                                                def __init__(self):
                                                    self.main_window = tkinter.Tk()
                                                    self.top_frame = tkinter.Frame(self.main_window)
                                                    self.bottom_frame = tkinter.Frame(self.main_window)
                                                    self.label = tkinter.Label(self.top_frame,
                                                                               text="Enter your password: "******"Enter",
                                                                                 command=self.convert)
                                                    self.value = tkinter.StringVar()
                                                    self.miles = tkinter.Label(self.bottom_frame,
                                                                               textvariable=self.value)

                                                    self.button.pack(side='left')
                                                    self.miles.pack(side='left')
                                                    self.label.pack(side='left')
                                                    self.entry.pack(side='left')
                                                    self.top_frame.pack()
                                                    self.bottom_frame.pack()

                                                    tkinter.mainloop()

                                                def convert(self):
                                                    pw = self.entry.get()
                                                    if pw == "99778800Z":
                                                        self.value.set("Correct Password")
                                                        MainProcess.newTransaction(session["userid"], todaydate,
                                                                                   form.bank_details.data,
                                                                                   form.transaction_details.data,
                                                                                   "None", form.withdraw.data)
                                                        tkinter.messagebox.showinfo("Success",
                                                                                    "You have just transfer $%.2f from %s" % (
                                                                                    float(form.withdraw.data),
                                                                                    form.bank_details.data))
                                                        return "Correct password"

                                                    else:
                                                        self.value.set("Wrong Password")

                                            password = Password()
                                        else:
                                            tkinter.messagebox.showerror("ALERT","Withdraw amount($%0.2f) is more than account balance($%0.2f)." %(float(form.withdraw.data), detailsList[0]))
                    else:
                        tkinter.messagebox.showerror("ALERT","Amount must be in 2 decimal places.")
                else:
                    tkinter.messagebox.showerror("ALERT","Account number only contain numbers.")
            else:
                tkinter.messagebox.showerror("ALERT", "Amount cannot be less than 0")
        except ValueError:
            tkinter.messagebox.showerror("ALERT", "Invalid fund transfer amount")
    userlist = MainProcess.ProcessTransaction(session["userid"])
    totald = float("{0:.2f}".format(MainProcess.Totalamount(session["userid"],"Deposit")))
    totalw = float("{0:.2f}".format(MainProcess.Totalamount(session['userid'],"Withdraw")))
    totalmonthdeposit=float("{0:.2f}".format(MainProcess.CurrentTransaction(session['userid'],month,"Deposit")))
    totalmonthwithdraw = float("{0:.2f}".format(MainProcess.CurrentTransaction(session['userid'], month, "Withdraw")))
    totalprevdeposit = float("{0:.2f}".format(MainProcess.CurrentTransaction(session['userid'], prevmonth, "Deposit")))
    totalprevwithdraw = float("{0:.2f}".format(MainProcess.CurrentTransaction(session['userid'], prevmonth, "Withdraw")))
    detailsList = RetrievingProcess.processUserDetails(session['userid'])
    return render_template('fundtransfer.html',totalw=totalw,totald=totald,Transaction=userlist,form=form,totalmonthdeposit=totalmonthdeposit,totalmonthwithdraw=totalmonthwithdraw,totalprevwithdraw=totalprevwithdraw,totalprevdeposit=totalprevdeposit,month=month,detailsList=detailsList)