Shop Management System
Class 12 — Informatics Practices (IP) Project
Student: Sasi
Date: December 3,
2025
Certificate
CERTIFICATE
This is to certify that the project entitled "Shop Management System" submitted by
Sasi (Class 12) to the school is a bonafide record of the work carried out by the
student under my supervision.
Teacher's Signature: Date: //
Acknowledgement
ACKNOWLEDGEMENT
I express my sincere gratitude to my teacher and school for their guidance. I
would also like to thank my parents and friends for their encouragement.
Index
CONTENTS
1. Title Page
2. Certificate
3. Acknowledgement
4. Index
5. Introduction
6. Objectives
7. Software & Hardware Requirements
8. System Study (ER Diagram & Flowchart)
9. Modules and Algorithms
[Link] Code (Python - Tkinter + SQLite)
[Link] Outputs (text)
[Link]
[Link]
[Link]
Introduction
INTRODUCTION
A Shop Management System helps shopkeepers manage products, customers, sales and
inventory efficiently. This project implements a desktop application using Python with a
graphical
interface (Tkinter) and uses SQLite as the database engine.
Key features:
- Add / update / delete products
- Record sales (generate simple receipts)
- Search products and view low-stock alerts
- Maintain simple customer records
Objectives
OBJECTIVES
- To develop an easy-to-use desktop application for small shops.
- To learn database connectivity and GUI programming.
- To implement CRUD operations (Create, Read, Update, Delete).
- To generate and view simple sales records and inventory status.
Requirements
SOFTWARE & HARDWARE REQUIREMENTS
Software:
- Python 3.8+ (recommended)
- Standard libraries: sqlite3, tkinter
- Optional: pillow (PIL) if image handling is added
Hardware:
- Any PC or laptop with at least 2GB RAM and 100MB free disk space.
System Study
SYSTEM STUDY
Entities:
- Product(product_id, name, price, quantity, category)
- Customer(customer_id, name, phone)
- Sale(sale_id, date, product_id, quantity, total_amount)
Relationships:
- A Sale references one Product and optionally one Customer.
- A Product can appear in many Sales.
ER Diagram (textual):
Product ---< Sale >--- Customer
Flowchart (high level):
1. Start
2. Login (optional)
3. Main Menu
- Manage Products
- Manage Customers
- Record Sale
- View Reports
4. Exit
Modules & Algorithms
MODULES & ALGORITHMS
Modules:
1. product_manager: add, update, delete, list, search products.
2. customer_manager: add, list customers.
3. sales_manager: create sale, update inventory, store sale record.
4. gui_main: Tkinter GUI for user interaction.
Algorithm to record a sale (simplified):
- Input product id and quantity
- Fetch product details from DB
- If quantity available >= requested:
- Compute total = price * quantity
- Insert a sale record into sale table with date and total
- Reduce product quantity by requested amount and update DB
- Show receipt to
user Else:
- Show 'Insufficient stock' message
Flowchart (ASCII)
FLOWCHART (ASCII)
+---------------+
| Start |
+---------------+
|
v
+---------------+
| Main Menu |
+---------------+
| | | |
v v v v
Prod Cust Sale Report
Mgmt Mgmt Mgmt View
Source Code (Python)
# Shop Management System (Class 12 IP) - Simple implementation
# Requirements: Python 3.x (sqlite3 and tkinter are in standard library)
import sqlite3
import tkinter as
tk
from tkinter import ttk,
messagebox import datetime
DB_FILE =
'shop_management.db' def
init_db():
conn = [Link](DB_FILE)
c = [Link]()
[Link](\"\"\"
CREATE TABLE IF NOT EXISTS product (
product_id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
category TEXT,
price REAL NOT NULL,
quantity INTEGER NOT NULL
)
\"\"\")
[Link](\"\"\"
CREATE TABLE IF NOT EXISTS customer (
customer_id INTEGER PRIMARY KEY
AUTOINCREMENT, name TEXT NOT NULL,
phone TEXT
)
\"\"\")
[Link](\"\"\"
CREATE TABLE IF NOT EXISTS sale (
sale_id INTEGER PRIMARY KEY AUTOINCREMENT,
date TEXT NOT NULL,
product_id INTEGER,
quantity INTEGER,
total_amount REAL,
FOREIGN KEY(product_id) REFERENCES product(product_id)
)
\"\"\")
[Link]()
[Link]()
# Product operations
def add_product(name, category,
price, qty): conn =
[Link](DB_FILE)
c = [Link]()
[Link]('INSERT INTO product (name, category, price, quantity) VALUES (?, ?, ?,
?)', (name, category, price, qty))
[Link]()
[Link]()
def update_product(pid, name, category, price,
qty): conn = [Link](DB_FILE)
c = [Link]()
[Link]('UPDATE product SET name=?, category=?, price=?, quantity=? WHERE
product_id=?', (name, category, price, qty, pid))
[Link]()
[Link]()
def delete_product(pid):
conn =
[Link](DB_FILE) c =
[Link]()
[Link]('DELETE FROM product WHERE product_id=?',
(pid,)) [Link]()
[Link]()
def list_products():
conn =
[Link](DB_FILE) c =
[Link]()
[Link]('SELECT product_id, name, category, price, quantity FROM
product') rows = [Link]()
[Link]()
return rows
def get_product(pid):
conn =
[Link](DB_FILE) c =
[Link]()
[Link]('SELECT product_id, name, category, price, quantity FROM product
WHERE product_id=?', (pid,))
row =
[Link]()
[Link]()
return row
# Sale operations
def record_sale(product_id,
qty): prod =
get_product(product_id) if
prod is None:
return False, 'Product not found'
_, name, category, price, available =
prod if available < qty:
return False, 'Insufficient
stock' total = price * qty
conn =
[Link](DB_FILE) c =
[Link]()
date = [Link]().strftime('%Y-%m-%d %H:%M:%S')
[Link]('INSERT INTO sale (date, product_id, quantity, total_amount) VALUES (?, ?, ?,
?)',
(date, product_id, qty, total))
[Link]('UPDATE product SET quantity=? WHERE product_id=?', (available -
qty, product_id))
[Link]()
[Link]()
return True,
total
# --- Simple Tkinter GUI to demonstrate basic
operations --- class ShopApp:
def init (self, root):
[Link] = root
[Link]('Shop Management System - Class 12')
[Link]('780x520')
self.create_widgets(
)
self.refresh_product
s()
def
create_widgets(self)
: # Product frame
prod_frame = [Link]([Link], text='Product Management')
prod_frame.place(x=10, y=10, width=760, height=220)
[Link](prod_frame, text='Name:').place(x=10, y=10)
[Link] = [Link](prod_frame); [Link](x=70, y=10, width=200)
[Link](prod_frame, text='Category:').place(x=290, y=10)
[Link] = [Link](prod_frame); [Link](x=360, y=10, width=150)
[Link](prod_frame, text='Price:').place(x=10, y=40)
[Link] = [Link](prod_frame); [Link](x=70, y=40, width=100)
[Link](prod_frame, text='Qty:').place(x=190, y=40)
[Link] = [Link](prod_frame); [Link](x=230, y=40, width=60)
[Link](prod_frame, text='Add Product', command=self.add_product).place(x=310,
y=40) [Link](prod_frame, text='Update Selected',
command=self.update_selected).place(x=420, y=40)
[Link](prod_frame, text='Delete Selected',
command=self.delete_selected).place(x=540, y=40)
# Product list
cols = ('ID','Name','Category','Price','Qty')
[Link] = [Link](prod_frame, columns=cols,
show='headings') for c in cols:
[Link](c, text=c)
[Link](x=10, y=80, width=730, height=120)
[Link]('<<TreeviewSelect>>', self.on_select)
# Sales frame
sale_frame = [Link]([Link], text='Sales')
sale_frame.place(x=10, y=240, width=760,
height=120) [Link](sale_frame, text='Product
ID:').place(x=10, y=10)
self.s_pid = [Link](sale_frame); self.s_pid.place(x=90, y=10, width=80)
[Link](sale_frame, text='Quantity:').place(x=190, y=10)
self.s_qty = [Link](sale_frame); self.s_qty.place(x=260, y=10, width=60)
[Link](sale_frame, text='Record Sale',
command=self.record_sale).place(x=340, y=8) [Link] =
[Link](sale_frame, height=4, width=80)
[Link](x=10, y=40)
# Report frame
rep_frame = [Link]([Link], text='Reports /
Actions') rep_frame.place(x=10, y=370, width=760,
height=130) [Link](rep_frame, text='Refresh Products',
command=self.refresh_products).place(x=10, y=10)
[Link](rep_frame, text='Low Stock Alert',
command=self.show_low_stock).place(x=140, y=10)
[Link](rep_frame, text='Show Sales (console)',
command=self.show_sales_console).place(x=260, y=10)
[Link](rep_frame, text='Exit', command=[Link]).place(x=380, y=10)
def
add_product(self):
try:
name =
[Link]().strip() cat =
[Link]().strip()
price =
float([Link]().strip()) qty
= int([Link]().strip())
if name == '':
[Link]('Error','Name
required') return
add_product(name, cat, price, qty)
[Link]('Success','Product added')
self.refresh_products()
except Exception as e:
[Link]('Error', str(e))
def refresh_products(self):
for i in [Link].get_children():
[Link](i)
for row in list_products():
[Link]('', 'end',
values=row)
def on_select(self,
event): sel =
[Link]() if
not sel: return
vals = [Link](sel[0])
['values'] pid, name, cat, price,
qty = vals
[Link](0,'end'); [Link](0, name)
[Link](0,'end'); [Link](0, cat)
[Link](0,'end'); [Link](0, price)
[Link](0,'end'); [Link](0, qty)
def
update_selected(self)
: sel =
[Link]() if
not sel:
[Link]('Error','Select a product
first') return
pid = [Link](sel[0])
['values'][0] try:
name =
[Link]().strip() cat =
[Link]().strip()
price =
float([Link]().strip()) qty
= int([Link]().strip())
update_product(pid, name, cat, price, qty)
[Link]('Success','Product updated')
self.refresh_products()
except Exception as e:
[Link]('Error', str(e))
def
delete_selected(self):
sel =
[Link]() if
not sel:
[Link]('Error','Select a product
first') return
pid = [Link](sel[0])['values'][0]
delete_product(pid)
[Link]('Success','Product
deleted') self.refresh_products()
def
record_sale(self):
try:
pid =
int(self.s_pid.get().strip())
qty =
int(self.s_qty.get().strip())
ok, res = record_sale(pid,
qty) if not ok:
[Link]('Error',
res) else:
total = res
receipt_text = f"Receipt\\nProduct ID: {pid}\\nQuantity: {qty}\\nTotal:
{total}\\nDate: {[Link]()}"
[Link]('1.0', 'end')
[Link]('1.0', receipt_text)
[Link]('Success', f'Sale recorded. Total = {total}')
self.refresh_products()
except Exception as e:
[Link]('Error', str(e))
def show_low_stock(self):
rows = [r for r in list_products() if r[4] <= 5]
if not rows:
[Link]('Low Stock', 'No low stock
items') return
msg = "Low stock products:\\n" + "\\n".join([f"{r[1]} (ID {r[0]}) -
Qty {r[4]}" for r in rows])
[Link]('Low Stock', msg)
def show_sales_console(self):
conn =
[Link](DB_FILE) c =
[Link]()
[Link]('SELECT sale_id, date, product_id, quantity, total_amount FROM sale
ORDER BY sale_id DESC LIMIT 20')
rows = [Link]()
[Link]()
print('Recent
Sales:') for r in
rows:
print(r)
[Link]('Sales', 'Recent sales printed to console')
if name == ' main
': init_db()
root = [Link]()
app = ShopApp(root)
[Link]()
Sample Outputs
SAMPLE OUTPUTS (textual)
1) Adding a product:
- Fill Name, Category, Price and Qty in Product Management and click 'Add Product'.
- Message: 'Product added'
2) Recording a sale (example):
- Product ID: 1
- Quantity: 2
If available, message: 'Sale recorded. Total =
400.0' Receipt shown in Sales area.
3) Low stock alert:
If product qty <= 5, a dialog shows product names and quantities.
(Notes: The GUI is simple and designed for demo. Screenshots can be produced by
running the app.)
Testing
TESTING
- Unit testing: manual testing of product add/update/delete, sale
recording, low stock detection.
- Edge cases: recording sale with insufficient stock, deleting product used in
previous sales (allowed but will not remove historical sale records).
- Database file: shop_management.db will be created in the working directory.
Conclusion
CONCLUSION
This Shop Management System demonstrates basic GUI programming, database operations,
and CRUD functionality suitable for a Class 12 IP project. It can be extended with features
like:
- User authentication (login)
- PDF receipts
- Reports with date ranges
- Product images and categories
Bibliography
BIBLIOGRAPHY
- Python official docs: [Link]
- Tkinter documentation and tutorials
- SQLite documentation