-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.py
More file actions
36 lines (32 loc) · 914 Bytes
/
reports.py
File metadata and controls
36 lines (32 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from storage import load_sales, load_products
from utils import pause
def reports_menu():
while True:
print("\nReports")
print("-" * 10)
print("1. Total Revenue")
print("2. Low Stock Alert")
print("3. Back")
choice = input("Enter choice (1-3): ")
if choice == "1":
total_revenue()
elif choice == "2":
low_stock()
elif choice == "3":
break
else:
print(" Invalid choice")
def total_revenue():
sales = load_sales()
total = sales["TotalPrice"].sum()
print(f"\n Total Revenue: {total}")
pause()
def low_stock():
products = load_products()
low = products[products["Quantity"] < 5]
if low.empty:
print("All products sufficiently stocked.")
else:
print("\n Low Stock Products:")
print(low[["ID", "Name", "Quantity"]])
pause()