Billing Software
Billing Software
Billing Software
import math,random,os
class Bill_App:
def __init__(self,root):
self.root=root
self.root.geometry("1350x700+0+0")
self.root.title("Billing Software")
bg_color="#074463"
title=Label(self.root,text="Billing
Software",bd=12,relief=GROOVE,bg=bg_color,fg="white",font=("times new
roman",30,"bold"),pady=2).pack(fill=X)
OUTPUT :
#===================================Variables====================================
#=============Cosmatics======================
self.soap=IntVar()
self.face_cream=IntVar()
self.face_wash=IntVar()
self.spray=IntVar()
self.gell=IntVar()
self.loshan=IntVar()
#=============Grocery========================
self.rice=IntVar()
self.food_oil=IntVar()
self.daal=IntVar()
self.wheat=IntVar()
self.sugar=IntVar()
self.tea=IntVar()
#=============Cold Drink====================
self.maza=IntVar()
self.coca=IntVar()
self.frooti=IntVar()
self.thumbsup=IntVar()
self.limca=IntVar()
self.sprite=IntVar()
self.cosmetic_price=StringVar()
self.grocery_price=StringVar()
self.cold_drink_price=StringVar()
self.cosmetic_tax=StringVar()
self.grocery_tax=StringVar()
self.cold_drink_tax=StringVar()
#=============Customer Detail================
self.c_name=StringVar()
self.c_phon=StringVar()
self.bill_no=StringVar()
x=random.randint(1000,9999)
self.bill_no.set(str(x))
self.search_bill=StringVar()
#================Customer Detail====================
F1.place(x=0,y=90,relwidth=1)
cname_txt=Entry(F1,width=11,textvariable=self.c_name,font="arial
15",bd=7,relief=SUNKEN).grid(row=0,column=1,pady=5,padx=10)
cphn_txt=Entry(F1,width=11,textvariable=self.c_phon,font="arial
15",bd=7,relief=SUNKEN).grid(row=0,column=3,pady=5,padx=10)
cbill_txt=Entry(F1,width=11,textvariable=self.search_bill,font="arial
15",bd=7,relief=SUNKEN).grid(row=0,column=5,pady=5,padx=10)
bill_btn=Button(F1,text="Search",command=self.find_bill,width=10,bd=7,font="arial 12
bold").grid(row=0,column=6,padx=50,pady=10)
OUTPUT:
#=============Cosmetics Frame================
F2=LabelFrame(self.root,bd=10,relief=GROOVE,text="Cosmetics",font=("times new
roman",15,"bold"),fg="gold",bg=bg_color)
F2.place(x=3,y=205,width=325,height=380)
bath_txt=Entry(F2,width=10,textvariable=self.soap,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=0,column=1,padx=8,pady=10)
face_crm_lbl=Label(F2,text="Face Cream",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=1,column=0,padx=10,pady=10,sticky="w")
face_crm_txt=Entry(F2,width=10,textvariable=self.face_cream,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=1,column=1,padx=8,pady=10)
face_w_txt=Entry(F2,width=10,textvariable=self.face_wash,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=2,column=1,padx=8,pady=10)
hair_s_txt=Entry(F2,width=10,textvariable=self.spray,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=3,column=1,padx=8,pady=10)
hair_gel_txt=Entry(F2,width=10,textvariable=self.gell,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=4,column=1,padx=8,pady=10)
body_txt=Entry(F2,width=10,textvariable=self.loshan,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=5,column=1,padx=10,pady=10)
OUTPUT :
#=============Grocery Frame================
F3=LabelFrame(self.root,bd=10,relief=GROOVE,text="Grocery",font=("times new
roman",15,"bold"),fg="gold",bg=bg_color)
F3.place(x=320,y=205,width=285,height=380)
g1_lbl=Label(F3,text="Rice",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=0,column=0,padx=10,pady=10,sticky="w")
g1_txt=Entry(F3,width=10,textvariable=self.rice,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=0,column=1,padx=8,pady=10)
g2_txt=Entry(F3,width=10,textvariable=self.food_oil,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=1,column=1,padx=8,pady=10)
g3_lbl=Label(F3,text="Daal",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=2,column=0,padx=10,pady=10,sticky="w")
g3_txt=Entry(F3,width=10,textvariable=self.daal,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=2,column=1,padx=8,pady=10)
g4_lbl=Label(F3,text="Wheat",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=3,column=0,padx=10,pady=10,sticky="w")
g4_txt=Entry(F3,width=10,textvariable=self.wheat,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=3,column=1,padx=8,pady=10)
g5_lbl=Label(F3,text="Suger",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=4,column=0,padx=10,pady=10,sticky="w")
g5_txt=Entry(F3,width=10,textvariable=self.sugar,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=4,column=1,padx=8,pady=10)
g6_lbl=Label(F3,text="Tea",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=5,column=0,padx=10,pady=10,sticky="w")
g6_txt=Entry(F3,width=10,textvariable=self.tea,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=5,column=1,padx=10,pady=10)
OUTPUT :
#=============Cold Drink Frame================
F4.place(x=600,y=205,width=300,height=380)
c1_lbl=Label(F4,text="Mazza",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=0,column=0,padx=10,pady=10,sticky="w")
c1_txt=Entry(F4,width=10,textvariable=self.maza,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=0,column=1,padx=8,pady=10)
c2_lbl=Label(F4,text="Coca-cola",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=1,column=0,padx=10,pady=10,sticky="w")
c2_txt=Entry(F4,width=10,textvariable=self.coca,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=1,column=1,padx=8,pady=10)
c3_lbl=Label(F4,text="Frooti",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=2,column=0,padx=10,pady=10,sticky="w")
c3_txt=Entry(F4,width=10,textvariable=self.frooti,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=2,column=1,padx=8,pady=10)
c4_txt=Entry(F4,width=10,textvariable=self.thumbsup,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=3,column=1,padx=8,pady=10)
c5_lbl=Label(F4,text="Limca",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=4,column=0,padx=10,pady=10,sticky="w")
c5_txt=Entry(F4,width=10,textvariable=self.limca,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=4,column=1,padx=8,pady=10)
c6_lbl=Label(F4,text="Sprite",font=("times new
roman",15,"bold"),bg=bg_color,fg="lightgreen").grid(row=5,column=0,padx=10,pady=10,sticky="w")
c6_txt=Entry(F4,width=10,textvariable=self.sprite,font=("times new
roman",12,"bold"),bd=5,relief=SUNKEN).grid(row=5,column=1,padx=10,pady=10)
OUTPUT :
#=============Bill Area Frame================
F5=Frame(self.root,bd=10,relief=GROOVE)
F5.place(x=905,y=205,width=440,height=350)
scrol_y=Scrollbar(F5,orient=VERTICAL)
self.textarea=Text(F5,yscrollcommand=scrol_y.set)
scrol_y.pack(side=RIGHT,fill=Y)
scrol_y.config(command=self.textarea.yview)
self.textarea.pack(fill=BOTH,expand=1)
OUTPUT :
#=============Button Frame================
F6.place(x=3,y=560,relwidth=1,height=140)
m1_txt=Entry(F6,width=15,textvariable=self.cosmetic_price,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=0,column=1,padx=10,pady=1)
m2_txt=Entry(F6,width=15,textvariable=self.grocery_price,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=1,column=1,padx=10,pady=1)
m3_lbl=Label(F6,text="Total Cold Drink Price",bg=bg_color,fg="white",font=("times new
roman",14,"bold")).grid(row=2,column=0,padx=20,pady=1,sticky="w")
m3_txt=Entry(F6,width=15,textvariable=self.cold_drink_price,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=2,column=1,padx=10,pady=1)
c1_txt=Entry(F6,width=15,textvariable=self.cosmetic_tax,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=0,column=4,padx=10,pady=1)
c2_txt=Entry(F6,width=15,textvariable=self.grocery_tax,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=1,column=4,padx=10,pady=1)
c3_txt=Entry(F6,width=15,textvariable=self.cold_drink_tax,font="arial 10
bold",bd=7,relief=SUNKEN).grid(row=2,column=4,padx=10,pady=1)
btn_f=Frame(F6,bd=7,relief=GROOVE)
btn_f.place(x=820,width=510,height=180)
total_btn=Button(btn_f,text="Total",command=self.total,bg="cadetblue",fg="white",pady=10,width
=10,bd=4,font="arial 10 bold").grid(row=0,column=0,padx=5,pady=5)
gbill_btn=Button(btn_f,command=self.bill_area,text="Generate
Bill",bg="cadetblue",fg="white",pady=10,width=10,bd=4,font="arial 10
bold").grid(row=0,column=1,padx=5,pady=5)
clear_btn=Button(btn_f,text="Clear",command=self.clear_data,bg="cadetblue",fg="white",pady=10,
width=10,bd=4,font="arial 10 bold").grid(row=0,column=2,padx=5,pady=5)
exit_btn=Button(btn_f,text="Exit",command=self.Exit_app,bg="cadetblue",fg="white",pady=10,widt
h=10,bd=4,font="arial 10 bold").grid(row=0,column=3,padx=5,pady=5)
OUTPUT:
self.welcome_bill()
def total(self):
self.c_s_p=self.soap.get()*40
self.c_fc_p=self.face_cream.get()*80
self.c_fw_p=self.face_wash.get()*60
self.c_spr_p=self.spray.get()*180
self.c_g_p=self.gell.get()*120
self.c_l_p=self.loshan.get()*150
self.total_cosmatic_price=float(
self.c_s_p+
self.c_fc_p+
self.c_fw_p+
self.c_spr_p+
self.c_g_p+
self.c_l_p
self.cosmetic_price.set("Rs. "+str(self.total_cosmatic_price))
self.c_tax=round(self.total_cosmatic_price*0.28,2)
self.cosmetic_tax.set("Rs. "+str(self.c_tax))
self.g_r_p=self.rice.get()*80
self.g_fo_p=self.food_oil.get()*120
self.g_w_p=self.wheat.get()*30
self.g_d_p=self.daal.get()*80
self.g_s_p=self.sugar.get()*40
self.g_t_p=self.tea.get()*180
self.total_grocery_price=float(
self.g_r_p+
self.g_fo_p+
self.g_w_p+
self.g_d_p+
self.g_s_p+
self.g_t_p
self.grocery_price.set("Rs. "+str(self.total_grocery_price))
self.g_tax=round(self.total_grocery_price*0.18,2)
self.grocery_tax.set("Rs. "+str(self.g_tax))
self.cd_m_p=self.maza.get()*65
self.cd_c_p=self.coca.get()*70
self.cd_f_p=self.frooti.get()*50
self.cd_th_p=self.thumbsup.get()*45
self.cd_l_p=self.limca.get()*40
self.cd_s_p=self.sprite.get()*60
self.total_cold_drink_price=float(
self.cd_m_p+
self.cd_c_p+
self.cd_f_p+
self.cd_th_p+
self.cd_l_p+
self.cd_s_p
self.cold_drink_price.set("Rs. "+str(self.total_cold_drink_price))
self.cd_tax=round(self.total_cold_drink_price*0.28,2)
self.cold_drink_tax.set("Rs. "+str(self.cd_tax))
self.total_bill=float(
self.total_cosmatic_price+
self.total_grocery_price+
self.total_cold_drink_price+
self.c_tax+
self.g_tax+
self.cd_tax
def welcome_bill(self):
self.textarea.delete('1.0',END)
self.textarea.insert(END,f"\n======================================")
self.textarea.insert(END,f"\n Product\t\tQTY\t\tPrice")
self.textarea.insert(END,f"\n======================================")
def bill_area(self):
if self.c_name.get()=="" or self.c_phon.get()=="":
else:
self.welcome_bill()
#===cosmatics=====
if self.soap.get()!=0:
if self.face_cream.get()!=0:
if self.face_wash.get()!=0:
if self.spray.get()!=0:
if self.gell.get()!=0:
if self.loshan.get()!=0:
#===Grocery=====
if self.rice.get()!=0:
if self.food_oil.get()!=0:
if self.daal.get()!=0:
if self.wheat.get()!=0:
if self.sugar.get()!=0:
self.textarea.insert(END,f"\n Suger \t\t{self.sugar.get()}\t\t{self.g_s_p}")
if self.tea.get()!=0:
#===Cold Drink=====
if self.maza.get()!=0:
if self.coca.get()!=0:
if self.frooti.get()!=0:
if self.thumbsup.get()!=0:
if self.limca.get()!=0:
self.textarea.insert(END,f"\n Limca\t\t{self.limca.get()}\t\t{self.cd_l_p}")
if self.sprite.get()!=0:
self.textarea.insert(END,f"\n--------------------------------------")
if self.cosmetic_tax.get()!="Rs. 0.0":
if self.grocery_tax.get()!="Rs. 0.0":
if self.cold_drink_tax.get()!="Rs. 0.0":
self.save_bill()
def save_bill(self):
if op>0:
self.bill_data=self.textarea.get('1.0',END)
f1=open("F://python 50 projects//main//"+str(self.bill_no.get())+".txt","w")
f1.write(self.bill_data)
f1.close()
else:
return
def find_bill(self):
present="no"
if i.split(".")[0]==self.search_bill.get():
f1=open(f"F:\\python 50 projects\\main\\{i}","r")
self.textarea.delete('1.0',END)
for d in f1:
self.textarea.insert(END,d)
f1.close()
present="yes"
if present=="no":
def clear_data(self):
if op>0:
#=============Cosmatics======================
self.soap.set(0)
self.face_cream.set(0)
self.face_wash.set(0)
self.spray.set(0)
self.gell.set(0)
self.loshan.set(0)
#=============Grocery========================
self.rice.set(0)
self.food_oil.set(0)
self.daal.set(0)
self.wheat.set(0)
self.sugar.set(0)
self.tea.set(0)
#=============Cold Drink====================
self.maza.set(0)
self.coca.set(0)
self.frooti.set(0)
self.thumbsup.set(0)
self.limca.set(0)
self.sprite.set(0)
self.cosmetic_price.set("")
self.grocery_price.set("")
self.cold_drink_price.set("")
self.cosmetic_tax.set("")
self.grocery_tax.set("")
self.cold_drink_tax.set("")
#=============Customer Detail=====================
self.c_name.set("")
self.c_phon.set("")
self.bill_no.set("")
x=random.randint(1000,9999)
self.bill_no.set(str(x))
self.search_bill.set("")
self.welcome_bill()
def Exit_app(self):
if op>0:
self.root.destroy()
root=Tk()
obj=Bill_App(root)
root.mainloop()
MAIN OUTPUT:
================================THE END===============================