This project is made using two parts.
First : coding for making tables in mysql server.
Second : coding for using project interface.
Software Requirements
Mysql server : mysql server must be installed in computer. It will be used for accessing data of project. Tables will be made in server in which data will be stored.
Python idle : python idle must be installed in computer. It will be used for executing python scripts.
Mysql.connector : it will connect python idle with mysql server. To install it open cmd and write pip install mysql.connector
MySQL
In user and passwd, put your mysql server username and password.
import mysql.connector as a
con = a.connect(host="localhost",
user="root",
passwd="")
c = con.cursor()
sql1 = "create database rest1"
c.execute(sql1)
sql2 = "use rest1"
c.execute(sql2)
sql3 = "create table orders (order_id varchar(16), table_no varchar(5), items varchar(100), date varchar(10))"
c.execute(sql3)
sql4 = "create table feedback (wf varchar(50), order_id varchar(16))" #wf write feedback
c.execute(sql4)
sql5 = "create table menu (item_id varchar(10), item_name varchar(50), price varchar(10))"
c.execute(sql5)
sql6 = "create table staff (name varchar(50), role varchar(20), phone varchar(10), salary varchar(10))"
c.execute(sql6)
sql7 = "create table payments (payment_id varchar(10), order_id varchar(16), amount varchar(10), method varchar(10), date varchar(10))"
c.execute(sql7)
sql8 = "create table reservations (name varchar(50), phone varchar(10), table_no varchar(5), date varchar(10), time varchar(10))"
c.execute(sql8)
con.commit()
Python
After executing the python script the password for opening the interface is iloverest.
import mysql.connector as a
from datetime import datetime
con = a.connect(host="localhost",user="root",passwd="",database="rest1")
current_datetime = datetime.now()
ymdhms_text = current_datetime.strftime("%Y%m%d%H%M%S")
def add_order():
oid = ymdhms_text
t = input("Table No : ")
items = input("Items Code : ")
d = input("Date : ")
data = (oid,t,items,d)
sql = 'insert into orders values(%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Order Added Successfully")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def remove_order():
oid = ymdhms_text
data = (oid,)
sql = 'delete from orders where order_id = %s'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Order Removed")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def add_staff():
n = input("Staff Name : ")
r = input("Role : ")
ph = input("Phone : ")
s = input("Salary : ")
data = (n,r,ph,s)
sql = 'insert into staff values(%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Staff Added Successfully")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def remove_staff():
n = input("Staff Name : ")
data = (n,)
sql = 'delete from staff where name = %s'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Staff Removed")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def add_menu():
mid = input("Item ID : ")
name = input("Item Name : ")
price = input("Price : ")
data = (mid,name,price)
sql = 'insert into menu values(%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Menu Item Added")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def show_menu():
sql = "select * from menu"
c = con.cursor()
c.execute(sql)
d = c.fetchall()
for i in d:
print("ID : ",i[0])
print("ITEM : ",i[1])
print("PRICE : ",i[2])
print(">--------------------------------------<")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def payment():
pid = input("Payment ID : ")
oid = input("Order ID : ")
amt = input("Amount : ")
m = input("Method : ")
d = input("Date : ")
data = (pid,oid,amt,m,d)
sql = 'insert into payments values(%s,%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Payment Done")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def reservations():
n = input("Name : ")
ph = input("Phone : ")
t = input("Table No : ")
d = input("Date : ")
time = input("Time : ")
data = (n,ph,t,d,time)
sql = 'insert into reservations values(%s,%s,%s,%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Reservation Done")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def show_orders():
sql = "select * from orders"
c = con.cursor()
c.execute(sql)
d = c.fetchall()
for i in d:
print("ORDER ID : ",i[0])
print("TABLE : ",i[1])
print("ITEMS : ",i[2])
print("TOTAL : ",i[3])
print("DATE : ",i[4])
print(">--------------------------------------<")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def add_feedback():
w = input("Write : ")
oid = input(" Order ID : ")
data = (w,oid)
sql = 'insert into feedback values(%s,%s)'
c = con.cursor()
c.execute(sql,data)
con.commit()
print("Thanks!")
print(">--------------------------------------------------------------------------------------------------------<")
main()
def main():
print(""" RESTAURANT MANAGEMENT SYSTEM
1. ADD ORDER 2. REMOVE ORDER
3. ADD STAFF 4. REMOVE STAFF
5. ADD MENU ITEM 6. SHOW MENU
7. PAYMENT 8. RESERVATION
9. SHOW ORDERS 10. FEEDBACK
""")
choice = input("Enter Task No : ")
print(">--------------------------------------<")
if choice == '1':
add_order()
elif choice == '2':
remove_order()
elif choice == '3':
add_staff()
elif choice == '4':
remove_staff()
elif choice == '5':
add_menu()
elif choice == '6':
show_menu()
elif choice == '7':
payment()
elif choice == '8':
reservations()
elif choice == '9':
show_orders()
elif choice == '10':
add_feedback()
else:
print("Wrong choice..........")
main()
def pswd():
p = input("Password : ")
if p == "iloverest":
main()
else:
print("Wrong Password")
pswd()
pswd()
Educational Use Notice
This project is provided strictly for educational and learning purposes. Students are encouraged to study the code, understand the concepts, and use it as a reference for building their own original projects. Users are expected to modify, improve, and create their own implementations based on their understanding. By accessing this project, you agree to use it ethically and in accordance with your institution’s academic integrity policies.