Skip to content
emnextechPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Retail Inventory and Sales System

This project implements a single-store supermarket inventory and sales system for the coursework brief. It includes:

  • A MySQL database schema with sample data and reporting views
  • A Python tkinter desktop prototype for product, supplier, customer, stock, and sales management
  • Submission-ready documentation with requirements, system models, ERD, schema notes, normalization, and presentation slides

Screenshots

Dashboard

Dashboard

Products

Products

Stock / Restock

Stock / Restock

Suppliers

Suppliers

Customers

Customers

Sales Entry

Sales Entry

Sales History

Sales History

Reports

Reports

Reports — Best Sellers

Reports — Best Sellers

Reports — Sales Summary

Reports — Sales Summary

Quick Start (Windows)

# 1) Create and activate a virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1

# 2) Install dependencies
pip install -r requirements.txt

# 3) Ensure MySQL is running and credentials are set in .env
Test-NetConnection 127.0.0.1 -Port 3306

# 4) Create schema + load sample data
python scripts/setup_database.py

# 5) Run the desktop application
python main.py

Project Structure

database/
  schema.sql
  sample_data.sql
  queries.sql
docs/
  project_report.md
  presentation_slides.md
inventory_app/
  __init__.py
  database.py
  ui.py
scripts/
  setup_database.py
assets/
  screenshots/
main.py
requirements.txt
.env.example

Prerequisites

  1. Install MySQL Server 8.x and create or confirm credentials for a user with database creation rights.
  2. Install Python 3.14 or later.
  3. Create and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
  1. Install project dependencies:
pip install -r requirements.txt

Configuration

Copy .env.example to .env and adjust the values if needed:

INVENTORY_DB_HOST=localhost
INVENTORY_DB_PORT=3306
INVENTORY_DB_USER=root
INVENTORY_DB_PASSWORD=your_password
INVENTORY_DB_NAME=retail_inventory_sales_system

The application also reads these values directly from environment variables if you prefer not to use a .env file.

Database Setup

1) Start (and stop) MySQL Server (Windows)

This project needs a running MySQL Server listening on localhost:3306.

  • If you installed MySQL Server using MySQL Installer, it usually runs as a Windows service:
# List candidate services (service name differs per install)
Get-Service | Where-Object { $_.Name -match 'mysq|maria' -or $_.DisplayName -match 'mysq|maria' } |
  Format-Table -AutoSize Name,DisplayName,Status

# Start it (replace with the service name you found, e.g. MySQL, MySQL57, MySQL80)
net start <SERVICE_NAME>

# Stop it
net stop <SERVICE_NAME>
  • If you use XAMPP/Laragon/WAMP, start MySQL from that control panel instead.

Verify MySQL is reachable:

Test-NetConnection localhost -Port 3306

2) Configure the app connection

This application connects using the values in .env. Copy .env.example to .env and set:

  • INVENTORY_DB_HOST: usually localhost
  • INVENTORY_DB_PORT: usually 3306
  • INVENTORY_DB_USER / INVENTORY_DB_PASSWORD: a MySQL user that can create tables/views and insert data
  • INVENTORY_DB_NAME: default is retail_inventory_sales_system

Copy .env.example to .env and set your MySQL credentials:

INVENTORY_DB_HOST=localhost
INVENTORY_DB_PORT=3306
INVENTORY_DB_USER=root
INVENTORY_DB_PASSWORD=your_password
INVENTORY_DB_NAME=retail_inventory_sales_system

3) Create schema + load sample data

Create the database objects and load the sample data using the included setup script:

python scripts/setup_database.py

To create only the schema without seed data:

python scripts/setup_database.py --schema-only

If you see “Database setup failed”, it usually means one of:

  • MySQL Server is not running yet
  • MySQL is running on a different port than 3306
  • Your username/password in .env are incorrect
    • New MySQL installs almost always require a non-empty root password

4) What the setup script does

python scripts/setup_database.py runs the SQL in:

  • database/schema.sql (tables + views)
  • database/sample_data.sql (seed data)

If you want to inspect example SQL queries for reports and operations, see database/queries.sql.

Run the Application

python main.py

How to Use the App

The UI is a desktop management tool built with tkinter/ttk. It is organized into modules (navigation on the left).

Dashboard

  • Quick operational overview: counts, low stock, sales value.

Products

  • Add / update / delete products.
  • Products are linked to suppliers and include pricing, reorder levels, and active status.

Stock / Restock

  • Review stock levels.
  • Restock items by selecting a product and entering a quantity.

Suppliers and Customers

  • Maintain master data (add / update / delete).

Sales Entry

  • Select customer (or “Walk-in Customer”), payment method, and operator name.
  • Add items to the cart and save the sale.
  • Stock is reduced automatically when a sale is saved.

Sales History

  • Review saved sales and the items for each sale.

Reports

  • Low stock alerts
  • Best sellers
  • Date range sales summary

Troubleshooting

“Can't connect to MySQL server on 'localhost:3306'”

  • Start MySQL Server (Windows service or XAMPP/Laragon/WAMP)
  • Verify:
Test-NetConnection 127.0.0.1 -Port 3306

“Access denied for user …”

  • Your .env username/password are wrong, or the user doesn’t have permissions.
  • Confirm credentials by logging in with the MySQL client:
& "C:\Program Files\MySQL\MySQL Server 8.4\bin\mysql.exe" -u <user> -p

Resetting the database

  • Re-run the setup script. The schema script drops and recreates objects.

Notes for Submission

  • The report content is provided in Markdown and can be exported to Word or PDF.
  • The presentation content is provided as slide-ready Markdown and can be copied into PowerPoint or Canva.
  • The assets/screenshots/ folder includes instructions for capturing runtime screenshots after the database and GUI are running on your machine.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages