0% found this document useful (0 votes)
4 views

HMS

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)
4 views

HMS

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/ 36

CERTIFICATE

This to certify that the project / Dissertation


entitled HOTEL MANAGEMENT SYSTEM is a
project done by DIVYANSHU TEJWANI of class
XII-A ACADEMIC YEAR
2024-2025 in partial fulfilment of CBSE’s
AISSCE Examination 2025 and has been
carried out under my direct supervision and
guidance. This report or a similar report on
the topic has not been submitted for any
other examination and does not form a part
of any other course undergone by the
candidate.
ACKNOWLEDGEMENT

I would like to express our sincere


gratitude to Mrs. Ankita Sardana, our
Computer Science teacher, for her invaluable
guidance, continuous support, and insightful
feedback throughout the completion of this
project.
We also appreciate the collaborative efforts
of everyone involved, which were essential to
the success of this project.
Thank you to everyone who supported us in
making this project a success.
INTRODUCTION

The hospitality industry plays a pivotal role in the


global economy, serving as a cornerstone of socio-
economic activities. As hotels and resorts continue to
evolve, effective management of daily operations
becomes essential to ensure smooth functioning and
customer satisfaction. To achieve this, it is crucial to
have a robust tool that streamlines the management of
the large volume of data generated by hotels, including
guest information, bookings, room availability, and
billing.
Hotels, as primary establishments within the hospitality
sector, produce significant amounts of information
daily. However, this information is often scattered or
not easily accessible when needed, which can lead to
inefficiencies and errors in operations. In recent years,
hotel management systems have emerged as a
transformative solution, improving the overall
efficiency of hotel operations, enhancing guest
experiences, and optimizing resource allocation.
OBJECTIVE & SCOPE OF THE PROJECT

The Hotel Management System (HMS) allows us the


ability to optimize and digitize all the processes within
the hotel, which will help to improve customer service,
reduce operational costs, streamline the management of
bookings, guest information, bills, room availability,
and staff assignments, etc.; thus, creating a centralized
database for each module implemented.
A Hotel Management System is a web-based system
developed for hotels and other accommodation
providers that wish to manage their operations
effectively, implementing modules for each required
area. It is essential to mention that the information
within the system is controlled by trained hotel
personnel. Computer technology serves as a tool to
replace outdated methods of record-keeping (e.g., paper
logs, physical registers, and manual guest records). A
computer system only collects, processes, and organizes
data; it is the trained personnel who acquire, interpret,
and manage the information to ensure smooth
operations and improved guest experience.
Justification and Need

4 Reasons Why We Need a Hotel Management


System

1. Improved Efficiency and Automation


A Hotel Management System (HMS) automates
routine tasks such as booking, check-ins/check-outs,
billing, and room assignments. This significantly
reduces manual effort, saves time, and enhances
operational efficiency. Automation ensures that staff
can focus on more critical tasks like customer service,
improving overall productivity.

2. Centralized Data Management


The system stores all hotel data—guest information,
bookings, room status, etc.—in a single, easily
accessible platform. This centralized database allows
quick access to real-time information, eliminating
errors caused by fragmented or paper-based records.
3. Real-Time Room Availability and Management
The system provides real-time information about room
availability, preventing overbooking and ensuring
rooms are efficiently assigned. Managers can also track
room maintenance schedules, reducing downtime and
ensuring that rooms are always ready for guests.

4. Enhanced Security and Data Protection


A Hotel Management System ensures that guest data,
financial transactions, and other sensitive information
are securely stored and managed. Access control
mechanisms ensure that only authorized personnel can
access speciic data, thereby protecting both guest
privacy and the hotel’s reputation.
System Implementation

HARDWARE USED:

Intel(R) Core (TM) i5-6500 CPU @ 3.20GHz


3.19GHz

8.00 GB (7.68 GB usable)

SOFTWARE USED:

Windows 10
IDLE Python 3.12.6
MYSQL 8.0
Microsoft® Word (version 2019)
Theoretical Background

WHAT IS DATABASE?
DBMS is a software to store and maintain data in
the form of tables. We can easily create, modify,
delete and view data from database. Examples:
Ms-Access, MySQL, SQLite, Microsoft SQL Server,
Oracle etc.

WHAT IS MYSQL?
In order to access data within the Oracle
database, all programs and users must use,
Structured Query Language (SQL). SQL is the set of
commands that is recognised by nearly all
RDBMS.

WHAT IS PYTHON?
Python is a high-level language. It is a free and
open-source language. It is an interpreted
language, as Python programs are executed
by an interpreter
CODE
import mysql.connector

con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)

cursor=con.cursor()
def main():
while True:
print('='*50)
print('-'*18,'DARBAR PALACE','-'*17)
print('='*50)
Q=input("PRESS 1 TO EXIT PRESS ENTER TO LOGIN")
if Q=='1':
break
c=input("Enter your username\n")
d=input("Enter your password\n")
if (c,d)==password():
while True:
print('='*50)
print('-'*18,'DARBAR PALACE','-'*17)
print('='*50)
print("SELECT THE MANAGEMENT TYPE")
print("A) ROOM MANAGEMENT")
print("B) CUSTOMER MANAGEMENT")
print("C) LOGOUT")
ask=input("Enter your choice -- press A or B or C\n")
if ask=='c' or ask=='C':
break
while True:
print('='*50)
print('-'*4,"SELECT THE ACTION YOU WANT TO PERFORM",'-'*7)
print('='*50)
if ask=='A' or ask=='a':
print("1) ADD A NEW ROOM")
print("2) SHOW ALL ROOMS")
print("3) SHOW ALL VACANT OR OCCUPIED ROOMS")
print("4) SEARCH ROOMS")
print("5) UPDATE ROOMS")
print("6) SORT ROOMS")
print("7) DELETE ROOMS")
print("8) EXIT")
rm=int(input("Enter your choice\n"))
if rm==1:
from new_room import newroom
newroom()
elif rm==2:
from display_all_rooms import displayall
displayall()
elif rm==3:
from display_rooms_status import displayov
displayov()
elif rm==4:
from search_rooms import search
search()
elif rm==5:
from update_rooms import update
update()
elif rm==6:
from sort_rooms import sort
sort()
elif rm==7:
from delete_rooms import delete
delete()
elif rm==8:
break
else:
print("INVALID CHOICE TAKEN\n")
continue
elif ask=='B' or ask=='b':
print("1) CHECK-IN")
print("2) CHECK-OUT")
print("3) DISPLAY ALL CUSTOMERS")
print("4) DISPLAY CHECKED-IN OR CHECKED-OUT CUSTOMERS")
print("5) SEARCH CUSTOMERS")
print("6) UPDATE CUSTOMERS")
print("7) SORT CUSTOMERS")
print("8) CANCEL BOOKING")
print("9) EXIT")
cm=int(input("Enter your choice"))
if cm==1:
from checkin_customer import checkin
checkin()
elif cm==2:
from checkout_customers import checkout
checkout()
elif cm==3:
from display_all_customers import displayallcm
displayallcm()
elif cm==4:
from display_customers_status import displayio
displayio()
elif cm==5:
from search_customers import searchcust
searchcust()
elif cm==6:
from update_customers import updatecust
updatecust()
elif cm==7:
from sort_customers import sort
sort()
elif cm==8:
from delete_customers import cancel
cancel()
elif cm==9:
break
else:
print("INVALID CHOICE TAKEN")
continue
else:
print("BAD CREDENTIALS")
continue
main()
import mysql.connector
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def newroom():
try:
while True:
print("="*50)
print('-'*17,"ADD A NEW ROOM",'-'*17)
print("="*50)
rn=int(input("Enter the room number\n"))
rtype=input("Enter the type of room- General/Deluxe/Super Deluxe\n")
gl=int(input("Enter the maximum number of guests that can stay in the room\n"))
ac=input("Enter whether the room is AC/Non-AC\n")
rent=float(input("Enter the per day rent for the room\n"))
status="Vacant"
query="insert into rooms values({},'{}',{},'{}',{},'{}')".format(rn,rtype,gl,ac,rent,status)
cursor.execute(query)
con.commit()
print("New Room added successfully")
ch=input("Would you like to add more new rooms? press-y/n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Maybe the Room Number you entered already exists")

import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def displayall():
print("="*50)
print('-'*17,"SHOW ALL ROOMS",'-'*17)
print("="*50)
query="select*from rooms"
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for i in r:
table.add_row(i)
print(table)
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def displayov():
try:
print("="*50)
print('-'*8,"SHOW ALL VACANT OR OCCUPIED ROOMS",'-'*7)
print("="*50)
ask=int(input("Press 1 to see Vacant Rooms, Press 2 to see Occupied Rooms\n"))
query=""
if ask==1:
query="select*from rooms where Status='Vacant'"
elif ask==2:
query="select*from rooms where Status='Occupied'"
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for i in r:
table.add_row(i)
print(table)
except Exception:
print("Something Went Wrong- Bad Credentials")

import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def search():
try:
while True:
print("="*50)
print('-'*19,"SEARCH ROOM",'-'*18)
print("="*50)
choice=input("would you like to search records for all Vacant rooms or Occupied rooms or All Rooms\n")
query=""
stat=choice.capitalize()
if stat=="Vacant" or stat=="Occupied":
print("Press 1 to search rooms on the basis of Room No.")
print("Press 2 to search rooms on the basis of Room Type")
print("Press 3 to search rooms on the basis of Guest Limit")
print("Press 4 to search records on the basis of AC or Non-AC rooms")
print("Press 5 to search rooms on the basis of Rent Per Day")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1:
n=int(input("Enter the room number you are looking for"))
query="select*from rooms where Room_No={} and status='{}'".format(n,stat)
elif ask==2:
t=input("Enter the Room Type- General/Deluxe/Super Deluxe")
query="select*from rooms where Room_Type='{}' and status='{}'".format(t,stat)
elif ask==3:
p=int(input("Enter the Guest limit"))
query="select*from rooms where Guest_Limit={} and status='{}'".format(p,stat)
elif ask==4:
q=input("Enter the type as AC/Non-AC")
query="select*from rooms where AC_or_Non_AC='{}' and status='{}'".format(q,stat)
elif ask==5:
x=float(input("Enter the lower limit of price"))
w=float(input("Enter the upper limit of price-(keep it same as upper limit if you want to search for a single price)"))
query="select*from rooms where Rent_Per_Day between {} and {} and status='{}'".format(x,w,stat)
else:
print("Invalid Choice taken")
continue
else:
print("Press 1 to search rooms on the basis of Room No.")
print("Press 2 to search rooms on the basis of Room Type")
print("Press 3 to search rooms on the basis of Guest Limit")
print("Press 4 to search records on the basis of AC or Non-AC rooms")
print("Press 5 to search rooms on the basis of Rent Per Day")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1:
n=int(input("Enter the room number you are looking for"))
query="select*from rooms where Room_No={}".format(n)
elif ask==2:
t=input("Enter the Room Type- General/Deluxe/Super Deluxe")
query="select*from rooms where Room_Type='{}'".format(t)
elif ask==3:
p=int(input("Enter the Guest limit"))
query="select*from rooms where Guest_Limit={}".format(p)
elif ask==4:
q=input("Enter the type as AC/Non-AC")
query="select*from rooms where AC_or_Non_AC='{}'".format(q)
elif ask==5:
x=float(input("Enter the lower limit of price"))
w=float(input("Enter the upper limit of price-(keep it same as upper limit if you want to search for a single price)"))
query="select*from rooms where Rent_Per_Day between {} and {}".format(x,w)
else:
print("Invalid Choice taken")
continue
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for i in r:
table.add_row(i)
print(table)
ch=input("Would you like to search fro more records? press-y/n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def update():
try:
while True:
print("="*50)
print('-'*18,"UPDATE ROOMS",'-'*18)
print("="*50)
query=""
print("Press 1 to Update Room No.")
print("Press 2 to Update Room Type")
print("Press 3 to Update Guest Limit")
print("Press 4 to Update Type of cooling as AC or Non-AC rooms")
print("Press 5 to Update Rent Per Day")
ask=int(input("Enter your choice for updating records suitably\n"))
if ask==1:
n=int(input("Enter the Room Number you want to update\n"))
e=int(input("Enter the new room number\n"))
query="update rooms set Room_No={} where Room_No={}".format(e,n)
elif ask==2:
t=int(input("Enter the Room No. for which you want to update Room Type\n"))
z=input("Enter the new Room Type\n")
query="update rooms set Room_Type='{}' where Room_No={}".format(z,t)
elif ask==3:
p=int(input("Enter the Room No. for which you want to update Guest Limit\n"))
x=int(input("Enter the new Guest Limit\n"))
query="update rooms set Guest_Limit={} where Room_No={}".format(x,p)
elif ask==4:
q=int(input("Enter the Room No. for which you want to update cooling type as AC/Non-AC"))
b=input("Enter the new cooling type as AC/Non-AC\n")
query="update rooms set AC_or_Non_AC='{}' where Room_No={} ".format(b,q)
elif ask==5:
w=int(input("Enter the Room No. for which you want to update Rent Per Day"))
v=float(input("Enter the new Rent Per Day\n"))
query="update rooms set Rent_Per_Day={} where Room_No={}".format(v,w)
elif ask not in [1,2,3,4,5]:
print("Invalid Choice taken")
continue
ch=input("Would you like to update more records? press-y/n\n")
if ch=='n' or ch=='N':
cursor.execute(query)
con.commit()
print("Records Updated Successfully")
break
else:
print("Here is the Updated Table")
cursor.execute(query)
con.commit()
query1="select*from rooms"
cursor.execute(query1)
r=cursor.fetchall()
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for i in r:
table.add_row(i)
print(table)
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def sort():
try:
while True:
print("="*50)
print('-'*19,"SORT ROOMS",'-'*19)
print("="*50)
choice=input("would you like to sort records for all Vacant rooms or Occupied rooms or All Rooms\n")
query=""
stat=choice.capitalize()
if stat=="Vacant" or stat=="Occupied":
print("Press 1 to sort rooms on the basis of Room No.")
print("Press 2 to sort rooms on the basis of Guest Limit")
print("Press 3 to sort rooms on the basis of Rent Per Day")
ask=int(input("Enter your choice for sorting records suitably\n"))
n=input("Type 'asc' to sort in Ascending Order or 'desc' to sort in Descending Order\n")
if ask==1:
query="select*from rooms where status='{}' order by Room_No {}".format(stat,n)
elif ask==2:
query="select*from rooms where status='{}' order by Guest_Limit {} ".format(stat,n)
elif ask==3:
query="select*from rooms where status='{}' order by Rent_Per_Day".format(stat,n)
else:
print("Invalid Choice taken")
continue
else:
print("Press 1 to sort rooms on the basis of Room No.")
print("Press 2 to sort rooms on the basis of Guest Limit")
print("Press 3 to sort rooms on the basis of Rent Per Day")
ask=int(input("Enter your choice for sorting records suitably\n"))
n=input("Type 'asc' to sort in Ascending Order or 'desc' to sort in Descending Order\n")
if ask==1:
query="select*from rooms order by Room_No {}".format(n)
elif ask==2:
query="select*from rooms order by Guest_Limit {}".format(n)
elif ask==3:
query="select*from rooms order by Rent_Per_Day {}".format(n)
else:
print("Invalid Choice taken")
continue
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table= PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for i in r:
table.add_row(i)
print(table)
ch=input("Would you like to sort more records? press-y/n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def delete():
try:
while True:
print("="*50)
print('-'*18,"DELETE ROOMS",'-'*18)
print("="*50)
print("NOTE!: YOU CANNOT DELETE RECORDS FOR OCCUPIED ROOMS")
print("Here is list of records having Vacant Rooms")
query1="select*from rooms where status='Vacant'"
cursor.execute(query1)
o=cursor.fetchall()
if len(o)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
for k in o:
table.add_row(k)
print(table)
query=""
print("Press 1 to delete rooms on the basis of Room No.")
print("Press 2 to delete rooms on the basis of Room Type")
print("Press 3 to delete rooms on the basis of Guest Limit")
print("Press 4 to delete records on the basis of AC or Non-AC rooms")
print("Press 5 to delete rooms on the basis of Rent Per Day")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1
n=int(input("Enter the room number for which you want to delete records\n"))
query="delete from rooms where Room_No={} and status='Vacant'".format(n)
elif ask==2:
t=input("Enter the Room Type- General/Deluxe/Super Deluxe for which you want to delete records")
query="delete from rooms where Room_Type='{}' and status='Vacant'".format(t)
elif ask==3:
p=int(input("Enter the Guest limit"))
query="delete from rooms where Guest_Limit={} and status='Vacant'".format(p)
elif ask==4:
q=input("Enter the type as AC/Non-AC")
query="delete from rooms where AC_or_Non_AC='{}' and status='Vacant'".format(q)
elif ask==5:
x=float(input("Enter the lower limit of price"))
w=float(input("Enter the upper limit of price-(keep it same as upper limit if you want to search for a single price)"))
query="delete from rooms where Rent_Per_Day between {} and {} and status='Vacant'".format(x,w)
elif ask not in [1,2,3,4,5]:
print("Invalid Choice taken")
continue
ch=input("Would you like to delete more records? press y/n")
if ch=='n' or ch=='N':
cursor.execute(query)
con.commit()
print("Records Deleted Successfully")
break
else:
table=PrettyTable()
table.field_names=['Room_No','Room_Type','Guest_Limit','AC_or_Non_AC','Rent_Per_Day','Status']
print("Here is the list of Updated Records")
cursor.execute(query)
con.commit()
r=cursor.fetchall()
for i in r:
table.add_row(i)
print(table)
continue
except Exception:
print("Something Went Wrong- Bad Credentials")

import mysql.connector
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def checkin():
try:
while True:
print("="*50)
print('-'*16,"CHECK-IN CUSTOMER",'-'*15)
print("="*50)
ref=int(input("Enter the reference number\n"))
cn=input("Enter the Customer Name\n")
gender=input("Enter the gender\n")
age=int(input("Enter the age\n"))
mob=input("Enter the Mobile Number (TYPE 0 if no Mobile Number)\n")
email=input("Enter the email id (TYPE 0 if no email)\n")
nat=input("Enter the nationality\n")
iproof=input("Enter the ID-PROOF submitted as PAN Card/Driving License/Aadhar Card/Passport(TYPE 0 if no ID Proof)\n")
ino=input("Enter ID Number on ID PROOF (TYPE 0 if no ID NO)\n")
add=input("Enter the address\n")
cd=input("Enter the date of check-in in yyyy-mm-dd format\n")
co='1111-11-11'
rn=int(input("Enter the room number alloted\n"))
status="Checked-in"
query1="update rooms set Status='Occupied' where Room_No={}".format(rn)
cursor.execute(query1)
con.commit()
query="insert into customers values({},'{}','{}',{},'{}','{}','{}','{}','{}','{}','{}',
{},'{}','{}')".format(ref,cn,gender,age,mob,email,nat,iproof,ino,add,cd,rn,status,co)
cursor.execute(query)
con.commit()
print("Check-in done successfully")
ch=input("Would you like to add more new customer? press-y/n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
import datetime
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def checkout():
print("="*50)
print('-'*15,"CHECK-OUT CUSTOMER",'-'*14)
print("="*50)

d=0
Total_Bill=0
room=int(input("Enter the room number in which customer is staying\n"))
year=int(input("Enter the year of check-out\n"))
month=int(input("Enter the month of check-out\n"))
day=int(input("Enter the day of check-out\n"))
co=datetime.date(year,month,day)
query1="select Check_In_Date from customers where Room_No={} and Status='Checked-in'".format(room)
cursor.execute(query1)
f=cursor.fetchall()
for i in f:
for j in i:
if j==co:
d=1
else:
d=co-j
query2="select Rent_Per_Day from rooms where Room_No={}".format(room)
cursor.execute(query2)
g=cursor.fetchall()
for k in g:
for x in k:
if d==1:
Total_Bill=d*x
else:
Total_Bill=d.days*x
print("The total bill for the customer is-",Total_Bill)
print("Your Check-Out was Successful")
query="update customers set Check_Out_Date='{}' where Room_No={} and Status='Checked-in'".format(co,room)
cursor.execute(query)
query3="update customers set Status='Checked-out' where Room_No={} and Status='Checked-in'".format(room)
cursor.execute(query3)
query4="update rooms set Status='Vacant' where Room_No={}".format(room)
cursor.execute(query4)
con.commit()

checkout()
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def displayallcm():
print("="*50)
print('-'*16,"SHOW ALL CUSTOMERS",'-'*16)
print("="*50)
query="select*from customers"
cursor.execute(query)
r=cursor.fetchall()
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
if len(r)==0:
print("No records found")
else:
for i in r:
table.add_row(i)
print(table)

import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def displayio():
print("="*50)
print('-'*5,"SHOW ALL CHECKED-IN OR CHECKED-OUT CUSTOMERS",'-'*5)
print("="*50)
try:
ask=int(input("Press 1 to see Checked-in Customers, Press 2 to see Checked-out Customers\n"))
query=""
if ask==1:
query="select*from customers where Status='Checked-in'"
else:
query="select*from customers where Status='Checked-out'"
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
for i in r:
table.add_row(i)
print(table)
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def searchcust():
try:
while True:
print("="*50)
print('-'*17,"SEARCH CUSTOMER",'-'*16)
print("="*50)
choice=input("would you like to search records for all Checked-in customers or Checked-out customers or All
Customers\n")
query=""
stat=choice.capitalize()
if stat=="Checked-in" or stat=="Checked-out":
print("Press 1 to search Customers on the basis of Reference No.")
print("Press 2 to search Customers on the basis of Name")
print("Press 3 to search Customers on the basis of Gender")
print("Press 4 to search Customers on the basis of Age")
print("Press 5 to search Customers on the basis of Mobile Number")
print("Press 6 to search Customers on the basis of Email ID")
print("Press 7 to search Customers on the basis of Nationality")
print("Press 8 to search Customers on the basis of ID Proof Type")
print("Press 9 to search Customers on the basis of ID No")
print("Press 10 to search Customers on the basis of Address")
print("Press 11 to search Customers on the basis of Check In Date")
print("Press 12 to search Customers on the basis of Check Out Date")
print("Press 13 to search Customers on the basis of Room No")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1:
n=int(input("Entehe Reference Number of the customer you are looking for\n"))
query="select*from customers where Reference_No={} and status='{}'".format(n,stat)
elif ask==2:
t=input("Enter the Name of the customer you are looking for\n")
query="select*from customers where Customer_Name='{}' and status='{}'".format(t,stat)
elif ask==3:
p=input("Enter the Gender of the customer you are looking for\n")
query="select*from customers where Gender='{}' and status='{}'".format(p,stat)
elif ask==4:
q=int(input("Enter the Age of the customer you are looking for\n"))
query="select*from customers where Age={} and status='{}'".format(q,stat)
elif ask==5:
x=input("Enter Mobile Number of the customer you are looking for\n")
query="select*from customers where Mobile_Number='{}' and status='{}'".format(x,stat)
elif ask==6:
A=input("Enter Email ID of the customer you are looking for\n")
query="select*from customers where Email_ID='{}' and status='{}'".format(A,stat)
elif ask==7:
B=input("Enter Nationality of the customer you are looking for\n")
query="select*from customers where Nationality='{}' and status='{}'".format(B,stat)
elif ask==8:
C=input("Enter ID Proof Type of the customer you are looking for\n")
query="select*from customers where ID_Proof_Type='{}' and status='{}'".format(C,stat)
elif ask==9:
D=input("Enter ID Number of the customer you are looking for\n")
query="select*from customers where ID_No='{}' and status='{}'".format(D,stat)
elif ask==10:
E=input("Enter Address of the customer you are looking for\n")
query="select*from customers where Address='{}' and status='{}'".format(E,stat)
elif ask==11:
F=input("Enter Check In Date of the customer you are looking for in yyyy-mm-dd format\n")
query="select*from customers where Check_In_Date='{}' and status='{}'".format(F,stat)
elif ask==12:
G=input("Enter Check Out Date of the customer you are looking for in yyyy-mm-dd format\n")
query="select*from customers where Check_Out_Date='{}' and status='{}'".format(G,stat)
elif ask==13:
H=input("Enter Room Number of the customer you are looking for\n")
query="select*from customers where Room_No='{}' and status='{}'".format(H,stat)
else:
print("Invalid Choice taken")
continue
else:
print("Press 1 to search Customers on the basis of Reference No.")
print("Press 2 to search Customers on the basis of Name")
print("Press 3 to search Customers on the basis of Gender")
print("Press 4 to search Customers on the basis of Age")
print("Press 5 to search Customers on the basis of Mobile Number")
print("Press 6 to search Customers on the basis of Email ID")
print("Press 7 to search Customers on the basis of Nationality")
print("Press 8 to search Customers on the basis of ID Proof Type")
print("Press 9 to search Customers on the basis of ID No")
print("Press 10 to search Customers on the basis of Address")
print("Press 11 to search Customers on the basis of Check In Date")
print("Press 12 to search Customers on the basis of Check Out Date")
print("Press 13 to search Customers on the basis of Room No")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1:
n=int(input("Enter the Reference Number of the customer you are looking for\n"))
query="select*from customers where Reference_No={}".format(n)
elif ask==2:
t=input("Enter the Name of the customer you are looking for\n")
query="select*from customers where Customer_Name='{}'".format(t)
elif ask==3:
p=input("Enter the Gender of the customer you are looking for\n")
query="select*from customers where Gender='{}'".format(p)
elif ask==4:
q=int(input("Enter the Age of the customer you are looking for\n"))
query="select*from customers where Age={}".format(q)
elif ask==5:
x=input("Enter Mobile Number of the customer you are looking for\n")
query="select*from customers where Mobile_Number='{}'".format(x)
elif ask==6:
A=input("Enter Email ID of the customer you are looking for\n")
query="select*from customers where Email_ID='{}'".format(A)
elif ask==7:
B=input("Enter Nationality of the customer you are looking for\n")
query="select*from customers where Nationality='{}'".format(B)
elif ask==8:
C=input("Enter ID Proof Type of the customer you are looking for\n")
query="select*from customers where ID_Proof_Type='{}'".format(C)
elif ask==9:
D=input("Enter ID Number of the customer you are looking for\n")
query="select*from customers where ID_No='{}'".format(D)
elif ask==10:
E=input("Enter Address of the customer you are looking for\n")
query="select*from customers where Address='{}'".format(E)
elif ask==11:
F=input("Enter Check In Date of the customer you are looking for in yyyy/mm/dd format\n")
query="select*from customers where Check_In_Date='{}'".format(F)
elif ask==12:
G=input("Enter Check Out Date of the customer you are looking for in yyyy/mm/dd format\n")
query="select*from customers where Check_Out_Date='{}'".format(G)
elif ask==13:
H=input("Enter Room Number of the customer you are looking for\n")
query="select*from customers where Room_No='{}'".format(H)
else:
print("Invalid Choice taken")
continue
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
for i in r:
table.add_row(i)
print(table)
ch=input("Would you like to search for more records? press-y/n\n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Bad Credentials")

import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def updatecust():
print("="*50)
print('-'*16,"UPDATE CUSTOMERS",'-'*16)
print("="*50)
try:
query2="select*from customers where Status='Checked-in'"
cursor.execute(query2)
u=cursor.fetchall()
if len(u)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
for k in u:
table.add_row(k)
print(table)
while True:
query=""
print("Press 1 to Update Reference No.")
print("Press 2 to Update Name")
print("Press 3 to Update Gender")
print("Press 4 to Update Age")
print("Press 5 to Update Mobile Number")
print("Press 6 to Update Email ID")
print("Press 7 to Update Nationality")
print("Press 8 to Update ID Proof Type")
print("Press 9 to Update ID No")
print("Press 10 to Update Address")
print("Press 11 to Update Check In Date")
print("Press 12 to Update Room No")
ask=int(input("Enter your choice for searching records suitably\n"))
if ask==1:
n=int(input("Enter the new Reference Number\n"))
m=int(input("Enter the new reference number\n"))
query="update customers set Reference_No={} where Reference_No={} and status='Checked-in'".format(n,m)
elif ask==2:
t=input("Enter the new Name of the customer\n")
T=int(input("Enter the Reference No.\n"))
query="update customers set Customer_Name='{}' where Reference_No={} and status='Checked-in'".format(t,T)
elif ask==3:
p=input("Enter the new Gender of the customer\n")
P=int(input("Enter the Reference No.\n"))
query="update customers set Gender='{}' where Reference_No={} and status='Checked-in'".format(p,P)
elif ask==4:
q=int(input("Enter the new Age of the customer\n"))
Q=int(input("Enter the Reference No.\n"))
query="update customers set Age={} where Reference_No={} and status='Checked-in'".format(q,Q)
elif ask==5:
x=input("Enter new Mobile Number of the customer\n")
X=int(input("Enter the Reference No.\n"))
query="update customers set Mobile_Number='{}' where Reference_No={} and status='Checked-in'".format(x,X)
elif ask==6:
A=input("Enter new Email ID of the customer\n")
a=int(input("Enter the Reference No.\n"))
query="update customers set Email_ID='{}' where Reference_No={} and status='Checked-in'".format(A,a)
elif ask==7:
B=input("Enter new Nationality of the customer\n")
b=int(input("Enter the Reference No.\n"))
query="update customers set Nationality='{}' where Reference_No={} and status='Checked-in'".format(B,b)
elif ask==8:
C=input("Enter new ID Proof Type of the customer\n")
c=int(input("Enter the Reference No.\n"))
query="update customers set ID_Proof_Type='{}' where Reference_No={} and status='Chceked-in'".format(C,c)
elif ask==9:
D=input("Enter new ID Number of the customer\n")
d=int(input("Enter the Reference No.\n"))
query="update customers set ID_No='{}' where Reference_No={} and status='Checked-in'".format(D,d)
elif ask==10:
E=input("Enter new Address of the customer\n")
e=int(input("Enter the Reference No.\n"))
query="update customers set Address='{}' where Reference_No={} and status='Checked-in'".format(E,e)
elif ask==11:
F=input("Enter new Check In Date of the customer you are looking for in yyyy-mm-dd format\n")
f=int(input("Enter the Reference No."))
query="update customers set Check_In_Date='{}' where Reference_No={} and status='Checked-in'".format(F,f)
elif ask==12:
H=input("Enter new Room Number of the customer\n")
h=int(input("Enter the Reference No."))
query="update customers set Room_No='{}' where Reference_No={} and status='Checked-in'".format(H,h)
else:
print("Invalid Choice taken")
continue

ch=input("Would you like to update more records? press-y/n\n")


if ch=='n' or ch=='N':
cursor.execute(query)
con.commit()
print("Records Updated Successfully")
break
else:
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
print("Here is the Updated Table till now")
queryd="select*from customers where Status='Checked-in'"
cursor.execute(queryd)
V=cursor.fetchall()
for i in V:
table.add_row(i)
print(table)
continue
except Exception:
print("Something Went Wrong- Bad Credentials")

import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def sort():
try:
while True:
print("="*50)
print('-'*17,"SORT CUSTOMERS",'-'*17)
print("="*50)
choice=input("would you like to sort records for all Checked-in customers or Checked-Out or All Customers\n")
query=""
stat=choice.capitalize()
if stat=="Checked-in" or stat=="Checked-out":
print("Press 1 to sort customers on the basis of Reference No.")
print("Press 2 to sort customers on the basis of Room No.")
print("Press 3 to sort customers on the basis of Name")
print("Press 4 to sort customers on the basis of Age")
print("Press 5 to sort customers on the basis of Check-in Date")
print("Press 6 to sort customers on the basis of Check-Out Date")
ask=int(input("Enter your choice for sorting records suitably\n"))
n=input("Type 'asc' to sort in Ascending Order or 'desc' to sort in Descending Order\n")
if ask==1:
query="select*from customers where status='{}' order by Reference_No {}".format(stat,n)
elif ask==2:
query="select*from customers where status='{}' order by Room_No {} ".format(stat,n)
elif ask==3:
query="select*from customers where status='{}' order by Customer_Name {}".format(stat,n)
elif ask==4:
query="select*from customers where status='{}' order by Age {}".format(stat,n)
elif ask==5:
query="select*from customers where status='{}' order by Check_In_Date {}".format(stat,n)
elif ask==6:
query="select*from customers where status='{}' order by Check_Out_Date {}".format(stat,n)
else:
print("Invalid Choice taken")
continue
else:
print("Press 1 to sort customers on the basis of Reference No.")
print("Press 2 to sort customers on the basis of Room No.")
print("Press 3 to sort customers on the basis of Name")
print("Press 4 to sort customers on the basis of Age")
print("Press 5 to sort customers on the basis of Check-in Date")
print("Press 6 to sort customers on the basis of Check-Out Date")
ask=int(input("Enter your choice for sorting records suitably\n"))
n=input("Type 'asc' to sort in Ascending Order or 'desc' to sort in Descending Order\n")
if ask==1:
query="select*from customers order by Reference_No {}".format(n)
elif ask==2:
query="select*from customers order by Room_No {}".format(n)
elif ask==3:
query="select*from customers order by Customer_Name {}".format(n)
elif ask==4:
query="select*from customers order by Age {}".format(n)
elif ask==5:
query="select*from customers order by Check_In_Date {}".format(n)
elif ask==6:
query="select*from customers order by Check_Out_Date {}".format(n)
else:
print("Invalid Choice taken")
continue
cursor.execute(query)
r=cursor.fetchall()
if len(r)==0:
print("No records found")
else:
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
for i in r:
table.add_row(i)
print(table)
ch=input("Would you like to sort more records? press-y/n")
if ch=='n' or ch=='N':
break
else:
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
import mysql.connector
from prettytable import PrettyTable
con = mysql.connector.connect(host="localhost",user="root",password="hillwoods",database="darbar_palace",use_pure=True)
cursor=con.cursor()
def cancel():
try:
while True:
print("="*50)
print('-'*17,"CANCEL BOOKING",'-'*17)
print("="*50)
query=""
stat="Checked-in"
print("Press 1 to delete Customers on the basis of Reference No.")
print("Press 2 to delete Customers on the basis of Name")
print("Press 3 to delete Customers on the basis of Mobile Number")
print("Press 4 to delete Customers on the basis of Email ID")
print("Press 5 to delete Customers on the basis of Check In Date")
ask=int(input("Enter your choice for deleting records suitably\n"))
if ask==1:
n=int(input("Enter the Reference Number of the customer for which you want to cancel booking\n"))
query="delete from customers where Reference_No={} and status='{}'".format(n,stat)
elif ask==2:
t=input("Enter the Name of the customer for which you want to cancel booking\n")
query="delete from customers where Customer_Name='{}' and status='{}'".format(t,stat)
elif ask==3:
x=input("Enter Mobile Number of the customer for which you want to cancel booking\n")
query="delete from customers where Mobile_Number='{}' and status='{}'".format(x,stat)
elif ask==4:
A=input("Enter Email ID of the customer for which you want to can booking\n")
query="delete from customers where Email_ID='{}' and status='{}'".format(A,stat)
elif ask==5:
B=input("Enter Nationality of the customer for which you want to cancel booking\n")
query="delete from customers where Nationality='{}' and status='{}'".format(B,stat)
else:
print("Invalid Choice taken")
continue
cursor.execute(query)
con.commit()
print("Records Deleted Succesfully")
ch=input("Would you like to delete more records? press-y/n\n")
if ch=='n' or ch=='N':
break
else:
print("Here is the Updated Table after Cancellation Till Now")
query1="select*from customers where Status='Checked-in'"
cursor.execute(query1)
r=cursor.fetchall()
table=PrettyTable()
table.field_names=
['Reference_No','Customer_Name','Gender','Age','Mobile_Number','Email_ID','Nationality','ID_Proof_Type','ID_No','Address
','Check_In_Date','Room_No','Status','Check_Out_Date']
for i in r:
table.add_row(i)
print(table)
continue
except Exception:
print("Something Went Wrong- Bad Credentials")
OUTPUT
REFERENCES

In order to work on this project titled-


HOTEL MANAGEMENT SYSTEM, the
following books and sites are referred by us
during the various phases of development:
1. http://www.mysql.org/
2. http://www.python.org/
3. COMPUTER SCIENCE FOR CLASS XII
- by SUMITA ARORA

You might also like