Note - Double Click to Copy Code Contact Us!

Billing System using Python

Tech Doubility
Billing System using Python

HTML
  1. from tkinter import*
  2. import random
  3. import os
  4. from tkinter import messagebox
  5.  
  6. # ============main============================
  7. class Bill_App:
  8. def __init__(self, root):
  9. self.root = root
  10. self.root.geometry("1350x700+0+0")
  11. self.root.title("Billing Software")
  12. bg_color = "#badc57"
  13. title = Label(self.root, text="Billing Software", font=('times new roman', 30, 'bold'), pady=2, bd=12, bg="#badc57", fg="Black", relief=GROOVE)
  14. title.pack(fill=X)
  15. # ================variables=======================
  16. self.sanitizer = IntVar()
  17. self.mask = IntVar()
  18. self.hand_gloves = IntVar()
  19. self.dettol = IntVar()
  20. self.newsprin = IntVar()
  21. self.thermal_gun = IntVar()
  22. # ============grocery==============================
  23. self.rice = IntVar()
  24. self.food_oil = IntVar()
  25. self.wheat = IntVar()
  26. self.daal = IntVar()
  27. self.flour = IntVar()
  28. self.maggi = IntVar()
  29. #=============coldDtinks=============================
  30. self.sprite = IntVar()
  31. self.limka = IntVar()
  32. self.mazza = IntVar()
  33. self.coke = IntVar()
  34. self.fanta = IntVar()
  35. self.mountain_duo = IntVar()
  36. # ==============Total product price================
  37. self.medical_price = StringVar()
  38. self.grocery_price = StringVar()
  39. self.cold_drinks_price = StringVar()
  40. # ==============Customer==========================
  41. self.c_name = StringVar()
  42. self.c_phone = StringVar()
  43. self.bill_no = StringVar()
  44. x = random.randint(1000, 9999)
  45. self.bill_no.set(str(x))
  46. self.search_bill = StringVar()
  47. # ===============Tax================================
  48. self.medical_tax = StringVar()
  49. self.grocery_tax = StringVar()
  50. self.cold_drinks_tax = StringVar()
  51. # =============customer retail details======================
  52. F1 = LabelFrame(self.root, text="Customer Details", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
  53. F1.place(x=0, y=80, relwidth=1)
  54. cname_lbl = Label(F1, text="Customer Name:", bg=bg_color, font=('times new roman', 15, 'bold'))
  55. cname_lbl.grid(row=0, column=0, padx=20, pady=5)
  56. cname_txt = Entry(F1, width=15, textvariable=self.c_name, font='arial 15', bd=7, relief=GROOVE)
  57. cname_txt.grid(row=0, column=1, pady=5, padx=10)
  58.  
  59. cphn_lbl = Label(F1, text="Customer Phone:", bg="#badc57", font=('times new roman', 15, 'bold'))
  60. cphn_lbl.grid(row=0, column=2, padx=20, pady=5)
  61. cphn_txt = Entry(F1, width=15, textvariable=self.c_phone, font='arial 15', bd=7, relief=GROOVE)
  62. cphn_txt.grid(row=0, column=3, pady=5, padx=10)
  63.  
  64. c_bill_lbl = Label(F1, text="Bill Number:", bg="#badc57", font=('times new roman', 15, 'bold'))
  65. c_bill_lbl.grid(row=0, column=4, padx=20, pady=5)
  66. c_bill_txt = Entry(F1, width=15, textvariable=self.search_bill, font='arial 15', bd=7, relief=GROOVE)
  67. c_bill_txt.grid(row=0, column=5, pady=5, padx=10)
  68.  
  69. bil_btn = Button(F1, text="Search", command=self.find_bill, width=10, bd=7, font=('arial', 12, 'bold'), relief=GROOVE)
  70. bil_btn.grid(row=0, column=6, pady=5, padx=10)
  71.  
  72. # ===================Medical====================================
  73. F2 = LabelFrame(self.root, text="Medical Purpose", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
  74. F2.place(x=5, y=180, width=325, height=380)
  75.  
  76. sanitizer_lbl = Label(F2, text="Sanitizer", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  77. sanitizer_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
  78. sanitizer_txt = Entry(F2, width=10, textvariable=self.sanitizer, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  79. sanitizer_txt.grid(row=0, column=1, padx=10, pady=10)
  80.  
  81. mask_lbl = Label(F2, text="Mask", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  82. mask_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
  83. mask_txt = Entry(F2, width=10, textvariable=self.mask, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  84. mask_txt.grid(row=1, column=1, padx=10, pady=10)
  85.  
  86. hand_gloves_lbl = Label(F2, text="Hand Gloves", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  87. hand_gloves_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
  88. hand_gloves_txt = Entry(F2, width=10, textvariable=self.hand_gloves, font=('times new roman', 16, 'bold'), bd=5, relief =GROOVE)
  89. hand_gloves_txt.grid(row=2, column=1, padx=10, pady=10)
  90.  
  91. dettol_lbl = Label(F2, text="Dettol", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  92. dettol_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
  93. dettol_txt = Entry(F2, width=10, textvariable=self.dettol, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  94. dettol_txt.grid(row=3, column=1, padx=10, pady=10)
  95.  
  96. newsprin_lbl = Label(F2, text="Newsprin", font =('times new roman', 16, 'bold'), bg = "#badc57", fg = "black")
  97. newsprin_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
  98. newsprin_txt = Entry(F2, width=10, textvariable=self.newsprin, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  99. newsprin_txt.grid(row=4, column=1, padx=10, pady=10)
  100.  
  101. thermal_gun_lbl = Label(F2, text="Thermal Gun", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  102. thermal_gun_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
  103. thermal_gun_txt = Entry(F2, width=10, textvariable=self.thermal_gun, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  104. thermal_gun_txt.grid(row=5, column=1, padx=10, pady=10)
  105.  
  106. # ==========GroceryItems=========================
  107. F3 = LabelFrame(self.root, text="Grocery Items", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
  108. F3.place(x=340, y=180, width=325, height=380)
  109.  
  110. rice_lbl = Label(F3, text="Rice", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  111. rice_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
  112. rice_txt = Entry(F3, width=10, textvariable=self.rice, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  113. rice_txt.grid(row=0, column=1, padx=10, pady=10)
  114.  
  115. food_oil_lbl = Label(F3, text="Food Oil", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  116. food_oil_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
  117. food_oil_txt = Entry(F3, width=10, textvariable=self.food_oil, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  118. food_oil_txt.grid(row=1, column=1, padx=10, pady=10)
  119.  
  120. wheat_lbl = Label(F3, text="Wheat", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  121. wheat_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
  122. wheat_txt = Entry(F3, width=10, textvariable=self.wheat, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  123. wheat_txt.grid(row=2, column=1, padx=10, pady=10)
  124.  
  125. daal_lbl = Label(F3, text="Daal", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  126. daal_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
  127. daal_txt = Entry(F3, width=10, textvariable=self.daal, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  128. daal_txt.grid(row=3, column=1, padx=10, pady=10)
  129.  
  130. flour_lbl = Label(F3, text="Flour", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  131. flour_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
  132. flour_txt = Entry(F3, width=10, textvariable=self.flour, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  133. flour_txt.grid(row=4, column=1, padx=10, pady=10)
  134.  
  135. maggi_lbl = Label(F3, text="Maggi", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  136. maggi_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
  137. maggi_txt = Entry(F3, width=10, textvariable=self.maggi, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  138. maggi_txt.grid(row=5, column=1, padx=10, pady=10)
  139.  
  140. # ===========ColdDrinks================================
  141. F4 = LabelFrame(self.root, text="Cold Drinks", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57")
  142. F4.place(x=670, y=180, width=325, height=380)
  143.  
  144. sprite_lbl = Label(F4, text="Sprite", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  145. sprite_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W')
  146. sprite_txt = Entry(F4, width=10, textvariable=self.sprite, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  147. sprite_txt.grid(row=0, column=1, padx=10, pady=10)
  148.  
  149. limka_lbl = Label(F4, text="Limka", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  150. limka_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W')
  151. limka_txt = Entry(F4, width=10, textvariable=self.limka, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  152. limka_txt.grid(row=1, column=1, padx=10, pady=10)
  153.  
  154. mazza_lbl = Label(F4, text="Mazza", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  155. mazza_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W')
  156. wheat_txt = Entry(F4, width=10, textvariable=self.mazza, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  157. wheat_txt.grid(row=2, column=1, padx=10, pady=10)
  158.  
  159. coke_lbl = Label(F4, text="Coke", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  160. coke_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W')
  161. coke_txt = Entry(F4, width=10, textvariable=self.coke, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  162. coke_txt.grid(row=3, column=1, padx=10, pady=10)
  163.  
  164. fanta_lbl = Label(F4, text="Fanta", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  165. fanta_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W')
  166. fanta_txt = Entry(F4, width=10, textvariable=self.fanta, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  167. fanta_txt.grid(row=4, column=1, padx=10, pady=10)
  168.  
  169. mountain_duo_lbl = Label(F4, text="Mountain Duo", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black")
  170. mountain_duo_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W')
  171. mountain_duo_txt = Entry(F4, width=10, textvariable=self.mountain_duo, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE)
  172. mountain_duo_txt.grid(row=5, column=1, padx=10, pady=10)
  173.  
  174. # =================BillArea======================
  175. F5 = Frame(self.root, bd=10, relief=GROOVE)
  176. F5.place(x=1010, y=180, width=350, height=380)
  177.  
  178. bill_title = Label(F5, text="Bill Area", font='arial 15 bold', bd=7, relief=GROOVE)
  179. bill_title.pack(fill=X)
  180. scroll_y = Scrollbar(F5, orient=VERTICAL)
  181. self.txtarea = Text(F5, yscrollcommand=scroll_y.set)
  182. scroll_y.pack(side=RIGHT, fill=Y)
  183. scroll_y.config(command=self.txtarea.yview)
  184. self.txtarea.pack(fill=BOTH, expand=1)
  185.  
  186. # =======================ButtonFrame=============
  187. F6 = LabelFrame(self.root, text="Bill Area", font=('times new roman', 14, 'bold'), bd=10, fg="Black", bg="#badc57")
  188. F6.place(x=0, y=560, relwidth=1, height=140)
  189.  
  190. m1_lbl = Label(F6, text="Total Medical Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  191. m1_lbl.grid(row=0, column=0, padx=20, pady=1, sticky='W')
  192. m1_txt = Entry(F6, width=18, textvariable=self.medical_price, font='arial 10 bold', bd=7, relief=GROOVE)
  193. m1_txt.grid(row=0, column=1, padx=18, pady=1)
  194.  
  195. m2_lbl = Label(F6, text="Total Grocery Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  196. m2_lbl.grid(row=1, column=0, padx=20, pady=1, sticky='W')
  197. m2_txt = Entry(F6, width=18, textvariable=self.grocery_price, font='arial 10 bold', bd=7, relief=GROOVE)
  198. m2_txt.grid(row=1, column=1, padx=18, pady=1)
  199.  
  200. m3_lbl = Label(F6, text="Total Cold Drinks Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  201. m3_lbl.grid(row=2, column=0, padx=20, pady=1, sticky='W')
  202. m3_txt = Entry(F6, width=18, textvariable=self.cold_drinks_price, font='arial 10 bold', bd=7, relief=GROOVE)
  203. m3_txt.grid(row=2, column=1, padx=18, pady=1)
  204.  
  205. m4_lbl = Label(F6, text="Medical Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  206. m4_lbl.grid(row=0, column=2, padx=20, pady=1, sticky='W')
  207. m4_txt = Entry(F6, width=18, textvariable=self.medical_tax, font='arial 10 bold', bd=7, relief=GROOVE)
  208. m4_txt.grid(row=0, column=3, padx=18, pady=1)
  209.  
  210. m5_lbl = Label(F6, text="Grocery Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  211. m5_lbl.grid(row=1, column=2, padx=20, pady=1, sticky='W')
  212. m5_txt = Entry(F6, width=18, textvariable=self.grocery_tax, font='arial 10 bold', bd=7, relief=GROOVE)
  213. m5_txt.grid(row=1, column=3, padx=18, pady=1)
  214.  
  215. m6_lbl = Label(F6, text="Cold Drinks Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black")
  216. m6_lbl.grid(row=2, column=2, padx=20, pady=1, sticky='W')
  217. m6_txt = Entry(F6, width=18, textvariable=self.cold_drinks_tax, font='arial 10 bold', bd=7, relief=GROOVE)
  218. m6_txt.grid(row=2, column=3, padx=18, pady=1)
  219.  
  220. # =======Buttons-======================================
  221. btn_f = Frame(F6, bd=7, relief=GROOVE)
  222. btn_f.place(x=760, width=580, height=105)
  223.  
  224. total_btn = Button(btn_f, command=self.total, text="Total", bg="#535C68", bd=2, fg="white", pady=15, width=12, font='arial 13 bold')
  225. total_btn.grid(row=0, column=0, padx=5, pady=5)
  226.  
  227. generateBill_btn = Button(btn_f, command=self.bill_area, text="Generate Bill", bd=2, bg="#535C68", fg="white", pady=12, width=12, font='arial 13 bold')
  228. generateBill_btn.grid(row=0, column=1, padx=5, pady=5)
  229.  
  230. clear_btn = Button(btn_f, command=self.clear_data, text="Clear", bg="#535C68", bd=2, fg="white", pady=15, width=12, font='arial 13 bold')
  231. clear_btn.grid(row=0, column=2, padx=5, pady=5)
  232.  
  233. exit_btn = Button(btn_f, command=self.exit_app, text="Exit", bd=2, bg="#535C68", fg="white", pady=15, width=12, font='arial 13 bold')
  234. exit_btn.grid(row=0, column=3, padx=5, pady=5)
  235. self.welcome_bill()
  236.  
  237. #================totalBill==========================
  238. def total(self):
  239. self.m_h_g_p = self.hand_gloves.get()*12
  240. self.m_s_p = self.sanitizer.get()*2
  241. self.m_m_p = self.mask.get()*5
  242. self.m_d_p = self.dettol.get()*30
  243. self.m_n_p = self.newsprin.get()*5
  244. self.m_t_g_p = self.thermal_gun.get()*15
  245. self.total_medical_price = float(self.m_m_p+self.m_h_g_p+self.m_d_p+self.m_n_p+self.m_t_g_p+self.m_s_p)
  246.  
  247. self.medical_price.set("Rs. "+str(self.total_medical_price))
  248. self.c_tax = round((self.total_medical_price*0.05), 2)
  249. self.medical_tax.set("Rs. "+str(self.c_tax))
  250.  
  251. self.g_r_p = self.rice.get()*10
  252. self.g_f_o_p = self.food_oil.get()*10
  253. self.g_w_p = self.wheat.get()*10
  254. self.g_d_p = self.daal.get()*6
  255. self.g_f_p = self.flour.get()*8
  256. self.g_m_p = self.maggi.get()*5
  257. self.total_grocery_price = float(self.g_r_p+self.g_f_o_p+self.g_w_p+self.g_d_p+self.g_f_p+self.g_m_p)
  258.  
  259. self.grocery_price.set("Rs. " + str(self.total_grocery_price))
  260. self.g_tax = round((self.total_grocery_price*5), 2)
  261. self.grocery_tax.set("Rs. " + str(self.g_tax))
  262.  
  263. self.c_d_s_p = self.sprite.get()*10
  264. self.c_d_l_p = self.limka.get()*10
  265. self.c_d_m_p = self.mazza.get()*10
  266. self.c_d_c_p = self.coke.get()*10
  267. self.c_d_f_p = self.fanta.get()*10
  268. self.c_m_d = self.mountain_duo.get()*10
  269. self.total_cold_drinks_price = float(self.c_d_s_p+self.c_d_l_p+self.c_d_m_p+self.c_d_c_p+self.c_d_f_p+self.c_m_d)
  270.  
  271. self.cold_drinks_price.set("Rs. "+str(self.total_cold_drinks_price))
  272. self.c_d_tax = round((self.total_cold_drinks_price * 0.1), 2)
  273. self.cold_drinks_tax.set("Rs. "+str(self.c_d_tax))
  274.  
  275. self.total_bill = float(self.total_medical_price+self.total_grocery_price+self.total_cold_drinks_price+self.c_tax+self.g_tax+self.c_d_tax)
  276.  
  277. #==============welcome-bill==============================
  278. def welcome_bill(self):
  279. self.txtarea.delete('1.0', END)
  280. self.txtarea.insert(END, "\tWelcome Webcode Retail")
  281. self.txtarea.insert(END, f"\n Bill Number:{self.bill_no.get()}")
  282. self.txtarea.insert(END, f"\nCustomer Name:{self.c_name.get()}")
  283. self.txtarea.insert(END, f"\nPhone Number{self.c_phone.get()}")
  284. self.txtarea.insert(END, f"\n================================")
  285. self.txtarea.insert(END, f"\nProducts\t\tQTY\t\tPrice")
  286.  
  287. #=========billArea=================================================
  288. def bill_area(self):
  289. if self.c_name.get() == " " or self.c_phone.get() == " ":
  290. messagebox.showerror("Error", "Customer Details Are Must")
  291. elif self.medical_price.get() == "Rs. 0.0" and self.grocery_price.get() == "Rs. 0.0" and self.cold_drinks_price.get()=="Rs. 0.0":
  292. messagebox.showerror("Error", "No Product Purchased")
  293. else:
  294. self.welcome_bill()
  295. # ============medical===========================
  296. if self.sanitizer.get() != 0:
  297. self.txtarea.insert(END, f"\n Sanitizer\t\t{self.sanitizer.get()}\t\t{self.m_s_p}")
  298. if self.mask.get() != 0:
  299. self.txtarea.insert(END, f"\n Sanitizer\t\t{self.mask.get()}\t\t{self.m_m_p}")
  300. if self.hand_gloves.get() != 0:
  301. self.txtarea.insert(END, f"\n Hand Gloves\t\t{self.hand_gloves.get()}\t\t{self.m_h_g_p}")
  302. if self.dettol.get() != 0:
  303. self.txtarea.insert(END, f"\n Dettol\t\t{self.dettol.get()}\t\t{self.m_d_p}")
  304. if self.newsprin.get() != 0:
  305. self.txtarea.insert(END, f"\n Newsprin\t\t{self.newsprin.get()}\t\t{self.m_n_p}")
  306. if self.thermal_gun.get() != 0:
  307. self.txtarea.insert(END , f"\n Thermal Gun\t\t{self.sanitizer.get()}\t\t{self.m_t_g_p}")
  308. # ==============Grocery============================
  309. if self.rice.get() != 0:
  310. self.txtarea.insert(END, f"\n Rice\t\t{self.rice.get()}\t\t{self.g_r_p}")
  311. if self.food_oil.get() != 0:
  312. self.txtarea.insert(END, f"\n Food Oil\t\t{self.food_oil.get()}\t\t{self.g_f_o_p}")
  313. if self.wheat.get() != 0:
  314. self.txtarea.insert(END, f"\n Wheat\t\t{self.wheat.get()}\t\t{self.g_w_p}")
  315. if self.daal.get() != 0:
  316. self.txtarea.insert(END, f"\n Daal\t\t{self.daal.get()}\t\t{self.g_d_p}")
  317. if self.flour.get() != 0:
  318. self.txtarea.insert(END, f"\n Flour\t\t{self.flour.get()}\t\t{self.g_f_p}")
  319. if self.maggi.get() != 0:
  320. self.txtarea.insert(END, f"\n Maggi\t\t{self.maggi.get()}\t\t{self.g_m_p}")
  321. #================ColdDrinks==========================
  322. if self.sprite.get() != 0:
  323. self.txtarea.insert(END, f"\n Sprite\t\t{self.sprite.get()}\t\t{self.c_d_s_p}")
  324. if self.limka.get() != 0:
  325. self.txtarea.insert(END, f"\n Sanitizer\t\t{self.limka.get()}\t\t{self.c_d_l_p}")
  326. if self.mazza.get() != 0:
  327. self.txtarea.insert(END, f"\n Mazza\t\t{self.mazza.get()}\t\t{self.c_d_m_p}")
  328. if self.coke.get() != 0:
  329. self.txtarea.insert(END, f"\n Dettol\t\t{self.coke.get()}\t\t{self.c_d_c_p}")
  330. if self.fanta.get() != 0:
  331. self.txtarea.insert(END, f"\n Fanta\t\t{self.newsprin.get()}\t\t{self.c_d_f_p}")
  332. if self.mountain_duo.get() != 0:
  333. self.txtarea.insert(END, f"\n Mountain Duo\t\t{self.sanitizer.get()}\t\t{self.c_m_d}")
  334. self.txtarea.insert(END, f"\n--------------------------------")
  335. # ===============taxes==============================
  336. if self.medical_tax.get() != '0.0':
  337. self.txtarea.insert(END, f"\n Medical Tax\t\t\t{self.medical_tax.get()}")
  338. if self.grocery_tax.get() != '0.0':
  339. self.txtarea.insert(END, f"\n Grocery Tax\t\t\t{self.grocery_tax.get()}")
  340. if self.cold_drinks_tax.get() != '0.0':
  341. self.txtarea.insert(END, f"\n Cold Drinks Tax\t\t\t{self.cold_drinks_tax.get()}")
  342.  
  343. self.txtarea.insert(END, f"\n Total Bil:\t\t\t Rs.{self.total_bill}")
  344. self.txtarea.insert(END, f"\n--------------------------------")
  345. self.save_bill()
  346.  
  347. #=========savebill============================
  348. def save_bill(self):
  349. op = messagebox.askyesno("Save Bill", "Do you want to save the bill?")
  350. if op > 0:
  351. self.bill_data = self.txtarea.get('1.0', END)
  352. f1 = open("bills/"+str(self.bill_no.get())+".txt", "w")
  353. f1.write(self.bill_data)
  354. f1.close()
  355. messagebox.showinfo("Saved", f"Bill no:{self.bill_no.get()} Saved Successfully")
  356. else:
  357. return
  358.  
  359. # ===================find_bill================================
  360. def find_bill(self):
  361. present = "no"
  362. for i in os.listdir("bills/"):
  363. if i.split('.')[0] == self.search_bill.get():
  364. f1 = open(f"bills/{i}", "r")
  365. self.txtarea.delete("1.0", END)
  366. for d in f1:
  367. self.txtarea.insert(END, d)
  368. f1.close()
  369. present = "yes"
  370. if present == "no":
  371. messagebox.showerror("Error", "Invalid Bill No")
  372.  
  373. # ======================clear-bill======================
  374. def clear_data(self):
  375. op = messagebox.askyesno("Clear", "Do you really want to Clear?")
  376. if op > 0:
  377. self.sanitizer.set(0)
  378. self.mask.set(0)
  379. self.hand_gloves.set(0)
  380. self.dettol.set(0)
  381. self.newsprin.set(0)
  382. self.thermal_gun.set(0)
  383. # ============grocery==============================
  384. self.rice.set(0)
  385. self.food_oil.set(0)
  386. self.wheat.set(0)
  387. self.daal.set(0)
  388. self.flour.set(0)
  389. self.maggi.set(0)
  390. # =============coldDrinks=============================
  391. self.sprite.set(0)
  392. self.limka.set(0)
  393. self.mazza.set(0)
  394. self.coke.set(0)
  395. self.fanta.set(0)
  396. self.mountain_duo.set(0)
  397. # ====================taxes================================
  398. self.medical_price.set("")
  399. self.grocery_price.set("")
  400. self.cold_drinks_price.set("")
  401.  
  402. self.medical_tax.set("")
  403. self.grocery_tax.set("")
  404. self.cold_drinks_tax.set("")
  405.  
  406. self.c_name.set("")
  407. self.c_phone.set("")
  408.  
  409. self.bill_no.set("")
  410. x = random.randint(1000, 9999)
  411. self.bill_no.set(str(x))
  412.  
  413. self.search_bill.set("")
  414. self.welcome_bill()
  415.  
  416. # ===========exit=======================
  417. def exit_app(self):
  418. op = messagebox.askyesno("Exit", "Do you really want to exit?")
  419. if op > 0:
  420. self.root.destroy()
  421.  
  422.  
  423. root = Tk()
  424. obj = Bill_App(root)
  425. root.mainloop()
  426.  
  427.  


👉👉

Billing system using Tkinter

This project can be used for any shops. User can store all the data and generate the bill.

Tech stack:

  • Python

Libraries used:

  • Tkinter
  • Os
  • Messagebox

To install external modules:

  • Run pip install tkinter
  • To execute the project:

  • Run billing system.py
  • Post a Comment

    Cookie Consent
    We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
    Oops!
    It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
    AdBlock Detected!
    We have detected that you are using adblocking plugin in your browser.
    The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
    Site is Blocked
    Sorry! This site is not available in your country.