diff --git a/README.md b/README.md index 1567a3d..b6d82a8 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,37 @@ -# Restaurant-Management-System-Python- -Restaurant-Management-System in python(tkinter) , GUI based project for college students in python using module tkinter, Based on new boston tutorials with some added tabs and functions. +# Restaurant Management System + +The **Restaurant Management System** is a Python application developed using the Tkinter library. It offers a user-friendly graphical interface for managing orders, calculating costs, and generating bills for a restaurant. + +## Features + +1. **Calculator**: An integrated calculator simplifies cost calculations. +2. **Order Management**: Easily manage orders for various meals and drinks. +3. **Billing**: The system automatically calculates total costs, taxes, and service charges. +4. **Price List**: Display the price list for menu items. + +## Requirements + +- Python 3.x +- Tkinter library (usually included in Python installations) + +## How to Use + +1. Clone this repository to your local machine. +2. Ensure you have Python installed. +3. Run the `main.py` file using Python. +4. Use the graphical interface to manage orders, calculate costs, and generate bills. + +## Usage + +1. Enter the quantity of each item (e.g., Fries Meal, Lunch Meal, Burger Meal). +2. Click the "TOTAL" button to calculate the total cost, taxes, and service charges. +3. Click the "PRICE" button to view the price list of menu items. +4. Utilize the calculator for any additional calculations needed. + +## License + +This project is licensed under the MIT License. + +## Acknowledgements + +Special thanks to Amar Kumar for the original codebase. diff --git a/restaurant.py b/restaurant.py index dff7dbf..0be55c1 100644 --- a/restaurant.py +++ b/restaurant.py @@ -1,20 +1,21 @@ from tkinter import* import random import time +import tkinter.messagebox as mb root = Tk() -root.geometry("1600x700+0+0") +root.geometry("1500x700+0+0") root.resizable(0,0) root.title("Restaurant Management System") Tops = Frame(root,bg="white",width = 1600,height=50,relief=SUNKEN) Tops.pack(side=TOP) -f1 = Frame(root,width = 900,height=700,relief=SUNKEN) -f1.pack(side=LEFT) +top_frame = Frame(root,width = 900,height=700,relief=SUNKEN) +top_frame.pack(side=LEFT) -f2 = Frame(root ,width = 400,height=700,relief=SUNKEN) -f2.pack(side=RIGHT) +left_frame = Frame(root ,width = 400,height=700,relief=SUNKEN) +left_frame.pack(side=RIGHT) #------------------TIME-------------- localtime=time.asctime(time.localtime(time.time())) #-----------------INFO TOP------------ @@ -27,7 +28,7 @@ text_Input=StringVar() operator ="" -txtdisplay = Entry(f2,font=('ariel' ,20,'bold'), textvariable=text_Input , bd=5 ,insertwidth=7 ,bg="white",justify='right') +txtdisplay = Entry(left_frame,font=('ariel' ,20,'bold'), textvariable=text_Input , bd=5 ,insertwidth=7 ,bg="white",justify='right') txtdisplay.grid(columnspan=4) def btnclick(numbers): @@ -42,44 +43,51 @@ def clrdisplay(): def eqals(): global operator - sumup=str(eval(operator)) - - text_Input.set(sumup) - operator = "" - + try: + sumup = str(eval(operator)) + text_Input.set(sumup) + operator = "" + except Exception as e: + mb.showerror("Error", "Invalid Input") + operator = "" + text_Input.set("") def Ref(): - x=random.randint(12980, 50876) - randomRef = str(x) - # rand.set(randomRef) - - cof =float(Fries.get()) - colfries= float(Largefries.get()) - cob= float(Burger.get()) - cofi= float(Filet.get()) - cochee= float(Cheese_burger.get()) - codr= float(Drinks.get()) - - costoffries = cof*25 - costoflargefries = colfries*40 - costofburger = cob*35 - costoffilet = cofi*50 - costofcheeseburger = cochee*50 - costofdrinks = codr*35 - - costofmeal = "Rs.",str('%.2f'% (costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks)) - PayTax=((costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks)*0.33) - Totalcost=(costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks) - Ser_Charge=((costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks)/99) - Service="Rs.",str('%.2f'% Ser_Charge) - OverAllCost="Rs.",str( PayTax + Totalcost + Ser_Charge) - PaidTax="Rs.",str('%.2f'% PayTax) - - Service_Charge.set(Service) - cost.set(costofmeal) - Tax.set(PaidTax) - Subtotal.set(costofmeal) - Total.set(OverAllCost) - + try: + x = random.randint(12980, 50876) + randomRef = str(x) + rand.set(randomRef) + + cof = float(Fries.get()) + colfries = float(Largefries.get()) + cob = float(Burger.get()) + cofi = float(Filet.get()) + cochee = float(Cheese_burger.get()) + codr = float(Drinks.get()) + + costoffries = cof * 25 + costoflargefries = colfries * 40 + costofburger = cob * 35 + costoffilet = cofi * 50 + costofcheeseburger = cochee * 50 + costofdrinks = codr * 35 + + costofmeal = "Rs.", str('%.2f' % (costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks)) + PayTax = ((costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks) * 0.33) + Totalcost = (costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks) + Ser_Charge = ((costoffries + costoflargefries + costofburger + costoffilet + costofcheeseburger + costofdrinks) / 99) + Service = "Rs.", str('%.2f' % Ser_Charge) + OverAllCost = "Rs.", str(PayTax + Totalcost + Ser_Charge) + PaidTax = "Rs.", str('%.2f' % PayTax) + + Service_Charge.set(Service) + cost.set(costofmeal) + Tax.set(PaidTax) + Subtotal.set(costofmeal) + Total.set(OverAllCost) + except ValueError: + mb.showerror("Error", "Invalid Input") + except Exception as e: + mb.showerror("Error", str(e)) def qexit(): root.destroy() @@ -99,57 +107,57 @@ def reset(): Cheese_burger.set("") -btn7=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="7",bg="powder blue", command=lambda: btnclick(7) ) +btn7=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="7",bg="powder blue", command=lambda: btnclick(7) ) btn7.grid(row=2,column=0) -btn8=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="8",bg="powder blue", command=lambda: btnclick(8) ) +btn8=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="8",bg="powder blue", command=lambda: btnclick(8) ) btn8.grid(row=2,column=1) -btn9=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="9",bg="powder blue", command=lambda: btnclick(9) ) +btn9=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="9",bg="powder blue", command=lambda: btnclick(9) ) btn9.grid(row=2,column=2) -Addition=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="+",bg="powder blue", command=lambda: btnclick("+") ) +Addition=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="+",bg="powder blue", command=lambda: btnclick("+") ) Addition.grid(row=2,column=3) #--------------------------------------------------------------------------------------------- -btn4=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="4",bg="powder blue", command=lambda: btnclick(4) ) +btn4=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="4",bg="powder blue", command=lambda: btnclick(4) ) btn4.grid(row=3,column=0) -btn5=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="5",bg="powder blue", command=lambda: btnclick(5) ) +btn5=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="5",bg="powder blue", command=lambda: btnclick(5) ) btn5.grid(row=3,column=1) -btn6=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="6",bg="powder blue", command=lambda: btnclick(6) ) +btn6=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="6",bg="powder blue", command=lambda: btnclick(6) ) btn6.grid(row=3,column=2) -Substraction=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="-",bg="powder blue", command=lambda: btnclick("-") ) +Substraction=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="-",bg="powder blue", command=lambda: btnclick("-") ) Substraction.grid(row=3,column=3) #----------------------------------------------------------------------------------------------- -btn1=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="1",bg="powder blue", command=lambda: btnclick(1) ) +btn1=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="1",bg="powder blue", command=lambda: btnclick(1) ) btn1.grid(row=4,column=0) -btn2=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="2",bg="powder blue", command=lambda: btnclick(2) ) +btn2=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="2",bg="powder blue", command=lambda: btnclick(2) ) btn2.grid(row=4,column=1) -btn3=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="3",bg="powder blue", command=lambda: btnclick(3) ) +btn3=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="3",bg="powder blue", command=lambda: btnclick(3) ) btn3.grid(row=4,column=2) -multiply=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="*",bg="powder blue", command=lambda: btnclick("*") ) +multiply=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="*",bg="powder blue", command=lambda: btnclick("*") ) multiply.grid(row=4,column=3) #------------------------------------------------------------------------------------------------ -btn0=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="0",bg="powder blue", command=lambda: btnclick(0) ) +btn0=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="0",bg="powder blue", command=lambda: btnclick(0) ) btn0.grid(row=5,column=0) -btnc=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="c",bg="powder blue", command=clrdisplay) +btnc=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="c",bg="powder blue", command=clrdisplay) btnc.grid(row=5,column=1) -btnequal=Button(f2,padx=16,pady=16,bd=4,width = 16, fg="black", font=('ariel', 20 ,'bold'),text="=",bg="powder blue",command=eqals) +btnequal=Button(left_frame,padx=16,pady=16,bd=4,width = 16, fg="black", font=('ariel', 20 ,'bold'),text="=",bg="powder blue",command=eqals) btnequal.grid(columnspan=4) -Decimal=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text=".",bg="powder blue", command=lambda: btnclick(".") ) +Decimal=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text=".",bg="powder blue", command=lambda: btnclick(".") ) Decimal.grid(row=5,column=2) -Division=Button(f2,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="/",bg="powder blue", command=lambda: btnclick("/") ) +Division=Button(left_frame,padx=16,pady=16,bd=4, fg="black", font=('ariel', 20 ,'bold'),text="/",bg="powder blue", command=lambda: btnclick("/") ) Division.grid(row=5,column=3) -status = Label(f2,font=('aria', 15, 'bold'),width = 16, text="-By Amar Kumar",bd=2,relief=SUNKEN) +status = Label(left_frame,font=('aria', 15, 'bold'),width = 16, text="-By Amar Kumar",bd=2,relief=SUNKEN) status.grid(row=7,columnspan=3) #--------------------------------------------------------------------------------------- @@ -167,79 +175,79 @@ def reset(): Cheese_burger = StringVar() -lblreference = Label(f1, font=( 'aria' ,16, 'bold' ),text="Order No.",fg="steel blue",bd=10,anchor='w') +lblreference = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Order No.",fg="steel blue",bd=10,anchor='w') lblreference.grid(row=0,column=0) -txtreference = Entry(f1,font=('ariel' ,16,'bold'), textvariable=rand , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtreference = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=rand , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtreference.grid(row=0,column=1) -lblfries = Label(f1, font=( 'aria' ,16, 'bold' ),text="Fries Meal",fg="steel blue",bd=10,anchor='w') +lblfries = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Fries Meal",fg="steel blue",bd=10,anchor='w') lblfries.grid(row=1,column=0) -txtfries = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Fries , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtfries = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Fries , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtfries.grid(row=1,column=1) -lblLargefries = Label(f1, font=( 'aria' ,16, 'bold' ),text="Lunch Meal",fg="steel blue",bd=10,anchor='w') +lblLargefries = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Lunch Meal",fg="steel blue",bd=10,anchor='w') lblLargefries.grid(row=2,column=0) -txtLargefries = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Largefries , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtLargefries = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Largefries , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtLargefries.grid(row=2,column=1) -lblburger = Label(f1, font=( 'aria' ,16, 'bold' ),text="Burger Meal",fg="steel blue",bd=10,anchor='w') +lblburger = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Burger Meal",fg="steel blue",bd=10,anchor='w') lblburger.grid(row=3,column=0) -txtburger = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Burger , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtburger = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Burger , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtburger.grid(row=3,column=1) -lblFilet = Label(f1, font=( 'aria' ,16, 'bold' ),text="Pizza Meal",fg="steel blue",bd=10,anchor='w') +lblFilet = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Pizza Meal",fg="steel blue",bd=10,anchor='w') lblFilet.grid(row=4,column=0) -txtFilet = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Filet , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtFilet = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Filet , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtFilet.grid(row=4,column=1) -lblCheese_burger = Label(f1, font=( 'aria' ,16, 'bold' ),text="Cheese burger",fg="steel blue",bd=10,anchor='w') +lblCheese_burger = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Cheese burger",fg="steel blue",bd=10,anchor='w') lblCheese_burger.grid(row=5,column=0) -txtCheese_burger = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Cheese_burger , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtCheese_burger = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Cheese_burger , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtCheese_burger.grid(row=5,column=1) #-------------------------------------------------------------------------------------- -lblDrinks = Label(f1, font=( 'aria' ,16, 'bold' ),text="Drinks",fg="steel blue",bd=10,anchor='w') +lblDrinks = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Drinks",fg="steel blue",bd=10,anchor='w') lblDrinks.grid(row=0,column=2) -txtDrinks = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Drinks , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtDrinks = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Drinks , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtDrinks.grid(row=0,column=3) -lblcost = Label(f1, font=( 'aria' ,16, 'bold' ),text="cost",fg="steel blue",bd=10,anchor='w') +lblcost = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="cost",fg="steel blue",bd=10,anchor='w') lblcost.grid(row=1,column=2) -txtcost = Entry(f1,font=('ariel' ,16,'bold'), textvariable=cost , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtcost = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=cost , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtcost.grid(row=1,column=3) -lblService_Charge = Label(f1, font=( 'aria' ,16, 'bold' ),text="Service Charge",fg="steel blue",bd=10,anchor='w') +lblService_Charge = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Service Charge",fg="steel blue",bd=10,anchor='w') lblService_Charge.grid(row=2,column=2) -txtService_Charge = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Service_Charge , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtService_Charge = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Service_Charge , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtService_Charge.grid(row=2,column=3) -lblTax = Label(f1, font=( 'aria' ,16, 'bold' ),text="Tax",fg="steel blue",bd=10,anchor='w') +lblTax = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Tax",fg="steel blue",bd=10,anchor='w') lblTax.grid(row=3,column=2) -txtTax = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Tax , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtTax = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Tax , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtTax.grid(row=3,column=3) -lblSubtotal = Label(f1, font=( 'aria' ,16, 'bold' ),text="Subtotal",fg="steel blue",bd=10,anchor='w') +lblSubtotal = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Subtotal",fg="steel blue",bd=10,anchor='w') lblSubtotal.grid(row=4,column=2) -txtSubtotal = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Subtotal , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtSubtotal = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Subtotal , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtSubtotal.grid(row=4,column=3) -lblTotal = Label(f1, font=( 'aria' ,16, 'bold' ),text="Total",fg="steel blue",bd=10,anchor='w') +lblTotal = Label(top_frame, font=( 'aria' ,16, 'bold' ),text="Total",fg="steel blue",bd=10,anchor='w') lblTotal.grid(row=5,column=2) -txtTotal = Entry(f1,font=('ariel' ,16,'bold'), textvariable=Total , bd=6,insertwidth=4,bg="powder blue" ,justify='right') +txtTotal = Entry(top_frame,font=('ariel' ,16,'bold'), textvariable=Total , bd=6,insertwidth=4,bg="powder blue" ,justify='right') txtTotal.grid(row=5,column=3) #-----------------------------------------buttons------------------------------------------ -lblTotal = Label(f1,text="---------------------",fg="white") +lblTotal = Label(top_frame,text="---------------------",fg="white") lblTotal.grid(row=6,columnspan=3) -btnTotal=Button(f1,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="TOTAL", bg="powder blue",command=Ref) +btnTotal=Button(top_frame,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="TOTAL", bg="powder blue",command=Ref) btnTotal.grid(row=7, column=1) -btnreset=Button(f1,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="RESET", bg="powder blue",command=reset) +btnreset=Button(top_frame,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="RESET", bg="powder blue",command=reset) btnreset.grid(row=7, column=2) -btnexit=Button(f1,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="EXIT", bg="powder blue",command=qexit) +btnexit=Button(top_frame,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="EXIT", bg="powder blue",command=qexit) btnexit.grid(row=7, column=3) def price(): @@ -279,8 +287,9 @@ def price(): roo.mainloop() -btnprice=Button(f1,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="PRICE", bg="powder blue",command=price) +btnprice=Button(top_frame,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="PRICE", bg="powder blue",command=price) btnprice.grid(row=7, column=0) - -root.mainloop() - +try: + root.mainloop() +except Exception as e: + mb.showerror("Error", str(e)) \ No newline at end of file