Hotel Managment Computer Project
Hotel Managment Computer Project
connector
myConnnection =""
cursor=""
userName=""
password =""
roomrent =0
restaurentbill=0
totalAmount=0
cid=""
global myConnection
global userName
global password
myConnection=mysql.connector.connect(host="localhost",user=userName,passwd=password ,auth_
plugin='mysql_native_password',charset='utf8')
if myConnection:
cursor=myConnection.cursor()
cursor.execute("COMMIT")
cursor.close()
return myConnection
else:
MYSQLconnectionCheck ()
global password
global myConnection
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()
cursor.execute(createTable)
values= (cid,checkin,checkout)
cursor.execute(sql,values)
cursor.execute("COMMIT")
cursor.close()
else:
def roomRent():
global cid
customer=searchCustomer()
if customer:
global roomrent
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
print ("\n ##### We have The Following Rooms For You #####")
if roomchoice==1:
elif roomchoice==2:
elif roomchoice==3:
elif roomchoice==4:
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
return
values= (cid,roomchoice,noofdays,roomno,roomrent,)
cursor.execute(sql,values)
cursor.execute("COMMIT")
print("Thank You , Your Room Has Been Booked For : ",noofdays , "Days" )
cursor.close()
else:
print("\nERROR ESTABLISHING MYSQL CONNECTION !")
def Restaurent():
global cid
customer=searchCustomer()
if customer:
global restaurentbill
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
if choice_dish==1:
elif choice_dish==2:
elif choice_dish==3:
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:
def totalAmount():
global cid
customer=searchCustomer()
if customer:
global grandTotal
global roomrent
global restaurentbill
if myConnection:
cursor=myConnection.cursor()
cursor.execute(createTable)
grandTotal=roomrent + restaurentbill
cursor.execute(sql,values)
cursor.execute("COMMIT")
cursor.close()
print("___________________________________________________")
print("\nTOTAL AMOUNT : Rs. ",grandTotal)
cursor.close()
else:
def 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:
print("""
myConnection = MYSQLconnectionCheck ()
if myConnection:
MYSQLconnection ()
while(True):
2--->Booking Record
8--->EXIT ''')
if choice ==2:
bookingRecord()
roomRent()
Restaurent()
searchCustomer()
totalAmount()
searchOldBill()
userEntry()
break
else:
print("Sorry ,May Be You Are Giving Me Wrong Input, Please Try Again !!! ")
else:
# END OF PROJECT
OUTPUTS
2--->Booking Record
8--->EXIT
2--->Booking Record
8--->EXIT
2--->Booking Record
8--->EXIT
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 2
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 2
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 1
Enter Quantity : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 2
Enter Quantity : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
Enter Quantity : 1
8--->EXIT
ENTER CUSTOMER ID : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 2
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
[('3', 'arush', 'vizag', '18', 'India', '890765', 'arush78@gmail.com')]
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 1
___________________________________________________
2--->Booking Record
ENTER CUSTOMER ID : 2
___________________________________________________
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
___________________________________________________
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 1
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 2
2--->Booking Record
8--->EXIT
ENTER CUSTOMER ID : 3
2--->Booking Record
8--->EXIT
>>>
OUTPUTS
+----------------+
| Tables_in_hms |
+----------------+
| booking_record |
| c_details |
| restaurent |
| room_rent |
| total |
+----------------+
+------+------------+------------+
+------+------------+------------+
| 1 | 2024-11-08 | 2024-11-10 |
| 2 | 2024-11-08 | 2024-11-09 |
| 3 | 2024-11-08 | 2024-11-11 |
+------+------------+------------+
+------+---------+-----------+-------+-----------+---------+--------------------+
+------+---------+-----------+-------+-----------+---------+--------------------+
| 1 | harsha | vizag | 18 | india | 9087654 | harsha6@gmail.com |
+------+---------+-----------+-------+-----------+---------+--------------------+
+------+---------+----------+----------------+--------------+
+------+---------+----------+----------------+--------------+
+------+---------+----------+----------------+--------------+