Project Doc Aryan
Project Doc Aryan
1|Page
CERTIFICATE
This is to certify that Mr. ARYAN KUMAR of class XII – Science, PM Shri
Kendriya Vidayalaya N.A.D. Karanja has completed the project on
Restaurant Management of Computer Science. As per All India Senior
Secondary Certificate Examination (AISSCE) as prescribed by CBSE for
the year 2024-25.
CBSE Roll No. _________________
Principal
(Mr. Rajesh Kumar Patil)
2|Page
ACKNOWLEDGEMENT
3|Page
INDEX
1. Introduction
2. Requirements
3. Objective of project
4. Flow Of Program
5. Source CODE
6. MySQL Database and Tables
7. Output
8. Conclusion
9. Bibliography
4|Page
iNtroDUCtioN
5|Page
rEQUirEMENtS
For this Python-based Restaurant Management program using MySQL, here are the
minimum and recommended system requirements:
These requirements ensure the program runs smoothly, particularly during multi-role
operations and data-intensive tasks.
6|Page
OBJECTIVE OF PROJECT
• Automate Restaurant Operations: Simplify daily tasks such as order management,
inventory tracking, and staff coordination through a terminal-based interface.
• Enhance Role-Based Efficiency: Develop dedicated modules for Admin, Cook, Waiter,
and Storekeeper roles to streamline specific tasks relevant to each position.
• Improve Order Processing: Enable quick order placement, status checking, and order
fulfilment, reducing wait times and enhancing customer service.
• Optimize Staff Management: Provide an Admin module for adding, updating, and
viewing staff details, ensuring efficient personnel management and role-based access
control.
• Facilitate Communication and Complaint Resolution: Include options for staff to submit
complaints or requests and for Admin to view and address these, fostering better
internal communication.
• Ensure Data Security: Implement password encryption to secure access and ensure
sensitive information is protected.
• Centralize Data Storage: Maintain organized tables for menu items, staff details,
announcements, orders, complaints, and requests within a MySQL database for easy
data retrieval and management.
7|Page
FLoW oF ProGrAM
8|Page
SOURCE CODE
1st File: Create Database and Tables.py
import mysql.connector
def create_database_and_tables():
db = mysql.connector.connect(host="localhost", user="root",
password="octane", auth_plugin='mysql_native_password')
cursor = db.cursor()
# Create database
cursor.execute("CREATE DATABASE IF NOT EXISTS test3")
cursor.execute("USE test3")
9|Page
# Create 'menu' table
cursor.execute("""
CREATE TABLE IF NOT EXISTS menu (
food_item VARCHAR(50),
price DECIMAL(5,2)
)
""")
create_database_and_tables()
def login_module(cursor):
11 | P a g e
try:
position = input("Enter your position (Waiter, Cook, Admin,
Storekeeper): ")
password = input("Enter your password: ")
if result:
print("Welcome, " + result[0] + "!") # result[0] is the
name of the user
return position
else:
print("Invalid credentials!")
return None
except mysql.connector.Error as e:
print("Database error: " + str(e))
return None
except Exception as e:
print("An unexpected error occurred: " + str(e))
return None
def get_yes_no_input(prompt):
"""Utility function to get a valid 'Yes' or 'No' input."""
while True:
try:
choice = input(prompt).strip().title()
if choice not in ['Yes', 'No']:
raise ValueError
return choice
except ValueError:
print("Invalid input. Please enter 'Yes' or 'No'.")
def main():
if role == "Waiter":
waiter_module(cursor, connection)
elif role == "Cook":
cook_module(cursor, connection)
elif role == "Admin":
admin_module(cursor, connection)
elif role == "Storekeeper":
storekeeper_module(cursor, connection)
else:
print("No valid role found.")
if logout_choice == 'Yes':
exit_choice = get_yes_no_input("Do you want to exit the
program? (Yes/No): ")
if exit_choice == 'Yes':
print("Exiting the Program!")
break # Exit the while loop and close the program
else:
print("Logging out...\n")
# Reset the connection and cursor for the next login
continue
main()
13 | P a g e
def admin_module(cursor, connection):
while True:
print("\n--- Admin Module ---")
print("1. Add Food Items to Menu")
print("2. Update Staff Details")
print("3. Delete food items from menu")
print("4. Make Announcements")
print("5. View Staff List")
print("6. Update existing Staff Details")
print("7. Update Staff password")
print("8. View and fix complaints")
print("9. View Requests from employees")
print("10. Delete Employees")
print("11. Exit")
else:
break
except ValueError:
print("Invalid Input. Try again!")
if choice == 1:
add_food_items(cursor, connection)
elif choice == 2:
add_staff(cursor, connection)
elif choice == 3:
delete_food_item(cursor, connection)
elif choice == 4:
make_announcement(cursor, connection)
elif choice == 5:
14 | P a g e
view_staff_list(cursor)
elif choice == 6:
update_staff_details(cursor, connection)
elif choice == 7:
update_staff_password(cursor, connection)
elif choice == 8:
view_and_fix_complaints(cursor, connection)
elif choice == 9:
view_requests(cursor)
elif choice == 10:
delete_employee(cursor, connection)
elif choice == 11:
break
else:
print("Invalid choice. Please try again.")
def view_staff_list(cursor):
print("\n--- Staff List ---")
try:
# get all staff details
cursor.execute("SELECT name, employee_id, position, salary,
performance, password FROM Staff")
staff_records = cursor.fetchall() # Fetch all records
if staff_records:
# Create Table
table = PrettyTable()
table.field_names = ["Name", "Employee ID", "Position",
"Salary", "Performance", "Password"]
food_items = food_items_input.split(',')
if result:
connection.commit()
print("Menu updated successfully.\n")
while True:
try:
# Password input
while True:
password = input("Enter password: ")
break
try:
cursor.execute("INSERT INTO Staff (name, employee_id,
position, salary, performance, password) VALUES ('" + name + "', '" +
17 | P a g e
employee_id + "', '" + position + "', " + str(salary) + ", '" +
performance + "', '" + password + "')")
print("Staff details added successfully.\n")
except mysql.connector.Error as err:
print("Error: " + str(err))
connection.commit()
print("Announcement made successfully.\n")
if result:
18 | P a g e
print("Current Details: Name: " + result[0] + ", Position:
" + result[1] + ", Salary: " + str(result[2]) + ", Performance: " +
result[3])
#updated details
new_name = input("Enter new name (Leave blank to keep as "
+ result[0] + "): ") or result[0]
new_position = input("Enter new position (Leave blank to
keep as " + result[1] + "): ") or result[1]
new_salary = input("Enter new salary (Leave blank to keep
as " + str(result[2]) + "): ") or str(result[2])
new_performance = input("Enter new performance (Leave
blank to keep as " + result[3] + "): ") or result[3]
except Exception as e:
print("An error occurred: " + str(e))
if result:
print("Current password for " + result[0] + " is hidden
for security purposes.")
19 | P a g e
#new password
new_password = input("Enter new password: ")
except Exception as e:
print("An error occurred: " + str(e))
if not complaints:
print("No pending complaints.")
return
def view_requests(cursor):
print("\n--- View Requests ---")
20 | P a g e
# Query to retrieve all requests
cursor.execute("SELECT staff_name, request, date_submitted FROM
Requests")
requests = cursor.fetchall() # Fetch all requests instead of
fetchmany
if not requests:
print("No requests found.")
else:
# Create Table
table = PrettyTable()
if result:
# Confirm before deletion
confirmation = input(f"Are you sure you want to delete
{result[0]} (Employee ID: {employee_id})? (yes/no): ").lower()
if confirmation == 'yes':
cursor.execute("DELETE FROM Staff WHERE employee_id = " +
employee_id)
21 | P a g e
print(f"Employee {result[0]} with Employee ID
{employee_id} has been deleted.")
connection.commit()
else:
print("Deletion cancelled.")
else:
print(f"No employee found with Employee ID: {employee_id}.")
if result:
message = result[0]
priority = result[1]
created_at = result[2]
print("\n--- Announcement ---")
print("Priority: " + str(priority))
print("Date: " + created_at.strftime('%Y-%m-%d %H:%M:%S'))
print("Message: " + message + "\n")
else:
print("\nNo announcements at this time.\n")
display_announcement(cursor)
while True:
print("\n--- Waiter Module ---")
print("1. Place a new order")
print("2. Check order status")
print("3. Register a complaint")
print("4. Add Request")
print("5. Exit")
try:
22 | P a g e
choice = int(input("Enter your choice: "))
except ValueError:
print("Invalid input. Please enter a number.")
continue
if choice == 1:
# Place a new order
cursor.execute("SELECT * FROM Menu")
menu = cursor.fetchall()
if not menu:
print("No items in the menu.")
return
print("Menu:")
for item in menu:
print(str(item[0]) + ": @" + str(item[1]))
# Take order
order = input("Enter food items ordered (comma separated):
").strip()
if not order:
print("No order was placed.")
return
if result:
price = result[0]
ordered_items.append((item, price)) #
Store item and its price as a tuple
total += price
else:
print(item + " is not available on the
menu.")
# Print bill
print("\n" + "="*30)
print(restaurant_name)
print("-" * 30)
print("Items Ordered:")
print("-" * 30)
print("Total: @" + str(total))
print("Issued by: " + issued_by)
print("="*30 + "\n")
connection.commit()
24 | P a g e
generate_bill(order, cursor, issued_by="Waiter",
connection=connection)
elif choice == 2:
def check_order_status(cursor):
print("\n--- Check Order Status ---")
if status == 'Accepted':
print("Time required: " +
str(time_required) + " minutes")
elif status == 'Rejected':
print("Reason for rejection: " + reason)
else:
# No orders found
print("No orders found.")
check_order_status(cursor)
elif choice == 3:
import datetime
try:
cursor.execute(query)
connection.commit()
print("Complaint submitted successfully.")
except Exception as e:
print(f"Error submitting complaint: {e}")
add_complaint(cursor, connection)
elif choice == 4:
def add_request(cursor, connection):
print("\n--- Add Request ---")
try:
cursor.execute(query)
connection.commit()
print("Request added successfully.\n")
except Exception as e:
print(f"An error occurred: {e}")
26 | P a g e
add_request(cursor, connection)
elif choice == 5:
print("Exiting")
break
else:
print("Invalid choice. Please try again.")
if result:
message = result[0]
priority = result[1]
created_at = result[2]
print("\n--- Announcement ---")
print("Priority: " + str(priority))
print("Date: " + created_at.strftime('%Y-%m-%d %H:%M:%S'))
print("Message: " + message + "\n")
else:
print("\nNo announcements at this time.\n")
display_announcement(cursor)
while True:
try:
27 | P a g e
choice = int(input("Enter your choice (1, 2, 3, 4 or 5):
"))
except ValueError:
print("Invalid input. Please enter a number (1, 2, 3, 4 or
5).")
continue
if choice == 1:
# View all pending orders
try:
cursor.execute("SELECT id, items, status FROM Orders
WHERE status='Pending'")
pending_orders = cursor.fetchall()
if not pending_orders:
print("******************************* No
pending orders. *******************************")
else:
print("Pending Orders:")
for order in pending_orders:
print("Order ID: " + str(order[0]) + ", Items:
" + order[1] + ", Status: " + order[2])
except Exception as e:
print("Error fetching pending orders: " + str(e))
elif choice == 2:
# Accept or reject an order
try:
cursor.execute("SELECT id, items FROM Orders WHERE
status='Pending'")
orders = cursor.fetchall()
if not orders:
print("No pending orders.")
continue
print("Pending Orders:")
28 | P a g e
for order in orders:
print("Order ID: " + str(order[0]) + ", Items: " +
order[1])
if not order:
print("Invalid Order ID or order is not pending.")
continue
if decision == 'accept':
try:
time_required = int(input("Enter time required
(in minutes) to prepare the order: "))
cursor.execute("UPDATE Orders SET
status='Accepted', time_required=" + str(time_required) + " WHERE id="
+ str(order_id))
connection.commit()
print("Order " + str(order_id) + " accepted.
Time required: " + str(time_required) + " minutes.")
except ValueError:
print("Invalid input for time required. Please
enter a number.")
elif decision == 'reject':
reason = input("Enter the reason for rejecting the
order: ")
cursor.execute("UPDATE Orders SET
status='Rejected', reason='" + reason + "' WHERE id=" + str(order_id))
connection.commit()
print("Order " + str(order_id) + " rejected.
Reason: " + reason)
else:
29 | P a g e
print("Invalid choice. Please enter 'accept' or
'reject'.")
except Exception as e:
print("Error processing order: " + str(e))
elif choice == 3:
# Mark an order as completed
try:
cursor.execute("SELECT id, items, status FROM Orders
WHERE status='Accepted'")
accepted_orders = cursor.fetchall()
if not accepted_orders:
print("No accepted orders to mark as completed.")
else:
print("Accepted Orders:")
for order in accepted_orders:
print("Order ID: " + str(order[0]) + ", Items:
" + order[1] + ", Status: " + order[2])
elif choice == 4:
def add_request(cursor, connection):
print("\n--- Add Request ---")
try:
cursor.execute(query)
connection.commit()
print("Request added successfully.\n")
except Exception as e:
print(f"An error occurred: {e}")
add_request(cursor, connection)
elif choice == 5:
print("Exiting Cook Module.")
break
else:
print("Invalid choice. Please try again.")
if result:
message = result[0]
priority = result[1]
created_at = result[2]
print("\n--- Announcement ---")
print("Priority: " + str(priority))
print("Date: " + created_at.strftime('%Y-%m-%d %H:%M:%S'))
31 | P a g e
print("Message: " + message + "\n")
else:
print("\nNo announcements at this time.\n")
display_announcement(cursor)
while True:
if choice == '1':
# Update the quantity of an existing item
item = input("Enter item name to update: ")
if result:
while True:
try:
quantity = int(input("Enter new quantity: "))
break
except ValueError:
print("Invalid input for quantity. Please
enter an integer.")
try:
cursor.execute("UPDATE Store SET quantity=" +
str(quantity) + " WHERE item='" + item + "'")
connection.commit()
32 | P a g e
print("Quantity of " + item + " updated to " +
str(quantity) + ".")
except Exception as e:
print("Error updating item: " + str(e))
else:
print("Item '" + item + "' does not exist in the
store.")
while True:
try:
quantity = int(input("Enter quantity: "))
break
except ValueError:
print("Invalid input for quantity. Please enter an
integer.")
try:
cursor.execute("INSERT INTO Store (item, quantity,
`MFG/Date_of_purchase`) VALUES ('" + item + "', " + str(quantity) + ",
'" + str(date_of_purchase) + "')")
connection.commit()
print("New item '" + item + "' added to the store with
quantity " + str(quantity) + " and date " + str(date_of_purchase) +
".")
except Exception as e:
33 | P a g e
print("Error adding new item: " + str(e))
try:
cursor.execute(query)
connection.commit()
print("Request added successfully.\n")
except Exception as e:
print(f"An error occurred: {e}")
add_request(cursor, connection)
try:
item_name = input("Enter Name of Item to Delete: ")
query = "DELETE FROM store WHERE item = '" + item_name
+ "'"
cursor.execute(query)
connection.commit()
if cursor.rowcount > 0:
print("Item '" + item_name + "' deleted
successfully!")
else:
print("Item '" + item_name + "' not found!")
items = cursor.fetchall()
# Create Table
table = PrettyTable()
table.field_names = ["Item", "Quantity",
"MFG/Date_of_purchase"]
35 | P a g e
MySQL DAtABASE AND tABLES
36 | P a g e
37 | P a g e
38 | P a g e
oUtPUt
---Login Interface---
39 | P a g e
---Waiter---
---Cook---
40 | P a g e
---Storekeeper---
41 | P a g e
CoNCLUSioN
42 | P a g e
BiBLioGrAPhy
• WEBSITE REFRENCES:
• Book References:
43 | P a g e
44 | P a g e