0% found this document useful (0 votes)
18 views38 pages

Fast Food Restaurant

This document contains code for a Python GUI application for a fast food restaurant management system. It defines a class called Example that contains methods for initializing the GUI, adding menu options, and handling user interactions like adding, editing, deleting product details and generating bills. Methods are defined to connect to a MySQL database and execute SQL queries to manage the product and bill data. Widgets like labels, entries, buttons are created and placed on the GUI for users to interact with the various features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views38 pages

Fast Food Restaurant

This document contains code for a Python GUI application for a fast food restaurant management system. It defines a class called Example that contains methods for initializing the GUI, adding menu options, and handling user interactions like adding, editing, deleting product details and generating bills. Methods are defined to connect to a MySQL database and execute SQL queries to manage the product and bill data. Widgets like labels, entries, buttons are created and placed on the GUI for users to interact with the various features.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 38

from tkinter import *

#import tkMessageBox

import tkinter.messagebox

import datetime

#import Tix as tk

from tkinter import tix

from tkinter.constants import *

import sys

import ast

class Example(Frame):

def __init__(self, parent):

Frame.__init__(self, parent)

self.parent = parent

self.initUI()

def initUI(self):

self.parent.title("BHASKAR USMAN LANCY FASTFOOD JOINT L.L.C.")

self.pack(fill=BOTH, expand=1)

menubar = Menu(self.parent)

self.parent.config(menu=menubar)
self.Photohob = PhotoImage(file="20130319-214502.gif")

self.label100 = Label(self,image = self.Photohob)

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="BHASKAR USMAN LANCY \n Fastfood Joint",borderwidth=10,width=22,


height=1,font="times 20 bold").place(x=300,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_command(label="Product Details", command=self.productform) #To add Product


details into table

fileMenu.add_command(label="Billing", command=self.billform) #To sale of products and billing


for customer

fileMenu.add_command(label="Exit Form", command=self.onExit)

fileMenu.add_separator()
fileMenu.add_command(label="Quit All", command=self.parent.destroy)

menubar.add_cascade(label="Reports", menu=reportmenu)

reportmenu.add_command(label="All Fastfood Report", command=self.foodreportform)


#Details of all Products in the business

reportmenu.add_command(label="Bill Report(BILL NO. WISE)",


command=self.billreport)#Details of Bill when Billcode is given

reportmenu.add_command(label="Bill Report (DATE WISE)",


command=self.billreportdate)#Details of Bill when Billcode is given

def onExit(self):

self.destroy()

def destroy_children(self):

for child in self.winfo_children():

child.destroy()

def onClick(self):

if self.var.get() == 1:

self.master.title("Checkbutton....")

else:

self.master.title("")

#To add Product details into table form

def productform(self):

self.destroy_children()
self.Photohob = PhotoImage(file="cucina ristorante cuochi-2.gif")

self.label100 = Label(self,image = self.Photohob)

self.label100.image = self.Photohob

self.label100.pack()

#self.label100.place(relx = 0.488,rely=0.38)

self.label100.place(x=0,y=0)

#Clears all texts and values from the textbox

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)

#Inserts all entered data into SQL table

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()

sql = "INSERT INTO productdetails(fcode,fname,fqty,fprice,fprofit,fsprice,ftype)VALUES


("+fcode1+",'"+fname1+"',"+fqty1+","+fprice1+","+fprofit1+","+fsprice1+",'"+ftype1+"')"

print (sql)

cursor.execute(sql)

db.commit()

print ("added")

tkMessageBox.showinfo("Food Details", "Record Added")

db.close()

#Selects datas from the SQL according to primary key


def callselect():

fcode1=fcode.get()

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT * FROM productdetails WHERE fcode = "+fcode1+""

cursor.execute(sql)

results = cursor.fetchall()

for row in results:

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()

#Checks whether fcode is already existing

def callcheckfcode():

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT max(fcode) FROM productdetails"


cursor.execute(sql)

results = cursor.fetchall()

for row in results:

fcode.insert(0,(row[0]+1))

db.close()

#Updates datas from the SQL according to primary key

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()

sql = "UPDATE productdetails SET fname='"+fname1+"',fqty


="+fqty1+",fprice="+fprice1+",fprofit='"+fprofit1+"',fsprice='"+fsprice1+"',ftype='"+ftype1+"' WHERE
fcode="+fcode1+""

cursor.execute(sql)

db.commit()
print ("Updated")

tkMessageBox.showinfo("Fastfood Details", "Record Updated")

db.close()

#Deletes datas from the SQL according to primary key

def calldelete():

fcode1=fcode.get()

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "DELETE FROM productdetails WHERE fcode ="+fcode1+""

cursor.execute(sql)

db.commit()

print ("Deleted")

tkMessageBox.showinfo("Fastfood Details", "Record Deleted")

#Radio Button selection of food type

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)

#Shows the actual price after adding profit

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 Button to add data into SQL

add_but=Button(self,text="Add",command=callinsert,activebackground='lightblue',width=10)

add_but.pack()

add_but.place(x=120, y=300)

#Select Button to select data from SQL

select_but=Button(self,text="Select",command=callselect,activebackground='lightblue',width=10)

select_but.pack()

select_but.place(x=220, y=300)

#Update Button to update data from SQL

update_but=Button(self,text="Update",command=callupdate,activebackground='lightblue',width=1
0)

update_but.pack()

update_but.place(x=320, y=300)

#Delete Button to delete data from SQL

delete_but=Button(self,text="Delete",command=calldelete,activebackground='lightblue',width=10)
delete_but.pack()

delete_but.place(x=420, y=300)

#Clears all the textbox

bClear = Button(self, text="Clear", command=evClear,activebackground='lightblue',width=10)

bClear.pack()

bClear.place(x=520,y=300)

#Adds the price with the profit to show selling price

price_but=Button(self,text="Selling
Price",command=callactualprice,activebackground='lightblue',width=10)

price_but.pack()

price_but.place(x=250,y=160)

#Generating New Fcode

check_but=Button(self,text="...",command=callcheckfcode,activebackground='lightblue',width=5)

check_but.pack()

check_but.place(x=250,y=10)

#GENERATING BILL IN BILLFORM

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)

Label(self, text="PCode",borderwidth=1,width=5, height=1 ,fg='Blue',font="times 10


bold" ).place(x=350,y=150)

Label(self, text="Product Name",borderwidth=1,width=13, height=1 ,fg='Blue',font="times 10


bold" ).place(x=400,y=150)

Label(self, text="Price",borderwidth=1,width=5, height=1 ,fg='Blue',font="times 10


bold" ).place(x=510,y=150)

Label(self, text="Quantity",borderwidth=1,width=10, height=1 ,fg='Blue',font="times 10


bold" ).place(x=550,y=150)

Label(self, text="Tot Price",borderwidth=1,width=10, height=1 ,fg='Blue',font="times 10


bold" ).place(x=620,y=150)

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "select * from bill where fbcode="+self.globalbno1+""

#print ("Noorul.")

print (sql)

cursor.execute(sql)

results = cursor.fetchall()

r=IntVar()

r=200

self.totamt1=0

for row in results:

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=fbdate3,borderwidth=1, height=1,font="times 10


bold").place(x=620,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)

Label(self, text="TOTAL",borderwidth=1, width=10, height=1).place(x=400,y=r)

r=r+40

Label(self, text="THANK YOU FOR VISITING COME AGAIN",borderwidth=1, width=40,


height=1 ,fg='blue',font="times 10 bold").place(x=390,y=r)

db.close()
#GENERATING bill FORM

def billform(self):

self.destroy_children()

self.Photohob = PhotoImage(file="subscription-billing-credit-cards-1024x768.gif")

self.label100 = Label(self,image = self.Photohob)

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()

sql = "SELECT * FROM productdetails"

cursor.execute(sql)

results = cursor.fetchall()

Label(self, text="Available Items",bg='green').place(x=800,y=0)

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

for row in results:


fcode2 = StringVar()

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()

#Clears the Bill textboxes

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)

#Clears the Fbname

def clear_textbox():

fbname.delete(0,END)

#Generating

def callcheckfbcode():

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT max(fbcode) FROM bill"

cursor.execute(sql)

results = cursor.fetchall()

for row in results:

fbcode.insert(0,(row[0]+1))

db.close()

#Clears all textboxes except bcode

def evanotherproductbill():

fcode.delete(0,END)

fbname.delete(0,END)

fbprice.delete(0,END)

fbqty.delete(0,END)
fbtot.delete(0,END)

#Inserts Bill into database

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()

sql = "INSERT INTO bill(fcode,fbcode,fbname,fbprice,fbqty,fbtot,fbdate)VALUES


("+fcode1+","+fbcode1+",'"+fbname1+"',"+fbprice1+","+fbqty1+","+fbtot1+",'"+fbdate1+"')"

cursor.execute(sql)

db.commit()

sql2 = "UPDATE productdetails set fqty=fqty-"+fbqty1+" where fcode="+fcode1+""

cursor.execute(sql2)

db.commit()

print ("added")

tkMessageBox.showinfo("Bill", "Added")

db.close()

#Selecting product from database

def callselectproduct():
fcode1=fcode.get()

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT * FROM productdetails WHERE fcode = "+fcode1+""

cursor.execute(sql)

results = cursor.fetchall()

for row in results:

fbname.insert(0,row[1])

fbprice.insert(0,row[5])

#Checking whether product is in stock

def callcheckproduct():

fcode1=fcode.get()

fbqty1=int(fbqty.get())

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT * FROM productdetails WHERE fcode = "+fcode1+""

cursor.execute(sql)

results = cursor.fetchall()

for row in results:

qtycheck=int(row[2])

if(fbqty1>qtycheck):

tkMessageBox.showinfo("Bill", "Product Quantity more than entered Quantity")


elif(fbqty1==qtycheck):

tkMessageBox.showinfo("Bill", "Available Quantity only ")

elif(fbqty1<qtycheck):

tkMessageBox.showinfo("Bill", "Product is in Stock")

db.close()

#Generating Bill(Taking Bill No and calling Billcomplete report)

def callselectbill():

self.globalbno1=fbcode.get()

self.billcompletereport()

#Deleting Bill From Database

def calldeletebill():

fbcode1=fbcode.get()

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "DELETE FROM bill WHERE fbcode ="+fbcode1+""

cursor.execute(sql)

db.commit()

print ("Deleted")
tkMessageBox.showinfo("Bill", "Deleted")

db.close()

#Calculating Price With quantity purchased

def callactualprice():

a1=float(fbprice.get())

b1=float(fbqty.get())

c1=a1*b1

round(c1,2)

fbtot.insert(0,c1)

#Finding Current date

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)

#Generating new fbcode

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 = Button(self, text="Clear",


command=evClearbill,activebackground='lightblue',width=10)

bClear_bill.pack()

bClear_bill.place(x=590,y=280)

bClear_product = Button(self, text="Add Another Product",


command=evanotherproductbill,activebackground='lightblue',width=20)

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)

#Report for all food in the restaurant


def foodreportform(self):

self.destroy_children()

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "SELECT * FROM productdetails"

cursor.execute(sql)

results = cursor.fetchall()

Label(self,text="BHASKAR USMAN LANCY \n Fastfood Joint \n Food


Available",fg='black',borderwidth=10 ,height=2 ,font="times 20 bold").place(x=300,y=20)

Label(self, text="Fcode",borderwidth=1,width=5, height=1 ,bg='green').place(x=100,y=150)

Label(self, text="Fname",borderwidth=1 ,width=10, height=1 ,bg='green').place(x=190,y=150)

Label(self, text="Fqty",borderwidth=1,width=10, height=1 ,bg='green' ).place(x=350,y=150)

Label(self, text="Fprice",borderwidth=1,width=10, height=1 ,bg='green' ).place(x=450,y=150)

Label(self, text="Fprofit",borderwidth=1,width=10, height=1 ,bg='green' ).place(x=550,y=150)

Label(self, text="Fsprice",borderwidth=1,width=10, height=1 ,bg='green' ).place(x=650,y=150)

Label(self, text="Ftype",borderwidth=1,width=10, height=1 ,bg='green' ).place(x=750,y=150)

r = IntVar()

r=200

for row in results:

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=fname2,borderwidth=1 ,width=20,


height=1,bg='Black',fg="White" ).place(x=170,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()

Label(self, text="BHASKAR USMAN LANCY \n Fastfood Joint \n DATE WISE


REPORT",borderwidth=10,width=50, height=2,font="times 20 bold").place(x=100,y=0)

Label(self, text="Bill Date:",borderwidth=1 ,width=30, height=1,font="times 10


bold").place(x=200,y=100)

Label(self, text="PCode",borderwidth=1, height=1 ,fg='Blue',font="times 10


bold" ).place(x=300,y=150)
Label(self, text="Product Name",borderwidth=1, height=1 ,fg='Blue',font="times 10
bold" ).place(x=380,y=150)

Label(self, text="Price",borderwidth=1, height=1 ,fg='Blue',font="times 10


bold" ).place(x=490,y=150)

Label(self, text="Quantity",borderwidth=1, height=1 ,fg='Blue',font="times 10


bold" ).place(x=560,y=150)

Label(self, text="Tot Price",borderwidth=1, height=1 ,fg='Blue',font="times 10


bold" ).place(x=660,y=150)

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "select * from bill where fbdate='"+self.globaldate3+"'"

cursor.execute(sql)

results = cursor.fetchall()

r=IntVar()

r=200

self.totamt1=0

for row in results:

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)

Label(self, textvariable=fcode3,borderwidth=1, bg='Black', fg="White",


width=5).place(x=300,y=r)

Label(self, textvariable=fbname3,borderwidth=1, bg='Black',fg="White" ,


width=15).place(x=370,y=r)

Label(self, textvariable=fbprice3,borderwidth=1, bg='Black',fg="White",


width=5).place(x=490,y=r)

Label(self, textvariable=fbqty3,borderwidth=1, bg='Black',fg="White",


width=10).place(x=550,y=r)

Label(self, textvariable=fbtot3,borderwidth=1, bg='Black', fg="White",


width=10).place(x=650,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+30

totamt1=Entry(self)

totamt1.pack()

totamt1.place(x=600, y=100)

totamt1.insert(0,self.totamt1)

Label(self, text="Total Sales:",borderwidth=1, width=10, height=1,font="times 10


bold").place(x=500,y=100)

db.close()

Label(self, text="ENTER THE DATE in this format


(YEAR/MONTH/DAY)",borderwidth=10,width=50, height=1,font="times 20 bold").place(x=180,y=0)

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()

Label(self, text="BHASKAR USMAN LANCY \n Fastfood Joint",borderwidth=10,width=22,


height=1,font="times 20 bold").place(x=350,y=20)

Label(self, text="PCode",borderwidth=1,width=5, height=1 ,fg='Blue',font="times 10


bold" ).place(x=350,y=150)

Label(self, text="Product Name",borderwidth=1,width=13, height=1 ,fg='Blue',font="times 10


bold" ).place(x=400,y=150)
Label(self, text="Price",borderwidth=1,width=5, height=1 ,fg='Blue',font="times 10
bold" ).place(x=510,y=150)

Label(self, text="Quantity",borderwidth=1,width=10, height=1 ,fg='Blue',font="times 10


bold" ).place(x=550,y=150)

Label(self, text="Tot Price",borderwidth=1,width=10, height=1 ,fg='Blue',font="times 10 bold"


).place(x=620,y=150)

import MySQLdb

db = MySQLdb.connect("localhost","root","root1","bhaskarusmanlancy" )

cursor = db.cursor()

sql = "select * from bill where fbcode="+self.globalbno2+""

#print "Noorul."

print (sql)

cursor.execute(sql)

results = cursor.fetchall()

r=IntVar()

r=200

self.totamt1=0

for row in results:

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=fbdate3,borderwidth=1, height=1,font="times 10


bold").place(x=620,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)

Label(self, text="TOTAL",borderwidth=1, width=10, height=1).place(x=400,y=r)

r=r+40

Label(self, text="THANK YOU FOR VISITING COME AGAIN",borderwidth=1, width=40, height=1


,fg='blue',font="times 10 bold").place(x=390,y=r)

db.close()

Label(self, text="Search any Bill according to Bill Number",borderwidth=10,width=60,


height=1,font="times 20 bold").place(x=50,y=20)

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()

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy