Project Hotelm
Project Hotelm
Source code
import pandas as pd
import mysql.connector as cp
con=cp.connect(host="localhost",user='root',passwd='francis',data
base='hotelm')
c=con.cursor()
def mainmenu():
print("\t\t\t--ST. FRANCIS SR. SEC. SCHOOL--\t\t\t")
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t\t---MENU---\t\t\t\t")
print("\
t*******************************************************************")
print("\t\t\t 1. About Project")
print("\t\t\t 2. Add Data")
print("\t\t\t 3. Show Data")
print("\t\t\t 4. Search Data")
print("\t\t\t 5. Delete Data")
print("\t\t\t 6. Update Data")
print("\t\t\t 7. Check_in")
print("\t\t\t 8. Check_out")
print("\
t*******************************************************************")
ch=int(input("Enter your choice"))
if ch==1:
aboutus()
elif ch==2:
add_data()
elif ch==3:
show()
elif ch==4:
search()
elif ch==5:
delete()
elif ch==6:
update()
elif ch==7:
check_in()
elif ch==8:
check_out()
elif ch!=[1,2,3,4,5,6,7,8]:
print('invalid choice')
mainmenu()
def aboutus():
print('\
t******************************************************************\t')
print('\t\t\t---ST. FRANCIS SR. SEC. SCHOOL---\t\t\t')
print('\t\t\t------Session :- 2024-25------\t\t\t')
print('\
t******************************************************************\t')
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print('\n')
print('\t\t\tSubmitted by:Deepika,Bhoomika,Tanvi\t\t\t')
print('\t\t\tGuided by:Sir Vijendra sharma\t\t\t')
print('\
t******************************************************************\t')
def add_data():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t ---ADD CUSTOMER DETAILS--- \t\t\t")
ci=int(input('enter the customer id'))
cn=input('enter the customer name')
cc=input('enter the customers city')
cp=int(input('enter the customer phone number'))
rn=int(input('enter the room number'))
rt=input('enter the room type')
cin=input('enter the check in date')
sql="insert into
customer(cus_id,cus_name,cus_city,cus_phone,room_no,room_t
ype,check_in,check_out,days)values({},'{}','{}',{},
{},'{}','{}')".format(ci,cn,cc,cp,rn,rt,cin)
c.execute(sql)
con.commit()
print('\t\tCUSTOMER DETAILS ADDED SUCCESSFULLY\t\t')
def show():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t --show customer details---- \t\t\t")
q="select * from customer"
c.execute(q)
data=c.fetchall()
for i in data:
print(i)
print("total no. of rows",c.rowcount)
def search():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t--Search the Details of Customers--\t\t\t")
ci=int(input("enter the customer id"))
q="select* from customer where cus_id={}".format(ci)
c.execute(q)
data=c.fetchall()
print(data)
def delete():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t --Delete Customer Record-- \t\t\t")
ci=int(input("enter the customer d"))
q="delete from customer where cus_id={}".format(ci)
c.execute(q)
print("deleted successfully")
con.commit()
def update():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
print("\t\t\t*****Update Customer Record******")
print("\t\t------------------------------------")
ci=int(input('enter the customer id'))
cn=input("enter the name")
cc=input("enter the city")
q1="update customer set cus_name='{}',cus_city='{}'where
cus_id={}".format(cn,cc,ci)
c.execute(q1)
con.commit()
print("data updated successfully")
def check_in():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
while(True):
print("\t\t-------------------------------------------")
print("\t\t*****Enter the Customer Details******")
print("\t\t-------------------------------------------")
ci=int(input("enter the customer id : "))
cn=input("enter the customer name: ")
cc=input("enter the city: ")
cp=int(input("enter the mobile no.: "))
rn=int(input("enter the room no.: "))
rt=input("enter room type(AC/NON-AC): ")
cin=input("enter the check in date(yyyy/mm/dd): ")
q="insert into
customer(cus_id,cus_name,cus_city,cus_phone,room_no,room_t
ype,check_in)values({},'{}','{}',{},
{},'{}','{}')".format(ci,cn,cc,cp,rn,rt,cin)
c.execute(q)
con.commit()
oc='occupied'
q1='update status set status=%s where room_no=%s'
d=(oc,rn)
c.execute(q1,d)
con.commit()
print('\t\t----------------------------------------')
print('customer check in successfully')
print('customer room no. is:',rn)
print('\t\t----------------------------------------')
print("1. enter more")
print("2. exit")
ch=int(input("enter your choice"))
if ch==2:
break
def check_out():
print("\t\t\t --HOTEL MANAGEMENT SYSTEM-- \t\t\t")
while(True):
print("\t\t------------------------------------")
print("\t\t*****--Generate Invoice******")
print("\t\t------------------------------------")
ci=int(input("enter the customer id : "))
rn=input("enter the room no.: ")
rt=input("enter room type(AC/NON-AC): ")
cou=input("enter the check_out date(yyyy/mm/dd): ")
da=int(input("\t\tenter the no. of days: "))
print("--------------------------------------")
q1="update customer set check_out=%s,days=%s where
cus_id=%s"
cout=(cou,da,ci)
c.execute(q1,cout)
if(rt=="ac"):
bill=6000*da
print("your total bill is",bill)
else:
bill=5000*da
print("your total bill is",bill)
q1="update customer set bill=%s where cus_id=%s"
d=(bill,ci)
c.execute(q1,d)
oc="vacant"
q2="update status set status=%s where room_no=%s"
d=(oc,rn)
c.execute(q2,d)
print("invoice has been generated")
con.commit()
print("\t\t-----------------------------------------------------")
print("1.enter more")
print("2.exit")
ch=int(input("enter your choice"))
if ch==2:
break
mainmenu()
programming output
menu:
About project:
Add data:
Show data:
Search data:
delete data:
Update data: