Open Pankaj-Str opened 4 months ago
productID = []
productName = []
quantity = []
unitPrice = []
option = 1
gst = 0
val = 0
discount = 0
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
while(switchOption != 0):
if(switchOption == 1):
prodID = input("Enter Product ID: ")
productID.append(prodID)
prodName = input("Enter Product Name: ")
productName.append(prodName)
quanti = int(input("Enter Quantity: "))
quantity.append(quanti)
uniPrice = int(input("Enter Unit Price (Rs): "))
unitPrice.append(uniPrice)
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
elif(switchOption == 2):
print("-----------------------------------")
print("Products List:")
print("-----------------------------------")
for i in range(0, len(productID)):
print(f"Product ID: {productID[i]}, Product Name: {productName[i]}, Quantity: {quantity[i]} + Unit Price (Rs): {unitPrice[i]}")
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
elif(switchOption == 3):
prodID = input("Enter Product ID to remove: ")
index = 0
for i in range(0, len(productID)):
if(productID[i] == prodID):
index = i
num = productID.pop(index)
num = productName.pop(index)
num = quantity.pop(index)
num = unitPrice.pop(index)
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
elif(switchOption == 4):
gst = int(input("Enter GST rate (%): "))
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
elif(switchOption == 5):
rate = 0
discount = 0
print("Select Discount Type:\n 1. Percentage Discount on Total Bill\n 2. Fixed Amount Discount on Total Bill\n 3. Discount on Specific Product\n")
val = int(input("Enter choice: "))
if(val == 1):
rate = int(input("Enter Discount Rate (%): "))
elif(val == 2):
discount = int(input("Enter the fixed amount discount on total bill: "))
elif(val == 3):
for i in range(0, len(productID)):
dis = int(input(f"Enter the discount for productID {productID[i]}: "))
unitPrice[i] = unitPrice[i] - (unitPrice[i] * dis / 100)
switchOption = int(input("Enter 1. To add new product\n 2. To view all products\n 3. To remove a product\n 4. To apply GST\n 5. To apply discounts\n 6. To generate and view the final invoice\n"))
elif(switchOption == 6):
print("-----------------------------------")
print("E-commerce Billing System Invoice")
print("-----------------------------------")
subtotal = 0
for i in range(0, len(productID)):
print(f"Product ID: {productID[i]}")
print(f"Product Name: {productName[i]}")
print(f"Quantity: {quantity[i]}")
print(f"Unit Price (Rs): {unitPrice[i]}")
subtotal = subtotal + quantity[i] * unitPrice[i]
print(f"Subtotal (Rs): {subtotal}")
print(f"GST @ {gst}% (Rs): {(gst*subtotal/100)}")
print("-----------------------------------")
print(f"Total before discount (₹): {(subtotal + gst*subtotal/100)}")
if(val == 1):
print(f"Discount @ {rate}% (Rs): {rate*(subtotal + gst*subtotal/100)/100}")
print("-----------------------------------")
finalTotal = (subtotal + gst*subtotal/100) - ((rate*(subtotal + gst*subtotal/100)/100))
print(f"Final Total (₹): {finalTotal}")
print("-----------------------------------")
elif(val == 2):
print(f"Discount is {discount}")
print("-----------------------------------")
finalTotal = (subtotal + gst*subtotal/100) - discount
print(f"Final Total (₹): {finalTotal}")
print("-----------------------------------")
elif(val == 3):
print("-----------------------------------")
finalTotal = (subtotal + gst*subtotal/100)
print(f"Final Total (₹): {finalTotal}")
print("-----------------------------------")
switchOption = 0
Objective:
Create an advanced billing system for an e-commerce application that allows users to input product details, apply GST, select discount offers, remove products, and calculate the final bill. The system should provide a detailed invoice with a breakdown of each item, taxes, discounts, and the total amount in Indian Rupees (₹).
Requirements:
Product Input:
GST Calculation:
Discount Offers:
Product Removal:
View Products:
Invoice Generation:
User Interface:
Data Validation:
Example Workflow:
Add Products:
View Products:
Remove Product:
Apply GST:
Apply Discounts:
Generate Invoice:
Submission:
Submit the Python script implementing the advanced billing system. Ensure your code is well-documented with comments explaining each part of the logic. Include a README file explaining how to run your program and any dependencies required.
Evaluation Criteria: