python pro
python pro
4. Program Code 11
5 Output 17
import random
importtime
root = Tk()
root.title("Billing")
root.geometry("2000x10
00") bg_color =
'#add8e6'
l = [] a =
[] C1f =
IntVar()
C2f = IntVar()
C3f = IntVar()
C4f = IntVar()
C5f = IntVar()
C6f = IntVar()
C7f = IntVar()
C8f = IntVar()
C9f = IntVar()
C10f= IntVar()
C11f= IntVar()
C12f= IntVar()
C13f= IntVar()
C14f= IntVar()
C15f= IntVar()
C16f= IntVar()
C17f= IntVar()
C18f= IntVar()
C19f= IntVar()
C20f = IntVar()
c_name =
StringVar()
c_phone =
StringVar()
bill_no =
StringVar()
x = random.randint(1000, 9999)
bill_no.set(str(x))
title.pack(fill=X)
name_lbl = Label(F1, text='Customer Name', font=('times new romon', 18, 'bold'), bg=bg_color,
fg='black').grid(row=0, column=0, padx=20, pady=5) name_txt = Entry(F1, width=15,
textvariable=c_name, font='arial 15 bold', relief=SUNKEN, bd=7).grid(row=0, column=1, padx=10,
pady=5) phone_lbl = Label(F1, text='Phone No. ', font=('times new romon', 18, 'bold'), bg=bg_color,
fg='black').grid(row=0, column=2, padx=20, pady=5) phone_txt = Entry(F1, width=15, font='arial 15
bold', textvariable=c_phone, relief=SUNKEN, bd=7).grid(row=0, column=3,padx=10, pady=5) class
App(Frame):
def update_clock(self):
self.label.configure(text=now)
self.after(1000,
self.update_clock)
app = App(root)
# product details
scrol_y = Scrollbar(F2)
scrol_y.pack(side=RIGHT,
fill=Y) scrol_y.pack()
product_lbl = Label(F2, text="Product Name", bg=bg_color, font=('times new
roman', 15, 'bold')) product_lbl.place(x=40, y=10)
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
# p=price
p17 = Label(F2, text="₹ 15", anchor="w", bg=bg_color, font=('times
new roman', 12)) p17.place(x=260, y=440)
# p=price
# p=price
# p=price
F3 = Frame(root,
relief=GROOVE, bd=10)
F3.place(x=850, y=180,
width=650, height=600) def
welcome():
textarea.delete(1.0, END)
textarea.insert(END, "\t \t Welcome
Smartbyte Retail") textarea.insert(END,
f"\n\nBill Number:\t\t{bill_no.get()}")
textarea.insert(END, f"\nCustomer
Name:\t\t{c_name.get()}")
textarea.insert(END, f"\nPhone Number:\
t\t{c_phone.get()}")
textarea.insert(END, f"\n\
n================================================
==") textarea.insert(END, "\nProduct\t\tQTY\t\tPrice")
textarea.insert(END, f"\
n================================================
==\n") textarea.configure(font='arial 15 bold')
bill_title = Label(F3, text='Bill Area', font='arial 15 bold', bd=7,
relief=GROOVE).pack(fill=X) scrol_y = Scrollbar(F3,
orient=VERTICAL) textarea = Text(F3,
yscrollcommand=scrol_y) scrol_y.pack(side=RIGHT, fill=Y)
scrol_y.config(command=textarea.yview) textarea.pack()
def gbill(): # this function use for after press generate button to check a name/phone no is empty and after press of button
textarea content will be shown
textarea.insert(END, textAreaText)
textarea.insert(END, f"\
n======================================")
textarea.insert(END, f"\nTotal Paybill Amount :\t\
t {sum(l)}")
textarea.insert(END,f"\n\
n======================================")
save_bill()
bill_details = textarea.get('1.0',
END) f1= open("bills/" +
str(bill_no()) + ".txt", "w")
f1.write(bill_details
) f1.close()
else:
retur
n
defadditem():
if C1f.get() == 1: item_price =
int(p1.cget("text").replace("₹ ",
"")) quantity = int(sp.get())
total_price = item_price *
quantity l.append(total_price)
if C2f.get() == 1:
item_price =
int(p2.cget("text").replace("₹ ",
"")) quantity = int(sp1.get())
total_price = item_price *
quantity l.append(total_price)
if C3f.get() == 1:
item_price =
int(p3.cget("text").replace("₹ ",
"")) quantity = int(sp2.get())
total_price = item_price *
quantity l.append(total_price)
if C4f.get() == 1:
item_price =
int(p4.cget("text").replace("₹ ",
"")) quantity = int(sp3.get())
total_price = item_price *
quantity l.append(total_price)
if C7f.get() == 1: item_price =
int(p7.cget("text").replace("₹ ",
"")) quantity = int(sp6.get())
total_price = item_price *
quantity l.append(total_price)
if C8f.get() == 1:
item_price =
int(p8.cget("text").replace("₹ ",
"")) quantity = int(sp7.get())
total_price = item_price *
quantity l.append(total_price)
if C9f.get() == 1:
item_price =
int(p9.cget("text").replace("₹ ",
"")) quantity = int(sp8.get())
total_price = item_price *
quantity l.append(total_price)
if C10f.get() == 1: item_price =
int(p10.cget("text").replace("₹ ",
"")) quantity = int(sp9.get())
total_price = item_price *
quantity l.append(total_price)
if C11f.get() == 1:
item_price =
int(p11.cget("text").replace("₹ ",
"")) quantity = int(sp10.get())
total_price = item_price *
quantity l.append(total_price)
if C12f.get() == 1: item_price =
int(p12.cget("text").replace("₹ ",
"")) quantity = int(sp11.get())
total_price = item_price *
quantity l.append(total_price)
if C13f.get() == 1:
item_price =
int(p13.cget("text").replace("₹ ",
"")) quantity = int(sp12.get())
total_price = item_price *
quantity l.append(total_price)
if C14f.get() == 1:
item_price =
int(p14.cget("text").replace("₹ ",
"")) quantity = int(sp13.get())
total_price = item_price *
quantity l.append(total_price)
if C15f.get() == 1:
item_price =
int(p15.cget("text").replace("₹ ",
"")) quantity = int(sp14.get())
total_price = item_price *
quantity l.append(total_price)
if C16f.get() == 1: item_price =
int(p16.cget("text").replace("₹ ",
"")) quantity = int(sp15.get())
total_price = item_price *
quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C16.cget('text')}\t\t{quantity}\t\
t{total_price}\n")
if C17f.get() == 1: item_price =
int(p17.cget("text").replace("₹ ",
"")) quantity = int(sp16.get())
total_price = item_price *
quantity l.append(total_price)
if C18f.get() == 1: item_price =
int(p18.cget("text").replace("₹ ",
"")) quantity = int(sp17.get())
total_price = item_price *
quantity l.append(total_price)
if C19f.get() == 1: item_price =
int(p19.cget("text").replace("₹ ",
"")) quantity = int(sp18.get())
total_price = item_price *
quantity l.append(total_price)
if C20f.get() == 1: item_price =
int(p20.cget("text").replace("₹ ",
"")) quantity = int(sp19.get())
total_price = item_price *
quantity l.append(total_price)
if C1f.get() == 0 and C2f.get() == 0 and C3f.get() == 0 and C4f.get() == 0 and C5f.get() == 0 and C6f.get() == 0 and C7f.get() == 0 and
C8f.get() == 0 and C9f.get() == 0 and C10f.get() == 0 and C11f.get() == 0 and C12f.get() == 0 and C13f.get() == 0 and C14f.get() == 0
and C15f.get() == 0 and C16f.get() == 0 and C17f.get() == 0 and C18f.get() == 0 and C19f.get() == 0 and C20f.get() == 0:
messagebox.showerror('Error', 'Please select an item')
def clear():
c_name.set('')
c_phone.
set('')
welcome()
def exit():
exit_bill = messagebox.askyesno("Exit", "Do you
really want to exit?") if exit_bill > 0:
root.destr
oy() # Button
2.Scalability: While the software may work well for small to medium-sized
businesses, it may face scalability issues when handling a large volume of
transactions or expanding to multiple locations.
References
https://www.google.com/
https://en.wikipedia.org/
https://www.campusify.co.in