Backup Retail POS - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: General (https://python-forum.io/forum-1.html) +--- Forum: Code sharing (https://python-forum.io/forum-5.html) +--- Thread: Backup Retail POS (/thread-7549.html) |
Backup Retail POS - pando - Jan-15-2018 While at work yesterday (small retail setting) the POS systems all crashed and left us manually writing down and calculating taxes by hand. I experimented with writing a script that takes purchases and puts them into a list, adding tax totals at the end. I'm curious if anyone sees anything that can be improved upon/made more pythonic. """ Emergency Retail POS Quick fix to add totals with tax Tracks purchases and totals """ tax = float(input("What is tax: ")) #Sets amount of tax applied to each purchase, ex. 0.15 total_sales = 0 #Total $ value of purchase sales = [] #List of individual items sales_with_tax = [] #List of items plus tax sales_tax = 0 #Cost of item plus tax item = 1 while True: sale = float((input("Price of item number {} before taxes: ".format(item)))) if sale == 0: #Exits loop and displays total print("="*40) item -= 1 #Ensure item count is correct print ("Total sales with tax: {}".format(total_sales)) #Total cost of purchase print("Total number of items: {}".format(item)) #How many items in cart break elif sale > 0: taxes = sale * tax sale_with_tax = round(sale + taxes, 2) #Rounds to two decimals places sales.append(sale) sales_with_tax.append(sale_with_tax) total_sales += sale_with_tax item += 1 print("_" * 40) print("There are {} items".format(item - 1)) print("Items without tax: $ {}".format(sales)) print ("Items with tax: ${}".format((sales_with_tax))) print("Total purchase with tax: {}".format(round(total_sales, 2))) pass RE: Backup Retail POS - Gribouillis - Jan-15-2018 I think it could be functionally improved by using the cmd module. You could display the current list of items and add commands to remove or correct items or select tax rates, etc. There is some work to achieve this however.
RE: Backup Retail POS - pando - Jan-16-2018 Looking into cmd it looks like it would work great. Thanks for your reply, I'm going to see what I can make of that. RE: Backup Retail POS - nilamo - Jan-18-2018 There's currently not a way to add items that aren't taxed, like food. Another cool thing to add, would be a tally that went beyond a single transaction, so you could see how much sales were for the entire day/shift. Perhaps ask how much they're paying, if cash, and offer what the change is? RE: Backup Retail POS - pando - Jan-20-2018 That's a great point - not taxing certain items on the fly would be a good addition. I was thinking of adding the daily net too. And I like the change idea! All workable helpful ideas. Might post an update in here if I get some of those working. |