Skip to content
  • SiteMap
  • Our Services
  • Frequently Asked Questions (FAQ)
  • Support
  • About Us

UpdateGadh

Update Your Skills.

  • Home
  • Projects
    •  Blockchain projects
    • Python Project
    • Data Science
    •  Ai projects
    • Machine Learning
    • PHP Project
    • React Projects
    • Java Project
    • SpringBoot
    • JSP Projects
    • Java Script Projects
    • Code Snippet
    • Free Projects
  • Tutorials
    • Ai
    • Machine Learning
    • Advance Python
    • Advance SQL
    • DBMS Tutorial
    • Data Analyst
    • Deep Learning Tutorial
    • Data Science
    • Nodejs Tutorial
  • Blog
  • Contact us
  • Toggle search form
Bill Management System in Python Free Source Code - Bill Management

Bill Management System in Python Free Source Code

Posted on September 20, 2024September 20, 2024 By Rishabh saini No Comments on Bill Management System in Python Free Source Code

Introduction

Managing bills efficiently is crucial for financial stability, whether for personal use or business operations. A Bill Management System (BMS) simplifies this by automating invoice tracking, payment processing, and financial reporting. This blog post explores the key features and benefits of BMS, demonstrating how it enhances financial control, reduces errors, and saves time, making financial management more streamlined and effective.

Bill Management System in Python Free Source Code

Table of Contents

  • Introduction
  • Core Features
  • Technologies Used
  • Setting Up
  • Step-by-Step Guide
    • 1. Creating the Project Structure
    • 2. Setting Up the Database
    • 3. Adding New Bills
    • 4. Viewing All Bills
    • 5. Updating Bill Information
    • 6. Deleting a Bill
    • 7. Searching for a Bill
  • Complete Source Code

Core Features

  1. Add New Bills: Enter bill details such as bill type, amount, due date, and status (paid/unpaid).
  2. Update Existing Bills: Modify the details of existing bills.
  3. Delete Bills: Remove bills that are no longer needed.
  4. View All Bills: Show the status of each bill in a list.
  5. Search for a Bill: Quickly find a bill by its type or date.

Technologies Used

  • Python: The main programming language for building the system.
  • SQLite:Bill data is managed and stored in a lightweight database.
  • Tkinter (Optional): A Python library for creating a simple graphical user interface (GUI) if you prefer not to use the command line.

Setting Up

Make sure Python is installed on your machine before we start. You can download it from python.org. We will also be using SQLite, which comes bundled with Python.

Step-by-Step Guide

1. Creating the Project Structure

Start by creating a new directory for your project and inside it, create a Python script file named bill_management.py.

mkdir bill_management_system
cd bill_management_system
touch bill_management.py

2. Setting Up the Database

We will use SQLite to store our bill data. In your bill_management.py, import the sqlite3 library and set up the connection to the database.

import sqlite3

# Connect to the SQLite database (or create it if it doesn't exist)
conn = sqlite3.connect('bills.db')

# Create a cursor object to execute SQL commands
cursor = conn.cursor()

# Create a table for storing bill information
cursor.execute('''CREATE TABLE IF NOT EXISTS bills (
                    id INTEGER PRIMARY KEY,
                    bill_type TEXT,
                    amount REAL,
                    due_date TEXT,
                    status TEXT
                )''')

# Commit the changes and close the connection
conn.commit()

This code snippet creates a bills table in an SQLite database. The table has columns for id, bill_type, amount, due_date, and status.

3. Adding New Bills

Next, let’s create a function to add new bills to the database:

def add_bill(bill_type, amount, due_date, status):
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()

    cursor.execute("INSERT INTO bills (bill_type, amount, due_date, status) VALUES (?, ?, ?, ?)",
                   (bill_type, amount, due_date, status))

    conn.commit()
    conn.close()
    print("Bill added successfully!")

You can call this function in your script to add a bill:

add_bill('Electricity', 120.50, '2024-10-01', 'Unpaid')

4. Viewing All Bills

To view all the bills stored in the database, we’ll create a function that fetches and displays them:

def view_bills():
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()

    cursor.execute("SELECT * FROM bills")
    bills = cursor.fetchall()

    for bill in bills:
        print(f"ID: {bill[0]}, Type: {bill[1]}, Amount: {bill[2]}, Due Date: {bill[3]}, Status: {bill[4]}")

    conn.close()

Calling view_bills() will print out a list of all bills in the database.

5. Updating Bill Information

We can also create a function to update an existing bill’s information:

def update_bill(bill_id, bill_type=None, amount=None, due_date=None, status=None):
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()

    if bill_type:
        cursor.execute("UPDATE bills SET bill_type = ? WHERE id = ?", (bill_type, bill_id))
    if amount:
        cursor.execute("UPDATE bills SET amount = ? WHERE id = ?", (amount, bill_id))
    if due_date:
        cursor.execute("UPDATE bills SET due_date = ? WHERE id = ?", (due_date, bill_id))
    if status:
        cursor.execute("UPDATE bills SET status = ? WHERE id = ?", (status, bill_id))

    conn.commit()
    conn.close()
    print("Bill updated successfully!")

Use this function to update specific fields of a bill:

update_bill(1, amount=130.75, status='Paid')

6. Deleting a Bill

To delete a bill, implement the following function:

https://updategadh.com/free-projects/hotel-management/
def delete_bill(bill_id):
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()

    cursor.execute("DELETE FROM bills WHERE id = ?", (bill_id,))

    conn.commit()
    conn.close()
    print("Bill deleted successfully!")

You can remove a bill by passing its ID to this function:

delete_bill(1)

7. Searching for a Bill

Lastly, let’s add a function to search for a specific bill by its type or due date:

def search_bills(search_term):
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()

    cursor.execute("SELECT * FROM bills WHERE bill_type LIKE ? OR due_date LIKE ?", 
                   ('%' + search_term + '%', '%' + search_term + '%'))
    bills = cursor.fetchall()

    for bill in bills:
        print(f"ID: {bill[0]}, Type: {bill[1]}, Amount: {bill[2]}, Due Date: {bill[3]}, Status: {bill[4]}")

    conn.close()

Search for bills by calling search_bills() with your search term:

search_bills('Electricity')

Complete Source Code

Here’s the complete source code combining all the functionalities:

import sqlite3

# Function to set up the database
def setup_database():
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    cursor.execute('''CREATE TABLE IF NOT EXISTS bills (
                        id INTEGER PRIMARY KEY,
                        bill_type TEXT,
                        amount REAL,
                        due_date TEXT,
                        status TEXT
                    )''')
    conn.commit()
    conn.close()

# Function to add a new bill
def add_bill():
    bill_type = input("Enter the bill type: ")
    amount = float(input("Enter the amount: "))
    due_date = input("Enter the due date (YYYY-MM-DD): ")
    status = input("Enter the status (e.g., Unpaid, Paid): ")
    
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    cursor.execute("INSERT INTO bills (bill_type, amount, due_date, status) VALUES (?, ?, ?, ?)",
                   (bill_type, amount, due_date, status))
    conn.commit()
    conn.close()
    print("Bill added successfully!")

# Function to view all bills
def view_bills():
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM bills")
    bills = cursor.fetchall()
    if bills:
        for bill in bills:
            print(f"ID: {bill[0]}, Type: {bill[1]}, Amount: {bill[2]}, Due Date: {bill[3]}, Status: {bill[4]}")
    else:
        print("No bills found.")
    conn.close()

# Function to update a bill
def update_bill():
    bill_id = int(input("Enter the ID of the bill to update: "))
    bill_type = input("Enter the new bill type (or press Enter to skip): ")
    amount = input("Enter the new amount (or press Enter to skip): ")
    due_date = input("Enter the new due date (or press Enter to skip): ")
    status = input("Enter the new status (or press Enter to skip): ")
    
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    if bill_type:
        cursor.execute("UPDATE bills SET bill_type = ? WHERE id = ?", (bill_type, bill_id))
    if amount:
        cursor.execute("UPDATE bills SET amount = ? WHERE id = ?", (float(amount), bill_id))
    if due_date:
        cursor.execute("UPDATE bills SET due_date = ? WHERE id = ?", (due_date, bill_id))
    if status:
        cursor.execute("UPDATE bills SET status = ? WHERE id = ?", (status, bill_id))
    conn.commit()
    conn.close()
    print("Bill updated successfully!")

# Function to delete a bill
def delete_bill():
    bill_id = int(input("Enter the ID of the bill to delete: "))
    
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    cursor.execute("DELETE FROM bills WHERE id = ?", (bill_id,))
    conn.commit()
    conn.close()
    print("Bill deleted successfully!")

# Function to search for a bill
def search_bills():
    search_term = input("Enter a search term (bill type or due date): ")
    
    conn = sqlite3.connect('bills.db')
    cursor = conn.cursor()
    cursor.execute("SELECT * FROM bills WHERE bill_type LIKE ? OR due_date LIKE ?",
                   ('%' + search_term + '%', '%' + search_term + '%'))
    bills = cursor.fetchall()
    if bills:
        for bill in bills:
            print(f"ID: {bill[0]}, Type: {bill[1]}, Amount: {bill[2]}, Due Date: {bill[3]}, Status: {bill[4]}")
    else:
        print("No matching bills found.")
    conn.close()

# Setting up the database
setup_database()

# Main menu
def main_menu():
    while True:
        print("\nBill Management System")
        print("1. Add a Bill")
        print("2. View All Bills")
        print("3. Update a Bill")
        print("4. Delete a Bill")
        print("5. Search Bills")
        print("6. Exit")

        choice = input("Choose an option (1-6): ")
        if choice == '1':
            add_bill()
        elif choice == '2':
            view_bills()
        elif choice == '3':
            update_bill()
        elif choice == '4':
            delete_bill()
        elif choice == '5':
            search_bills()
        elif choice == '6':
            print("Thank you for using the Bill Management System. Goodbye!")
            break
        else:
            print("Invalid choice, please try again.")

main_menu()
Bill Management System in Python Free Source Code
Bill Management System in Python Free Source Code
Bill Management System in Python Free Source Code
Bill Management System in Python Free Source Code
Bill Management System in Python with Source Code
  • New Project :-https://www.youtube.com/@Decodeit2
  • PHP PROJECT:- CLICK HERE
  • bill management system in python
  • bill management system project in python
  • simple Bill Management System in Python Free Source Code
  • billing system python project
  • billing management system project in python
  • python source code for billing system
  • python Bill Management System in Python Free Source Code
  • Bill Management System in Python Free Source Code

Post Views: 781
code Snippets Tags:billing management system python source code, billing system in python, billing system project in python with source code, create a customer billing system in python, employee management system in python, gst billing project in python django with source code, how to create a customer billing system in python, management system in python, python project with source code, restaurant billing system in python, restaurant management system using python

Post navigation

Previous Post: Instagram Clone Using HTML, CSS with Free Code
Next Post: Book Library in JavaScript With Free Code

More Related Articles

Doodle Jump Game in JAVA with Source Code - Java Doodle Jump Game with Source Code Doodle Jump Game in JAVA with Source Code code Snippets
Data Types in PHP Data Types in PHP code Snippets
Bus Ticket Booking PHP Free Source Code - Bus Ticket Booking Bus Ticket Booking PHP Free Source Code code Snippets

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may also like

  1. Supply Chain Management PHP and CSS
  2. Online Shopping System using PHP, MySQL with Free Source Code
  3. F1 Race Road Game in Python Free Source Code
  4. Create Address Book in Python with Source Code
  5. Contact Management in Python with Source Code
  6. Movie Management System in Python with Source Code

Most Viewed Posts

  1. Top Large Language Models in 2025
  2. Online Shopping System using PHP, MySQL with Free Source Code
  3. login form in php and mysql , Step-by-Step with Free Source Code
  4. Flipkart Clone using PHP And MYSQL Free Source Code
  5. News Portal Project in PHP and MySql Free Source Code
  6. User Login & Registration System Using PHP and MySQL Free Code
  7. Top 10 Final Year Project Ideas in Python
  8. Blog Site In PHP And MYSQL With Source Code || Best Project
  9. Online Bike Rental Management System Using PHP and MySQL
  10. E learning Website in php with Free source code
  • AI
  • ASP.NET
  • Blockchain
  • ChatCPT
  • code Snippets
  • Collage Projects
  • Data Science Project
  • Data Science Tutorial
  • DBMS Tutorial
  • Deep Learning Tutorial
  • Final Year Projects
  • Free Projects
  • How to
  • html
  • Interview Question
  • Java Notes
  • Java Project
  • Java Script Notes
  • JAVASCRIPT
  • Javascript Project
  • JSP JAVA(J2EE)
  • Machine Learning Project
  • Machine Learning Tutorial
  • MySQL Tutorial
  • Node.js Tutorial
  • PHP Project
  • Portfolio
  • Python
  • Python Interview Question
  • Python Projects
  • PythonFreeProject
  • React Free Project
  • React Projects
  • Spring boot
  • SQL Tutorial
  • TOP 10
  • Uncategorized
  • Real-Time Medical Queue & Appointment System with Django
  • Online Examination System in PHP with Source Code
  • AI Chatbot for College and Hospital
  • Job Portal Web Application in PHP MySQL
  • Online Tutorial Portal Site in PHP MySQL — Full Project with Source Code

Most Viewed Posts

  • Top Large Language Models in 2025 (8,616)
  • Online Shopping System using PHP, MySQL with Free Source Code (5,227)
  • login form in php and mysql , Step-by-Step with Free Source Code (4,875)

Copyright © 2026 UpdateGadh.

Powered by PressBook Green WordPress theme