MANBODH Da DHABBA
MANBODH Da DHABBA
External Examiner
ACKNOWLEGDEMENT
I would like to express my heartful gratitude to
my computer teacher, Mrs. Sweta Gupta, who
gave me this opportunity to do this thought-
provoking project on the topic “RESTRAUNT
MANAGEMENT SYSTEM” which enhanced my
knowledge.
Akshat Manbodh
TABLE OF CONTENT
1. Certificate
2. Acknowledgement
3. Introduction
4. Source Code
5. Output
6. Bibliography
Restraunt
management system
Source code
import mysql.connector
from datetime import datetime
db.commit()
cursor.close()
db.close()
# Function to insert sample data into the menu table
def insert_sample_data():
"""
Inserts predefined sample menu items into the
menu table.
This function is helpful for testing the application
without needing to add items manually.
It will only insert data if the table is empty.
"""
db = create_connection()
cursor = db.cursor()
db.commit()
cursor.close()
db.close()
print("Sample data inserted into the menu table.")
db.commit()
cursor.close()
db.close()
print("Menu:")
for item in menu_items:
# Display each menu item with its details
print(
f"ID: {item[0]}, Name: {item[1]}, Price:
{item[2]:.2f}, Category: {item[3]}, Available: {'Yes' if
item[4] else 'No'}")
cursor.close()
db.close()
order_date = datetime.now()
# SQL command to insert a new order into the
orders table
cursor.execute("INSERT INTO orders (item_id,
quantity, order_date) VALUES (%s, %s, %s)",
(item_id, quantity, order_date))
db.commit()
cursor.close()
db.close()
# Notify the user that the order was placed
successfully
print(f"Order placed: Item ID {item_id}, Quantity
{quantity}")
# Function to view all orders placed
def view_orders():
"""
Fetches and displays all orders from the orders
table.
This function allows users to see a list of their past
orders.
"""
db = create_connection()
cursor = db.cursor()
print("Orders:")
for order in orders:
# Display each order with its details
print(f"Order ID: {order[0]}, Item: {order[1]},
Quantity: {order[2]}, Date: {order[3]}")
cursor.close()
db.close()
db.commit()
cursor.close()
db.close()
db.commit()
cursor.close()
db.close()
def search_menu_item(name):
"""
Searches for a menu item by its name.
Returns the details of the menu item if found.
"""
db = create_connection()
cursor = db.cursor()
if menu_items:
print("Search Results:")
for item in menu_items:
print(
f"ID: {item[0]}, Name: {item[1]}, Price:
{item[2]:.2f}, Category: {item[3]}, Available: {'Yes' if
item[4] else 'No'}")
else:
print("No items found.")
cursor.close()
db.close()
cursor.close()
db.close()
orders = cursor.fetchall()
cursor.close()
db.close()
if choice == '1':
display_menu()
elif choice == '2':
item_id = int(input("Enter item ID to order: "))
quantity = int(input("Enter quantity: "))
place_order(item_id, quantity)
elif choice == '3':
view_orders()
elif choice == '4':
item_id = int(input("Enter item ID to update: "))
name = input("Enter new name (leave blank to
skip): ")
price = input("Enter new price (leave blank to
skip): ")
category = input("Enter new category (leave
blank to skip): ")
available = input("Is it available? (yes/no,
leave blank to skip): ")
available = available.lower() == 'yes' if
available else None
update_menu_item(item_id, name if name
else None, float(price) if price else None,
category if category else None,
available)
elif choice == '5':
item_id = int(input("Enter item ID to delete: "))
delete_menu_item(item_id)
elif choice == '6':
name = input("Enter the name of the menu
item to search for: ")
search_menu_item(name)
elif choice == '7':
view_total_sales()
elif choice == '8':
start_date = input("Enter start date (YYYY-MM-
DD): ")
end_date = input("Enter end date (YYYY-MM-
DD): ")
view_orders_by_date(start_date, end_date)
elif choice == '9':
break
else:
print("Invalid choice. Please try again.")
OUTPUT
1.Display Menu
2.Place Order
3.View Orders
brainycode.org
codingninjas.com
learnpython.org
gitticodingzone.com