Inventory Management System Using Python

Inventory Management System Using Python

Introduction

The Inventory Management System is a Python-based project built using Tkinter, which provides a simple graphical user interface (GUI). This system makes it easier for businesses to manage their inventory, including products, suppliers, employees, and sales. It also handles billing, allowing businesses to keep track of sales transactions and invoices.

The system is made up of 8 Python scripts that all work together to make the system function smoothly. These scripts use different Python libraries like Tkinter for the interface, Pillow (PIL) for image handling, SQLite3 for the database, and os for file management. Each script has a specific job, such as managing employees, products, or sales.

The main goal of this system is to simplify inventory management. Businesses can use it to keep track of stock, suppliers, and employees, making their workflow more efficient. The user interface is easy to use, and everything you need is just a click away. You can add new products, employees, suppliers, and even manage sales and billing, all in one place.

 

How to Run the Code

Running the Inventory Management System on your computer is straightforward. Here are the steps:

  1. Install Python Libraries: Before you run the system, you need to install some Python libraries. Open your terminal or command prompt and run the following commands:

     
    pip install time
    pip install pil
    pip install sqlite3
    pip install os
    
  2. Set Up the Database:

    • Go to the folder where you have saved the project files.

    • First, run the create_db.py script. This will create the database and tables needed for the system to work.

    • Open your terminal and run this command:

      python create_db.py
      
  3. Start the Dashboard:

    • Once the database is set up, run the dashboard.py script to open the main interface.

    • Use the following command:

       
      python dashboard.py
      
  4. Add and Manage Data:

    • In the dashboard, you can add and manage data like employees, suppliers, products, and sales.

    • Click on the relevant buttons to add or update data, or view your sales and billing records.

Code Explanation

Here’s a breakdown of some of the important parts of the code:

  1. create_db.py:
    This script sets up the database. It creates the tables where all the data, such as employee details, products, and suppliers, will be stored. The script uses SQLite3, a simple database system.

    Example code:

     
    import sqlite3
    
    def create_database():
        conn = sqlite3.connect('inventory.db')
        c = conn.cursor()
    
        # Create the tables
        c.execute('''CREATE TABLE IF NOT EXISTS employees
                     (id INTEGER PRIMARY KEY, name TEXT, email TEXT, contact TEXT)''')
        c.execute('''CREATE TABLE IF NOT EXISTS products
                     (id INTEGER PRIMARY KEY, name TEXT, category TEXT, supplier TEXT, price REAL)''')
        conn.commit()
        conn.close()
    

    This ensures that when you first start the system, the database is ready to store data.

  2. dashboard.py:
    The dashboard.py file controls the main interface of the system. It shows buttons for managing employees, suppliers, products, and sales. When you click any button, the corresponding screen for managing that data opens.

    Example code:

     
    import tkinter as tk
    from tkinter import messagebox
    
    def open_employee_screen():
        # Open the employee management screen
        employee_screen = tk.Toplevel(window)
        employee_screen.title("Employee Management")
    
    window = tk.Tk()
    window.title("Inventory Management Dashboard")
    
    btn_employee = tk.Button(window, text="Employee", command=open_employee_screen)
    btn_employee.pack()
    
    window.mainloop()
    

    The code uses Tkinter to create buttons and windows, making the interface interactive and user-friendly.

  3. employee.py:
    This script manages employee data. You can add new employees or search for existing ones by name, email, or contact details. It allows you to update or delete employee records.

    Example code:

     
    def add_employee(name, email, contact):
        conn = sqlite3.connect('inventory.db')
        c = conn.cursor()
        c.execute("INSERT INTO employees (name, email, contact) VALUES (?, ?, ?)", (name, email, contact))
        conn.commit()
        conn.close()
    
  4. billing.py:
    The billing.py script handles everything related to billing. It calculates the total price of the products selected by the customer, including any discounts. It also generates invoices.

    Example code:

    def calculate_total(products, discounts):
        total = sum([product['price'] for product in products])
        discount_amount = total * (discounts / 100)
        return total - discount_amount
    

    This script is important because it helps the system calculate the total bill for each sale and generate invoices.


Provided Code

Here’s a list of the Python files used in this project:

  1. create_db.py – Sets up the database and tables.

  2. dashboard.py – Controls the main dashboard interface.

  3. employee.py – Manages employee records.

  4. supplier.py – Manages supplier data.

  5. product.py – Manages product details.

  6. category.py – Handles product categories.

  7. sales.py – Tracks sales transactions.

  8. billing.py – Handles billing and invoice generation.

Source Code

Your download is starting now...

Output

More Projects:

Get Huge Discounts
More Python Projects