Help us create more useful apps! We've already built a screen recorder(availabe in APPS section), and we're planning even more practical and developer-friendly applications.
Donate UsEXCEL SHEET for below code
from openpyxl import load_workbook import pandas as pd def ADMIN(): excel_file = 'miniproject.xlsx' df = pd.read_excel(excel_file) data_dict = df.to_dict(orient='records') m = 1 for record in data_dict: print(f"Serial No. {m} ::: {record}") m += 1 file_path = 'miniproject.xlsx' workbook = load_workbook(file_path) sheet = workbook.active import math i = int(input("Enter The Serial No:")) i = i + 1 i = "C" + str(i) print("Stock(s) available:", sheet[i].value) j = int(input("Stock(s) you have added:")) sheet[i] = sheet[i].value + j workbook.save(file_path) print("=" * 80) print(" Stocks updated successfully!") def USER(): excel_file = 'miniproject.xlsx' df = pd.read_excel(excel_file) data_dict = df.to_dict(orient='records') cart = [] customer_name = input("Enter Customer Name:").capitalize() customer_mobile = int(input("Customer's mobile number:")) while True: product = input("Enter product name (or) done to finish:").upper() if product == "DONE": break found = False for record in data_dict: item_name = record['ITEM NAME'].strip().upper() if item_name == product: found = True qty = int(input(f"Enter quantity for {product}:")) price = record['PRICE (INR)'] cart.append((product, price, qty)) break if not found: print("Item not available") print("\n" + "=" * 40) print('POKECHAN'.center(40)) print("=" * 40) print(f"Customer Name: {customer_name}") print(f"Customer Mobile Number: {customer_mobile}") print("-" * 40) print(f"{'Product':<15}{'Qty':<10}{'Price':<10}{'Total':<10}") print("-" * 40) total = 0 for (product, price, qty) in cart: line_total = price * qty total += line_total print(f"{product:<15}{qty:<10}{price:<10}{line_total:<10}") print("-" * 40) print(f"{'Total Amount:':>35} ₹{total}") print("=" * 40) print("Thanks for shopping. visit again!".center(40)) print("=" * 40) a = input("Did the customer paid(Y/N):") a = a.upper() if a == 'Y': for product, price, qty in cart: for item in data_dict: if item['ITEM NAME'] == product: item['STOCK AVAILABLE'] -= qty print(f"Stock updated for {product}. {item['STOCK AVAILABLE']} units remaining.") else: print("Customer has not paid.") while True: a = int(input("Enter the page to be redirected(1 for ADMIN / 2 for USER): ")) if a ==1 : ADMIN() break elif a==2 : USER() break else: print("INVALID input.") continue
No comments:
Post a Comment