Giter Site home page Giter Site logo

Sucheta Mohanty 's Projects

developerfolio icon developerfolio

🚀 Software Developer Portfolio Template that helps you showcase your work and skills as a software developer.

my-restaurant-billing-system icon my-restaurant-billing-system

import tkinter import time import random import tkinter.messagebox from tkinter import * import br as br root=Tk() root.geometry("1400x750+0+0") root.title("Restaurant Billing System") root.configure(background='sky blue') Tops = Frame(root, bg='dark blue', bd=25, pady=20, relief=GROOVE) Tops.pack(side=TOP) lblTitle = Label(Tops, font=('arial', 30, 'bold'), text='Restaurant Billing System', bd=15, bg='sky blue', fg='dark blue', justify=CENTER) lblTitle.grid(row=0) ReceiptCal_Function = Frame(root, bg='dark blue', bd=10, relief=GROOVE) ReceiptCal_Function.pack(side=LEFT) Buttons_Function = Frame(ReceiptCal_Function, bg='dark blue', bd=3, relief=GROOVE) Buttons_Function.pack(side=TOP) Calculator_Function = Frame(ReceiptCal_Function, bg='dark blue', bd=6, relief=GROOVE) Calculator_Function.pack(side=BOTTOM) Receipt_Function = Frame(ReceiptCal_Function, bg='dark blue', bd=4, relief=GROOVE) Receipt_Function.pack(side=BOTTOM) MenuFrame = Frame(root, bg='dark blue', bd=32, relief=GROOVE) MenuFrame.pack(side=RIGHT) Total_Function = Frame(MenuFrame, bg='sky blue', bd=4) Total_Function.pack(side=BOTTOM) Drinks_Function = Frame(MenuFrame, bg='sky blue', bd=4) Drinks_Function.pack(side=TOP) Drinks_Function = Frame(MenuFrame, bg='sky blue', bd=4, relief=GROOVE) Drinks_Function.pack(side=LEFT) Food_Function = Frame(MenuFrame, bg='sky blue', bd=4, relief=GROOVE) Food_Function.pack(side=RIGHT) variable1 = IntVar() variable2 = IntVar() variable3 = IntVar() variable4 = IntVar() variable5 = IntVar() variable6 = IntVar() variable7 = IntVar() variable8 = IntVar() variable9 = IntVar() variable10 = IntVar() variable11 = IntVar() variable12 = IntVar() variable13 = IntVar() variable14 = IntVar() variable15 = IntVar() variable16 = IntVar() Date_of_Order = StringVar() Receipt_Ref = StringVar() PaidTax = StringVar() SubTotal = StringVar() TotalCost = StringVar() Total_of_Food = StringVar() Total_of_Drinks = StringVar() ServiceCharge = StringVar() text_Input = StringVar() operator = "" cocktail = StringVar() iced_tea = StringVar() hot_chocolate = StringVar() orange_juice = StringVar() milkshake = StringVar() mountain_dew = StringVar() sting = StringVar() cobra = StringVar() fried_chicken = StringVar() kare_kare = StringVar() crispy_pata = StringVar() sinigang_baboy = StringVar() sinigang_hipon = StringVar() bicol_express = StringVar() asparagus_tofu = StringVar() chicken_sisig = StringVar() cocktail.set("0") iced_tea.set("0") hot_chocolate.set("0") orange_juice.set("0") milkshake.set("0") mountain_dew.set("0") sting.set("0") cobra.set("0") fried_chicken.set("0") kare_kare.set("0") crispy_pata.set("0") sinigang_baboy.set("0") sinigang_hipon.set("0") bicol_express.set("0") asparagus_tofu.set("0") chicken_sisig.set("0") def drinksIceTea(args): pass def TotalofUnit(): Unit1 = float(cocktail.get()) Unit2 = float(iced_tea.get()) Unit3 = float(hot_chocolate.get()) Unit4 = float(orange_juice.get()) Unit5 = float(milkshake.get()) Unit6 = float(mountain_dew.get()) Unit7 = float(sting.get()) Unit8 = float(cobra.get()) Unit9 = float(fried_chicken.get()) Unit10 = float(kare_kare.get()) Unit11 = float(crispy_pata.get()) Unit12 = float(sinigang_baboy.get()) Unit13 = float(sinigang_hipon.get()) Unit14 = float(bicol_express.get()) Unit15 = float(asparagus_tofu.get()) Unit16 = float(chicken_sisig.get()) Prices_Drinks = (Unit1 * 50) + (Unit2 * 45) + (Unit3 * 60) + (Unit4 * 35) + (Unit5 * 70) + (Unit6 * 40) + (Unit7 * 55) + (Unit8 * 75) Prices_Food = (Unit9 * 490) + (Unit10 * 450) + (Unit11 * 350) + (Unit12 * 400) + (Unit13 * 500) + (Unit14 * 250) + (Unit15 * 650) + (Unit16 * 370) DrinksPrices = "P" + str('%.2f' % Prices_Drinks) FoodsPrices = "P" + str('%.2f' % Prices_Food) Total_of_Food.set(FoodsPrices) Total_of_Drinks.set(DrinksPrices) SC = "P" + str('%.2f' % 1.59) ServiceCharge.set(SC) Sub_Total_of_Unit = "P" + str('%.2f'%(Prices_Drinks + Prices_Food + 1.59)) SubTotal.set(Sub_Total_of_Unit) Tax = "P" + str('%.2f' % ((Prices_Drinks + Prices_Food + 1.59) * 0.15)) PaidTax.set(Tax) TT = ((Prices_Drinks + Prices_Food + 1.59) * 0.15) TC = "P" + str('%.2f' % (Prices_Drinks + Prices_Food + 1.59 + TT)) TotalCost.set(TC) def drinksCocktail(): if variable1.get()==1: textCocktail.configure(state=NORMAL) textCocktail.focus() textCocktail.delete('0', END) cocktail.set("") elif variable1.get() == 0: textCocktail.configure(state=DISABLED) cocktail.set("0") def drinksIceTea(): if variable2.get() == 1: textIcedTea.configure(state=NORMAL) textIcedTea.focus() textIcedTea.delete('0', END) iced_tea.set("") elif variable2.get() == 0: textIcedTea.configure(state=DISABLED) iced_tea.set("0") def drinksHotChocolate(): if variable3.get() == 1: textHotChocolate.configure(state=NORMAL) textHotChocolate.delete('0', END) textHotChocolate.focus() elif variable3.get() == 0: textHotChocolate.configure(state=DISABLED) hot_chocolate.set("0") def drinksMilkShake(): if variable5.get() == 1: textMilkShake.configure(state=NORMAL) textMilkShake.delete('0', END) textMilkShake.focus() elif variable5.get() == 0: textMilkShake.configure(state=DISABLED) milkshake.set("0") def drinksMountainDew(): if variable6.get() == 1: textMountainDew.configure(state=NORMAL) textMountainDew.delete('0', END) textMountainDew.focus() elif variable6.get() == 0: textMountainDew.configure(state=DISABLED) mountain_dew.set("0") def drinksSting(): if variable7.get() == 1: textSting.configure(state=NORMAL) textSting.delete('0', END) textSting.focus() elif variable7.get() == 0: textSting.configure(state=DISABLED) sting.set("0") def drinksCobra(): if variable8.get() == 1: textCobra.configure(state=NORMAL) textCobra.delete('0', END) textCobra.focus() elif variable8.get() == 0: textCobra.configure(state=DISABLED) cobra.set("0") def foodsFriedChicken(): if variable9.get() == 1: textFriedChicken.configure(state=NORMAL) textFriedChicken.delete('0', END) textFriedChicken.focus() elif variable9.get() == 0: textFriedChicken.configure(state=DISABLED) fried_chicken.set("0") def foodsKareKare(): if variable10.get() == 1: textKareKAre.configure(state=NORMAL) textKareKAre.delete('0', END) textKareKAre.focus() elif variable10.get() == 0: textKareKAre.configure(state=DISABLED) kare_kare.set("0") def foodsCrispyPata(): if variable11.get() == 1: textCrispyPata.configure(state=NORMAL) textCrispyPata.delete('0', END) textCrispyPata.focus() elif variable11.get() == 0: textCrispyPata.configure(state=DISABLED) crispy_pata.set("0") def foodsSinigangBaboy(): if variable12.get() == 1: textSinigangBaboy.configure(state=NORMAL) textSinigangBaboy.delete('0', END) textSinigangBaboy.focus() elif variable12.get() == 0: textSinigangBaboy.configure(state=DISABLED) sinigang_baboy.set("0") def foodsSinigangHipon(): if variable13.get() == 1: textSinigangHipon.configure(state=NORMAL) textSinigangHipon.delete('0', END) textSinigangHipon.focus() elif (variable13.get() == 0): textSinigangHipon.configure(state=DISABLED) sinigang_hipon.set("0") def foodsBicolExpress(): if variable14.get() == 1: textBicolExpress.configure(state=NORMAL) textBicolExpress.delete('0', END) textBicolExpress.focus() elif variable14.get() == 0: textBicolExpress.configure(state=DISABLED) bicol_express.set("0") def foodsAsparagusTofu(): if variable15.get() == 1: textAsparagusTofu.configure(state=NORMAL) textAsparagusTofu.delete('0', END) textAsparagusTofu.focus() elif variable15.get() == 0: textAsparagusTofu.configure(state=DISABLED) asparagus_tofu.set("0") def foodsChickenSisig(): if variable16.get() == 1: textChickenSisig.configure(state=NORMAL) textChickenSisig.delete('0', END) textChickenSisig.focus() elif (variable16.get() == 0): textChickenSisig.configure(state=DISABLED) chicken_sisig.set("0") Cocktail = Checkbutton(Drinks_Function, text='Cocktail', variable=variable1, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksCocktail).grid(row=0, sticky=W) IcedTea = Checkbutton(Drinks_Function, text='Iced Tea', variable=variable2, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksIceTea).grid(row=1, sticky=W) HotChocolate = Checkbutton(Drinks_Function, text='Hot Chocolate', variable=variable3, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksHotChocolate).grid(row=2, sticky=W) MilkShake = Checkbutton(Drinks_Function, text='Milk Shake', variable=variable5, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksMilkShake).grid(row=4, sticky=W) MountainDew = Checkbutton(Drinks_Function, text='Mountain Dew', variable=variable6, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksMountainDew).grid(row=5, sticky=W) Sting = Checkbutton(Drinks_Function, text='Sting', variable=variable7, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksSting).grid(row=6, sticky=W) Cobra = Checkbutton(Drinks_Function, text='Cobra', variable=variable8, onvalue=1, offvalue=0, font=('arial', 16, 'bold'), bg='sky blue', command=drinksCobra).grid(row=7, sticky=W) textCocktail = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=cocktail) textCocktail.grid(row=0, column=1) textIcedTea = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=iced_tea) textIcedTea.grid(row=1, column=1) textHotChocolate = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=hot_chocolate) textHotChocolate.grid(row=2, column=1) textMilkShake = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=milkshake) textMilkShake.grid(row=4, column=1) textMountainDew = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=mountain_dew) textMountainDew.grid(row=5, column=1) textSting = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED , textvariable=sting) textSting.grid(row=6, column=1) textCobra = Entry(Drinks_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED , textvariable=cobra) textCobra.grid(row=7, column=1) FriedChicken = Checkbutton(Food_Function,text="Fried Chicken\t\t\t ",variable=variable9,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsFriedChicken).grid(row=0,sticky=W) KareKare = Checkbutton(Food_Function,text="Kare kare",variable=variable10,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsKareKare).grid(row=1,sticky=W) CrispyPata = Checkbutton(Food_Function,text="Crispy Pata ",variable=variable11,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsCrispyPata).grid(row=2,sticky=W) SinigangBaboy = Checkbutton(Food_Function,text="Sinigang Baboy ",variable=variable12,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsSinigangBaboy).grid(row=3,sticky=W) SinigangHipon = Checkbutton(Food_Function,text="Sinigang Hipon ",variable=variable13,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsSinigangHipon).grid(row=4,sticky=W) BicolExpress = Checkbutton(Food_Function,text="Bicol Express ",variable=variable14,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsBicolExpress).grid(row=5,sticky=W) AsparagusTofu = Checkbutton(Food_Function,text="Asparagus Tofu ",variable=variable15,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsAsparagusTofu).grid(row=6,sticky=W) ChickenSisig = Checkbutton(Food_Function,text="Chicken Sisig ",variable=variable16,onvalue = 1, offvalue=0, font=('arial',16,'bold'),bg='sky blue',command=foodsChickenSisig).grid(row=7,sticky=W) textFriedChicken = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=fried_chicken) textFriedChicken.grid(row=0, column=1) textKareKAre = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=kare_kare) textKareKAre.grid(row=1, column=1) textCrispyPata = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=crispy_pata) textCrispyPata.grid(row=2, column=1) textSinigangBaboy = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=sinigang_baboy) textSinigangBaboy.grid(row=3, column=1) textSinigangHipon = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=sinigang_hipon) textSinigangHipon.grid(row=4, column=1) textBicolExpress = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=bicol_express) textBicolExpress.grid(row=5, column=1) textAsparagusTofu = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=asparagus_tofu) textAsparagusTofu.grid(row=6, column=1) textChickenSisig = Entry(Food_Function, font=('arial', 16, 'bold'), bd=8, width=6, justify=LEFT, state=DISABLED, textvariable=chicken_sisig) textChickenSisig.grid(row=7, column=1) lblTotalofDrinks = Label(Total_Function, font=('arial', 14, 'bold'), text='Total of Drinks\t', bg='sky blue', fg='black', justify=CENTER) lblTotalofDrinks.grid(row=0, column=0, sticky=W) textTotalofDrinks = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=Total_of_Drinks) textTotalofDrinks.grid(row=0, column=1) lblTotalofFood = Label(Total_Function, font=('arial', 14, 'bold'), text='Total of Foods ', bg='sky blue', fg='black', justify=CENTER) lblTotalofFood.grid(row=1, column=0, sticky=W) textTotalofFood = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=Total_of_Food) textTotalofFood.grid(row=1, column=1) lblServiceCharge = Label(Total_Function, font=('arial', 14, 'bold'), text='Service Charge', bg='sky blue', fg='black', justify=CENTER) lblServiceCharge.grid(row=2, column=0, sticky=W) txtServiceCharge = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=ServiceCharge) txtServiceCharge.grid(row=2, column=1) lblPaidTax = Label(Total_Function, font=('arial', 14, 'bold'), text='\tPaid Tax', bg='sky blue', bd=7, fg='black', justify=CENTER) lblPaidTax.grid(row=0, column=2, sticky=W) textPaidTax = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=PaidTax) textPaidTax.grid(row=0, column=3) lblSubTotal = Label(Total_Function, font=('arial', 14, 'bold'), text='\tSub Total', bg='sky blue', bd=7, fg='black', justify=CENTER) lblSubTotal.grid(row=1, column=2, sticky=W) textSubTotal = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=SubTotal) textSubTotal.grid(row=1, column=3) lblTotalCost = Label(Total_Function, font=('arial', 14, 'bold'), text='\tTotal', bg='sky blue', bd=7, fg='black', justify=CENTER) lblTotalCost.grid(row=2, column=2, sticky=W) textTotalCost = Entry(Total_Function, bg='white', bd=7, font=('arial', 14, 'bold'), insertwidth=2, justify=RIGHT, textvariable=TotalCost) textTotalCost.grid(row=2, column=3) def Receipt(textReceipt=None): textReceipt.delete=("1.0",END) x = random.randint(10908, 500876) randomRef = str(x) Receipt_Ref.set("Bill" + randomRef) textReceipt.insert(END, 'Receipt Ref:\t\t\t' + Receipt_Ref.get() + '\t' + Date_of_Order.get() + '\n') textReceipt.insert(END, 'Unit\t\t\t\t' + "Total of Unit \n") textReceipt.insert(END, 'Cocktail:\t\t\t\t\t' + cocktail.get() + '\n') textReceipt.insert(END, 'Iced Tea:\t\t\t\t\t' + iced_tea.get() + '\n') textReceipt.insert(END, 'Hot Chocolate:\t\t\t\t\t' + hot_chocolate.get() + '\n') textReceipt.insert(END, 'Milk Shake:\t\t\t\t\t' + milkshake.get() + '\n') textReceipt.insert(END, 'Mountain Dew:\t\t\t\t\t' + mountain_dew.get() + '\n') textReceipt.insert(END, 'Sting:\t\t\t\t\t' + sting.get() + '\n') textReceipt.insert(END, 'Cobra:\t\t\t\t\t' + cobra.get() + '\n') textReceipt.insert(END, 'Fried Chicken:\t\t\t\t\t' + fried_chicken.get() + '\n') textReceipt.insert(END, 'Kare Kare:\t\t\t\t\t' + kare_kare.get() + '\n') textReceipt.insert(END, 'Crispy Pata:\t\t\t\t\t' + crispy_pata.get() + '\n') textReceipt.insert(END, 'Sinigang baboy:\t\t\t\t\t' + sinigang_baboy.get() + '\n') textReceipt.insert(END, 'Sinigang Hipon:\t\t\t\t\t' + sinigang_hipon.get() + '\n') textReceipt.insert(END, 'Bicol Express:\t\t\t\t\t' + bicol_express.get() + '\n') textReceipt.insert(END, 'Asparagus Tofu:\t\t\t\t\t' + asparagus_tofu.get() + '\n') textReceipt.insert(END, 'Chicken Sisig:\t\t\t\t\t' + chicken_sisig.get() + '\n') textReceipt.insert(END, 'Total of Drinks:\t\t\t\t' + Total_of_Drinks.get() + '\nTax Paid:\t\t\t\t' + PaidTax.get() + "\n") textReceipt.insert(END, 'Total of Foods:\t\t\t\t' + Total_of_Food.get() + '\nSubTotal:\t\t\t\t' + str( SubTotal.get()) + "\n") textReceipt.insert(END, 'Service Charge:\t\t\t\t' + ServiceCharge.get() + '\nTotal Cost:\t\t\t\t' + str( TotalCost.get()) + "\n") def btnClick(numbers): global operator operator=operator+str(numbers) def btnClear(): global operator operator='' text_Input.set('') def btnEquals(): global operator sumup = str(eval(operator)) text_Input.set(sumup) operator = "" txtDisplay = Entry(Calculator_Function, width=45, bg='white', bd=4, font=('arial', 12, 'bold'), justify=RIGHT, textvariable=text_Input) txtDisplay.grid(row=0, column=0, columnspan=4, pady=1) txtDisplay.insert(0, "0") button7 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='7', bg='black', command=lambda: btnClick(7)).grid(row=2, column=0) button8 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='8', bg='black', command=lambda: btnClick(8)).grid(row=2, column=1) button9 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='9', bg='black', command=lambda: btnClick(9)).grid(row=2, column=2) buttonAdd = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='+', bg='black', command=lambda: btnClick('+')).grid(row=2, column=3) button4 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='4', bg='black', command=lambda: btnClick(4)).grid(row=3, column=0) button5 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='5', bg='black', command=lambda: btnClick(5)).grid(row=3, column=1) button6 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='6', bg='black', command=lambda: btnClick(6)).grid(row=3, column=2) buttonSub = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='-', bg='black', command=lambda: btnClick('-')).grid(row=3, column=3) button1 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='1', bg='black', command=lambda: btnClick(1)).grid(row=4, column=0) button2 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='2', bg='black', command=lambda: btnClick(2)).grid(row=4, column=1) button3 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='3', bg='black', command=lambda: btnClick(3)).grid(row=4, column=2) buttonMulti = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='', bg='black', command=lambda: btnClick('')).grid(row=4, column=3) button0 = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='0', bg='black', command=lambda: btnClick(0)).grid(row=5, column=0) buttonClear = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='C', bg='black', command=btnClear).grid(row=5, column=1) buttonEqual = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='=', bg='black', command=btnEquals).grid(row=5, column=2) buttonDiv = Button(Calculator_Function, padx=16, pady=1, bd=7, fg='gold', font=('arial', 12, 'bold'), width=4, text='/', bg='black', command=lambda: btnClick('/')).grid(row=5, column=3) root.mainloop()

online-banking-system icon online-banking-system

import tkinter as tk from tkinter import messagebox from time import gmtime, strftime def is_number(s): try: float(s) return 1 except ValueError: return 0 def check_acc_nmb(num): try: fpin = open(num + ".txt", 'r') except FileNotFoundError: messagebox.showinfo("Error", "Invalid Credentials!\nTry Again!") return 0 fpin.close() return def home_return(master): master.destroy() Main_Menu() def write(master, name, oc, pin): if ((is_number(name)) or (is_number(oc) == 0) or (is_number(pin) == 0) or name == ""): messagebox.showinfo("Error", "Invalid Credentials\nPlease try again.") master.destroy() return f1 = open("Accnt_Record.txt", 'r') accnt_no = int(f1.readline()) accnt_no += 1 f1.close() f1 = open("Accnt_Record.txt", 'w') f1.write(str(accnt_no)) f1.close() fdet = open(str(accnt_no) + ".txt", "w") fdet.write(pin + "\n") fdet.write(oc + "\n") fdet.write(str(accnt_no) + "\n") fdet.write(name + "\n") fdet.close() frec = open(str(accnt_no) + "-rec.txt", 'w') frec.write("Date Credit Debit Balance\n") frec.write(str(strftime("[%Y-%m-%d] [%H:%M:%S] ", gmtime())) + " " + oc + " " + oc + "\n") frec.close() messagebox.showinfo("Details", "Your Account Number is:" + str(accnt_no)) master.destroy() return def crdt_write(master, amt, accnt, name): if (is_number(amt) == 0): messagebox.showinfo("Error", "Invalid Credentials\nPlease try again.") master.destroy() return fdet = open(accnt + ".txt", 'r') pin = fdet.readline() camt = int(fdet.readline()) fdet.close() amti = int(amt) cb = amti + camt fdet = open(accnt + ".txt", 'w') fdet.write(pin) fdet.write(str(cb) + "\n") fdet.write(accnt + "\n") fdet.write(name + "\n") fdet.close() frec = open(str(accnt) + "-rec.txt", 'a+') frec.write( str(strftime("[%Y-%m-%d] [%H:%M:%S] ", gmtime())) + " " + str(amti) + " " + str(cb) + "\n") frec.close() messagebox.showinfo("Operation Successfull!!", "Amount Credited Successfully!!") master.destroy() return def debit_write(master, amt, accnt, name): if (is_number(amt) == 0): messagebox.showinfo("Error", "Invalid Credentials\nPlease try again.") master.destroy() return fdet = open(accnt + ".txt", 'r') pin = fdet.readline() camt = int(fdet.readline()) fdet.close() if (int(amt) > camt): messagebox.showinfo("Error!!", "You dont have that amount left in your account\nPlease try again.") else: amti = int(amt) cb = camt - amti fdet = open(accnt + ".txt", 'w') fdet.write(pin) fdet.write(str(cb) + "\n") fdet.write(accnt + "\n") fdet.write(name + "\n") fdet.close() frec = open(str(accnt) + "-rec.txt", 'a+') frec.write(str(strftime("[%Y-%m-%d] [%H:%M:%S] ", gmtime())) + " " + " " + str( amti) + " " + str(cb) + "\n") frec.close() messagebox.showinfo("Operation Successfull!!", "Amount Debited Successfully!!") master.destroy() return def Cr_Amt(accnt, name): creditwn = tk.Tk() creditwn.geometry("600x300") creditwn.title("Credit Amount") creditwn.configure(bg="orange") fr1 = tk.Frame(creditwn, bg="blue") l_title = tk.Message(creditwn, text="UNITED BANK", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") l1 = tk.Label(creditwn, relief="raised", text="Enter Amount to be credited: ") e1 = tk.Entry(creditwn, relief="raised") l1.pack(side="top") e1.pack(side="top") b = tk.Button(creditwn, text="Credit", relief="raised", command=lambda: crdt_write(creditwn, e1.get(), accnt, name)) b.pack(side="top") creditwn.bind("<Return>", lambda x: crdt_write(creditwn, e1.get(), accnt, name)) def De_Amt(accnt, name): debitwn = tk.Tk() debitwn.geometry("600x300") debitwn.title("Debit Amount") debitwn.configure(bg="orange") fr1 = tk.Frame(debitwn, bg="blue") l_title = tk.Message(debitwn, text="UNITED BANK", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") l1 = tk.Label(debitwn, relief="raised", text="Enter Amount to be debited: ") e1 = tk.Entry(debitwn, relief="raised") l1.pack(side="top") e1.pack(side="top") b = tk.Button(debitwn, text="Debit", relief="raised", command=lambda: debit_write(debitwn, e1.get(), accnt, name)) b.pack(side="top") debitwn.bind("<Return>", lambda x: debit_write(debitwn, e1.get(), accnt, name)) def disp_bal(accnt): fdet = open(accnt + ".txt", 'r') fdet.readline() bal = fdet.readline() fdet.close() messagebox.showinfo("Balance", bal) def disp_tr_hist(accnt): disp_wn = tk.Tk() disp_wn.geometry("900x600") disp_wn.title("Transaction History") disp_wn.configure(bg="orange") fr1 = tk.Frame(disp_wn, bg="blue") l_title = tk.Message(disp_wn, text="UNITED BANK", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") fr1 = tk.Frame(disp_wn) fr1.pack(side="top") l1 = tk.Message(disp_wn, text="Your Transaction History:", padx=100, pady=20, width=1000, bg="blue", fg="orange", relief="raised") l1.pack(side="top") fr2 = tk.Frame(disp_wn) fr2.pack(side="top") frec = open(accnt + "-rec.txt", 'r') for line in frec: l = tk.Message(disp_wn, anchor="w", text=line, relief="raised", width=2000) l.pack(side="top") b = tk.Button(disp_wn, text="Quit", relief="raised", command=disp_wn.destroy) b.pack(side="top") frec.close() def logged_in_menu(accnt, name): rootwn = tk.Tk() rootwn.geometry("1600x500") rootwn.title("UNITED BANK-" + name) rootwn.configure(background='orange') fr1 = tk.Frame(rootwn) fr1.pack(side="top") l_title = tk.Message(rootwn, text="SIMPLE BANKING\n SYSTEM", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") label = tk.Label(text="Logged in as: " + name, relief="raised", bg="black", fg="white", anchor="center", justify="center") label.pack(side="top") img2 = tk.PhotoImage(file="credit.gif") myimg2 = img2.subsample(2, 2) img3 = tk.PhotoImage(file="debit.gif") myimg3 = img3.subsample(2, 2) img4 = tk.PhotoImage(file="balance1.gif") myimg4 = img4.subsample(2, 2) img5 = tk.PhotoImage(file="transaction.gif") myimg5 = img5.subsample(2, 2) b2 = tk.Button(image=myimg2, command=lambda: Cr_Amt(accnt, name)) b2.image = myimg2 b3 = tk.Button(image=myimg3, command=lambda: De_Amt(accnt, name)) b3.image = myimg3 b4 = tk.Button(image=myimg4, command=lambda: disp_bal(accnt)) b4.image = myimg4 b5 = tk.Button(image=myimg5, command=lambda: disp_tr_hist(accnt)) b5.image = myimg5 img6 = tk.PhotoImage(file="logout.gif") myimg6 = img6.subsample(2, 2) b6 = tk.Button(image=myimg6, relief="raised", command=lambda: logout(rootwn)) b6.image = myimg6 b2.place(x=100, y=150) b3.place(x=100, y=220) b4.place(x=900, y=150) b5.place(x=900, y=220) b6.place(x=500, y=400) def fp(name=None): import math, random # function to generate OTP def generateOTP(): # Declare a digits variable # which stores all digits digits = "0123456789" OTP = "" # length of password can be chaged # by changing value in range for i in range(4): OTP += digits[math.floor(random.random() * 10)] return OTP # Driver code if name == "main": print("OTP of 4 digits:", generateOTP()) messagebox.showinfo("OTP", "Your OTP IS " + generateOTP()) def logout(master): messagebox.showinfo("Logged Out", "You Have Been Successfully Logged Out!!") master.destroy() Main_Menu() def check_log_in(master, name, acc_num, pin, fp): if (check_acc_nmb(acc_num) == 0): master.destroy() Main_Menu() return if (is_number(fp)==0): messagebox.showinfo("Error", "Invalid OTP\nPlease try again.") master.destroy() Main_Menu() return if ((is_number(name)) or (is_number(pin) == 0) ): messagebox.showinfo("Error", "Invalid Credentials\nPlease try again.") master.destroy() Main_Menu() else: master.destroy() logged_in_menu(acc_num, name) def log_in(master): master.destroy() loginwn = tk.Tk() loginwn.geometry("600x300") loginwn.title("Log in") loginwn.configure(bg="orange") fr1 = tk.Frame(loginwn, bg="blue") l_title = tk.Message(loginwn, text="UNITED BANK", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") l1 = tk.Label(loginwn, text="Enter Name:", relief="raised") l1.pack(side="top") e1 = tk.Entry(loginwn) e1.pack(side="top") l2 = tk.Label(loginwn, text="Enter account number:", relief="raised") l2.pack(side="top") e2 = tk.Entry(loginwn) e2.pack(side="top") l3 = tk.Label(loginwn, text="Enter your PIN:", relief="raised") l3.pack(side="top") e3 = tk.Entry(loginwn, show="*") e3.pack(side="top") l4 = tk.Label(loginwn, text="Enter your OTP:", relief="raised") l4.pack(side="top") e4 = tk.Entry(loginwn, show="*") e4.pack(side="top") b = tk.Button(loginwn, text="generate OTP", command=fp) b.pack(side="top") b1 = tk.Button(loginwn, text="Submit", command=lambda: check_log_in(loginwn, e1.get().strip(), e2.get().strip(), e3.get().strip(), e4.get().strip())) b1.pack(side="top") b2 = tk.Button(text="HOME", relief="raised", bg="black", fg="white", command=lambda: home_return(loginwn)) b2.pack(side="top") loginwn.bind("<Return>", lambda x: check_log_in(loginwn, e1.get().strip(), e2.get().strip(), e3.get().strip(), e4.get().strip())) def Create(): crwn = tk.Tk() crwn.geometry("600x300") crwn.title("Create Account") crwn.configure(bg="orange") fr1 = tk.Frame(crwn, bg="blue") l_title = tk.Message(crwn, text="UNITED BANK", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") l1 = tk.Label(crwn, text="Enter Name:", relief="raised") l1.pack(side="top") e1 = tk.Entry(crwn) e1.pack(side="top") l2 = tk.Label(crwn, text="Enter opening credit:", relief="raised") l2.pack(side="top") e2 = tk.Entry(crwn) e2.pack(side="top") l3 = tk.Label(crwn, text="Enter desired PIN:", relief="raised") l3.pack(side="top") e3 = tk.Entry(crwn, show="*") e3.pack(side="top") b = tk.Button(crwn, text="Submit", command=lambda: write(crwn, e1.get().strip(), e2.get().strip(), e3.get().strip())) b.pack(side="top") crwn.bind("<Return>", lambda x: write(crwn, e1.get().strip(), e2.get().strip(), e3.get().strip())) return def Main_Menu(): rootwn = tk.Tk() rootwn.geometry("1600x500") rootwn.title("UNITED Bank") rootwn.configure(background='orange') fr1 = tk.Frame(rootwn) fr1.pack(side="top") bg_image = tk.PhotoImage(file="pile1.gif") x = tk.Label(image=bg_image) x.place(y=-400) l_title = tk.Message(text="SIMPLE BANKING\n SYSTEM", relief="raised", width=2000, padx=600, pady=0, fg="white", bg="black", justify="center", anchor="center") l_title.config(font=("Courier", "50", "bold")) l_title.pack(side="top") imgc1 = tk.PhotoImage(file="new.gif") imglo = tk.PhotoImage(file="login.gif") imgc = imgc1.subsample(2, 2) imglog = imglo.subsample(2, 2) b1 = tk.Button(image=imgc, command=Create) b1.image = imgc b2 = tk.Button(image=imglog, command=lambda: log_in(rootwn)) b2.image = imglog img6 = tk.PhotoImage(file="quit.gif") myimg6 = img6.subsample(2, 2) b6 = tk.Button(image=myimg6, command=rootwn.destroy) b6.image = myimg6 b1.place(x=800, y=300) b2.place(x=800, y=200) b6.place(x=920, y=400) rootwn.mainloop() Main_Menu()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.