Professional Documents
Culture Documents
Fast Food Restaurant
Fast Food Restaurant
#import tkMessageBox
import tkinter.messagebox
import datetime
#import Tix as tk
import sys
import ast
class Example(Frame):
Frame.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
self.pack(fill=BOTH, expand=1)
menubar = Menu(self.parent)
self.parent.config(menu=menubar)
self.Photohob = PhotoImage(file="20130319-214502.gif")
self.label100.image = self.Photohob
self.label100.pack()
#self.label100.place(relx = 0.488,rely=0.38)
self.label100.place(x=0,y=20)
Label(self, text="Welcome to Bhaskar Usman Lancy Fastfood Joint. \n We offer Fastfood Of all
Kinds. \n Come and Enjoy and be Delighted. \n \n This Program will help you: \n
1.Add,Select,Edit,Update,Delete Product Details \n 2.Generate Bills \n 3.Reports
",borderwidth=10,width=40, height=10,font="times 15 bold").place(x=250,y=80)
fileMenu = Menu(menubar)
reportmenu = Menu(menubar)
menubar.add_cascade(label="Fastfood", menu=fileMenu)
fileMenu.add_separator()
fileMenu.add_command(label="Quit All", command=self.parent.destroy)
menubar.add_cascade(label="Reports", menu=reportmenu)
def onExit(self):
self.destroy()
def destroy_children(self):
child.destroy()
def onClick(self):
if self.var.get() == 1:
self.master.title("Checkbutton....")
else:
self.master.title("")
def productform(self):
self.destroy_children()
self.Photohob = PhotoImage(file="cucina ristorante cuochi-2.gif")
self.label100.image = self.Photohob
self.label100.pack()
#self.label100.place(relx = 0.488,rely=0.38)
self.label100.place(x=0,y=0)
def evClear():
fcode.delete(0,END)
fname.delete(0,END)
fqty.delete(0,END)
fprice.delete(0,END)
fprofit.delete(0,END)
fsprice.delete(0,END)
ftype.delete(0,END)
def clear_textbox():
pname.delete(0,END)
def callinsert():
fcode1=fcode.get()
fname1=fname.get()
fqty1=fqty.get()
fprice1=fprice.get()
fprofit1=fprofit.get()
fsprice1=fsprice.get()
ftype1=ftype.get()
#import MySQLdb
#db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
import mysql.connector as ms
#db=ms.connect(host="localhoat",user="root",p
db = ms.connect("localhost","root","root1","bhaskarusmanlancy" )
if(db.is_connected()):
print("Connected")
else:
print("not connected")
cursor = db.cursor()
print (sql)
cursor.execute(sql)
db.commit()
print ("added")
db.close()
fcode1=fcode.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
fname.insert(0,row[1])
fqty.insert(0,row[2])
fprice.insert(0,row[3])
fprofit.insert(0,row[4])
fsprice.insert(0,row[5])
ftype.insert(0,row[6])
db.close()
def callcheckfcode():
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
results = cursor.fetchall()
fcode.insert(0,(row[0]+1))
db.close()
def callupdate():
fcode1=fcode.get()
fname1=fname.get()
fqty1=fqty.get()
fprice1=fprice.get()
fprofit1=fprofit.get()
fsprice1=fsprice.get()
ftype1=ftype.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
db.commit()
print ("Updated")
db.close()
def calldelete():
fcode1=fcode.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
db.commit()
print ("Deleted")
def getftype():
ftype.delete(0,END)
if(ftype1.get()==1):
ftypeselected="Appetizers&Starters"
elif(ftype1.get()==2):
ftypeselected="Main Course"
elif(ftype1.get()==3):
ftypeselected="Grills"
elif(ftype1.get()==4):
ftypeselected="Salads&Chaat"
elif(ftype1.get()==5):
ftypeselected="Icecreams"
elif(ftype1.get()==6):
ftypeselected="Desserts&Smoothies"
ftype.insert(0,ftypeselected)
def callactualprice():
a1=float(fprice.get())
b1=float(fprofit.get())
c1=a1+((b1/100)*a1)
fsprice.insert(0,c1)
l1=Label(self,text="Food Code",fg='blue')
l1.pack()
l1.place(x=0,y=10)
fcode=Entry(self)
fcode.pack()
fcode.place(x=120,y=10)
l2=Label(self,text="Food Name",fg='blue')
l2.pack()
l2.place(x=0,y=40)
fname=Entry(self)
fname.pack()
fname.place(x=120,y=40)
l3=Label(self,text="Food Quantity",fg='blue')
l3.pack()
l3.place(x=0,y=70)
fqty=Entry(self)
fqty.pack()
fqty.place(x=120,y=70)
l4=Label(self,text="Food Price",fg='blue')
l4.pack()
l4.place(x=0,y=100)
fprice=Entry(self)
fprice.pack()
fprice.place(x=120,y=100)
l5=Label(self,text="Food Profit",fg='blue')
l5.pack()
l5.place(x=0,y=130)
fprofit=Entry(self)
fprofit.pack()
fprofit.place(x=120,y=130)
l6=Label(self,text="Food Selling Price",fg='blue')
l6.pack()
l6.place(x=0,y=160)
fsprice=Entry(self)
fsprice.pack()
fsprice.place(x=120,y=160)
l7=Label(self,text="Food Type",fg='blue')
l7.pack()
l7.place(x=0,y=190)
ftype1 = IntVar()
s1=Radiobutton(self,variable=ftype1,value=1,text="Appetizers&Starters",command=getftype)
s1.pack()
s1.place(x=90,y=190)
s2=Radiobutton(self,variable=ftype1,value=2,text="Main Course",command=getftype)
s2.pack()
s2.place(x=215,y=190)
s3=Radiobutton(self,variable=ftype1,value=3,text="Grills",command=getftype)
s3.pack()
s3.place(x=315,y=190)
s4=Radiobutton(self,variable=ftype1,value=4,text="Salads&Chaat",command=getftype)
s4.pack()
s4.place(x=380,y=190)
s5=Radiobutton(self,variable=ftype1,value=5,text="Icreams",command=getftype)
s5.pack()
s5.place(x=490,y=190)
s6=Radiobutton(self,variable=ftype1,value=6,text="Desserts&Smoothies",command=getftype)
s6.pack()
s6.place(x=550,y=190)
ftype=Entry(self)
ftype.pack()
ftype.place(x=690,y=190)
add_but=Button(self,text="Add",command=callinsert,activebackground='lightblue',width=10)
add_but.pack()
add_but.place(x=120, y=300)
select_but=Button(self,text="Select",command=callselect,activebackground='lightblue',width=10)
select_but.pack()
select_but.place(x=220, y=300)
update_but=Button(self,text="Update",command=callupdate,activebackground='lightblue',width=1
0)
update_but.pack()
update_but.place(x=320, y=300)
delete_but=Button(self,text="Delete",command=calldelete,activebackground='lightblue',width=10)
delete_but.pack()
delete_but.place(x=420, y=300)
bClear.pack()
bClear.place(x=520,y=300)
price_but=Button(self,text="Selling
Price",command=callactualprice,activebackground='lightblue',width=10)
price_but.pack()
price_but.place(x=250,y=160)
check_but=Button(self,text="...",command=callcheckfcode,activebackground='lightblue',width=5)
check_but.pack()
check_but.place(x=250,y=10)
def billcompletereport(self):
self.destroy_children()
Label(self, text="BHASKAR USMAN LANCY \n Fastfood Joint",borderwidth=10,width=22,
height=1,font="times 20 bold").place(x=350,y=20)
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
#print ("Noorul.")
print (sql)
cursor.execute(sql)
results = cursor.fetchall()
r=IntVar()
r=200
self.totamt1=0
fbcode3= StringVar()
fbdate3= StringVar()
fcode3 = StringVar()
fbname3 = StringVar()
fbprice3 = StringVar()
fbqty3 = StringVar()
fbtot3 = StringVar()
Label(self, textvariable=fcode3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=350,y=r)
Label(self, textvariable=fbname3,borderwidth=1,width=13,
height=1,bg='Black',fg="White" ).place(x=400,y=r)
Label(self, textvariable=fbprice3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=510,y=r)
Label(self, textvariable=fbqty3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=560,y=r)
Label(self, textvariable=fbtot3,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=620,y=r)
print (row)
fbcode3.set(row[0])
fbdate3.set(row[1])
fcode3.set(row[2])
fbname3.set(row[3])
fbprice3.set(row[4])
fbqty3.set(row[5])
fbtot3.set(row[6])
self.totamt1=self.totamt1+row[6]
r=r+20
r=r+50
totamt1=Entry(self)
totamt1.pack()
totamt1.place(x=500, y=r)
totamt1.insert(0,self.totamt1)
r=r+40
db.close()
#GENERATING bill FORM
def billform(self):
self.destroy_children()
self.Photohob = PhotoImage(file="subscription-billing-credit-cards-1024x768.gif")
self.label100.image = self.Photohob
self.label100.pack()
#self.label100.place(relx = 0.488,rely=0.38)
self.label100.place(x=0,y=0)
#Shows all the food data on the right hand side of the form
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
Label(self, text="FCODE",fg='blue').place(x=800,y=25)
Label(self, text="FNAME",fg='blue').place(x=850,y=25)
r = IntVar()
r=50
fname2 = StringVar()
fqty2 = StringVar()
Label(self, textvariable=fcode2).place(x=800,y=r)
Label(self, textvariable=fname2).place(x=850,y=r)
print (row)
print ("r=",r)
print (row[1])
fcode2.set(row[0])
fname2.set(row[1])
r=r+20
db.close()
def evClearbill():
fbcode.delete(0,END)
fcode.delete(0,END)
fbname.delete(0,END)
fbprice.delete(0,END)
fbqty.delete(0,END)
fbtot.delete(0,END)
fbdate.delete(0,END)
def clear_textbox():
fbname.delete(0,END)
#Generating
def callcheckfbcode():
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
fbcode.insert(0,(row[0]+1))
db.close()
def evanotherproductbill():
fcode.delete(0,END)
fbname.delete(0,END)
fbprice.delete(0,END)
fbqty.delete(0,END)
fbtot.delete(0,END)
def callinsertbill():
fcode1=fcode.get()
fbcode1=fbcode.get()
fbname1=fbname.get()
fbprice1=fbprice.get()
fbqty1=fbqty.get()
fbtot1=fbtot.get()
fbdate1=fbdate.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
db.commit()
cursor.execute(sql2)
db.commit()
print ("added")
tkMessageBox.showinfo("Bill", "Added")
db.close()
def callselectproduct():
fcode1=fcode.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
fbname.insert(0,row[1])
fbprice.insert(0,row[5])
def callcheckproduct():
fcode1=fcode.get()
fbqty1=int(fbqty.get())
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
qtycheck=int(row[2])
if(fbqty1>qtycheck):
elif(fbqty1<qtycheck):
db.close()
def callselectbill():
self.globalbno1=fbcode.get()
self.billcompletereport()
def calldeletebill():
fbcode1=fbcode.get()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
db.commit()
print ("Deleted")
tkMessageBox.showinfo("Bill", "Deleted")
db.close()
def callactualprice():
a1=float(fbprice.get())
b1=float(fbqty.get())
c1=a1*b1
round(c1,2)
fbtot.insert(0,c1)
def callfinddate():
today = datetime.date.today()
y=today.year
m=today.month
d=today.day
fbdate.insert(0,d)
fbdate.insert(0,"/")
fbdate.insert(0,m)
fbdate.insert(0,"/")
fbdate.insert(0,y)
lb1=Label(self,text="Bill Code",fg='blue')
lb1.pack()
lb1.place(x=0,y=10)
fbcode=Entry(self)
fbcode.pack()
fbcode.place(x=120,y=10)
checkfb_but=Button(self,text="...",command=callcheckfbcode,activebackground='lightblue',width=5
)
checkfb_but.pack()
checkfb_but.place(x=250,y=10)
lb2=Label(self,text="Food Code",fg='blue')
lb2.pack()
lb2.place(x=0,y=40)
fcode=Entry(self)
fcode.pack()
fcode.place(x=120,y=40)
lb3=Label(self,text="Food Name",fg='blue')
lb3.pack()
lb3.place(x=0,y=70)
fbname=Entry(self)
fbname.pack()
fbname.place(x=120,y=70)
lb4=Label(self,text="Price",fg='blue')
lb4.pack()
lb4.place(x=0,y=100)
fbprice=Entry(self)
fbprice.pack()
fbprice.place(x=120,y=100)
lb5=Label(self,text="Quantity",fg='blue')
lb5.pack()
lb5.place(x=0,y=130)
fbqty=Entry(self)
fbqty.pack()
fbqty.place(x=120,y=130)
lb6=Label(self,text="Total",fg='blue')
lb6.pack()
lb6.place(x=0,y=160)
fbtot=Entry(self)
fbtot.pack()
fbtot.place(x=120,y=160)
lb7=Label(self,text="Date",fg='blue')
lb7.pack()
lb7.place(x=400,y=10)
fbdate=Entry(self)
fbdate.pack()
fbdate.place(x=500,y=10)
add_but_bill=Button(self,text="Add",command=callinsertbill,activebackground='lightblue',width=10)
add_but_bill.pack()
add_but_bill.place(x=120, y=280)
select_but_bill=Button(self,text="Select Product
Data",command=callselectproduct,activebackground='lightblue',width=20)
select_but_bill.pack()
select_but_bill.place(x=270, y=40)
select_but_bill1=Button(self,text="Generate
Bill",command=callselectbill,activebackground='lightblue',width=20)
select_but_bill1.pack()
select_but_bill1.place(x=220, y=280)
check_but_bill=Button(self,text="...",command=callcheckproduct,activebackground='lightblue',widt
h=5)
check_but_bill.pack()
check_but_bill.place(x=280, y=130)
delete_but_bill=Button(self,text="Delete",command=calldeletebill,activebackground='lightblue',widt
h=10)
delete_but_bill.pack()
delete_but_bill.place(x=490, y=280)
bClear_bill.pack()
bClear_bill.place(x=590,y=280)
bClear_product.pack()
bClear_product.place(x=700,y=280)
price_but_bill=Button(self,text="Price",command=callactualprice,activebackground='lightblue',width
=10)
price_but_bill.pack()
price_but_bill.place(x=260, y=160)
find_date_bill=Button(self,text="Find
Date",command=callfinddate,activebackground='lightblue',width=10)
find_date_bill.pack()
find_date_bill.place(x=650, y=10)
self.destroy_children()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
r = IntVar()
r=200
fcode2 = StringVar()
fname2 = StringVar()
fqty2 = StringVar()
fprice2 = StringVar()
fprofit2 = StringVar()
fsprice2 = StringVar()
ftype2 = StringVar()
Label(self, textvariable=fcode2,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=100,y=r)
Label(self, textvariable=fqty2,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=350,y=r)
Label(self, textvariable=fprice2,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=450,y=r)
Label(self, textvariable=fprofit2,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=550,y=r)
Label(self, textvariable=fsprice2,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=650,y=r)
Label(self, textvariable=ftype2,borderwidth=1,width=20,
height=1,bg='Black',fg="White" ).place(x=750,y=r)
print (row)
print ("r=",r)
print (row[1])
fcode2.set(row[0])
fname2.set(row[1])
fqty2.set(row[2])
fprice2.set(row[3])
fprofit2.set(row[4])
fsprice2.set(row[5])
ftype2.set(row[6])
r=r+20
db.close()
def billreportdate(self):
self.destroy_children()
self.callselectbill3()
def callselectbill3(self):
def billcompletereport2():
self.globaldate3=bdate.get()
self.destroy_children()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
cursor.execute(sql)
results = cursor.fetchall()
r=IntVar()
r=200
self.totamt1=0
fbcode3= StringVar()
fbdate3= StringVar()
fcode3 = StringVar()
fbname3 = StringVar()
fbprice3 = StringVar()
fbqty3 = StringVar()
fbtot3 = StringVar()
Label(self, textvariable=fbdate3,borderwidth=1, height=1 ).place(x=335,y=100)
print (row)
fbcode3.set(row[0])
fbdate3.set(row[1])
fcode3.set(row[2])
fbname3.set(row[3])
fbprice3.set(row[4])
fbqty3.set(row[5])
fbtot3.set(row[6])
self.totamt1=self.totamt1+row[6]
r=r+30
totamt1=Entry(self)
totamt1.pack()
totamt1.place(x=600, y=100)
totamt1.insert(0,self.totamt1)
db.close()
lb100=Label(self,text="Bill Date",fg='blue')
lb100.pack()
lb100.place(x=400,y=50)
bdate=Entry(self)
bdate.pack()
bdate.place(x=450,y=50)
bi_but_billdate=Button(self,text="...",command=billcompletereport2,activebackground='lightblue',w
idth=5)
bi_but_billdate.pack()
bi_but_billdate.place(x=580, y=50)
def billreport(self):
self.destroy_children()
self.callselectbill2()
def callselectbill2(self):
def billcompletereport1():
self.globalbno2=bcode.get()
print (self.globalbno2)
self.destroy_children()
import MySQLdb
db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )
cursor = db.cursor()
#print "Noorul."
print (sql)
cursor.execute(sql)
results = cursor.fetchall()
r=IntVar()
r=200
self.totamt1=0
fbcode3= StringVar()
fbdate3= StringVar()
fcode3 = StringVar()
fbname3 = StringVar()
fbprice3 = StringVar()
fbqty3 = StringVar()
fbtot3 = StringVar()
Label(self, textvariable=fbcode3,borderwidth=1,width=5, height=1 ,font="times 10
bold").place(x=350,y=100)
Label(self, textvariable=fcode3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=350,y=r)
Label(self, textvariable=fbname3,borderwidth=1,width=13,
height=1,bg='Black',fg="White" ).place(x=400,y=r)
Label(self, textvariable=fbprice3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=510,y=r)
Label(self, textvariable=fbqty3,borderwidth=1,width=5,
height=1,bg='Black',fg="White" ).place(x=560,y=r)
Label(self, textvariable=fbtot3,borderwidth=1,width=10,
height=1,bg='Black',fg="White" ).place(x=620,y=r)
print (row)
fbcode3.set(row[0])
fbdate3.set(row[1])
fcode3.set(row[2])
fbname3.set(row[3])
fbprice3.set(row[4])
fbqty3.set(row[5])
fbtot3.set(row[6])
self.totamt1=self.totamt1+row[6]
r=r+20
r=r+50
totamt1=Entry(self)
totamt1.pack()
totamt1.place(x=500, y=r)
totamt1.insert(0,self.totamt1)
r=r+40
db.close()
lb100=Label(self,text="Bill Code",fg='blue')
lb100.pack()
lb100.place(x=400,y=100)
bcode=Entry(self)
bcode.pack()
bcode.place(x=450,y=100)
bi_but_bill=Button(self,text="...",command=billcompletereport1,activebackground='lightblue',width
=5)
bi_but_bill.pack()
bi_but_bill.place(x=570, y=100)
def main():
root = Tk()
#root = tix.Tk()
root.geometry("250x150+300+300")
app = Example(root)
root.mainloop()
if __name__ == '__main__':
main()