Hi, The Codezine Fams, Myself Dark Soulz & today I will show you guys one of the good projects that you can build while learning python. Today I will be discussing “How to build a restaurant management software or system in python”. Probably, it will be helpful for both intermediate & beginners. Also, not to forget, after finishing this tutorial you can also build your own restaurant management system for various restaurants. This will help you in earning extra bucks. So, now let’s move on directly to the tut. i.e Easy Way to Develop a Restaurant Management System in Python.
Project requirements:
- Some basic concepts of python programming.
- Foremost, a Pc where the latest version of python 3 is installed.
- A good code ide such as Vs code, Atom, Sublime, etc
- Your attention & focus on this tut.
Tutorial:
- First of all, make a file called main.py[Python File] in your ide or in your desktop after making a folder with any name.
- Second of all, drag the file into your code ide or editor.
- After that, copy the codes below given and save it.
- Lastly, run the python it by SHIFT+RIGHT CLICK cmd and type python main.py which will help you to execute the py file.
- That’s it your restaurant management system will be right your eyes if the steps you follow are rightfully done.
Code:
__author__ = "Tripura Coders"
from tkinter import*
import random
import time
import datetime root=Tk()
root.geometry("1600x8000")
root.title("Python Restaurant Management Software") Tops=Frame(root, width=1600,relief=SUNKEN)
Tops.pack(side=TOP) f1=Frame(root,width=800,height=700,relief=SUNKEN)
f1.pack(side=LEFT) #=================================================================================
# TIME
#================================================================================
localtime=time.asctime(time.localtime(time.time())) lblInfo=Label(Tops,font=('helvetica',40,'bold'),text="Python Restaurant Management Software ",fg="red",bd=10,anchor='w')
lblInfo.grid(row=0,column=0) lblInfo=Label(Tops,font=('arial',20,'bold'),text=localtime,fg="blue",bd=10,anchor='w')
lblInfo.grid(row=1,column=0)
lblInfo=Label(Tops,font=('arial',10,'bold'),text="By The Codezine[https://thecodezine.com] ",fg="blue",bd=10,anchor='w')
lblInfo.grid(row=3,column=0) def Ref(): x=random.randint(10908,500876) randomRef=str(x) rand.set(randomRef) if (Fries.get()==""): CoFries=0 else: CoFries=float(Fries.get()) if (Noodles.get()==""): CoNoodles=0 else: CoNoodles=float(Noodles.get()) if (Soup.get()==""): CoSoup=0 else: CoSoup=float(Soup.get()) if (Burger.get()==""): CoBurger=0 else: CoBurger=float(Burger.get()) if (Sandwich.get()==""): CoSandwich=0 else: CoSandwich=float(Sandwich.get()) if (Drinks.get()==""): CoD=0 else: CoD=float(Drinks.get()) CostofFries =CoFries * 140 CostofDrinks=CoD * 65 CostofNoodles = CoNoodles* 90 CostofSoup = CoSoup * 140 CostBurger = CoBurger* 260 CostSandwich=CoSandwich * 300 CostofMeal= "Rs", str('%.2f' % (CostofFries+CostofDrinks+CostofNoodles+CostofSoup+CostBurger+CostSandwich)) PayTax=((CostofFries+CostofDrinks+CostofNoodles+CostofSoup+CostBurger+CostSandwich) * 0.2) TotalCost=(CostofFries+CostofDrinks+CostofNoodles+CostofSoup+CostBurger+CostSandwich) Ser_Charge= ((CostofFries+CostofDrinks+CostofNoodles+CostofSoup+CostBurger+CostSandwich)/99) Service = "Rs", str ('%.2f' % Ser_Charge) OverAllCost ="Rs", str ('%.2f' % (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) def qExit(): root.destroy() def Reset(): rand.set("") Fries.set("") Noodles.set("") Soup.set("") SubTotal.set("") Total.set("") Service_Charge.set("") Drinks.set("") Tax.set("") Cost.set("") Burger.set("") Sandwich.set("") #====================================Restaraunt Info 1===========================================================
rand = StringVar()
Fries=StringVar()
Noodles=StringVar()
Soup=StringVar()
SubTotal=StringVar()
Total=StringVar()
Service_Charge=StringVar()
Drinks=StringVar()
Tax=StringVar()
Cost=StringVar()
Burger=StringVar()
Sandwich=StringVar() lblReference= Label(f1, font=('arial', 16, 'bold'),text="Order No",bd=16,anchor="w")
lblReference.grid(row=0, column=0)
txtReference=Entry(f1, font=('arial',16,'bold'),textvariable=rand,bd=10,insertwidth=4,bg="red",justify='right')
txtReference.grid(row=0,column=1) lblFries= Label(f1, font=('arial', 16, 'bold'),text="Fries",bd=16,anchor="w")
lblFries.grid(row=1, column=0)
txtFries=Entry(f1, font=('arial',16,'bold'),textvariable=Fries,bd=10,insertwidth=4,bg="red",justify='right')
txtFries.grid(row=1,column=1) lblNoodles= Label(f1, font=('arial', 16, 'bold'),text="Noodles",bd=16,anchor="w")
lblNoodles.grid(row=2, column=0)
txtNoodles=Entry(f1, font=('arial',16,'bold'),textvariable=Noodles,bd=10,insertwidth=4,bg="red",justify='right')
txtNoodles.grid(row=2,column=1) lblSoup= Label(f1, font=('arial', 16, 'bold'),text="Soup",bd=16,anchor="w")
lblSoup.grid(row=3, column=0)
txtSoup=Entry(f1, font=('arial',16,'bold'),textvariable=Soup,bd=10,insertwidth=4,bg="red",justify='right')
txtSoup.grid(row=3,column=1) lblBurger= Label(f1, font=('arial', 16, 'bold'),text="Burger",bd=16,anchor="w")
lblBurger.grid(row=4, column=0)
txtBurger=Entry(f1, font=('arial',16,'bold'),textvariable=Burger,bd=10,insertwidth=4,bg="red",justify='right')
txtBurger.grid(row=4,column=1) lblSandwich= Label(f1, font=('arial', 16, 'bold'),text="Sandwich",bd=16,anchor="w")
lblSandwich.grid(row=5, column=0)
txtSandwich=Entry(f1, font=('arial',16,'bold'),textvariable=Sandwich,bd=10,insertwidth=4,bg="red",justify='right')
txtSandwich.grid(row=5,column=1) #============================================================================================================#
# RESTAURANT OTHER INFO #
#============================================================================================================# lblDrinks= Label(f1, font=('arial', 16, 'bold'),text="Drinks",bd=16,anchor="w")
lblDrinks.grid(row=0, column=2)
txtDrinks=Entry(f1, font=('arial',16,'bold'),textvariable=Drinks,bd=10,insertwidth=4,bg="red",justify='right')
txtDrinks.grid(row=0,column=3) lblCost= Label(f1, font=('arial', 16, 'bold'),text="Cost of Meal",bd=16,anchor="w")
lblCost.grid(row=1, column=2)
txtCost=Entry(f1, font=('arial',16,'bold'),textvariable=Cost,bd=10,insertwidth=4,bg="red",justify='right')
txtCost.grid(row=1,column=3) lblService= Label(f1, font=('arial', 16, 'bold'),text="Service Charge",bd=16,anchor="w")
lblService.grid(row=2, column=2)
txtService=Entry(f1, font=('arial',16,'bold'),textvariable=Service_Charge,bd=10,insertwidth=4,bg="red",justify='right')
txtService.grid(row=2,column=3) lblStateTax= Label(f1, font=('arial', 16, 'bold'),text="Tax",bd=16,anchor="w")
lblStateTax.grid(row=3, column=2)
txtStateTax=Entry(f1, font=('arial',16,'bold'),textvariable=Tax,bd=10,insertwidth=4,bg="red",justify='right')
txtStateTax.grid(row=3,column=3) lblSubTotal= Label(f1, font=('arial', 16, 'bold'),text="Sub Total",bd=16,anchor="w")
lblSubTotal.grid(row=4, column=2)
txtSubTotal=Entry(f1, font=('arial',16,'bold'),textvariable=SubTotal,bd=10,insertwidth=4,bg="red",justify='right')
txtSubTotal.grid(row=4,column=3) lblTotalCost= Label(f1, font=('arial', 16, 'bold'),text="Total Cost",bd=16,anchor="w")
lblTotalCost.grid(row=5, column=2)
txtTotalCost=Entry(f1, font=('arial',16,'bold'),textvariable=Total,bd=10,insertwidth=4,bg="red",justify='right')
txtTotalCost.grid(row=5,column=3) #==========================================Buttons==========================================================================================
btnTotal=Button(f1,padx=16,pady=8,bd=16,fg="black",font=('arial',16,'bold'),width=10,text="Total",bg="red",command=Ref).grid(row=7,column=1) btnReset=Button(f1,padx=16,pady=8,bd=16,fg="black",font=('arial',16,'bold'),width=10,text="Reset",bg="red",command=Reset).grid(row=7,column=2) btnExit=Button(f1,padx=16,pady=8,bd=16,fg="black",font=('arial',16,'bold'),width=10,text="Exit",bg="red",command=qExit).grid(row=7,column=3) def price(): roo = Tk() roo.geometry("600x220+0+0") roo.title("Item Price List") lblinfo = Label(roo, font=('aria', 15, 'bold'), text="ITEM", fg="black", bd=5) lblinfo.grid(row=0, column=0) lblinfo = Label(roo, font=('aria', 15,'bold'), text="_____________", fg="white", anchor=W) lblinfo.grid(row=0, column=2) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="PRICE", fg="black", anchor=W) lblinfo.grid(row=0, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Fries", fg="red", anchor=W) lblinfo.grid(row=1, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="140", fg="red", anchor=W) lblinfo.grid(row=1, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Noodles", fg="red", anchor=W) lblinfo.grid(row=2, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="90", fg="red", anchor=W) lblinfo.grid(row=2, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Soup", fg="red", anchor=W) lblinfo.grid(row=3, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="140", fg="red", anchor=W) lblinfo.grid(row=3, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Burger", fg="red", anchor=W) lblinfo.grid(row=4, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="260", fg="red", anchor=W) lblinfo.grid(row=4, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Sandwich", fg="red", anchor=W) lblinfo.grid(row=5, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="300", fg="red", anchor=W) lblinfo.grid(row=5, column=3) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="Drinks", fg="red", anchor=W) lblinfo.grid(row=6, column=0) lblinfo = Label(roo, font=('aria', 15, 'bold'), text="65", fg="red", anchor=W) lblinfo.grid(row=6, column=3) roo.mainloop() btnprice=Button(f1,padx=16,pady=8, bd=10 ,fg="black",font=('ariel' ,16,'bold'),width=10, text="PRICE", bg="red",command=price)
btnprice.grid(row=7, column=0) root.mainloop()
Conclusion:
You can edit or modify the script given above in your way and I hope it will be easy for any beginners as the script is written is easy to understand. For example: If you want to add new food items or change food item prices or other prices according to your needs. Also, as I say in every tutorial take special care while copying the codes or while writing codes as it will help you to avoid errors. Don’t forget to comment & share this blog if you find it interesting. Thank you!
Source: https://thecodezine.com/easy-way-to-develop-a-restaurant-management-system-in-python/