Hotel Management System Python
Hotel Management System Python
In
Informatics practices
Certificate
Contents
1. Introduction of the Project.
3. Python Coding.
5. References.
PYTHON CODING
#***************N. K. BAGRODIA PUBLIC SCHOOL **********************
VARIABLES DECLARATION
userName="" password
="" roomrent =0
restaurentbill=0
gamingbill=0
fashionbill=0
totalAmount=0
cid=""
global myConnection
password
myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password ,
auth_plugin='mysql_native_password' )
if myConnection:
print("\n CONGRATULATIONS ! YOUR MYSQL CONNECTION HAS BEEN ESTABLISHED !")
HMS") cursor.execute("COMMIT")
cursor.close()
return myConnection
else:
global cid
myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password ,
database="HMS" , auth_plugin='mysql_native_password' )
if myConnection:
return myConnection
else:
myConnection.close()
def userEntry():
global cid
if myConnection:
cursor=myConnection.cursor(
cursor.execute(createTable)
values= (cid,name,address,age,nationality,phoneno,email)
cursor.execute(sql,values) cursor.execute("COMMIT")
cursor.close()
else:
def bookingRecord():
global cid
customer=searchCustomer()
if customer:
if myConnection:
cursor=myConnection.cursor()
BOOKING_RECORD VALUES(%s,%s,%s)"
values= (cid,checkin,checkout)
cursor.execute(sql,values) cursor.execute("COMMIT")
SUCCESSFULLY !")
cursor.close()
else:
def roomRent():
global cid
customer=searchCustomer()
if customer:
global roomrent
if myConnection:
cursor=myConnection.cursor()
roomchoice==2:
elif roomchoice==3:
elif roomchoice==4:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
return
sql= "INSERT INTO ROOM_RENT VALUES(%s,%s,%s,%s,%s)" values=
(cid,roomchoice,noofdays,roomno,roomrent,) cursor.execute(sql,values)
",roomrent)
cursor.close()
else:
def Restaurent():
global cid
customer=searchCustomer()
if customer:
global restaurentbill
if myConnection:
cursor=myConnection.cursor(
"""
elif choice_dish==2:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
return
values= (cid,choice_dish,quantity,restaurentbill)
cursor.execute(sql,values) cursor.execute("COMMIT")
cursor.close()
else:
customer=searchCustomer()
if customer:
global gamingbill
if myConnection:
cursor=myConnection.cursor()
""" cursor.execute(createTable)
print("""
7. Exit
""")
print("\n\n#################################################")
if game==1:
print("YOU HAVE SELECTED TO PLAY : Table Tennis")
elif game==2:
elif game==5:
else: print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try
return
values= (cid,game,hour,gamingbill)
cursor.execute(sql,values)
print("FOR : ",hour," HOURS","\n *** WE HOPE YOU WILL ENJOY YOUR GAME ***")
print("\n\n#################################################")
cursor.close() else:
customer=searchCustomer()
if customer:
global fashionbill
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
print("""
""")
if dress==1:
print("\nShirts")
elif dress==2:
print("\nT-Shirts")
nPants") fashionbill =
print("\nJeans") fashionbill
dress==5:
print("\nTassel top")
nGown") fashionbill =
print("\nWestern dress")
nSkirts")
elif dress==9:
print("\nTrousers")
dress==10:
print("\nInnerWear")
fashionbill = quantity * 30
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
return
(cid,dress,quantity,fashionbill) cursor.execute(sql,values)
cursor.execute("COMMIT") print("\n\
n#################################################")
print("\n\n#################################################")
cursor.close()
else:
totalAmount():
global cid
customer=searchCustomer()
if customer:
global grandTotal
restaurentbill global
fashionbill global
gamingbill
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
gamingbill,fashionbill,grandTotal) cursor.execute(sql,values)
cursor.execute("COMMIT")
cursor.close()
print("___________________________________________________")
cursor.close() else:
searchOldBill():
global cid
customer=searchCustomer()
if customer: if
myConnection:
cursor=myConnection.cursor()
cursor.execute(sql,(cid,))
data=cursor.fetchall()
if data:
print(data)
else:
cursor.close() else:
def searchCustomer():
global cid if
myConnection:
cursor=myConnection.cursor()
cursor.execute(sql,(cid,))
data=cursor.fetchall()
if data:
print(data)
return True
else:
return False
cursor.close()
else:
""")
myConnection = MYSQLconnectionCheck ()
if myConnection: MYSQLconnection ()
while(True):
print("""
2--->Booking Record
10--->EXIT """)
if choice == 1:
userEntry() elif
choice ==2:
bookingRecord()
roomRent() elif
choice ==4:
Restaurent() elif
choice ==5:
Gaming() elif
choice ==6:
Fashion() elif
choice ==7:
searchCustomer()
totalAmount() elif
choice ==9:
searchOldBill() elif
choice ==10:
break
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ") else:
# END OF PROJECT
MAIN SCREEN
USER AUTHENTICATION
CUSTOMER DETAILS
CUSTOMER BOOKING RECORDS
ROOM RENT
RESTAURENT BILL
GAMING BILL
FASHION STORE BILL
DETAILS OF THE CUSTOMER
TOTAL BILL
OLD BILL
EXIT
MYSQL DATABASE AND TABLES USED IN THIS PROJECT
DATABASE
TABLE STRUCTURE 1 AND 2
TABLE STRUCTURE 3 AND 4
TABLE STRUCTURE 5 AND 6
TABLE STRUCTURE 7