Inventory Management System
Inventory Management System
file_path = "D:\\garv\\"
def products_below_threshold(threshold):
print("Products below threshold quantity:")
with open(file_path + 'Products.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
try:
if int(row[2]) < threshold:
print(", ".join(row))
except ValueError:
# Skip this row if there's an issue converting the quantity to an integer
continue
# Main Program
def main():
while True:
print("\nInventory Management System")
print("1. Display Products")
print("2. Display Suppliers")
print("3. Display Sales")
print("4. Add New Product")
print("5. Add New Supplier")
print("6. Record Sale")
print("7. Update Product Quantity")
print("8. Search Product by ID")
print("9. View Products Below Threshold")
print("10. Generate Sales Report")
print("0. Exit")
choice = input("Enter your choice: ")
if choice == '1':
display_products()
elif choice == '2':
display_suppliers()
elif choice == '3':
display_sales()
elif choice == '4':
product_id = input("Enter Product ID: ")
name = input("Enter Product Name: ")
quantity = input("Enter Quantity: ")
price = input("Enter Price: ")
category = input("Enter Category: ")
add_product(product_id, name, quantity, price, category)
elif choice == '5':
supplier_id = input("Enter Supplier ID: ")
name = input("Enter Supplier Name: ")
contact = input("Enter Contact: ")
products_supplied = input("Enter Products Supplied (semicolon-separated
IDs): ")
add_supplier(supplier_id, name, contact, products_supplied)
elif choice == '6':
sale_id = input("Enter Sale ID: ")
product_id = input("Enter Product ID: ")
quantity_sold = input("Enter Quantity Sold: ")
sale_date = datetime.today().strftime('%Y-%m-%d')
customer_name = input("Enter Customer Name: ")
record_sale(sale_id, product_id, quantity_sold, sale_date, customer_name)
elif choice == '7':
product_id = input("Enter Product ID to update: ")
new_quantity = input("Enter New Quantity: ")
update_product_quantity(product_id, new_quantity)
elif choice == '8':
product_id = input("Enter Product ID to search: ")
search_product(product_id)
elif choice == '9':
threshold = int(input("Enter threshold quantity: "))
products_below_threshold(threshold)
elif choice == '10':
generate_sales_report()
elif choice == '0':
print("Exiting...")
break
else:
print("Invalid choice. Please try again.")
display_suppliers()
display_sales()
add_product(product_id, name, quantity, price, category)
add_supplier(supplier_id, name, contact, products_supplied)
search_product(product_id)
products_below_threshold(threshold)
generate_sales_report()