0% found this document useful (0 votes)
2 views9 pages

Food Ordering System with Admin Panel

Uploaded by

pragyasingh2599
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views9 pages

Food Ordering System with Admin Panel

Uploaded by

pragyasingh2599
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import mysql.

connector as pro

d=[Link](host="localhost",user="root",password="mypass",database="food")

e=[Link]()

# ADDING FOOD OPTION FOR ADMIN

def add_food():

ser=int(input("Enter FOOD ID:"))

fi=input("Enter FOOD NAME:")

fp=int(input("Enter PRICE OF FOOD:"))

ft=input("Enter FOOD TYPE:")

[Link]("insert into item values({},'{}',{},'{}')".format(ser,fi,fp,ft))

print("NEW FOOD ADDED SUCCESSFULLY")

[Link]()

# UPDATING FOOD & PRICE OPTION FOR ADMIN

def update_food():

print("[Link] food name")

print("[Link] food price")

us=int(input("Enter your choice: "))

if us==1:

fnid=int(input("Enter the FOOD ID whose food name you want to update: "))

fna=input("Enter the updated FOOD NAME: ")

[Link]("update Item set FOOD_NAME='{}' where FOOD_ID={}".format(fna,fnid))

print("UPDATED SUCCESSFULLY")

[Link]()
elif us==2:

fnic=int(input("Enter the FOOD ID whose food price you want to update :"))

fnf=input("Enter the updated FOOD PRICE: ")

[Link]("Update Item set food_price={} where food_id={}".format(fnf,fnic))

print("UPDATED SUCCESSFULLY")

[Link]()

print("You have been Redirected to the Admin page")

ad_login()

# DELETING FOOD OPTION FOR ADMIN

def delete_food():

fidd=int(input("Enter the Food ID you want to delete :"))

[Link]("delete from item where food_id={}".format(fidd))

print("YOU HAVE DELETED A FOOD ITEM %%!SUCCESSFULLY")

[Link]()

# VIEWING ORDER HISTORY OPTION FOR ADMIN

def view_orders():

fgg=("select * from orders")

print("Details of all orders are:")

[Link](fgg)

rtt=[Link]()

for i in rtt:

print("*****************************************************")

print("FOOD NAME: ",i[0])


print("FOOD PRICE: ",i[1])

print("TOTAL PRICE: ",i[2])

print("PHONE NO: ",i[3])

print("ADDRESS: ",i[4])

print("******************************************************")

# LOGIN OPTION FOR ADMIN

def ad_login():

while 1:

print("1. ADD FOOD")

print("2. UPDATE FOOD")

print("3. DELETE FOOD")

print("4. VIEW ORDERS")

print("5. LOGOUT")

ask=int(input("Enter your Choice: "))

if ask==1:

add_food()

elif ask==2:

update_food()

elif ask==3:

delete_food()

elif ask==4:

view_orders()

elif ask==5:

return
# PASSWORD FOR ADMIN TO LOGIN

def ad_panel():

pas=input("Enter Password :")

if pas=='DIGIN':

print("Access granted")

ad_login()

else:

print("Wrong Password")

print("You have been REdirected to the Main Page")

admin()

# FOOD ITEMS TO SHOW CUSTOMER

def show_menu():

[Link]("select * from item")

w=[Link]()

print("-------------MENU FOR TODAY---------------")

for i in w:

print("Food No.",i[0],"Food Name:",i[1],"--Price:",i[2],"--Food type:",i[3] )

[Link]()

ui=input("Do you want to order food:")

if ui=="Yes" or ui=="yes":

F_order()

else:

print("THANK YOU")
print("You have been Redirected to the Main Page")

return

# TO PLACE ORDER OF FOOD ITEM

def F_order():

io=int(input("Enter the Food item no. you want to order:"))

Qty=int(input("Enter Quantity of food:"))

phn=input("Enter your Phone No:")

ADR=input("Enter your Address:")

fi=("select * from item where food_id={}".format(io))

[Link](fi)

fi=[Link]()

iname=fi[0][1]

iprice=fi[0][2]

oprice=iprice*Qty

ins="insert into
orders(O_name,I_price,O_price,P_no,ADR)values('{}',{},{},{},'{}')".format(iname,iprice,oprice,phn,ADR)

print("********BILL********")

print("Address:",ADR)

print("Phone NO:",phn)

print("Food name:",iname)

print('Food price:',iprice)

print("Quantity of food:",Qty)

print('Total price:',oprice)

print("********************")

print("Thanks for ordering food")


print("Your order has been confirmed")

print("You have been Redirected to the MAIN PAGE")

[Link](ins)

[Link]()

# VIEWING YOUR FOOD ORDERHISTORY

def F_View():

yno=int(input("Enter your phone NO:"))

a=("select * from orders where P_no={}").format(yno)

[Link](a)

rt=[Link]()

if len(rt)>0:

for i in rt:

print("Your recent orders are:")

print("**********YOUR ORDER DETAILS ARE SHOWN BELOW**********")

print("Food name:",i[0])

print("Food price:",i[1])

print("Total price:",i[2])

print("Phone NO:",i[3])

print("Address:",i[4])

else:

print("YOU HAVE NOT PLACED ANY ORDER")

[Link]()

# CANCELING YOUR FOOD ORDER


def F_Cancel():

cor=int(input("Enter your phone NO:"))

dele=("delete from orders where P_no={}").format(cor)

[Link](dele)

print("Your order has been cancelled SUCCESSFULLY")

print("You have been REdirected to the MAIN PAGE")

[Link]()

# FEEDBACK OPTION FOR CUSTOMER

def F_feedb():

fdb=int(input("Enter your Phone NO:"))

fdc=input("Give us Feedback--")

fdp=("insert into Feed values(’{}’,'{}')").format(fdb,fdc)

print("THANKS FOR YOUR FEEDBACK")

print("You have been Redirected to MAIN PAGE")

[Link]()

# MAIN MENU FOR CUSTOMER

def main_menu():

while True:

print("----------------------WELCOME TO FOOD PORTAL----------------------")

print("1. Main Menu")

print("2. Place your Orders")

print("3. View order")

print("4. Cancel your Order")


print("5. Feedback")

print("6. Exit")

a=int(input("Enter the Service you want:"))

if a==1:

show_menu()

elif a==2:

F_order()

elif a==3:

F_View()

elif a==4:

F_Cancel()

elif a==5:

F_feedb()

elif a==6:

break

# HOME PAGE

def admin():

while True:

print("**********************************************")

print("WELCOME TO FOOD PORTAL")

print("1. ADMIN LOGIN")

print("2. CUSTOMER LOGIN")

print("3. EXIT")

op=int(input("Enter option :"))


if op==1:

ad_panel()

elif op==2:

main_menu()

elif op==3:

break

admin()

You might also like