Computer Project-1zxcxzzccz
Computer Project-1zxcxzzccz
2
3. ACKNOWLEDGEMENT
Primarily I would like to thank the god for being able to complete this project
with success. Then I would like to thank my computer science teacher: Mrs.
Juliet Priya whose valuable guidance has been ones that helped me patch
this project make it full proof success. Her suggestions and her instructions
have served as the major contributions towards the completion to the project.
I would like to thank principal Mrs. Jyothi Menon who is a constant source of
encouragement to the students.
Finally, I would like to thank my parents and classmates for their valuable
suggestions and guidance.
3
4. TABLE OF CONTENTS
4
5. INTRODUCTION
One of the key features of a restaurant management system is its ability to track and
analyze sales data. This data can be used to make informed decisions about menu
pricing, inventory levels, and staffing needs. The system can also help to identify trends
and patterns in customer behavior, allowing businesses to tailor their marketing and
promotional efforts accordingly.
In addition to sales tracking and analysis, a restaurant management system can also help
to streamline other aspects of restaurant operations. For example, it can be used to
create and manage employee schedules, track employee hours, and process payroll. It
can also help with menu planning, allowing restaurants to optimize their menus based on
customer preferences and trends.
Another important feature of a restaurant management system is its ability to track and
manage customer relationships. This includes the ability to collect customer feedback,
track customer loyalty, and send personalized promotions and offers to customers.
5
6. MODULES AND FUNCTIONS USED
mysql.connector is a Python driver that allows you to connect to MySQL servers from
Python. It is implemented as a pure Python C extension, and it supports the following
features:
import statement
mysql.connector.connect()
cc.connect()
con.cursor()
cur.execute()
cur.fetchall()
con.commit()
print()
input()
6
7. HARDWARE & SOFTWARE REQUIREMENTS
Software - Python
Python is a high-level, interpreted programming language that is widely used
for web development, data analysis, scientific computing, and artificial
intelligence.
Python has a large, active community of developers who contribute to its open-
source ecosystem of libraries and frameworks.
Python is known for its simplicity and readability, with a syntax that is easy to
learn and use.
Python supports object-oriented, functional, and imperative programming
styles, making it a versatile language for a wide range of applications.
Python has a large standard library, as well as third-party libraries and
frameworks, that provide tools and functionality for a wide range of tasks,
including web development, data analysis, machine learning, and more.
7
Software – MySQL
MySQL is a popular open-source database management system that is used to
store and organize data.
It is written in C and C++ and is available on many operating systems, including
Linux, Windows, and MacOS.
MySQL is widely used in web applications, as it allows for fast access to large
amounts of data and is easy to use and configure.
It is commonly used in conjunction with the PHP programming language, as
PHP is often used to interact with MySQL databases in web applications.
MySQL has a number of features that make it an attractive choice for
developers, including support for multiple storage engines, a flexible schema,
and a wide range of built-in functions and tools.
8
8. FLOWCHART
9
9. SOURCE CODE
import mysql.connector as cc
# connecting DB
con = cc.connect(
host='localhost',
user='root',
password='password'
)
# create Db
cur = con.cursor()
cur.execute('show databases') # shows the databases
datalist = cur.fetchall() # collects the databases from the above statement
dlempt = []
for i in datalist:
dlempt.append(i[0]) # puts the collected data in a list
if 'restaurant' in dlempt: # uses the database if it exists, if not it creates a new
one with tables
cur.execute('use restaurant')
else:
q1 = 'create database restaurant'
q2 = 'use restaurant'
q3 = 'create table Dish(Dish varchar(30), Cost int, DishID varchar(70))'
q4 = 'create table Cook(Name varchar(40), Aadhar varchar(12), Salary int,
DOJ varchar(10))'
q5 = 'create table Orders(Date varchar(10), Name varchar(40), Aadhar varchar(12),
DishIDs varchar(70), Cost int)'
q6 = 'create table Salary(Name varchar(40), Aadhar varchar(12), Bank varchar(30),
Account varchar(15), Payday varchar(10), Salary int, Days int, Net int)'
q7 = 'create table Expense(Type varchar(30), Expense int, Date varchar(10))'
cur.execute(q1)
cur.execute(q2)
cur.execute(q3)
cur.execute(q4)
cur.execute(q5)
cur.execute(q6)
cur.execute(q7)
con.commit()
print('Created Database')
def signin():
print('\n')
print(' ------------------------------>>>>>>>>>>>>>>> WELCOME TO OREO\'S CAFE
<<<<<<<<<<<<<<<-----------------------------')
print('\n')
10
# signin into the client so that only the person who knows the password can enter
client = input('Enter Password: ')
if client == 'oreo123':
options()
else:
print('Wrong password! Try again!')
signin()
def dishID(): # it is a function to create dishID; it fetches the maximum number from
the dish ID & adds +1 to it
query = 'select count(*), max(DishID) from Dish'
cur.execute(query)
fetch = cur.fetchall()
11
for i in fetch:
if i[0] == 0:
return 1
else:
return (int(i[1]) + 1)
def dishes(): # a function which is used to show to add, remove, display food available
ch = input('1. Add Food 2. Remove Food 3. Display Food 4. Main Menu: ')
if ch == '1':
dishname = input('Enter Dish Name: ')
dishprice = int(input('Enter Dish Price: '))
dishid = str(dishID())
query = 'insert into dish values(\'{}\', {}, {})'.format(
dishname, dishprice, dishid)
cur.execute(query)
con.commit()
print("Dish has been added successfully")
elif ch == '2':
dishid = input('Enter Dish ID: ')
query = 'delete from Dish where DishID={}'.format(dishid)
cur.execute(query)
con.commit()
print("Dish has been deleted successfully")
elif ch == '3':
print('\n')
query = ('select * from Dish')
cur.execute(query)
fetch = cur.fetchall()
for i in fetch:
print(i[0], '-', i[1], '-', i[2])
print('\n')
else:
options()
12
dil = []
while True: # create a loop so that people can order more than 1 food item
# as dishID 0 does not exists we can use 0 as a check statement so that the loop
terminates when 0 is entered
di = input("Select Dish ID {Enter 0 when done}: ")
if di == '0':
break
else:
dil.append(di)
sql = 'select DishID, Cost from Dish'
cur.execute(sql)
d = cur.fetchall()
dic1 = {}
for i in d: # fetches the data at 'line 139' and puts them in a dictionary
dic1[i[0]] = i[1]
tc = 0
for i in dil:
# accesses the Cost column of the database & adds it together
dc = dic1[i]
tc = tc+dc
name = input("Enter Name: ")
aadhar = input("Enter aadhar ID: ")
date = input('Enter Date (YYYY-MM-DD): ')
# for confirmation, we ask the dish ID/order of the user again
lis = input("Enter Dish IDs: ")
sql2 = "insert into Orders value('{}', '{}', '{}', '{}', {})".format(
date, name, aadhar, lis, tc)
cur.execute(sql2)
con.commit()
13
def cooks(): # adds, removes, displays information about cooks
ch = input('1. Add Cook 2. Remove Cook 3. Display Cook 4. Main Menu: ')
if ch == '1':
cookname = input('Enter Cook Name: ')
aadhar = input('Enter Aadhar no: ')
salary = int(input('Enter Salary: '))
joind = input('Enter Date of Joining (YYYY-MM-DD): ')
query = 'insert into Cook values(\'{}\', {}, {}, \'{}\')'.format(
cookname, aadhar, salary, joind)
cur.execute(query)
con.commit()
print("Cook has been added successfully")
elif ch == '2':
cookn = input('Enter Cook Name: ')
aadharn = int(input('Enter Aadhar No.: '))
query = "delete from Cook where Name='{}' and Aadhar={}".format(
cookn, aadharn)
cur.execute(query)
con.commit()
print("Cook has been deleted successfully")
elif ch == '3':
print('\n')
query = ('select * from Cook')
cur.execute(query)
fetch = cur.fetchall()
for i in fetch:
print(i[0], '-', i[1], '-', i[2])
print('\n')
else:
options()
14
acc = int(input("Enter cook's account number: "))
date = input('Enter Date of Salary (YYYY-MM-DD): ')
sal = int(input("Enter cook's salary: "))
days = int(input("Enter no. of working days: "))
# splits the date i.e it chooses the month, which has 31 days
if date[5:7] in ['01', '03', '05', '07', '08', '10', '12']:
ns = (sal/31)*days
# splits the date i.e it chooses the month, which has 30 days
elif date[5:7] in ['04', '06,', '09', '11']:
ns = (sal/30)*days
else:
# splits the date i.e it chooses the month, which has 28 days i.e february
ns = (sal/28)*days
sql = "insert into Salary values('{}', {}, '{}', {}, '{}', {}, {}, {})".format(
cookname, aadhar, bank, acc, date, sal, days, ns)
cur.execute(sql)
con.commit()
print("Net Salary Paid: Rs.", ns)
print('-----------------------------------------------------------------------------
-------------------------------------')
ui = input("1. Salary Menu 2. Main Menu: ")
print('-----------------------------------------------------------------------------
-------------------------------------')
if ui == '1':
salary()
elif ui == '2':
options()
else:
options()
15
for i in d:
if yr in i[1]: # as the date column is fetched by sql, it compares it with
the user input
oi = oi+i[0]
print("Total income from Orders: Rs. ", oi, )
elif t == '3':
dt = input('Enter Year/Month/Date: ')
def expense(): # tallys the expenses done by the store like electricity bill, water
bill etc.
exp = input('1. Bill Entry 2. Show Bills 3. Main Menu: ')
if exp == '1': # the value is added to database
type = input('Type: ')
cost = int(input('Cost: '))
date = input('Date (YYYY/MM/DD): ')
data = (type, cost, date)
query = 'insert into Expense values(%s, %s, %s)'
cur.execute(query, data)
con.commit()
print('Data entered successfully!')
elif exp == '2': # values is fetched from the database
query = 'Select * from Expense order by Date;' # arranges them in ascending
order
cur.execute(query)
d = cur.fetchall()
for i in d:
print(i)
else:
options()
signin()
16
10. OUTPUT
17
18
19
11. BIBLIOGRAPHY
https://openai.com/blog/chatgpt/
https://www.w3schools.com
https://docs.python.org/3/
https://dev.mysql.com/doc/
20