GST Billing System Project Final
GST Billing System Project Final
1. ACKNOWLEDGEMENT 1
2. CERTIFICATE 2
3. INTRODUCTION 3
4. PROJECT STRUCTURE 4
5. CODING 4-14
6. OUTPUT 15-17
7. CONCLUSION 18
8. BIBLIOGRPHY 19
Acknowledgement
Project Overview
The GST Billing System project is designed to help students understand
the practical application of Python programming in real-world scenarios.
The system allows users to input item details, including the price and
GST rate, and calculates the total amount payable, including GST. The
project also includes features to generate a detailed bill and save it to a
file for future reference.
Key Objectives
1. User-Friendly Interface: Create an easy-to-use interface for adding
items and generating bills.
2. Accurate GST Calculations: Implement precise calculations for
GST based on user inputs.
3. File Handling: Save the generated bill to a text file for record-
keeping and future reference.
4. Input Validation: Ensure robust validation of user inputs to prevent
errors and inaccuracies.
2. Project Structure
The project will have the following structure:
3.Coding
import datetime
import os
i: Product Class
class Product:
def __init__(self, category, name,
price, gst_rate):
self.category = category
self.name = name
self.price = price
self.gst_rate = gst_rate
def calculate_gst(self):
return self.price * self.gst_rate /
100
def total_price(self):
return self.price +
self.calculate_gst()
def calculate_total(self):
total = 0
for item in self.items:
product, quantity = item
total += product.total_price()
* quantity
return total
def generate_invoice(self):
invoice = Invoice(self.customer)
for item in self.items:
product, quantity = item
invoice.add_item(product,
quantity)
invoice.display()
invoice.save()
def display(self):
print(f"\nInvoice Date:
{self.date}")
print(f"Customer Name:
{self.customer.name}")
print(f"Customer Address:
{self.customer.address}")
print(f"Customer Contact:
{self.customer.contact}")
print("====================================
=")
print("Category | Product |
Quantity | Price | GST | Total Price")
for item in self.items:
product, quantity, total_price
= item
print(f"{product.category} |
{product.name} | {quantity} |
{product.price} | {product.gst_rate}% |
{total_price}")
print("====================================
=")
print(f"Total Amount:
{self.total}")
def save(self):
filename =
f"Invoice_{self.date.strftime('%Y%m%d_%H%M%
S')}.txt"
with open(filename, 'w') as f:
f.write(f"Invoice Date:
{self.date}\n")
f.write(f"Customer Name:
{self.customer.name}\n")
f.write(f"Customer Address:
{self.customer.address}\n")
f.write(f"Customer Contact:
{self.customer.contact}\n")
f.write("==================================
===\n")
f.write("Category | Product |
Quantity | Price | GST | Total Price\n")
for item in self.items:
product, quantity,
total_price = item
f.write(f"{product.category} |
{product.name} | {quantity} |
{product.price} | {product.gst_rate}% |
{total_price}\n")
f.write("==================================
===\n")
f.write(f"Total Amount:
{self.total}\n")
v: Input Validation
def get_valid_input(prompt, input_type,
condition):
while True:
try:
value =
input_type(input(prompt))
if condition(value):
return value
else:
print("Invalid input.
Please try again.")
except ValueError:
print("Invalid input. Please
enter the correct type.")
billing_system = BillingSystem()
while True:
print("\nAvailable products:")
for i, product in
enumerate(products):
print(f"{i + 1}.
{product.category} - {product.name} -
Price: {product.price} - GST:
{product.gst_rate}%")
choice = get_valid_input("Select a
product by number (or 0 to finish): ", int,
lambda x: 0 <= x <= len(products))
if choice == 0:
break
quantity = get_valid_input("Enter
quantity: ", int, lambda x: x > 0)
billing_system.add_product(products[choice
- 1], quantity)
billing_system.generate_invoice()
if __name__ == "__main__":
main()
4.Output
Enter Customer Details:
Customer Name: John Doe
Customer Address: 123 Elm Street
Customer Contact: 555-1234
Available products:
1. Electronics - Laptop - Price: 50000 - GST:
18%
2. Electronics - Smartphone - Price: 20000 -
GST: 12%
3. Electronics - Tablet - Price: 15000 - GST:
12%
4. Accessories - Monitor - Price: 10000 - GST:
18%
5. Accessories - Keyboard - Price: 1000 - GST:
18%
Available products:
1. Electronics - Laptop - Price: 50000 - GST:
18%
2. Electronics - Smartphone - Price: 20000 -
GST: 12%
3. Electronics - Tablet - Price: 15000 - GST:
12%
4. Accessories - Monitor - Price: 10000 - GST:
18%
5. Accessories - Keyboard - Price: 1000 - GST:
18%
Available products:
1. Electronics - Laptop - Price: 50000 - GST:
18%
2. Electronics - Smartphone - Price: 20000 -
GST: 12%
3. Electronics - Tablet - Price: 15000 - GST:
12%
4. Accessories - Monitor - Price: 10000 - GST:
18%
5. Accessories - Keyboard - Price: 1000 - GST:
18%
Past Invoices:
Invoice_20231221_103341.txt
5.Conclusion
1. Python Documentation:
"The Python Standard Library." Python.org. Accessed July
2024. https://docs.python.org/3/library/
"Classes." Python.org. Accessed July 2024.
https://docs.python.org/3/tutorial/classes.html
2. GST References:
"Goods and Services Tax (GST)." Government of India,
https://cleartax.in/s/gst-law-goods-and-services-tax
3. Project-Specific References:
"How to Create a Simple Billing System in Python."
https://www.programiz.com/python-programming/file-
operation
"Python Input Validation." Tutorialspoint. Accessed July 2024.
https://www.tutorialspoint.com/python/python_basic_operators.
htm
4. Tools and Libraries:
"Datetime Module." Python.org. Accessed July 2024.
https://docs.python.org/3/library/datetime.html