INDEX
S NO. TITLE PG NO.
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
I would like to express my sincere gratitude to all those who have
supported and guided me throughout this project.
First, I extend my heartfelt thanks to my computer teacher,
M.R. Kalyan Ghosh,
for their invaluable guidance and encouragement.
Their expert advice was crucial in shaping this project.
I am also grateful to S.G.D Modern School for providing the
necessary resources and facilities to conduct this experiment.
Lastly, I thank my family for their unwavering support and
motivation throughout this project.
Thank you all for your contributions and support.
1. Introduction
The Goods and Services Tax (GST) is a comprehensive, multi-stage,
destination-based tax that is levied on every value addition in India. As a
crucial component of the financial ecosystem, businesses need efficient
systems to manage and calculate GST for their products and services.
This project, "GST Billing System," aims to provide a simple yet
effective solution for generating bills that include GST calculations.
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:
gst_billing_system.py (main file)
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()
ii: Customer Class
class Customer:
def __init__(self, name, address,
contact):
self.name = name
self.address = address
self.contact = contact
iii: BillingSystem Class
class BillingSystem:
def __init__(self):
self.items = []
self.customer = None
def add_customer(self, customer):
self.customer = customer
def add_product(self, product,
quantity):
self.items.append((product,
quantity))
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()
iv: Invoice Class
class Invoice:
def __init__(self, customer):
self.date = datetime.datetime.now()
self.customer = customer
self.items = []
self.total = 0
def add_item(self, product, quantity):
total_price = product.total_price()
* quantity
self.items.append((product,
quantity, total_price))
self.total += total_price
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.")
vi: Display Past Invoices
def display_past_invoices():
print("\nPast Invoices:")
for filename in os.listdir('.'):
if filename.startswith("Invoice_")
and filename.endswith(".txt"):
print(filename)
print()
vii: Main Function
def main():
products = [
Product("Electronics", "Laptop",
50000, 18),
Product("Electronics",
"Smartphone", 20000, 12),
Product("Electronics", "Tablet",
15000, 12),
Product("Accessories", "Monitor",
10000, 18),
Product("Accessories", "Keyboard",
1000, 18),
]
billing_system = BillingSystem()
# Adding Customer Details
print("\nEnter Customer Details:")
customer_name = input("Customer Name:
")
customer_address = input("Customer
Address: ")
customer_contact = input("Customer
Contact: ")
customer = Customer(customer_name,
customer_address, customer_contact)
billing_system.add_customer(customer)
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()
# Display Past Invoices
display_past_invoices()
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%
Select a product by number (or 0 to finish): 1
Enter quantity: 2
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%
Select a product by number (or 0 to finish): 3
Enter quantity: 1
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%
Select a product by number (or 0 to finish): 0
Invoice Date: 2023-12-21 10:33:41.593402
Customer Name: John Doe
Customer Address: 123 Elm Street
Customer Contact: 555-1234
=====================================
Category | Product | Quantity | Price | GST |
Total Price
Electronics | Laptop | 2 | 50000 | 18% |
118000.0
Electronics | Tablet | 1 | 15000 | 12% | 16800.0
=====================================
Total Amount: 134800.0
Past Invoices:
Invoice_20231221_103341.txt
5.Conclusion
In this project, we successfully created a GST Billing System
using Python. The system allows users to input product details,
calculate the GST for each product, and generate a final invoice
with the total amount. The project demonstrates the use of
classes and methods to handle the billing process efficiently.
This basic system can be extended with additional features such
as user input validation, saving invoices to a file, and creating a
more interactive user interface. By building this project, we have
covered fundamental concepts of object-oriented programming,
such as class definitions, methods, and instance variables, and
have applied them to solve a real-world problem.
This project serves as a solid foundation for further development
in the area of billing systems and can be enhanced to meet more
complex requirements in a business environment.
Bibliography
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,
Ministry of Finance. Accessed July 2024.
https://www.gst.gov.in/
"Introduction to GST." ClearTax. Accessed July 2024.
https://cleartax.in/s/gst-law-goods-and-services-tax
3. Project-Specific References:
"How to Create a Simple Billing System in Python."
GeeksforGeeks. Accessed July 2024.
https://www.geeksforgeeks.org/simple-billing-system-python/
"Python File Handling." Programiz. Accessed July 2024.
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