0% found this document useful (0 votes)
0 views12 pages

Item

Phy

Uploaded by

shivomrawat84
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)
0 views12 pages

Item

Phy

Uploaded by

shivomrawat84
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
You are on page 1/ 12

SOURCE CODE FOR RESTAURANT MANAGEMENT SYSTEM

import pandas as pd
from datetime import date
item_file=r"E:\\XII-BRN-1\Newfolder\item_file.csv"
Customer_file=r"E:\\XII-BRN-1\Newfolder\customer_file.csv"
issueitems_file=r"E:\\XII-BRN-1\New folder\issueitems_file.csv"
print("WELCOME TO RESTAURANT MANAGEMENT SYSTEM")
#fuction to add new item

def additem():
item_id=int(input("Enter item id:"))
item_name=input("Enter item name:")
item_category=input("Enter item type:")
item_cost=float(input("Enter item cost:"))
pdf=pd.read_csv(item_file)
print(pdf)
n=pdf["item_id"].count()
pdf.loc[n]=[item_id,item_name,item_category,item_cost]
pdf.to_csv(item_file, index=False)
print("item added successfully")
print(pdf)

#FUNCTION TO SEARCH ITEM FROM THE LIST


def searchitem():
item_id = int(input("Enter an item id:"))
p1df = pd.read_csv(item_file)
if p1df.empty:
print("No item found with the given item id")
else:
print(" item details are:")
print(p1df)
def deleteitem():
item_id = int(input("Enter a item id: "))
p2df = pd.read_csv(item_file)
p2df = p2df.drop(p2df[p2df["item_id"] == item_id].index)
p2df.to_csv(item_file, index=False)
print("Item Deleted Successfully")
print(p2df)

def showitems():
pdf = pd.read_csv(item_file)
print(pdf)

# Function to add a new customer to the restaurant


def addcustomer():
customer_id = input("Enter a customer id: ")
cname = input("Enter customer name: ")
phoneno = int(input("Enter phone number: "))
numberofitemsissued =int(input("enter number of items issued"))
cdf=pd.read_csv(Customer_file)
n = cdf["customer_id"].count()
cdf.loc[n] = [customer_id, cname, phoneno,
numberofitemsissued] # Use loc[] here
cdf.to_csv(Customer_file, index=False)
print("New customer added successfully")
print(cdf)
# Function to search a customer
def searchcustomer():
cname = input("Enter a customer name: ")
pdf = pd.read_csv(Customer_file)
df = pdf.loc[pdf["cname"] == cname]
if df.empty:
print("No customer found with the given name")
else:
print("customer details are:")
print(df)

# Function to delete a customer from the restaurant


def deletecustomer():
customer_id = input("Enter Customer Id : ")
df = pd.read_csv(Customer_file)
df = df[df['customer_id'] != customer_id]
df.to_csv(Customer_file, index=False)
print("Customer Deleted Successfully")
# Function to show all customers in the restaurant
def showcustomer():
pdf = pd.read_csv(Customer_file)
print(pdf)

# Function to issue a product to a customer


def issueitems():
item_name = input("Enter product name: ")
pdf = pd.read_csv(item_file)
pdf = pdf.loc[pdf['item_name'] == item_name]
if pdf.empty:
print("No item Found in the restaurant")
return
cname = input("Enter customer name: ")
cdf = pd.read_csv(Customer_file)
cdf = cdf.loc[cdf["cname"] == cname]
if cdf.empty:
print("No such customer Found")
return
dateofissue = date.today()
numberofitemsissued = int(input("Enter number of product issued:
"))
issue_df = pd.read_csv(issueitems_file)
n = issue_df["item_name"].count()
issue_df.loc[n] = [item_name, cname, dateofissue,
numberofitemsissued]
issue_df.to_csv(issueitems_file, index=False)
print("item issued successfully")
print(issue_df)

while True:
print("\nOptions:")
print("1. Add item:")
print("2. Search item:")
print("3. Delete item:")
print("4. Show item:")
print("5. Add New customer:")
print("6. Search customer:")
print("7. Delete customer:")
print("8. Show customer:")
print("9. Issue item:")
print("0. Exit")
ch = int(input("enter your choice : "))
if ch == 1:
additem()
elif ch == 2:
searchitem()
elif ch == 3:
deleteitem()
elif ch == 4:
showitems()
elif ch == 5:
addcustomer()
elif ch == 6:
searchcustomer()
elif ch == 7:
deletecustomer()
elif ch == 8:
showcustomer()
elif ch == 9:
issueitems()
elif ch == 0:
print("Thank you for using the digital store.Goodbye! ")
break
else:
print("Invalid choice. Please select a valid option.")
continue

MAIN MENU
WELCOME TO RESTAURANT MANAGEMENT SYSTEM
Options:
1. Add item:
2. Search item:
3. Delete item:
4. Show item:
5. Add New customer:
6. Search customer:
7. Delete customer:
8. Show customer:
9. Issue item:
0. Exit
ADD ITEM
enter your choice : 1
Enter item id:4
Enter item name:Pizza
Enter item type:Main Course
Enter item cost:110
Item added successfully
item_id item_name item_category item_cost
0 1 Garlic Bread Appetizer 80
1 2 Chocolate Brownie Dessert 90
2 3 Mango Smoothie Beverage 70
3 4 Pizza Main Course 110.0

CSV FILE-
SEARCH ITEM
enter your choice : 2
Enter an item id:2
item details are:
item_id item_name item_category item_cost
1 2 Chocolate Brownie Dessert 90.0

DELETE ITEM
enter your choice : 3
Enter a item id: 3
Item Deleted Successfully
item_id item_name item_category item_cost
0 1 Garlic Bread Appetizer 80.0
1 2 Chocolate Brownie Dessert 90.0
3 4 Pizza Main Course 110.0
SHOW ITEMS
enter your choice : 4
item_id item_name item_category item_cost
0 1 Garlic Bread Appetizer 80.0
1 2 Chocolate Brownie Dessert 90.0
2 4 Pizza Main Course 110.0

ADD CUSTOMERS
enter your choice : 5
Enter a customer id: c03
Enter customer name: Natasha
Enter phone number: 8050480504
enter number of items issued: 13
New customer added successfully
customer_id cname phoneno numberofitemsissued
0 c01 abhi 9765478965 7
1 c02 anish 7856543990 6
2 c03 Natasha 8050480504 13
SEARCH CUSTOMER

enter your choice : 6


Enter a customer name: abhi
customer details are:
customer_id cname phoneno numberofitemsissued
0 c01 abhi 9765478965 7

DELETE CUSTOMER

enter your choice : 7


Enter Customer Id : c01
Customer Deleted Successfully
customer_id cname phoneno numberofitemsissued
0 c02 anish 7856543990 6
1 c03 Natasha 8050480504 13
SHOW CUSTOMER
enter your choice : 8
customer_id cname phoneno numberofitemsissued
0 c02 anish 7856543990 6
1 c03 Natasha 8050480504 13

ISSUE ITEMS
enter your choice : 9
Enter item name: Pizza
Enter customer name: anish
Enter number of product issued: 4
item issued successfully
item_name cname dateofissue numberofitemsissued
0 Garlic Bread Natasha 2024-12-24 13
1 Pizza anish 2024-12-24 4
INVALID CHOICE

enter your choice : 10


Invalid choice. Please select a valid option.

EXIT FROM R.M.S

enter your choice : 0


Thank you for using the digital store.Goodbye! .

You might also like