0% found this document useful (0 votes)
0 views

invoice_billing_system_documentation

The Invoice Billing System enables users to create and manage invoices by adding products with prices and tax rates, calculating totals, and storing invoices in a SQLite database. It features a user-friendly GUI built with Tkinter, allows for invoice history viewing, and optionally supports PDF generation. Future enhancements include adding a search feature and improving the interface.

Uploaded by

jaspreet.1353
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

invoice_billing_system_documentation

The Invoice Billing System enables users to create and manage invoices by adding products with prices and tax rates, calculating totals, and storing invoices in a SQLite database. It features a user-friendly GUI built with Tkinter, allows for invoice history viewing, and optionally supports PDF generation. Future enhancements include adding a search feature and improving the interface.

Uploaded by

jaspreet.1353
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Invoice Billing System - Project Documentation

Project Overview:

The Invoice Billing System allows users to create invoices by adding products to the system,

marking their prices, and applying a tax rate. It calculates the total amount, stores invoices in a

database, and allows the user to generate and view invoices later.

Features:

1. Add Product: Users can add a product with its name, price, and tax rate.

2. Generate Invoice: Automatically calculate total with tax, and store the invoice details.

3. Invoice History: View past invoices by querying the database.

4. Save to Database: All data is saved in a SQLite database.

5. PDF Generation (optional): Export invoices as PDFs using the reportlab library.

Tools and Technologies:

- SQLite: For database management.

- Tkinter: GUI for user interaction.

- Python: Main programming language.

- ReportLab (Optional): For generating PDFs.

Database Schema:

Products Table:

- id: INTEGER PRIMARY KEY

- name: TEXT

- price: REAL
- tax_rate: REAL

Invoices Table:

- id: INTEGER PRIMARY KEY

- date: TEXT

- total: REAL

How to Run the Application:

1. Install Python and required libraries (sqlite3, tkinter).

2. Save the Python script as 'invoice_billing_system.py'.

3. Run the script with the command:

python invoice_billing_system.py

4. Use the GUI to add products, generate invoices, and view past records.

Future Enhancements:

- Add a search feature for products and invoices.

- Implement PDF export for invoices using ReportLab.

- Improve the GUI layout and user-friendly interface.

Code Implementation:

import sqlite3

from tkinter import *

from tkinter import messagebox

from tkinter import simpledialog

from datetime import datetime

import os
# Database setup

def init_db():

conn = sqlite3.connect('billing_system.db')

c = conn.cursor()

c.execute('''CREATE TABLE IF NOT EXISTS products (

id INTEGER PRIMARY KEY,

name TEXT,

price REAL,

tax_rate REAL)''')

c.execute('''CREATE TABLE IF NOT EXISTS invoices (

id INTEGER PRIMARY KEY,

date TEXT,

total REAL)''')

conn.commit()

conn.close()

# Add product to the database

def add_product(name, price, tax_rate):

conn = sqlite3.connect('billing_system.db')

c = conn.cursor()

c.execute('INSERT INTO products (name, price, tax_rate) VALUES (?, ?, ?)', (name,

price, tax_rate))

conn.commit()

conn.close()

# Generate invoice and calculate total


def generate_invoice():

conn = sqlite3.connect('billing_system.db')

c = conn.cursor()

# Get selected products and calculate total

total = 0

selected_products = []

for item in product_listbox.curselection():

product_id = product_listbox.get(item).split(" - ")[0]

c.execute('SELECT * FROM products WHERE id = ?', (product_id,))

product = c.fetchone()

price = product[2]

tax_rate = product[3]

total += price + (price * tax_rate / 100)

selected_products.append(product)

# Store invoice in the database

invoice_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

c.execute('INSERT INTO invoices (date, total) VALUES (?, ?)', (invoice_date, total))

conn.commit()

# Display success message

messagebox.showinfo('Invoice Generated', f'Total: {total:.2f}

Invoice saved.')

conn.close()
# GUI setup

root = Tk()

root.title('Invoice Billing System')

root.geometry('600x400')

init_db()

# Labels

Label(root, text="Product List").pack()

# Product listbox (show product id, name, and price)

product_listbox = Listbox(root, selectmode=MULTIPLE, width=50)

product_listbox.pack(pady=10)

# Add product entry fields and button

Label(root, text="Product Name:").pack()

product_name_entry = Entry(root)

product_name_entry.pack()

Label(root, text="Price:").pack()

product_price_entry = Entry(root)

product_price_entry.pack()

Label(root, text="Tax Rate (%):").pack()

product_tax_entry = Entry(root)

product_tax_entry.pack()
def add_product_to_list():

name = product_name_entry.get()

try:

price = float(product_price_entry.get())

tax_rate = float(product_tax_entry.get())

except ValueError:

messagebox.showwarning('Input Error', 'Please enter valid price and tax rate.')

return

add_product(name, price, tax_rate)

product_listbox.insert(END, f'{len(product_listbox.get(0, END)) + 1} - {name} -

{price} - {tax_rate}%')

Button(root, text="Add Product", command=add_product_to_list).pack(pady=5)

# Generate invoice button

Button(root, text="Generate Invoice", command=generate_invoice).pack(pady=10)

root.mainloop()

You might also like