def Read(): Read_list = [] Item_list = get_items_csv() SUM = 0 print("Read ready.") while True: i = 0 barcode = input() if barcode != "": Read_list.append(barcode) for i in range(len(Item_list)): if barcode == Item_list[i][0]: print("NAME: {0}, PRICE: {1}(In-TAX:{2})".format( Item_list[i][1], round(int(Item_list[i][2]) * 1.10), round(int(Item_list[i][2]) * 0.10))) else: break i += 1 for i in range(len(Read_list)): for j in range(len(Item_list)): if Read_list[i] == Item_list[j][0]: SUM += round(int(Item_list[j][2]) * 1.10) print("Total Fee", str(SUM)) update_inventory(Read_list)
def update_inventory(Read_list): Item_list = get_items_csv() for i in range(len(Read_list)): for j in range(len(Item_list)): if Read_list[i] == Item_list[j][0]: Item_list[j][3] = int(Item_list[j][3]) - 1 update_items_csv(Item_list) update_purchaced_csv(Read_list)
def check_purchased_history(): Items_list = get_items_csv() Purchased_history = get_purchased_csv() for i in range(len(Purchased_history)): print(Purchased_history[i])
def add_inventory_item(JAN, Name, Price, Stock_Quantity): Item_list = get_items_csv() Item_list.append([JAN, Name, Price, Stock_Quantity]) with open("items.csv", "w", encoding="utf_8") as file: writer = csv.writer(file, lineterminator="\n") writer.writerows(Item_list)
def check_inventory_list(): Item_list = get_items_csv() for i in range(len(Item_list)): print("JAN: {0:<13}, Price: {1}, Remaining: {2}".format( Item_list[i][0], Item_list[i][2], Item_list[i][3]))