COMPUTER SCIENCE PROJECT
RESTAURANT MANAGEMENT SYSTEM
Name:- Rohan Choudhary
Class:- XIIth A
Roll no:- 22
Group 1
ACKNOWLEDGEMENT
I would like to express my heartfelt gratitude to my subject
teacher Monika Sharma Mam for her guidance, my
honorable Principal Sir and Vice Principal Mam for
providing me with all the facilities that was required. I
would also like express my special thanks to parents and
friends for helping me to complete this Project File.
Date:
XII-Science
CERTIFICATE
This is to certify that _____________ of class XII-Science
has successfully completed his Computer Science
Practical File during the session 2025-26. This Project File
is as per AISSCE conducted by CBSE, New Delhi.
Hardware and Software Required
● Hardware:-
1. Desktop Computer
2. PC
● Software:-
1. Python (latest Version)
2. MySQL
3. Python connector module
INTRODUCTION
WELCOME TO RESTAURANT PORTAL
The Restaurant Management Portal is a complete backend driven system
developed using Python and MySQL to automate and streamline the day
to day operations of a restaurant. This portal is designed to replace
manual order tracking, inventory management, and billing processes with
a structured and reliable digital solution. By integrating Python with a
MySQL database through the mysql connector library, the system ensures
data consistency, accuracy, and long term storage of all restaurant
activities.
This portal operates as a command line based application, making it
lightweight, fast, and suitable for environments where graphical interfaces
are not required. Despite being CLI based, the system supports all
essential restaurant operations such as menu handling, order processing,
inventory updates, user authentication, and sales reporting.
The core objective of this system is to provide a centralized platform
where administrators and staff members can efficiently perform their roles
while maintaining full transparency and control over restaurant data.
Key Features of the Portal
User Authentication and Role Management
The portal includes a secure login system that differentiates users based
on roles such as administrator and staff. Administrators have full control
over the system including menu management and sales reporting, while
staff members are restricted to operational tasks such as viewing the
menu and creating customer orders. This role based access control
ensures operational security and prevents unauthorized actions.
Menu Management System
Administrators can add new menu items by specifying item names, prices,
and available stock. The menu data is stored permanently in the MySQL
database and can be viewed at any time by both administrators and staff.
This feature allows quick updates to pricing and stock levels without
altering the core application code.
Order Processing and Billing
The portal enables staff members to create customer orders by selecting
menu items and quantities. The system automatically calculates the total
bill amount based on item prices and quantities selected. Each order is
recorded in the database with a timestamp and the staff member
responsible for the transaction, ensuring complete traceability.
Inventory Tracking and Stock Management
Inventory levels are updated automatically whenever an order is placed.
The system prevents orders from being created if sufficient stock is not
available. Every stock change is logged in the inventory logs table along
with the reason and timestamp, allowing administrators to monitor
inventory movement and identify discrepancies.
Sales Reporting and Data Analysis
The portal includes a sales reporting feature that generates daily revenue
summaries based on recorded orders. This allows administrators to track
business performance, analyze trends, and make data driven decisions.
Since all data is stored in a relational database, the system can be
extended easily for more advanced analytics in the future.
Database Automation and Reliability
The system automatically creates the required database and tables on first
run, eliminating manual setup steps. This ensures that the portal can be
deployed quickly and consistently across different systems. MySQL
provides reliability, data integrity, and scalability, making the solution
suitable for small to medium scale restaurant operations.
Mission and Vision
The mission of the Restaurant Management Portal is to simplify restaurant
operations by providing a reliable, efficient, and easy to use digital system
that minimizes manual errors and improves workflow efficiency. The portal
aims to help restaurant staff focus on customer service rather than
paperwork and manual calculations.
Our vision is to build a scalable foundation that can evolve into a complete
restaurant management ecosystem. The current system is designed with
extensibility in mind, allowing future enhancements such as graphical user
interfaces, online ordering, analytics dashboards, and cloud deployment
without rewriting the core logic.
By combining Python's simplicity with MySQL's robustness, this portal
demonstrates how practical software solutions can be built to solve real
world operational problems in the food service industry.
PYTHON SOURCE
CODE
import [Link]
from [Link] import Error
from datetime import datetime
import sys
# ===================== DATABASE CONFIG
=====================
DB_CONFIG = {
"host": "localhost",
"user": "root",
"password": "your_mysql_password_here"
}
DB_NAME = "restaurant_db"
# ===================== DATABASE CONNECTION
=====================
def get_connection(db=None):
config = DB_CONFIG.copy()
if db:
config["database"] = db
return [Link](**config)
# ===================== DATABASE SETUP
=====================
def setup_database():
conn = get_connection()
cursor = [Link]()
[Link](f"CREATE DATABASE IF NOT EXISTS {DB_NAME}")
[Link]()
[Link]()
[Link]()
conn = get_connection(DB_NAME)
cursor = [Link]()
[Link]("""
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
role ENUM('admin','staff') NOT NULL
)
""")
[Link]("""
CREATE TABLE IF NOT EXISTS menu (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
price DECIMAL(10,2),
stock INT
)
""")
[Link]("""
CREATE TABLE IF NOT EXISTS orders (
id INT AUTO_INCREMENT PRIMARY KEY,
staff_id INT,
total DECIMAL(10,2),
created_at DATETIME,
FOREIGN KEY (staff_id) REFERENCES users(id)
)
""")
[Link]("""
CREATE TABLE IF NOT EXISTS order_items (
id INT AUTO_INCREMENT PRIMARY KEY,
order_id INT,
menu_id INT,
quantity INT,
price DECIMAL(10,2),
FOREIGN KEY (order_id) REFERENCES orders(id),
FOREIGN KEY (menu_id) REFERENCES menu(id)
)
""")
[Link]("""
CREATE TABLE IF NOT EXISTS inventory_logs (
id INT AUTO_INCREMENT PRIMARY KEY,
menu_id INT,
change_qty INT,
reason VARCHAR(255),
log_time DATETIME,
FOREIGN KEY (menu_id) REFERENCES menu(id)
)
""")
[Link]()
[Link]()
[Link]()
# ===================== USER MANAGEMENT
=====================
def create_default_admin():
conn = get_connection(DB_NAME)
cursor = [Link]()
[Link]("SELECT * FROM users WHERE role='admin'")
if not [Link]():
[Link](
"INSERT INTO users (username, password, role) VALUES
(%s,%s,%s)",
("admin", "admin123", "admin")
)
[Link]()
[Link]()
[Link]()
def login():
username = input("Username: ")
password = input("Password: ")
conn = get_connection(DB_NAME)
cursor = [Link](dictionary=True)
[Link](
"SELECT * FROM users WHERE username=%s AND password=%s",
(username, password)
)
user = [Link]()
[Link]()
[Link]()
if not user:
print("Invalid credentials")
return None
return user
# ===================== MENU MANAGEMENT
=====================
def add_menu_item():
name = input("Item name: ")
price = float(input("Price: "))
stock = int(input("Stock: "))
conn = get_connection(DB_NAME)
cursor = [Link]()
[Link](
"INSERT INTO menu (name, price, stock) VALUES (%s,%s,%s)",
(name, price, stock)
)
[Link]()
[Link]()
[Link]()
def view_menu():
conn = get_connection(DB_NAME)
cursor = [Link](dictionary=True)
[Link]("SELECT * FROM menu")
items = [Link]()
[Link]()
[Link]()
print("\n--- MENU ---")
for i in items:
print(f"{i['id']} | {i['name']} | ₹{i['price']} | Stock: {i['stock']}")
# ===================== ORDER SYSTEM
=====================
def create_order(staff_id):
conn = get_connection(DB_NAME)
cursor = [Link](dictionary=True)
total = 0
order_items = []
while True:
view_menu()
item_id = int(input("Menu ID (0 to finish): "))
if item_id == 0:
break
qty = int(input("Quantity: "))
[Link]("SELECT * FROM menu WHERE id=%s", (item_id,))
item = [Link]()
if not item or item["stock"] < qty:
print("Invalid item or insufficient stock")
continue
price = item["price"] * qty
total += price
order_items.append((item_id, qty, item["price"]))
[Link](
"UPDATE menu SET stock=stock-%s WHERE id=%s",
(qty, item_id)
)
[Link](
"INSERT INTO inventory_logs (menu_id, change_qty, reason,
log_time) VALUES (%s,%s,%s,%s)",
(item_id, -qty, "Order Sale", [Link]())
)
if not order_items:
print("No items ordered")
return
[Link](
"INSERT INTO orders (staff_id, total, created_at) VALUES
(%s,%s,%s)",
(staff_id, total, [Link]())
)
order_id = [Link]
for i in order_items:
[Link](
"INSERT INTO order_items (order_id, menu_id, quantity, price)
VALUES (%s,%s,%s,%s)",
(order_id, i[0], i[1], i[2])
)
[Link]()
[Link]()
[Link]()
print(f"Order placed successfully | Total: ₹{total}")
# ===================== REPORTS =====================
def daily_sales_report():
conn = get_connection(DB_NAME)
cursor = [Link](dictionary=True)
[Link]("""
SELECT DATE(created_at) as day, SUM(total) as revenue
FROM orders
GROUP BY day
""")
rows = [Link]()
[Link]()
[Link]()
print("\n--- DAILY SALES REPORT ---")
for r in rows:
print(f"{r['day']} : ₹{r['revenue']}")
# ===================== MENUS =====================
def admin_menu():
while True:
print("""
1. Add Menu Item
2. View Menu
3. Sales Report
4. Logout
""")
ch = input("Choice: ")
if ch == "1":
add_menu_item()
elif ch == "2":
view_menu()
elif ch == "3":
daily_sales_report()
elif ch == "4":
break
def staff_menu(user):
while True:
print("""
1. View Menu
2. Create Order
3. Logout
""")
ch = input("Choice: ")
if ch == "1":
view_menu()
elif ch == "2":
create_order(user["id"])
elif ch == "3":
break
# ===================== MAIN =====================
def main():
setup_database()
create_default_admin()
while True:
print("\n--- RESTAURANT MANAGEMENT SYSTEM ---")
user = login()
if not user:
continue
if user["role"] == "admin":
admin_menu()
else:
staff_menu(user)
if __name__ == "__main__":
main()
OUTPUTS
Restaurant Management System:-
Restaurant Management System(Wrong credentials):-
Ordering:-
Order Report:-
Other outputs:-
References :-
● Wikipedia
[Link]
● Python
[Link]
● MySQL
[Link]
● Class 11th and 12th Computer Science Books
(NCERT)
[Link]
[Link]