Python Microproejct 1 by Campusify
Python Microproejct 1 by Campusify
“Billing System”
4. Program Code 11
5 Output 17
def update_clock(self):
now = time.strftime('\tDate: %x \t \t %I:%M:%S %p')
self.label.configure(text=now)
self.after(1000, self.update_clock)
app = App(root)
# product details
F2 = LabelFrame(root, text='Product Details', font=('times new romon', 15, 'bold'), fg='Brown', bg=bg_color)
F2.place(x=20, y=180, width=800, height=600)
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)
C1 = Checkbutton(F2, text="Veggie Pizza ", anchor="w", bg=bg_color, variable=C1f, font=('times new roman', 12))
C1.place(x=50, y=40, width=300)
# p=price
p1 = Label(F2, text="₹ 99", anchor="w", bg=bg_color, font=('times new roman', 12))
p1.place(x=260, y=40)
C2 = Checkbutton(F2, text="Chessse pizza ", anchor="w", bg=bg_color, variable=C2f, font=('times new roman', 12))
C2.place(x=50, y=65, width=300)
# p=price
p2 = Label(F2, text="₹ 89", anchor="w", bg=bg_color, font=('times new roman', 12))
p2.place(x=260, y=65)
C3 = Checkbutton(F2, text="Margherita Pizza ", anchor="w", bg=bg_color, variable=C3f, font=('times new roman', 12))
C3.place(x=50, y=90, width=300)
# p=price
p3 = Label(F2, text="₹ 69", anchor="w", bg=bg_color, font=('times new roman', 12))
p3.place(x=260, y=90)
C4 = Checkbutton(F2, text="Chicken Pizza", anchor="w", bg=bg_color, variable=C4f, font=('times new roman', 12))
C4.place(x=50, y=115, width=300)
# p=price
p4 = Label(F2, text="₹ 109", anchor="w", bg=bg_color, font=('times new roman', 12))
p4.place(x=260, y=115)
C5 = Checkbutton(F2, text="Zinger Burger", anchor="w", bg=bg_color, variable=C5f, font=('times new roman', 12))
C5.place(x=50, y=140, width=300)
# p=price
p5 = Label(F2, text="₹ 99", anchor="w", bg=bg_color, font=('times new roman', 12))
p5.place(x=260, y=140)
C6 = Checkbutton(F2, text="Chicken Burger", anchor="w", bg=bg_color, variable=C6f, font=('times new roman', 12))
C6.place(x=50, y=165, width=300)
# p=price
p6 = Label(F2, text="₹ 89", anchor="w", bg=bg_color, font=('times new roman', 12))
p6.place(x=260, y=165)
C7 = Checkbutton(F2, text="Chicken Chesse Burger", anchor="w", bg=bg_color, variable=C7f, font=('times new roman', 12))
C7.place(x=50, y=190, width=300)
# p=price
p7 = Label(F2, text="₹ 139", anchor="w", bg=bg_color, font=('times new roman', 12))
p7.place(x=260, y=190)
C8 = Checkbutton(F2, text="Grilled Tikka Burger", anchor="w", bg=bg_color, variable=C8f, font=('times new roman', 12))
C8.place(x=50, y=215, width=300)
# p=price
p8 = Label(F2, text="₹ 119", anchor="w", bg=bg_color, font=('times new roman', 12))
p8.place(x=260, y=215)
C9 = Checkbutton(F2, text="Chicken Shawarma ", anchor="w", bg=bg_color, variable=C9f, font=('times new roman', 12))
C9.place(x=50, y=240, width=300)
# p=price
p9 = Label(F2, text="₹ 80", anchor="w", bg=bg_color, font=('times new roman', 12))
p9.place(x=260, y=240)
C11 = Checkbutton(F2, text="Vegetable Shawarma ", anchor="w", bg=bg_color, variable=C11f, font=('times new roman', 12))
C11.place(x=50, y=290, width=300)
# p=price
p11 = Label(F2, text="₹ 60", anchor="w", bg=bg_color, font=('times new roman', 12))
p11.place(x=260, y=290)
C12 = Checkbutton(F2, text="Maggi", anchor="w", bg=bg_color, variable=C12f, font=('times new roman', 12))
C12.place(x=50, y=315, width=300)
# p=price
p12 = Label(F2, text="₹ 30", anchor="w", bg=bg_color, font=('times new roman', 12))
p12.place(x=260, y=315)
C13 = Checkbutton(F2, text="Chesse Maggi", anchor="w", bg=bg_color, variable=C13f, font=('times new roman', 12))
C13.place(x=50, y=340, width=300)
# p=price
p13 = Label(F2, text="₹ 60", anchor="w", bg=bg_color, font=('times new roman', 12))
p13.place(x=260, y=340)
C14 = Checkbutton(F2, text="Cold Coffee Latte", anchor="w", bg=bg_color, variable=C14f, font=('times new roman', 12))
C14.place(x=50, y=365, width=300)
# p=price
p14 = Label(F2, text="₹ 60", anchor="w", bg=bg_color, font=('times new roman', 12))
p14.place(x=260, y=365)
C15 = Checkbutton(F2, text="Vanilla Cappuccino", anchor="w", bg=bg_color, variable=C15f, font=('times new roman', 12))
C15.place(x=50, y=390, width=300)
# p=price
p15 = Label(F2, text="₹ 100", anchor="w", bg=bg_color, font=('times new roman', 12))
p15.place(x=260, y=390)
C16 = Checkbutton(F2, text="Black Coffee", anchor="w", bg=bg_color, variable=C16f, font=('times new roman', 12))
C16.place(x=50, y=415, width=300)
# p=price
p16 = Label(F2, text="₹ 20", anchor="w", bg=bg_color, font=('times new roman', 12))
p16.place(x=260, y=415)
C17 = Checkbutton(F2, text="Tea", anchor="w", bg=bg_color, variable=C17f, font=('times new roman', 12))
C17.place(x=50, y=440, width=300)
# p=price
p17 = Label(F2, text="₹ 15", anchor="w", bg=bg_color, font=('times new roman', 12))
p17.place(x=260, y=440)
C18 = Checkbutton(F2, text="Vanila Ice-cream ", anchor="w", bg=bg_color, variable=C18f, font=('times new roman', 12))
C18.place(x=50, y=465, width=300)
# p=price
p18 = Label(F2, text="₹ 30", anchor="w", bg=bg_color, font=('times new roman', 12))
p18.place(x=260, y=465)
C19 = Checkbutton(F2, text="Butterscoch Ice-cream", anchor="w", bg=bg_color, variable=C19f,
font=('times new roman', 12))
C19.place(x=50, y=490, width=300)
# p=price
p19 = Label(F2, text="₹ 40", anchor="w", bg=bg_color, font=('times new roman', 12))
p19.place(x=260, y=490)
C20 = Checkbutton(F2, text="Strwaberry Ice-cream", anchor="w", bg=bg_color, variable=C20f, font=('times new roman', 12))
C20.place(x=50, y=515, width=300)
# p=price
p20 = Label(F2, text="₹ 50", anchor="w", bg=bg_color, font=('times new roman', 12))
p20.place(x=260, y=515)
sp = Spinbox(F2, from_=1, to=50)
sp.place(x=400, y=40)
sp1 = Spinbox(F2, from_=1, to=50)
sp1.place(x=400, y=65)
sp2 = Spinbox(F2, from_=1, to=50)
sp2.place(x=400, y=90)
sp3 = Spinbox(F2, from_=1, to=50)
sp3.place(x=400, y=115)
sp4 = Spinbox(F2, from_=1, to=50)
sp4.place(x=400, y=140)
sp5 = Spinbox(F2, from_=1, to=50)
sp5.place(x=400, y=165)
sp6 = Spinbox(F2, from_=1, to=50)
sp6.place(x=400, y=190)
sp7 = Spinbox(F2, from_=1, to=50)
sp7.place(x=400, y=215)
sp8 = Spinbox(F2, from_=1, to=50)
sp8.place(x=400, y=240)
sp9 = Spinbox(F2, from_=1, to=50)
sp9.place(x=400, y=265)
sp10 = Spinbox(F2, from_=1, to=50)
sp10.place(x=400, y=290)
sp11 = Spinbox(F2, from_=1, to=50)
sp11.place(x=400, y=315)
sp12 = Spinbox(F2, from_=1, to=50)
sp12.place(x=400, y=340)
sp13 = Spinbox(F2, from_=1, to=50)
sp13.place(x=400, y=365)
sp14 = Spinbox(F2, from_=1, to=50)
sp14.place(x=400, y=390)
sp15 = Spinbox(F2, from_=1, to=50)
sp15.place(x=400, y=415)
sp16 = Spinbox(F2, from_=1, to=50)
sp16.place(x=400, y=440)
sp17 = Spinbox(F2, from_=1, to=50)
sp17.place(x=400, y=465)
sp18 = Spinbox(F2, from_=1, to=50)
sp18.place(x=400, y=490)
sp19 = Spinbox(F2, from_=1, to=50)
sp19.place(x=400, y=515)
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()
welcome() # this function call for bill area
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
if c_name.get() == "" or c_phone.get() == "":
messagebox.showerror("Error", "Customer detail are must")
else:
textAreaText = textarea.get(10.0, (10.0 + float(len(l))))
# textAreaText1 = textarea.get(10.0, (10.0 + float(len(a))))
welcome()
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()
def save_bill():
op = messagebox.askyesno("Save bill", "Do you want t o save the Bill?")
if op > 0:
bill_details = textarea.get('1.0', END)
f1 = open("bills/" + str(bill_no()) + ".txt", "w")
f1.write(bill_details)
f1.close()
messagebox.showinfo("Saved", f"Bill no, :{bill_no()} Saved Successfully")
else:
return
def additem():
if C1f.get() == 1:
item_price = int(p1.cget("text").replace("₹ ", ""))
quantity = int(sp.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C1.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C2f.get() == 1:
item_price = int(p2.cget("text").replace("₹ ", ""))
quantity = int(sp1.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C2.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C3f.get() == 1:
item_price = int(p3.cget("text").replace("₹ ", ""))
quantity = int(sp2.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C3.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C4f.get() == 1:
item_price = int(p4.cget("text").replace("₹ ", ""))
quantity = int(sp3.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C4.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C5f.get() == 1:
item_price = int(p5.cget("text").replace("₹ ", ""))
quantity = int(sp4.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C5.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C6f.get() == 1:
item_price = int(p6.cget("text").replace("₹ ", ""))
quantity = int(sp5.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C6.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C7f.get() == 1:
item_price = int(p7.cget("text").replace("₹ ", ""))
quantity = int(sp6.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C7.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C8f.get() == 1:
item_price = int(p8.cget("text").replace("₹ ", ""))
quantity = int(sp7.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C8.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C9f.get() == 1:
item_price = int(p9.cget("text").replace("₹ ", ""))
quantity = int(sp8.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C9.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C10f.get() == 1:
item_price = int(p10.cget("text").replace("₹ ", ""))
quantity = int(sp9.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C10.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C11f.get() == 1:
item_price = int(p11.cget("text").replace("₹ ", ""))
quantity = int(sp10.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C11.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C12f.get() == 1:
item_price = int(p12.cget("text").replace("₹ ", ""))
quantity = int(sp11.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C12.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C13f.get() == 1:
item_price = int(p13.cget("text").replace("₹ ", ""))
quantity = int(sp12.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C13.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C14f.get() == 1:
item_price = int(p14.cget("text").replace("₹ ", ""))
quantity = int(sp13.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C14.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C15f.get() == 1:
item_price = int(p15.cget("text").replace("₹ ", ""))
quantity = int(sp14.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C15.cget('text')}\t\t{quantity}\t\t{total_price}\n")
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)
textarea.insert((10.0 + float(len(l) - 1)), f"{C17.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C18f.get() == 1:
item_price = int(p18.cget("text").replace("₹ ", ""))
quantity = int(sp17.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C18.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C19f.get() == 1:
item_price = int(p19.cget("text").replace("₹ ", ""))
quantity = int(sp18.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C19.cget('text')}\t\t{quantity}\t\t{total_price}\n")
if C20f.get() == 1:
item_price = int(p20.cget("text").replace("₹ ", ""))
quantity = int(sp19.get())
total_price = item_price * quantity
l.append(total_price)
textarea.insert((10.0 + float(len(l) - 1)), f"{C20.cget('text')}\t\t{quantity}\t\t{total_price}\n")
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.destroy()
# Button
exit_btn = Button(F2, text="Exit", font=('times new roman', 15, 'bold'), command=exit, background="yellow")
exit_btn.place(x=600, y=400, width=160, height=60)
clear_btn = Button(F2, text="Clear", font=('times new roman', 15, 'bold',), command=clear, background="yellow")
clear_btn.place(x=600, y=300, width=160, height=60)
add_btn = Button(F2, text="Add Item", font=('times new roman', 15, 'bold'), command=additem, background="yellow")
add_btn.place(x=600, y=200, width=160, height=60)
genrate_btn = Button(F2, text="Generate Bill", font=('times new roman', 15, 'bold'), command=gbill, background="yellow")
genrate_btn.place(x=600, y=100, width=160, height=60)
root.mainloop()
Output
Advantages Of Billing System
1. Automation and Efficiency: The software automates various aspects of the
billing process, such as calculating totals, generating bills, and storing customer
information. This saves time and effort, leading to increased efficiency.
Disadvantages Of BillingSystem
1. Limited Features: The provided software lacks advanced features such as
inventory management, reporting tools, or integration with external systems,
which may be necessary for some businesses.
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.
3. Security Concerns: Depending on how the software handles sensitive customer
data, there may be potential security risks such as data breaches or
unauthorized access.
4. Dependency on Technology: Any technical issues or system failures could
disrupt the billing process, leading to delays or downtime.
Conclusion
In conclusion, the provided billing software offers a convenient
and efficient solution for businesses to automate their billing
processes, manage customer details, and generate accurate
transaction records. Its key features include automation,
accuracy, customization, customer management, record-
keeping, user-friendly interface, and flexibility.
References
https://www.google.com/
https://en.wikipedia.org/
https://www.campusify.co.in