├── 1230.PNG ├── README.md └── Billing_system.py /1230.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohittiwari98/Billing_system/main/1230.PNG -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Billing_system 2 | 3 | ![](https://img.shields.io/badge/Programming_Language-Python-blue.svg) 4 | ![](https://img.shields.io/badge/Tool_Used-Tkinter-orange.svg) 5 | ![](https://img.shields.io/badge/Python_Version-3.7-blue.svg) 6 | ![](https://img.shields.io/badge/Application-Visualization-brown.svg) 7 | ![](https://img.shields.io/badge/Status-Complete-green.svg) 8 | 9 |
10 | DevOpsShack Banner 11 |
12 | 13 | A simple GUI-based Billing Management System built using Python with `tkinter` for the interface, designed to manage customer bills, calculate totals, and generate receipts. 14 | 15 | ## Features 16 | - Add customer details (name, items, quantities, prices). 17 | - Calculate total bill amount with tax (if applicable). 18 | - Generate and display a printable receipt. 19 | - Clear input fields for new entries. 20 | - Exit the application safely. 21 | - User-friendly interface with real-time updates. 22 | 23 | ## Prerequisites 24 | - Python 3.x 25 | - Required Python library: 26 | - `tkinter` (usually included with Python) 27 | 28 | ![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54) 29 | -------------------------------------------------------------------------------- /Billing_system.py: -------------------------------------------------------------------------------- 1 | #using model tinker 2 | from tkinter import* 3 | import random 4 | import os 5 | from tkinter import messagebox 6 | 7 | 8 | #===============main===================== 9 | class Bill_App: 10 | def __init__(self, root): 11 | self.root = root 12 | self.root.geometry("1350x700+0+0") 13 | self.root.title("Billing Software") 14 | bg_color = "#badc57" 15 | title = Label(self.root, text="Billing Software", font=('times new roman', 30, 'bold'), pady=2, bd=12, bg="#badc57", fg="Black", relief=GROOVE) 16 | title.pack(fill=X) 17 | # ================variables======================= 18 | self.sanitizer = IntVar() 19 | self.mask = IntVar() 20 | self.hand_gloves = IntVar() 21 | self.syrup = IntVar() 22 | self.cream = IntVar() 23 | self.thermal_gun = IntVar() 24 | # ============grocery============================== 25 | self.rice = IntVar() 26 | self.food_oil = IntVar() 27 | self.wheat = IntVar() 28 | self.spices = IntVar() 29 | self.flour = IntVar() 30 | self.maggi = IntVar() 31 | #=============coldDrinks============================= 32 | self.sprite = IntVar() 33 | self.mineral = IntVar() 34 | self.juice = IntVar() 35 | self.coke = IntVar() 36 | self.lassi = IntVar() 37 | self.mountain_duo = IntVar() 38 | # ==============Total product price================ 39 | self.medical_price = StringVar() 40 | self.grocery_price = StringVar() 41 | self.cold_drinks_price = StringVar() 42 | # ==============Customer========================== 43 | self.c_name = StringVar() 44 | self.c_phone = StringVar() 45 | self.bill_no = StringVar() 46 | x = random.randint(1000, 9999) 47 | self.bill_no.set(str(x)) 48 | self.search_bill = StringVar() 49 | # ===============Tax================================ 50 | self.medical_tax = StringVar() 51 | self.grocery_tax = StringVar() 52 | self.cold_drinks_tax = StringVar() 53 | # =============customer retail details====================== 54 | F1 = LabelFrame(self.root, text="Customer Details", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57") 55 | F1.place(x=0, y=80, relwidth=1) 56 | 57 | cname_lbl = Label(F1, text="Customer Name:", bg=bg_color, font=('times new roman', 15, 'bold')) 58 | cname_lbl.grid(row=0, column=0, padx=20, pady=5) 59 | cname_txt = Entry(F1, width=15, textvariable=self.c_name, font='arial 15', bd=7, relief=GROOVE) 60 | cname_txt.grid(row=0, column=1, pady=5, padx=10) 61 | 62 | cphn_lbl = Label(F1, text="Customer Phone:", bg="#badc57", font=('times new roman', 15, 'bold')) 63 | cphn_lbl.grid(row=0, column=2, padx=20, pady=5) 64 | cphn_txt = Entry(F1, width=15, textvariable=self.c_phone, font='arial 15', bd=7, relief=GROOVE) 65 | cphn_txt.grid(row=0, column=3, pady=5, padx=10) 66 | 67 | c_bill_lbl = Label(F1, text="Bill Number:", bg="#badc57", font=('times new roman', 15, 'bold')) 68 | c_bill_lbl.grid(row=0, column=4, padx=20, pady=5) 69 | c_bill_txt = Entry(F1, width=15, textvariable=self.search_bill, font='arial 15', bd=7, relief=GROOVE) 70 | c_bill_txt.grid(row=0, column=5, pady=5, padx=10) 71 | 72 | bil_btn = Button(F1, text="Search", command=self.find_bill, width=10, bd=7, font=('arial', 12, 'bold'), relief=GROOVE) 73 | bil_btn.grid(row=0, column=6, pady=5, padx=10) 74 | 75 | # ===================Medical==================================== 76 | F2 = LabelFrame(self.root, text="Medical Purpose", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57") 77 | F2.place(x=5, y=180, width=325, height=380) 78 | 79 | sanitizer_lbl = Label(F2, text="Sanitizer", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 80 | sanitizer_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W') 81 | sanitizer_txt = Entry(F2, width=10, textvariable=self.sanitizer, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 82 | sanitizer_txt.grid(row=0, column=1, padx=10, pady=10) 83 | 84 | mask_lbl = Label(F2, text="Mask", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 85 | mask_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W') 86 | mask_txt = Entry(F2, width=10, textvariable=self.mask, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 87 | mask_txt.grid(row=1, column=1, padx=10, pady=10) 88 | 89 | hand_gloves_lbl = Label(F2, text="Hand Gloves", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 90 | hand_gloves_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W') 91 | hand_gloves_txt = Entry(F2, width=10, textvariable=self.hand_gloves, font=('times new roman', 16, 'bold'), bd=5, relief =GROOVE) 92 | hand_gloves_txt.grid(row=2, column=1, padx=10, pady=10) 93 | 94 | syrup_lbl = Label(F2, text="Syrup", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 95 | syrup_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W') 96 | syrup_txt = Entry(F2, width=10, textvariable=self.syrup, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 97 | syrup_txt.grid(row=3, column=1, padx=10, pady=10) 98 | 99 | cream_lbl = Label(F2, text="Cream", font=('times new roman', 16, 'bold'), bg = "#badc57", fg = "black") 100 | cream_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W') 101 | cream_txt = Entry(F2, width=10, textvariable=self.cream, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 102 | cream_txt.grid(row=4, column=1, padx=10, pady=10) 103 | 104 | thermal_gun_lbl = Label(F2, text="Thermal Gun", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 105 | thermal_gun_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W') 106 | thermal_gun_txt = Entry(F2, width=10, textvariable=self.thermal_gun, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 107 | thermal_gun_txt.grid(row=5, column=1, padx=10, pady=10) 108 | 109 | # ==========GroceryItems========================= 110 | F3 = LabelFrame(self.root, text="Grocery Items", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57") 111 | F3.place(x=340, y=180, width=325, height=380) 112 | 113 | rice_lbl = Label(F3, text="Rice", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 114 | rice_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W') 115 | rice_txt = Entry(F3, width=10, textvariable=self.rice, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 116 | rice_txt.grid(row=0, column=1, padx=10, pady=10) 117 | 118 | food_oil_lbl = Label(F3, text="Food Oil", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 119 | food_oil_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W') 120 | food_oil_txt = Entry(F3, width=10, textvariable=self.food_oil, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 121 | food_oil_txt.grid(row=1, column=1, padx=10, pady=10) 122 | 123 | wheat_lbl = Label(F3, text="Wheat", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 124 | wheat_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W') 125 | wheat_txt = Entry(F3, width=10, textvariable=self.wheat, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 126 | wheat_txt.grid(row=2, column=1, padx=10, pady=10) 127 | 128 | spices_lbl = Label(F3, text="Spices", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 129 | spices_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W') 130 | spices_txt = Entry(F3, width=10, textvariable=self.spices, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 131 | spices_txt.grid(row=3, column=1, padx=10, pady=10) 132 | 133 | flour_lbl = Label(F3, text="Flour", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 134 | flour_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W') 135 | flour_txt = Entry(F3, width=10, textvariable=self.flour, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 136 | flour_txt.grid(row=4, column=1, padx=10, pady=10) 137 | 138 | maggi_lbl = Label(F3, text="Maggi", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 139 | maggi_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W') 140 | maggi_txt = Entry(F3, width=10, textvariable=self.maggi, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 141 | maggi_txt.grid(row=5, column=1, padx=10, pady=10) 142 | 143 | # ===========ColdDrinks================================ 144 | F4 = LabelFrame(self.root, text="Cold Drinks", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#badc57") 145 | F4.place(x=670, y=180, width=325, height=380) 146 | 147 | sprite_lbl = Label(F4, text="Sprite", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 148 | sprite_lbl.grid(row=0, column=0, padx=10, pady=10, sticky='W') 149 | sprite_txt = Entry(F4, width=10, textvariable=self.sprite, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 150 | sprite_txt.grid(row=0, column=1, padx=10, pady=10) 151 | 152 | mineral_lbl = Label(F4, text="Mineral Water", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 153 | mineral_lbl.grid(row=1, column=0, padx=10, pady=10, sticky='W') 154 | mineral_txt = Entry(F4, width=10, textvariable=self.mineral, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 155 | mineral_txt.grid(row=1, column=1, padx=10, pady=10) 156 | 157 | juice_lbl = Label(F4, text="Juice", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 158 | juice_lbl.grid(row=2, column=0, padx=10, pady=10, sticky='W') 159 | juice_txt = Entry(F4, width=10, textvariable=self.juice, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 160 | juice_txt.grid(row=2, column=1, padx=10, pady=10) 161 | 162 | coke_lbl = Label(F4, text="Coke", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 163 | coke_lbl.grid(row=3, column=0, padx=10, pady=10, sticky='W') 164 | coke_txt = Entry(F4, width=10, textvariable=self.coke, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 165 | coke_txt.grid(row=3, column=1, padx=10, pady=10) 166 | 167 | lassi_lbl = Label(F4, text="Lassi", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 168 | lassi_lbl.grid(row=4, column=0, padx=10, pady=10, sticky='W') 169 | lassi_txt = Entry(F4, width=10, textvariable=self.lassi, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 170 | lassi_txt.grid(row=4, column=1, padx=10, pady=10) 171 | 172 | mountain_duo_lbl = Label(F4, text="Mountain Duo", font=('times new roman', 16, 'bold'), bg="#badc57", fg="black") 173 | mountain_duo_lbl.grid(row=5, column=0, padx=10, pady=10, sticky='W') 174 | mountain_duo_txt = Entry(F4, width=10, textvariable=self.mountain_duo, font=('times new roman', 16, 'bold'), bd=5, relief=GROOVE) 175 | mountain_duo_txt.grid(row=5, column=1, padx=10, pady=10) 176 | 177 | # =================BillArea====================== 178 | F5 = Frame(self.root, bd=10, relief=GROOVE) 179 | F5.place(x=1010, y=180, width=350, height=380) 180 | 181 | bill_title = Label(F5, text="Bill Area", font='arial 15 bold', bd=7, relief=GROOVE) 182 | bill_title.pack(fill=X) 183 | scroll_y = Scrollbar(F5, orient=VERTICAL) 184 | self.txtarea = Text(F5, yscrollcommand=scroll_y.set) 185 | scroll_y.pack(side=RIGHT, fill=Y) 186 | scroll_y.config(command=self.txtarea.yview) 187 | self.txtarea.pack(fill=BOTH, expand=1) 188 | 189 | # =======================ButtonFrame============= 190 | F6 = LabelFrame(self.root, text="Bill Area", font=('times new roman', 14, 'bold'), bd=10, fg="Black", bg="#badc57") 191 | F6.place(x=0, y=560, relwidth=1, height=140) 192 | 193 | m1_lbl = Label(F6, text="Total Medical Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 194 | m1_lbl.grid(row=0, column=0, padx=20, pady=1, sticky='W') 195 | m1_txt = Entry(F6, width=18, textvariable=self.medical_price, font='arial 10 bold', bd=7, relief=GROOVE) 196 | m1_txt.grid(row=0, column=1, padx=18, pady=1) 197 | 198 | m2_lbl = Label(F6, text="Total Grocery Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 199 | m2_lbl.grid(row=1, column=0, padx=20, pady=1, sticky='W') 200 | m2_txt = Entry(F6, width=18, textvariable=self.grocery_price, font='arial 10 bold', bd=7, relief=GROOVE) 201 | m2_txt.grid(row=1, column=1, padx=18, pady=1) 202 | 203 | m3_lbl = Label(F6, text="Total Cold Drinks Price", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 204 | m3_lbl.grid(row=2, column=0, padx=20, pady=1, sticky='W') 205 | m3_txt = Entry(F6, width=18, textvariable=self.cold_drinks_price, font='arial 10 bold', bd=7, relief=GROOVE) 206 | m3_txt.grid(row=2, column=1, padx=18, pady=1) 207 | 208 | m4_lbl = Label(F6, text="Medical Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 209 | m4_lbl.grid(row=0, column=2, padx=20, pady=1, sticky='W') 210 | m4_txt = Entry(F6, width=18, textvariable=self.medical_tax, font='arial 10 bold', bd=7, relief=GROOVE) 211 | m4_txt.grid(row=0, column=3, padx=18, pady=1) 212 | 213 | m5_lbl = Label(F6, text="Grocery Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 214 | m5_lbl.grid(row=1, column=2, padx=20, pady=1, sticky='W') 215 | m5_txt = Entry(F6, width=18, textvariable=self.grocery_tax, font='arial 10 bold', bd=7, relief=GROOVE) 216 | m5_txt.grid(row=1, column=3, padx=18, pady=1) 217 | 218 | m6_lbl = Label(F6, text="Cold Drinks Tax", font=('times new roman', 14, 'bold'), bg="#badc57", fg="black") 219 | m6_lbl.grid(row=2, column=2, padx=20, pady=1, sticky='W') 220 | m6_txt = Entry(F6, width=18, textvariable=self.cold_drinks_tax, font='arial 10 bold', bd=7, relief=GROOVE) 221 | m6_txt.grid(row=2, column=3, padx=18, pady=1) 222 | 223 | # =======Buttons-====================================== 224 | btn_f = Frame(F6, bd=7, relief=GROOVE) 225 | btn_f.place(x=760, width=580, height=105) 226 | 227 | total_btn = Button(btn_f, command=self.total, text="Total", bg="#535C68", bd=2, fg="white", pady=15, width=12, font='arial 13 bold') 228 | total_btn.grid(row=0, column=0, padx=5, pady=5) 229 | 230 | 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') 231 | generateBill_btn.grid(row=0, column=1, padx=5, pady=5) 232 | 233 | 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') 234 | clear_btn.grid(row=0, column=2, padx=5, pady=5) 235 | 236 | 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') 237 | exit_btn.grid(row=0, column=3, padx=5, pady=5) 238 | self.welcome_bill() 239 | 240 | 241 | def total(self): 242 | self.m_h_g_p = self.hand_gloves.get()*12 243 | self.m_s_p = self.sanitizer.get()*2 244 | self.m_m_p = self.mask.get()*5 245 | self.m_s_p = self.syrup.get()*30 246 | self.m_c_p = self.cream.get()*5 247 | self.m_t_g_p = self.thermal_gun.get()*15 248 | self.total_medical_price = float(self.m_m_p+self.m_h_g_p+self.m_s_p+self.m_c_p+self.m_t_g_p+self.m_s_p) 249 | 250 | self.medical_price.set("Rs. "+str(self.total_medical_price)) 251 | self.c_tax = round((self.total_medical_price*0.05), 2) 252 | self.medical_tax.set("Rs. "+str(self.c_tax)) 253 | 254 | self.g_r_p = self.rice.get()*10 255 | self.g_f_o_p = self.food_oil.get()*10 256 | self.g_w_p = self.wheat.get()*10 257 | self.g_s_p = self.spices.get()*6 258 | self.g_f_p = self.flour.get()*8 259 | self.g_m_p = self.maggi.get()*5 260 | self.total_grocery_price = float(self.g_r_p+self.g_f_o_p+self.g_w_p+self.g_s_p+self.g_f_p+self.g_m_p) 261 | 262 | self.grocery_price.set("Rs. " + str(self.total_grocery_price)) 263 | self.g_tax = round((self.total_grocery_price*5), 2) 264 | self.grocery_tax.set("Rs. " + str(self.g_tax)) 265 | 266 | self.c_d_s_p = self.sprite.get()*10 267 | self.c_d_w_p = self.mineral.get()*10 268 | self.c_d_j_p = self.juice.get()*10 269 | self.c_d_c_p = self.coke.get()*10 270 | self.c_d_l_p = self.lassi.get()*10 271 | self.c_m_d = self.mountain_duo.get()*10 272 | self.total_cold_drinks_price = float(self.c_d_s_p+self.c_d_w_p+self.c_d_j_p+self.c_d_c_p+self.c_d_l_p+self.c_m_d) 273 | 274 | self.cold_drinks_price.set("Rs. "+str(self.total_cold_drinks_price)) 275 | self.c_d_tax = round((self.total_cold_drinks_price * 0.1), 2) 276 | self.cold_drinks_tax.set("Rs. "+str(self.c_d_tax)) 277 | 278 | 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) 279 | 280 | def welcome_bill(self): 281 | self.txtarea.delete('1.0', END) 282 | self.txtarea.insert(END, "\tWelcome Grocery Retail") 283 | self.txtarea.insert(END, f"\nBill Number:{self.bill_no.get()}") 284 | self.txtarea.insert(END, f"\nCustomer Name:{self.c_name.get()}") 285 | self.txtarea.insert(END, f"\nPhone Number{self.c_phone.get()}") 286 | self.txtarea.insert(END, f"\n================================") 287 | self.txtarea.insert(END, f"\nProducts\t\tQTY\t\tPrice") 288 | 289 | def bill_area(self): 290 | if self.c_name.get() == " " or self.c_phone.get() == " ": 291 | messagebox.showerror("Error", "Customer Details Are Must") 292 | 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": 293 | messagebox.showerror("Error", "No Product Purchased") 294 | else: 295 | self.welcome_bill() 296 | # ============medical=========================== 297 | if self.sanitizer.get() != 0: 298 | self.txtarea.insert(END, f"\n Sanitizer\t\t{self.sanitizer.get()}\t\t{self.m_s_p}") 299 | if self.mask.get() != 0: 300 | self.txtarea.insert(END, f"\n Mask\t\t{self.mask.get()}\t\t{self.m_m_p}") 301 | if self.hand_gloves.get() != 0: 302 | self.txtarea.insert(END, f"\n Hand Gloves\t\t{self.hand_gloves.get()}\t\t{self.m_h_g_p}") 303 | if self.syrup.get() != 0: 304 | self.txtarea.insert(END, f"\n Syrup\t\t{self.syrup.get()}\t\t{self.m_s_p}") 305 | if self.cream.get() != 0: 306 | self.txtarea.insert(END, f"\n Cream\t\t{self.cream.get()}\t\t{self.m_c_p}") 307 | if self.thermal_gun.get() != 0: 308 | self.txtarea.insert(END, f"\n Thermal Gun\t\t{self.sanitizer.get()}\t\t{self.m_t_g_p}") 309 | # ==============Grocery============================ 310 | if self.rice.get() != 0: 311 | self.txtarea.insert(END, f"\n Rice\t\t{self.rice.get()}\t\t{self.g_r_p}") 312 | if self.food_oil.get() != 0: 313 | self.txtarea.insert(END, f"\n Food Oil\t\t{self.food_oil.get()}\t\t{self.g_f_o_p}") 314 | if self.wheat.get() != 0: 315 | self.txtarea.insert(END, f"\n Wheat\t\t{self.wheat.get()}\t\t{self.g_w_p}") 316 | if self.spices.get() != 0: 317 | self.txtarea.insert(END, f"\n Spices\t\t{self.spices.get()}\t\t{self.g_s_p}") 318 | if self.flour.get() != 0: 319 | self.txtarea.insert(END, f"\n Flour\t\t{self.flour.get()}\t\t{self.g_f_p}") 320 | if self.maggi.get() != 0: 321 | self.txtarea.insert(END, f"\n Maggi\t\t{self.maggi.get()}\t\t{self.g_m_p}") 322 | #================ColdDrinks========================== 323 | if self.sprite.get() != 0: 324 | self.txtarea.insert(END, f"\n Sprite\t\t{self.sprite.get()}\t\t{self.c_d_s_p}") 325 | if self.mineral.get() != 0: 326 | self.txtarea.insert(END, f"\n Mineral\t\t{self.mineral.get()}\t\t{self.c_d_w_p}") 327 | if self.juice.get() != 0: 328 | self.txtarea.insert(END, f"\n Juice\t\t{self.juice.get()}\t\t{self.c_d_j_p}") 329 | if self.coke.get() != 0: 330 | self.txtarea.insert(END, f"\n Coke\t\t{self.coke.get()}\t\t{self.c_d_c_p}") 331 | if self.lassi.get() != 0: 332 | self.txtarea.insert(END, f"\n Lassi\t\t{self.cream.get()}\t\t{self.c_d_l_p}") 333 | if self.mountain_duo.get() != 0: 334 | self.txtarea.insert(END, f"\n Mountain Duo\t\t{self.sanitizer.get()}\t\t{self.c_m_d}") 335 | self.txtarea.insert(END, f"\n--------------------------------") 336 | # ===============taxes============================== 337 | if self.medical_tax.get() != '0.0': 338 | self.txtarea.insert(END, f"\n Medical Tax\t\t\t{self.medical_tax.get()}") 339 | if self.grocery_tax.get() != '0.0': 340 | self.txtarea.insert(END, f"\n Grocery Tax\t\t\t{self.grocery_tax.get()}") 341 | if self.cold_drinks_tax.get() != '0.0': 342 | self.txtarea.insert(END, f"\n Cold Drinks Tax\t\t\t{self.cold_drinks_tax.get()}") 343 | 344 | self.txtarea.insert(END, f"\n Total Bil:\t\t\t Rs.{self.total_bill}") 345 | self.txtarea.insert(END, f"\n--------------------------------") 346 | self.save_bill() 347 | 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 | def find_bill(self): 360 | present = "no" 361 | for i in os.listdir("bills/"): 362 | if i.split('.')[0] == self.search_bill.get(): 363 | f1 = open(f"bills/{i}", "r") 364 | self.txtarea.delete("1.0", END) 365 | for d in f1: 366 | self.txtarea.insert(END, d) 367 | f1.close() 368 | present = "yes" 369 | if present == "no": 370 | messagebox.showerror("Error", "Invalid Bill No") 371 | 372 | def clear_data(self): 373 | op = messagebox.askyesno("Clear", "Do you really want to Clear?") 374 | if op > 0: 375 | self.sanitizer.set(0) 376 | self.mask.set(0) 377 | self.hand_gloves.set(0) 378 | self.syrup.set(0) 379 | self.cream.set(0) 380 | self.thermal_gun.set(0) 381 | # ============grocery============================== 382 | self.rice.set(0) 383 | self.food_oil.set(0) 384 | self.wheat.set(0) 385 | self.spices.set(0) 386 | self.flour.set(0) 387 | self.maggi.set(0) 388 | # =============coldDrinks============================= 389 | self.sprite.set(0) 390 | self.mineral.set(0) 391 | self.juice.set(0) 392 | self.coke.set(0) 393 | self.lassi.set(0) 394 | self.mountain_duo.set(0) 395 | # ====================taxes================================ 396 | self.medical_price.set("") 397 | self.grocery_price.set("") 398 | self.cold_drinks_price.set("") 399 | 400 | self.medical_tax.set("") 401 | self.grocery_tax.set("") 402 | self.cold_drinks_tax.set("") 403 | 404 | self.c_name.set("") 405 | self.c_phone.set("") 406 | 407 | self.bill_no.set("") 408 | x = random.randint(1000, 9999) 409 | self.bill_no.set(str(x)) 410 | 411 | self.search_bill.set("") 412 | self.welcome_bill() 413 | 414 | def exit_app(self): 415 | op = messagebox.askyesno("Exit", "Do you really want to exit?") 416 | if op > 0: 417 | self.root.destroy() 418 | 419 | 420 | root = Tk() 421 | obj = Bill_App(root) 422 | root.mainloop() 423 | 424 | --------------------------------------------------------------------------------