Hotel Management

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

HOTEL MANAGEMENT

DBMS : MYSQL

HOST: LOCALHOST

USER:ROOT

PASSWORD :ROOT

DATABSE : HOTEL

im
port os

import platform

import mysql.connector

import pandas as pd

import datetime

global z

mydb = mysql.connector.connect(user='root', password='root',\

Page 1 of 12
host='localhost')

mycursor=mydb.cursor()

def create_db():

try:

mycursor = mydb.cursor()

mycursor.execute("CREATE DATABASE hotel")

except:

print("Databse or Table Already Created")

def create_table():

try:

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor = mydb.cursor()

mycursor.execute("CREATE TABLE custdata(custname varchar(10),addr varchar(15), indate date, outdate


date)")

print("custdata Table Created")

createRoomType="create table roomtype (sno varchar(5) primary key,roomtype varchar(10),rent


integer(10)); "

print("roomtype Table Created")

mycursor.execute(createRoomType)

q1="""insert into roomtype values ('1','type A',1000),('2','type B',2000),('3','type C',3000),('4','type


D',4000);"""

print("Add Room Type")

mycursor.execute(q1)

createRestaurent="create table restaurent (sno integer(10),itemname varchar(10),rate integer(10)); "

print("create Restaurent table")

mycursor.execute(createRestaurent)

q2="""insert into restaurent values(1,"tea",10),(2,"coffee",10),(3,"colddrink",20),(4,"samosa",10),\

(5,"sandwich",50),(6,"Dhokla",30),(7,"kachori",10),(8,"milk",20),\

Page 2 of 12
(9,"noodles",50),(10,"pasta",50)"""

print("Add dishes")

mycursor.execute(q2)

createLaundary="create table laundary(sno integer(10) primary key,itemname varchar(10),rate integer(10));


"

mycursor.execute(createLaundary)

print("Created laundary")

q3="""insert into laundary values(1,"pant",10),(2,"shirt",10),(3,"suit",10),(4,"sari",10); """

print("Add Record laundary")

mycursor.execute(q3)

mydb.commit()

except:

print("Table Already Created")

def registercust():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

L=[]

name=input("enter name:")

L.append(name)

addr=input("enter address:")

L.append(addr)

indate=input("enter check in date:")

L.append(indate)

outdate=input("enter check out date:")

L.append(outdate)

cust=(L)

print(cust)

sql="insert into custdata (custname,addr,indate,outdate)values(%s,%s,%s,%s)"

mycursor.execute(sql,cust)

Page 3 of 12
mydb.commit()

def roomtypeview():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

print("Do yoy want to see room type available : Enter 1 for yes :")

ch=int(input("enter your choice:"))

if ch==1:

sql="select * from roomtype"

mycursor.execute(sql)

rows=mycursor.fetchall()

for x in rows:

print(x)

def roomrent():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

print ("We have the following rooms for you:-")

print ("1. type A---->rs 1000 PN\-")

print ("2. type B---->rs 2000 PN\-")

print ("3. type C---->rs 3000 PN\-")

print ("4. type D---->rs 4000 PN\-")

x=int(input("Enter Your Choice Please->"))

n=int(input("For How Many Nights Did You Stay:"))

if(x==1):

print ("you have opted room type A")

s=1000*n

elif (x==2):

print ("you have opted room type B")

Page 4 of 12
s=2000*n

elif (x==3):

print ("you have opted room type C")

s=3000*n

elif (x==4):

print ("you have opted room type D")

s=4000*n

else:

print ("please choose a room")

print ("your room rent is =",s,"\n")

def restaurentmenuview():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

print("Do yoy want to see mebu available : Enter 1 for yes :")

ch=int(input("enter your choice:"))

if ch==1:

sql="select * from restaurent"

mycursor.execute(sql)

rows=mycursor.fetchall()

for x in rows:

print(x)

def orderitem():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

global s

print("Do yoy want to see mebu available : Enter 1 for yes :")

ch=int(input("enter your choice:"))

if ch==1:

Page 5 of 12
sql="select * from restaurent"

mycursor.execute(sql)

rows=mycursor.fetchall()

for x in rows:

print(x)

print("do you want to purchase from above list:enter your choice:")

d=int(input("enter your choice:"))

if(d==1):

print("you have ordered tea")

a=int(input("enter quantity"))

s=10*a

print("your amount for tea is :",s,"\n")

elif (d==2):

print("you have ordered coffee")

a=int(input("enter quantity"))

s=10*a

print("your amount for coffee is :",s,"\n")

elif(d==3):

print("you have ordered colddrink")

a=int(input("enter quantity"))

s=20*a

print("your amount for colddrink is :",s,"\n")

elif(d==4):

print("you have ordered samosa")

a=int(input("enter quantity"))

s=10*a

print("your amount fopr samosa is :",s,"\n")

elif(d==5):

Page 6 of 12
print("you have ordered sandwich")

a=int(input("enter quantity"))

s=50*a

print("your amount fopr sandwich is :",s,"\n")

elif(d==6):

print("you have ordered dhokla")

a=int(input("enter quantity"))

s=30*a

print("your amount for dhokla is :",s,"\n")

elif(d==7):

print("you have ordered kachori")

a=int(input("enter quantity"))

s=10*a

print("your amount for kachori is :",s,"\n")

elif(d==8):

print("you have ordered milk")

a=int(input("enter quantity"))

s=20*a

print("your amount for kachori is :",s,"\n")

elif(d==9):

print("you have ordered noodles")

a=int(input("enter quantity"))

s=50*a

print("your amount for noodles is :",s,"\n")

elif(d==10):

print("you have ordered pasta")

a=int(input("enter quantity"))

s=50*a

Page 7 of 12
print("your amount for pasta is :",s,"\n")

else:

Print("please enter your choice from the menu")

def laundarybill():

mydb = mysql.connector.connect(host="localhost",user="root",passwd="root",database="hotel")

mycursor=mydb.cursor()

global z

print("Do yoy want to see rate for laundary : Enter 1 for yes :")

ch=int(input("enter your choice:"))

if ch==1:

sql="select * from laundary"

mycursor.execute(sql)

rows=mycursor.fetchall()

for x in rows:

print(x)

y=int(input("Enter Your number of clothes->"))

z=y*10

print("your laundary bill:",z,"\n")

return z

def lb():

print(z)

def res():

print(s)

def viewbill():

a=input("enter customer name:")

print("customer name :",a,"\n")

print("laundarey bill:")

print(lb)

Page 8 of 12
print("restaurent bill:")

print(res)

def Menuset():

print("enter 1: To enter customer data")

print("enter 2 : To view roomtype")

print("enter 3 : for calculating room bill")

print("enter 4 : for viewing restaurent menu")

print("enter 5 : for restaurent bill")

print("enter 6 :for laundary bill")

print("enter 7 : for complete bill")

print("enter 8 : for exit:")

try:

userinput=int(input("please select an above option:"))

except ValueError:

exit("\n hi thats not a number")

userinput=int(input("enter your choice"))

if(userinput==1):

registercust()

elif(userinput==2):

roomtypeview()

elif(userinput==3):

roomrent()

elif(userinput==4):

restaurentmenuview()

elif(userinput==5):

orderitem()

elif(userinput==6):

laundarybill()

Page 9 of 12
elif(userinput==7):

viewbill()

elif(userinput==8):

quit()

else:

print("enter correct choice")

create_db()

create_table()

Menuset()

def runagain():

runagn=input("\n want to run again y/n:")

while(runagn.lower()=='y'):

if(platform.system()=="windows"):

print(os.system('cls'))

else:

print(os.system('clear'))

Menuset()

runagn=input("\n want to run again y/n:")

runagain()

Page 10 of 12
Page 11 of 12
Page 12 of 12

You might also like