├── README.md └── armyshop.py /README.md: -------------------------------------------------------------------------------- 1 | # Model-Army-Shop 2 | A model army shop counter record keeper using Tkinter and Python GUI 3 | 4 | 5 | ### Screenshots: 6 | ![image](https://user-images.githubusercontent.com/64016811/146784156-8319382d-dfa8-47fb-899f-078a2b74ed0d.png) 7 | 8 | ### How to Run: 9 | * Download the armyshop.py file or clone the repo into your favourite code editor. 10 | * Open a new terminal and type: python armyshop.py 11 | * Enter data as you like and generate, save and print results. 12 | 13 | ### Project Logs: 14 | | Name of Creator | Start Date | End Date | Duration | Project Type | Deploy | 15 | |-----------------|------------|----------|----------|--------------|--------| 16 | | Mainak Chaudhuri | 15-11-2021 | 20-12-2021 | 5 days | GUI, DBMS | NULL | 17 | 18 | 🛑 OUT OF ORDER 19 | -------------------------------------------------------------------------------- /armyshop.py: -------------------------------------------------------------------------------- 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("ARMY SUPPLIES") 12 | bg_color = "#badc57" 13 | title = Label(self.root, text="⚔ ARMY SUPPLIES ⚔", font=('times new roman', 30, 'bold'), pady=2, bd=12, bg="blue", fg="white", 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="#0388fc") 53 | F1.place(x=0, y=80, relwidth=1) 54 | cname_lbl = Label(F1, text="Customer Name:", bg="#0388fc", 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 ID:", bg="#0388fc", 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="#0388fc", 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 Rations==================================== 73 | F2 = LabelFrame(self.root, text="Medical Ration", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="#fc6f03") 74 | F2.place(x=5, y=180, width=325, height=380) 75 | 76 | sanitizer_lbl = Label(F2, text="COVID-Kit", font=('times new roman', 16, 'bold'), bg="#fc6f03", 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="Scissors", font=('times new roman', 16, 'bold'), bg="#fc6f03", 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="Medical Sprays", font=('times new roman', 16, 'bold'), bg="#fc6f03", 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="Disinfectants", font=('times new roman', 16, 'bold'), bg="#fc6f03", 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="Medicines", font =('times new roman', 16, 'bold'), bg = "#fc6f03", 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="Bandages", font=('times new roman', 16, 'bold'), bg="#fc6f03", 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 | # ==========Grocery Rations========================= 107 | F3 = LabelFrame(self.root, text="Grocery Rations", font=('times new roman', 15, 'bold'), bd=10, fg="Black", bg="white") 108 | F3.place(x=340, y=180, width=325, height=380) 109 | 110 | rice_lbl = Label(F3, text="MRE", font=('times new roman', 16, 'bold'), bg="white", 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="Ovens", font=('times new roman', 16, 'bold'), bg="white", 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="Health Drinks", font=('times new roman', 16, 'bold'), bg="white", 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="Toilet Kit", font=('times new roman', 16, 'bold'), bg="white", 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="Cutlery", font=('times new roman', 16, 'bold'), bg="white", 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="Stationaries", font=('times new roman', 16, 'bold'), bg="white", 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 | # ===========Clothing and Essentials================================ 141 | F4 = LabelFrame(self.root, text="Clothing and Essentials", font=('times new roman', 15, 'bold'), bd=10, fg="white", bg="green") 142 | F4.place(x=670, y=180, width=325, height=380) 143 | 144 | sprite_lbl = Label(F4, text="Uniforms", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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="Shoes", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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="Belts", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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="Weather Kit", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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="Rope", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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="Survival Tools", font=('times new roman', 16, 'bold'), bg="green", fg="white") 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', fg="white", bg="#272a87", 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="#03d7fc") 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="#03d7fc", 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="#03d7fc", 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 Essential Price", font=('times new roman', 14, 'bold'), bg="#03d7fc", 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="#03d7fc", 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="#03d7fc", 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="Essentials Tax", font=('times new roman', 14, 'bold'), bg="#03d7fc", 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 | 223 | btn_f.place(x=760, width=580, height=105) 224 | 225 | total_btn = Button(btn_f, command=self.total, text="Total", bg="#272a87", bd=2, fg="white", pady=12, width=12, font='arial 13 bold') 226 | total_btn.grid(row=0, column=0, padx=5, pady=5) 227 | 228 | generateBill_btn = Button(btn_f, command=self.bill_area, text="Generate Bill", bd=2, bg="#272a87", fg="white", pady=12, width=12, font='arial 13 bold') 229 | generateBill_btn.grid(row=0, column=1, padx=5, pady=5) 230 | 231 | clear_btn = Button(btn_f, command=self.clear_data, text="Clear", bg="#272a87", bd=2, fg="white", pady=12, width=12, font='arial 13 bold') 232 | clear_btn.grid(row=0, column=2, padx=5, pady=5) 233 | 234 | exit_btn = Button(btn_f, command=self.exit_app, text="Exit", bd=2, bg="#272a87", fg="white", pady=12, width=12, font='arial 13 bold') 235 | exit_btn.grid(row=0, column=3, padx=5, pady=5) 236 | 237 | 238 | 239 | #================totalBill========================== 240 | def total(self): 241 | self.m_h_g_p = self.hand_gloves.get()*12 242 | self.m_s_p = self.sanitizer.get()*2 243 | self.m_m_p = self.mask.get()*5 244 | self.m_d_p = self.dettol.get()*30 245 | self.m_n_p = self.newsprin.get()*5 246 | self.m_t_g_p = self.thermal_gun.get()*15 247 | 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) 248 | 249 | self.medical_price.set("Rs. "+str(self.total_medical_price)) 250 | self.c_tax = round((self.total_medical_price*0.05), 2) 251 | self.medical_tax.set("Rs. "+str(self.c_tax)) 252 | 253 | self.g_r_p = self.rice.get()*10 254 | self.g_f_o_p = self.food_oil.get()*10 255 | self.g_w_p = self.wheat.get()*10 256 | self.g_d_p = self.daal.get()*6 257 | self.g_f_p = self.flour.get()*8 258 | self.g_m_p = self.maggi.get()*5 259 | 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) 260 | 261 | self.grocery_price.set("Rs. " + str(self.total_grocery_price)) 262 | self.g_tax = round((self.total_grocery_price*0.05), 2) 263 | self.grocery_tax.set("Rs. " + str(self.g_tax)) 264 | 265 | self.c_d_s_p = self.sprite.get()*10 266 | self.c_d_l_p = self.limka.get()*10 267 | self.c_d_m_p = self.mazza.get()*10 268 | self.c_d_c_p = self.coke.get()*10 269 | self.c_d_f_p = self.fanta.get()*10 270 | self.c_m_d = self.mountain_duo.get()*10 271 | 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) 272 | 273 | self.cold_drinks_price.set("Rs. "+str(self.total_cold_drinks_price)) 274 | self.c_d_tax = round((self.total_cold_drinks_price * 0.1), 2) 275 | self.cold_drinks_tax.set("Rs. "+str(self.c_d_tax)) 276 | 277 | 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) 278 | 279 | #==============welcome-bill============================== 280 | def welcome_bill(self): 281 | self.txtarea.delete('1.0', END) 282 | self.txtarea.insert(END, "\tWelcome to Army Shop") 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"\nCustomer ID:{self.c_phone.get()}") 286 | self.txtarea.insert(END, f"\n================================") 287 | self.txtarea.insert(END, f"\nProducts\t\tQTY\t\tPrice") 288 | 289 | #=========billArea================================================= 290 | def bill_area(self): 291 | if self.c_name.get() == " " or self.c_phone.get() == " ": 292 | messagebox.showerror("Error", "Customer Details Are Must") 293 | 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": 294 | messagebox.showerror("Error", "No Product Purchased") 295 | else: 296 | self.welcome_bill() 297 | # ============medical=========================== 298 | if self.sanitizer.get() != 0: 299 | self.txtarea.insert(END, f"\n Covid Kit\t\t{self.sanitizer.get()}\t\t{self.m_s_p}") 300 | if self.mask.get() != 0: 301 | self.txtarea.insert(END, f"\n Scissors\t\t{self.mask.get()}\t\t{self.m_m_p}") 302 | if self.hand_gloves.get() != 0: 303 | self.txtarea.insert(END, f"\n Medical Sprays\t\t{self.hand_gloves.get()}\t\t{self.m_h_g_p}") 304 | if self.dettol.get() != 0: 305 | self.txtarea.insert(END, f"\n Disinfectants\t\t{self.dettol.get()}\t\t{self.m_d_p}") 306 | if self.newsprin.get() != 0: 307 | self.txtarea.insert(END, f"\n Medicines\t\t{self.newsprin.get()}\t\t{self.m_n_p}") 308 | if self.thermal_gun.get() != 0: 309 | self.txtarea.insert(END , f"\n Bandages\t\t{self.sanitizer.get()}\t\t{self.m_t_g_p}") 310 | # ==============Grocery============================ 311 | if self.rice.get() != 0: 312 | self.txtarea.insert(END, f"\n MRE\t\t{self.rice.get()}\t\t{self.g_r_p}") 313 | if self.food_oil.get() != 0: 314 | self.txtarea.insert(END, f"\n Ovens\t\t{self.food_oil.get()}\t\t{self.g_f_o_p}") 315 | if self.wheat.get() != 0: 316 | self.txtarea.insert(END, f"\n Health Drinks\t\t{self.wheat.get()}\t\t{self.g_w_p}") 317 | if self.daal.get() != 0: 318 | self.txtarea.insert(END, f"\n Toilet Kit\t\t{self.daal.get()}\t\t{self.g_d_p}") 319 | if self.flour.get() != 0: 320 | self.txtarea.insert(END, f"\n Cutlery\t\t{self.flour.get()}\t\t{self.g_f_p}") 321 | if self.maggi.get() != 0: 322 | self.txtarea.insert(END, f"\n Stationaries\t\t{self.maggi.get()}\t\t{self.g_m_p}") 323 | #================ColdDrinks========================== 324 | if self.sprite.get() != 0: 325 | self.txtarea.insert(END, f"\n Uniforms\t\t{self.sprite.get()}\t\t{self.c_d_s_p}") 326 | if self.limka.get() != 0: 327 | self.txtarea.insert(END, f"\n Shoes\t\t{self.limka.get()}\t\t{self.c_d_l_p}") 328 | if self.mazza.get() != 0: 329 | self.txtarea.insert(END, f"\n Belts\t\t{self.mazza.get()}\t\t{self.c_d_m_p}") 330 | if self.coke.get() != 0: 331 | self.txtarea.insert(END, f"\n Weather Kit\t\t{self.coke.get()}\t\t{self.c_d_c_p}") 332 | if self.fanta.get() != 0: 333 | self.txtarea.insert(END, f"\n Ropes\t\t{self.newsprin.get()}\t\t{self.c_d_f_p}") 334 | if self.mountain_duo.get() != 0: 335 | self.txtarea.insert(END, f"\n Survival Kit\t\t{self.sanitizer.get()}\t\t{self.c_m_d}") 336 | self.txtarea.insert(END, f"\n--------------------------------") 337 | # ===============taxes============================== 338 | if self.medical_tax.get() != '0.0': 339 | self.txtarea.insert(END, f"\n Medical Tax\t\t\t{self.medical_tax.get()}") 340 | if self.grocery_tax.get() != '0.0': 341 | self.txtarea.insert(END, f"\n Grocery Tax\t\t\t{self.grocery_tax.get()}") 342 | if self.cold_drinks_tax.get() != '0.0': 343 | self.txtarea.insert(END, f"\n Essentials Tax\t\t\t{self.cold_drinks_tax.get()}") 344 | 345 | self.txtarea.insert(END, f"\n Total Bil:\t\t\t Rs.{self.total_bill}") 346 | self.txtarea.insert(END, f"\n--------------------------------") 347 | self.save_bill() 348 | 349 | #=========savebill============================ 350 | def save_bill(self): 351 | op = messagebox.askyesno("Save Bill", "Do you want to save the bill?") 352 | if op > 0: 353 | self.bill_data = self.txtarea.get('1.0', END) 354 | f1 = open("bills/"+str(self.bill_no.get())+".txt", "w") 355 | f1.write(self.bill_data) 356 | f1.close() 357 | messagebox.showinfo("Saved", f"Bill no:{self.bill_no.get()} Saved Successfully") 358 | else: 359 | return 360 | 361 | # ===================find_bill================================ 362 | def find_bill(self): 363 | present = "no" 364 | for i in os.listdir("bills/"): 365 | if i.split('.')[0] == self.search_bill.get(): 366 | f1 = open(f"bills/{i}", "r") 367 | self.txtarea.delete("1.0", END) 368 | for d in f1: 369 | self.txtarea.insert(END, d) 370 | f1.close() 371 | present = "yes" 372 | if present == "no": 373 | messagebox.showerror("Error", "Invalid Bill No") 374 | 375 | # ======================clear-bill====================== 376 | def clear_data(self): 377 | op = messagebox.askyesno("Clear", "Do you really want to Clear?") 378 | if op > 0: 379 | self.sanitizer.set(0) 380 | self.mask.set(0) 381 | self.hand_gloves.set(0) 382 | self.dettol.set(0) 383 | self.newsprin.set(0) 384 | self.thermal_gun.set(0) 385 | # ============grocery============================== 386 | self.rice.set(0) 387 | self.food_oil.set(0) 388 | self.wheat.set(0) 389 | self.daal.set(0) 390 | self.flour.set(0) 391 | self.maggi.set(0) 392 | # =============coldDrinks============================= 393 | self.sprite.set(0) 394 | self.limka.set(0) 395 | self.mazza.set(0) 396 | self.coke.set(0) 397 | self.fanta.set(0) 398 | self.mountain_duo.set(0) 399 | # ====================taxes================================ 400 | self.medical_price.set("") 401 | self.grocery_price.set("") 402 | self.cold_drinks_price.set("") 403 | 404 | self.medical_tax.set("") 405 | self.grocery_tax.set("") 406 | self.cold_drinks_tax.set("") 407 | 408 | self.c_name.set("") 409 | self.c_phone.set("") 410 | 411 | self.bill_no.set("") 412 | x = random.randint(1000, 9999) 413 | self.bill_no.set(str(x)) 414 | 415 | self.search_bill.set("") 416 | self.welcome_bill() 417 | 418 | # ===========exit======================= 419 | def exit_app(self): 420 | op = messagebox.askyesno("Exit", "Do you really want to exit?") 421 | if op > 0: 422 | self.root.destroy() 423 | 424 | 425 | root = Tk() 426 | obj = Bill_App(root) 427 | root.mainloop() 428 | 429 | --------------------------------------------------------------------------------