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
tkinterdesktop prototype for product, supplier, customer, stock, and sales management - Submission-ready documentation with requirements, system models, ERD, schema notes, normalization, and presentation slides
# 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.pydatabase/
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
- Install MySQL Server 8.x and create or confirm credentials for a user with database creation rights.
- Install Python 3.14 or later.
- Create and activate a virtual environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1- Install project dependencies:
pip install -r requirements.txtCopy .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.
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 3306This application connects using the values in .env. Copy .env.example to .env and set:
INVENTORY_DB_HOST: usuallylocalhostINVENTORY_DB_PORT: usually3306INVENTORY_DB_USER/INVENTORY_DB_PASSWORD: a MySQL user that can create tables/views and insert dataINVENTORY_DB_NAME: default isretail_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
Create the database objects and load the sample data using the included setup script:
python scripts/setup_database.pyTo create only the schema without seed data:
python scripts/setup_database.py --schema-onlyIf 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
.envare incorrect- New MySQL installs almost always require a non-empty root password
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.
python main.pyThe UI is a desktop management tool built with tkinter/ttk. It is organized into modules (navigation on the left).
- Quick operational overview: counts, low stock, sales value.
- Add / update / delete products.
- Products are linked to suppliers and include pricing, reorder levels, and active status.
- Review stock levels.
- Restock items by selecting a product and entering a quantity.
- Maintain master data (add / update / delete).
- 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.
- Review saved sales and the items for each sale.
- Low stock alerts
- Best sellers
- Date range sales summary
- Start MySQL Server (Windows service or XAMPP/Laragon/WAMP)
- Verify:
Test-NetConnection 127.0.0.1 -Port 3306- Your
.envusername/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- Re-run the setup script. The schema script drops and recreates objects.
- 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.









