1213 lines
39 KiB
Python
1213 lines
39 KiB
Python
"""This is a fully functional hotel system from the Grand Budapest Hotel."""
|
|
|
|
__author__ = "7509429, Gebert, 0000000, YYYYY"
|
|
__email__ = "0000000@stud.uni-frankfurt.de"
|
|
__email__ = "s6474549@stud.uni-frankfurt.de"
|
|
__credit__ = " Grandhotel.wav by David Gebert "
|
|
|
|
import math
|
|
import os
|
|
import sys
|
|
import time
|
|
import random
|
|
|
|
|
|
|
|
#----------------CLASS---KEY------------------------------------------
|
|
|
|
|
|
class Key:
|
|
"""Key class for key management."""
|
|
|
|
how_many_keys = 0
|
|
|
|
def __init__(self, keynumber):
|
|
"""Initialization of a new key object."""
|
|
self.number = keynumber
|
|
self.possessor = "Rezeption"
|
|
|
|
def status_key(self, keynumber=None):
|
|
"""Prints the current possessor of a key."""
|
|
print("Schlüssel", self.number, "im Besitz", self.possessor)
|
|
|
|
def hand_out_key(self, keynumber, guest):
|
|
"""Changes the current possessor of a key to the guest who checks
|
|
in."""
|
|
self.possessor = guest
|
|
|
|
def get_back_key(self, keynumber):
|
|
"""Changes the current possessor of a key to the reception."""
|
|
self.possessor = "Rezeption"
|
|
|
|
# Generates all the keys, two for each room.
|
|
# results in keynumbers: 11, 12, 21, 22, 31, 32, 41, 42 .
|
|
key_list = []
|
|
for i in range(11, 42, 10):
|
|
a = "key_" + str(i) + " = Key(" + str(i) + ")"
|
|
exec(a)
|
|
a2 = "key_list.append(key_" + str(i) + ")"
|
|
exec(a2)
|
|
|
|
b = "key_" + str(i+1) + " = Key(" + str(i+1) + ")"
|
|
exec(b)
|
|
b2 = "key_list.append(key_" + str(i+1) + ")"
|
|
exec(b2)
|
|
|
|
#----------------CLASS---CLIENT-------------------------------------
|
|
#List of clients that are currently checked in.
|
|
checked_in_list = []
|
|
#List of clients that are currently checked out.
|
|
client_list = []
|
|
#List of all clients of the hotel.
|
|
all_clients = []
|
|
|
|
|
|
class Client():
|
|
"""Client class for customer management."""
|
|
months = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli',\
|
|
'August', 'September', 'Oktober', 'November', 'Dezember']
|
|
|
|
clients = 0
|
|
|
|
def __init__(self, name: str, surname: str, client_num: str, room: str,\
|
|
period, key_num: int, bookings, status: bool,\
|
|
checked_in: bool):
|
|
"""Initialization of a new client object."""
|
|
|
|
self.name = name
|
|
self.surname = surname
|
|
self.client_num = client_num
|
|
self.room = None
|
|
self.period = period
|
|
self.key_num = 0
|
|
self.bookings = []
|
|
self.status = False
|
|
self.checked_in = checked_in
|
|
Client.clients += 1
|
|
|
|
def check_in(self, room, key_num, period):
|
|
"""Check In function: assign client to room and hand out keys.
|
|
|
|
Args:
|
|
room: room name : str
|
|
key_num: key number : str
|
|
period: str
|
|
|
|
Returns:
|
|
new_bill: command for creating a new bill matching the booking
|
|
"""
|
|
|
|
self.checked_in = True
|
|
self.period = str(period)
|
|
room_list[reference.index(str(room))].occupy(self.surname, self.period)
|
|
self.room = str(room)
|
|
num_ = "key_" + str(key_num) + ".hand_out_key(" + str(key_num) + "," +\
|
|
"'" + str(self.surname) + "')"
|
|
checked_in_list.append(str(self.client_num))
|
|
client_list.remove(str(self.client_num))
|
|
self.key_num = int(key_num)
|
|
self.vip_status()
|
|
try:
|
|
exec(num_)
|
|
except:
|
|
("Schlüssel mit Daten nicht gefunden.")
|
|
if self.status == True:
|
|
print("Der Kunde besitzt VIP Privilegien. Er erhält \
|
|
kostenloses Frühstück sowie die kostenlose Benutzung der Mini-Bar.")
|
|
print("Check In erfolgreich.")
|
|
new_bill = add_bill(self.name, self.surname, self.client_num, room,\
|
|
self.period)
|
|
return new_bill
|
|
|
|
def check_out(self):
|
|
"""Check out function: clear room, key to reception"""
|
|
if self.checked_in == True:
|
|
|
|
room_list[reference.index(self.room)].free()
|
|
key_num = self.key_num
|
|
num_ = "key_" + str(key_num) + ".get_back_key(" + str(key_num) +\
|
|
")"
|
|
self.checked_in = False
|
|
self.room = None
|
|
self.period = None
|
|
self.key_num = None
|
|
self.vip_status()
|
|
checked_in_list.remove(self.client_num)
|
|
client_list.append(self.client_num)
|
|
try:
|
|
exec(num_)
|
|
print("Der Gast ist erfolgreich ausgecheckt worden.")
|
|
|
|
except:
|
|
("Schlüssel mit Daten nicht gefunden.")
|
|
|
|
def client_bill(self, bill_num):
|
|
"""Appends the new bill number to the bookings of client."""
|
|
self.bookings.append(str(bill_num))
|
|
|
|
def client_bill_delete(self, bill_num):
|
|
"""Deletes a bill number that includes the checking out process."""
|
|
if bill_num in self.bookings:
|
|
self.vip_status()
|
|
self.bookings.remove(bill_num)
|
|
print("Rechnung wurde beim Gast", self.client_num, "gelöscht.")
|
|
self.check_out()
|
|
|
|
|
|
def vip_status(self):
|
|
"""Adjusts the VIP Status of a client."""
|
|
if len(self.bookings) > 3:
|
|
self.status = True
|
|
if len(self.bookings) < 4:
|
|
self.status = False
|
|
|
|
|
|
def period_print(self):
|
|
"""Prints the stay period of a guest in a legible format."""
|
|
# creates a list format to work with
|
|
stay_period = []
|
|
num_string = ""
|
|
for i in self.period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period.append(num_string)
|
|
|
|
stay_period = tuple(stay_period)
|
|
# Same month
|
|
if stay_period[1] == stay_period[3]:
|
|
days = int(stay_period[0]) - int(stay_period[2])
|
|
month_num = int(stay_period[1]) - 1
|
|
month_print = Client.months[month_num]
|
|
print("Der Kunde bleibt", abs(days), "Tage.")
|
|
print("Vom", stay_period[0], "bis", stay_period[2], month_print)
|
|
|
|
# Across months
|
|
if stay_period[1] != stay_period[3]:
|
|
# Stay period more than 1 month
|
|
if int(stay_period[3]) - int(stay_period[1]) > 1:
|
|
days = 28 - int(stay_period[0]) + int(stay_period[2]) + \
|
|
((int(stay_period[3]) - int(stay_period[1])-1) * 28)
|
|
# Stay period
|
|
else:
|
|
days = 28 - int(stay_period[0]) + int(stay_period[2])
|
|
|
|
month_num_1 = int(stay_period[1]) - 1
|
|
month_num_2 = int(stay_period[3]) - 1
|
|
month_print_1 = Client.months[month_num_1]
|
|
month_print_2 = Client.months[month_num_2]
|
|
print("Der Kunde bleibt", abs(days), "Tage.")
|
|
print("Vom", stay_period[0], month_print_1, "bis", \
|
|
stay_period[2], month_print_2)
|
|
|
|
|
|
def info(self, action = None):
|
|
"""Prints infomation of a client, selected if desired."""
|
|
dic_ = {"Name" : self.name,
|
|
"Nachname" : self.surname,
|
|
"Kundennummer" : self.client_num,
|
|
"Zimmer" : self.room,
|
|
"Aufenthaltsdauer": self.period,
|
|
"Schlüsselnummer" : self.key_num,
|
|
"Buchungen" : self.bookings,
|
|
"VIP-Status" : self.status,
|
|
"Eingecheckt" : self.checked_in
|
|
}
|
|
if action != None:
|
|
# If asked client information is stay period
|
|
if action == "Aufenthaltsdauer":
|
|
client_num = self.client_num
|
|
stay = str(client_num)+ ".period_print()"
|
|
exec(stay)
|
|
# If asked client information is different
|
|
if action != "Aufenthaltsdauer":
|
|
for i in dic_:
|
|
if i == action:
|
|
print(action, "ist", dic_[i])
|
|
else:
|
|
for i in dic_:
|
|
print(i.ljust(16), ": ", dic_[i])
|
|
|
|
|
|
#----------------CLASS--ROOM------------------------------------------
|
|
|
|
|
|
class Room:
|
|
'''Room class for room management.'''
|
|
|
|
def __init__(self, room_number, guest=None, period=None):
|
|
"""Initialization of a new room object."""
|
|
|
|
self.number = room_number
|
|
self.occupied = False
|
|
self.resident = None
|
|
self.period = None
|
|
|
|
|
|
def occupy(self, guest, period):
|
|
"""Values in accordance with the given information,
|
|
when room gets occupied"""
|
|
|
|
self.occupied = True
|
|
self.resident = guest
|
|
self.period = period
|
|
|
|
|
|
def free(self):
|
|
"""Frees the room."""
|
|
self.occupied = False
|
|
self.resident = None
|
|
self.period = None
|
|
|
|
def is_free(self, client_num, room_name, period):
|
|
"""Checks if room is free in desired period.
|
|
|
|
Returns:
|
|
check: command for checking in.
|
|
"""
|
|
|
|
occupied = self.period
|
|
if occupied == None:
|
|
room_types = [["Single", 10], ["Double", 20], ["Suite", 30],\
|
|
["Panorama_Suite", 40]]
|
|
for i in room_types:
|
|
if i[0] == room_name:
|
|
key_num = i[1]+1
|
|
|
|
check = "exec(" + str(client_num) + ".check_in(" + "'" + \
|
|
str(room_name) + "'" + "," + str(key_num) + "," + "'" + str(period) + "'" +"))"
|
|
return (check)
|
|
|
|
else:
|
|
stay_period = []
|
|
num_string = ""
|
|
for i in self.period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period.append(num_string)
|
|
|
|
stay_period_new = []
|
|
num_string = ""
|
|
for i in period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period_new.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period_new.append(num_string)
|
|
|
|
if int(stay_period[3]) < int(stay_period_new[1]):
|
|
room_types = [["Single", 10], ["Double", 20], ["Suite", 30],\
|
|
["Panorama_Suite", 40]]
|
|
for i in room_types:
|
|
if i[0] == room_name:
|
|
key_num = i[1]+1
|
|
|
|
check = "exec(" + str(client_num) + ".check_in(" + "'" +\
|
|
str(room_name) + "'" + "," + str(key_num) + "," + "'" + str(period) + "'" +"))"
|
|
return (check)
|
|
|
|
|
|
if int(stay_period[3]) > int(stay_period_new[1]):
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum belegt.")
|
|
|
|
if int(stay_period[3]) == int(stay_period_new[1]):
|
|
if int(stay_period[2]) > int(stay_period_new[0]):
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum belegt.")
|
|
|
|
if int(stay_period[2]) <= int(stay_period_new[0]):
|
|
room_types = [["Single", 10], ["Double", 20],\
|
|
["Suite", 30], ["Panorama_Suite", 40]]
|
|
for i in room_types:
|
|
if i[0] == room_name:
|
|
key_num = i[1]+1
|
|
|
|
check = "exec(" + str(client_num) + ".check_in(" +\
|
|
"'" + str(room_name) + "'" + "," + str(key_num) + "," + "'" + \
|
|
str(period) + "'" +"))"
|
|
return (check)
|
|
|
|
|
|
|
|
def is_occupied(self, room_name, period):
|
|
"""Checks if room is available in given period."""
|
|
|
|
if self.period == None:
|
|
print("Das Zimmer", str(room_name)," ist frei.")
|
|
if self.period != None:
|
|
stay_period = []
|
|
num_string = ""
|
|
for i in self.period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period.append(num_string)
|
|
|
|
stay_period_new = []
|
|
num_string = ""
|
|
for i in period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period_new.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period_new.append(num_string)
|
|
|
|
if int(stay_period[3]) < int(stay_period_new[1]):
|
|
print(stay_period[3], stay_period_new[1])
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum frei.")
|
|
|
|
if int(stay_period[3]) > int(stay_period_new[1]):
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum belegt.")
|
|
|
|
if int(stay_period[3]) == int(stay_period_new[1]):
|
|
if int(stay_period[2]) > int(stay_period_new[0]):
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum belegt.")
|
|
|
|
if int(stay_period[2]) <= int(stay_period_new[0]):
|
|
print("Das Zimmer", room_name, "ist in dem gewünschten\
|
|
Zeitraum frei.")
|
|
|
|
|
|
def info(self, action = None):
|
|
"""Prints infomation of a room, selected if desired."""
|
|
|
|
dic_ = {"Nummer" : self.number,
|
|
"Gast" : self.resident,
|
|
}
|
|
|
|
if action != None:
|
|
if action == "Nummer":
|
|
print("Das Zimmer hat die Nummer", dic_["Nummer"])
|
|
|
|
if action == "Gast":
|
|
if dic_["Gast"] != None:
|
|
print("Das Zimmer", str(self.number),\
|
|
"ist gerade vom Gast", dic_["Gast"], "belegt")
|
|
else:
|
|
print("Das Zimmer", str(self.number),\
|
|
"ist im Moment nicht belegt.")
|
|
|
|
else:
|
|
for i in dic_:
|
|
print(i.ljust(16), ": ", dic_[i])
|
|
|
|
|
|
# Generates all the rooms
|
|
# nr.10-"Single", nr.20-"Double", nr.30-"Suite", nr.40-"Panorama_Suite"
|
|
reference = ["Single", "Double", "Suite", "Panorama_Suite"]
|
|
room_types = [["Single", 10], ["Double", 20], ["Suite", 30], \
|
|
["Panorama_Suite", 40]]
|
|
room_list = []
|
|
for i in room_types:
|
|
tmp = i[0] + " = Room(" + str(i[1]) + ")"
|
|
exec(tmp)
|
|
tmp = "room_list.append(" + str(i[0]) + ")"
|
|
exec(tmp)
|
|
|
|
#----------------CLASS--ACCOUNTING----------------------------
|
|
|
|
class Accounting():
|
|
'''Accounting class for accounting management.'''
|
|
all_bills = []
|
|
counter = 0
|
|
def __init__(self, name:str, surname:str, client_num:str, room:str,\
|
|
period:str, bill_num:str, bill_status:bool):
|
|
"""Initialization of a new bill object."""
|
|
self.name = name
|
|
self.surname = surname
|
|
self.client_num = client_num
|
|
self.period = period
|
|
self.bill_num = bill_num
|
|
self.bill_status = bill_status
|
|
Accounting.counter += 1
|
|
|
|
room_types = [["Single", 10], ["Double", 20], ["Suite", 30],\
|
|
["Panorama_Suite", 40]]
|
|
for i in room_types:
|
|
if i[0] == room:
|
|
self.room = i[1]
|
|
|
|
var = str(client_num) + ".client_bill(" + "'" + bill_num + "'" + ")"
|
|
exec(var)
|
|
|
|
def show_bill(self):
|
|
"""Prints the bill."""
|
|
|
|
stay_period = []
|
|
num_string = ""
|
|
for i in self.period:
|
|
if i.isnumeric():
|
|
num_string += i
|
|
if i == ",":
|
|
stay_period.append(num_string)
|
|
num_string = ""
|
|
|
|
stay_period.append(num_string)
|
|
|
|
stay_period = tuple(stay_period)
|
|
# Same month
|
|
|
|
if stay_period[1] == stay_period[3]:
|
|
days = int(stay_period[0]) - int(stay_period[2])
|
|
|
|
# Across months
|
|
if stay_period[1] != stay_period[3]:
|
|
# Stay period more than 1 month
|
|
if int(stay_period[3]) - int(stay_period[1]) > 1:
|
|
days = 28 - int(stay_period[0]) + int(stay_period[2]) + \
|
|
((int(stay_period[3]) - int(stay_period[1])-1) * 28)
|
|
# Stay period
|
|
else:
|
|
days = 28 - int(stay_period[0]) + int(stay_period[2])
|
|
days = abs(days)
|
|
costs = int(days) * int(self.room)
|
|
|
|
lines = [[] for i in range(13)]
|
|
lines[0].append( '┌─────────────────────────────┐')
|
|
lines[1].append( '│ Rechnung │')
|
|
lines[2].append( '│ │')
|
|
lines[3].append( '│Kunde: {} {} '.format(self.name,\
|
|
self.surname))
|
|
lines[4].append( '│Zimmer: {} '.format(self.room))
|
|
lines[5].append( '│Anz. Tage:{} '.format(days))
|
|
lines[6].append( '│pro Nacht:{}€ '.format(self.room))
|
|
lines[7].append( '│Kosten: {}€ '.format(costs))
|
|
lines[8].append( '│ ')
|
|
lines[9].append( '│Rech. Nr.:{} '.format\
|
|
(self.bill_num,))
|
|
lines[10].append('│Beglichen:{} '.format\
|
|
(self.bill_status))
|
|
lines[11].append('│ │')
|
|
lines[12].append('└─────────────────────────────┘')
|
|
|
|
for i in lines:
|
|
print(i[0])
|
|
|
|
|
|
def pay_bill(self):
|
|
"""Pay function."""
|
|
self.bill_status = True
|
|
print("Rechnung", self.bill_num, "wurde bezahlt.")
|
|
|
|
def delete_bill(self, bill_num):
|
|
"""Deletes bill from bill list and from client."""
|
|
for i in all_clients:
|
|
var = str(i) + ".client_bill_delete(" + "'" + bill_num + "'" + ")"
|
|
exec(var)
|
|
|
|
|
|
def __del__(self):
|
|
"""Called when object is destroyed."""
|
|
print("Rechnung wurde storniert.")
|
|
|
|
|
|
#-------------ADDITIONAL--ACCOUNTING--METHODS--------------------------
|
|
bill_list = []
|
|
|
|
|
|
def add_bill(name, surname, client_num, room, period):
|
|
"""Fuction for adding bill when bookings are made.
|
|
|
|
Args:
|
|
name: str
|
|
surname: str
|
|
client_num: str
|
|
room: str
|
|
period: str
|
|
|
|
Returns:
|
|
c: command for creating the bill in accounting class
|
|
"""
|
|
|
|
bill_numb = "r" + str(Accounting.counter)
|
|
|
|
c = bill_numb + " = Accounting(" + '"' + str(name) + '"' + "," + '"' + \
|
|
str(surname) + '"' + "," + '"' + str(client_num) + '"' + "," + '"' + \
|
|
str(room) + '"' + "," + '"' + str(period) + \
|
|
'"' + "," + '"'+ str(bill_numb) + '"' + ", False)"
|
|
|
|
bill_list.append(bill_numb)
|
|
return c
|
|
|
|
|
|
def show_single_bill():
|
|
"""Prints the bill of a given bill number."""
|
|
|
|
print("Volgenden Rechnungsnummern stehen zur Auswahl:")
|
|
print(bill_list)
|
|
while True:
|
|
k = input("Rechnungsnummer? ")
|
|
if k in bill_list or k == "abbrechen":
|
|
break
|
|
if k != "abbrechen":
|
|
try:
|
|
c = str(k) + ".show_bill()"
|
|
exec(c)
|
|
except:
|
|
print("Rechnung wurde nicht gefunden.")
|
|
|
|
|
|
|
|
def pay_your_bill():
|
|
"""Function for pay a bill of a client."""
|
|
|
|
print("Folgenden Rechnungsnummern stehen zur Auswahl:")
|
|
print(bill_list)
|
|
print("Rechungsnummer? ")
|
|
while True:
|
|
bill =input().strip().lower()
|
|
if bill in bill_list or bill == "abbrechen":
|
|
break
|
|
if bill != "abbrechen":
|
|
try:
|
|
c = str(bill) + ".pay_bill()"
|
|
exec(c)
|
|
except:
|
|
print("Rechung wurde nicht gefunden.")
|
|
|
|
|
|
def delete_bill(bill_numb):
|
|
"""Function that calls the delete function of a bill in the
|
|
accounting class."""
|
|
|
|
k = str(bill_numb) + ".delete_bill(bill_numb)"
|
|
exec(k)
|
|
|
|
|
|
#-------------ADDITIONAL---CLIENT---METHODS-------------------------
|
|
|
|
def clear():
|
|
"""Clear function for clean surface."""
|
|
if os.name == "posix":
|
|
os.system("clear")
|
|
elif os.name in ("nt", "dos", "ce"):
|
|
os.system('cls')
|
|
else:
|
|
print(80 * "\n")
|
|
|
|
|
|
def add_client():
|
|
"""Add a new client.
|
|
|
|
Returns:
|
|
c: command for creating the client in client class."""
|
|
while True:
|
|
name = input("Name : ")
|
|
if name.isalpha():
|
|
break
|
|
while True:
|
|
surname = input("Nachname :")
|
|
if surname.isalpha():
|
|
break
|
|
|
|
period = None
|
|
client_num = "c" + str(Client.clients)
|
|
room_num = None
|
|
key_num = None
|
|
|
|
c = str(client_num) + " = Client(" + '"' + str(name) + '"' + "," + '"' +\
|
|
str(surname) + '"' + "," + '"' + str(client_num) + '"' + "," + '"' + \
|
|
str(room_num) + '"' + "," + '"' + str(period) + '"' + "," + '"'+ \
|
|
str(key_num) + '"' + ",[], False, False)"
|
|
|
|
client_list.append(client_num)
|
|
all_clients.append(client_num)
|
|
return c
|
|
|
|
clear()
|
|
|
|
#Path for soundfile
|
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
#Checks if simpleaudio module is imported
|
|
imported = True
|
|
try:
|
|
import simpleaudio
|
|
except ModuleNotFoundError:
|
|
imported = False
|
|
|
|
|
|
def play_sound():
|
|
"""Plays sound with simpleaudio module.
|
|
|
|
Returns:
|
|
play_obj: plays the sound
|
|
None if no sound plays."""
|
|
|
|
if imported:
|
|
try:
|
|
wave_obj = simpleaudio.WaveObject.from_wave_file\
|
|
(os.path.join(dir_path, "grandhotel.wav"))
|
|
play_obj = wave_obj.play()
|
|
return play_obj
|
|
except:
|
|
print("Audiodatei nicht gefunden.")
|
|
|
|
return None
|
|
|
|
|
|
def stop_sound(play_obj):
|
|
"""Stops the sound."""
|
|
|
|
if play_obj is not None:
|
|
play_obj.stop()
|
|
|
|
|
|
def ascii_print():
|
|
"""Prints the intro logo."""
|
|
|
|
with open('ascii_print_hotel', 'r', encoding='utf8') as ascii_:
|
|
for line in ascii_:
|
|
sys.stdout.write(line)
|
|
time.sleep(0.1)
|
|
|
|
|
|
"""-------------START-----INTERFACE--------------------"""
|
|
system_list = ["1", "2", "3", "4", "5"]
|
|
|
|
clear()
|
|
#Intro sound
|
|
play_obj = play_sound()
|
|
|
|
#Intro Logo Print
|
|
ascii_print()
|
|
|
|
|
|
print("\t\tWELCOME TO THE GRAND BUDAPEST HOTEL SYSTEM")
|
|
input("\t\t\tPress enter to continue")
|
|
clear()
|
|
|
|
while True:
|
|
print("Im System stehen Ihnen verschiedene Funktionen zur Verfügung.\n")
|
|
print("""
|
|
1. Buchhaltung
|
|
2. Kundenverwaltung
|
|
3. Zimmerverwaltung
|
|
4. Schlüsselverwaltung
|
|
5. Dienstpläne
|
|
Hilfe
|
|
Beenden\n""")
|
|
while True:
|
|
print("Welches der folgenden Systeme möchten Sie öffnen?")
|
|
system = input().strip().lower()
|
|
if system in system_list or system == "beenden":
|
|
break
|
|
if system == "hilfe":
|
|
print("""
|
|
Um eines der Systeme zu öffnen, geben Sie die entsprechende Zahl ein.
|
|
Um das Programm zu beenden, geben Sie beenden ein.""")
|
|
input()
|
|
continue
|
|
else:
|
|
clear()
|
|
print("Bitte wählen Sie aus einem der bestehenden Systeme aus.")
|
|
print("""
|
|
1. Buchhaltung
|
|
2. Kundenverwaltung
|
|
3. Zimmerverwaltung
|
|
4. Schlüsselverwaltung
|
|
5. Dienstpläne
|
|
Hilfe
|
|
Beenden\n""")
|
|
|
|
#"""-----------INTERFACE-----ACCOUNTING------------------"""
|
|
|
|
if system == "1": #Accounting
|
|
clear()
|
|
|
|
while True:
|
|
print("Willkommen in der Buchhaltung")
|
|
print("Welche der folgenen Aktionen möchten Sie ausführen")
|
|
print("""
|
|
1. Rechnung anzeigen
|
|
2. Rechnung bezahlen
|
|
3. Rechnung löschen
|
|
Hilfe
|
|
Abbrechen
|
|
|
|
""")
|
|
account = input().strip().lower()
|
|
if account == "hilfe":
|
|
print("""
|
|
Um eine der Aktionen durchzuführen, geben Sie die entsprechende Zahl ein.
|
|
|
|
1.Rechnung anzeigen:
|
|
Geben Sie eine vorhandene Rechnungsnummer ein, die sich in der Liste befindet.
|
|
|
|
2.Rechnung bezahlen:
|
|
Geben Sie eine vorhandene Rechnungsnummer ein, die sich in der Liste befindet.
|
|
|
|
3.Rechnung löschen:
|
|
Geben Sie eine vorhandene Rechnungsnummer ein, die sich in der Liste befindet.
|
|
|
|
Sie können jederzeit über die Eingabe von abbrechen ins Hauptmenü zurückkehren.
|
|
""")
|
|
input()
|
|
clear()
|
|
continue
|
|
if account == "1":
|
|
print("Rechnung anzeigen\n")
|
|
show_single_bill()
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if account == "2":
|
|
print("Rechung bezahlen\n")
|
|
pay_your_bill()
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if account == "3":
|
|
print("Rechnung löschen\n")
|
|
while True:
|
|
print("Folgenden Rechnungsnummern stehen zur Auswahl:")
|
|
print(bill_list)
|
|
print("Rechungsnummer? ")
|
|
bill_numb =input().strip().lower()
|
|
if bill_numb in bill_list or bill_numb == "abbrechen":
|
|
break
|
|
|
|
if bill_numb == "abbrechen":
|
|
clear()
|
|
break
|
|
else:
|
|
delete_bill(bill_numb) # Delete bill at client
|
|
|
|
bill_list.remove(bill_numb) # Delete bill at bill_list
|
|
|
|
delete_ = "del " + bill_numb
|
|
exec(delete_) # Delete bill in system
|
|
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if account == "abbrechen":
|
|
clear()
|
|
break
|
|
|
|
#"""-----------INTERFACE-----CLIENT------------------"""
|
|
|
|
if system == "2": #Client
|
|
clear()
|
|
while True:
|
|
|
|
print("Willkommen in der Kundenverwaltung")
|
|
print("Welche der folgenen Aktionen möchten Sie ausführen")
|
|
print("""
|
|
1. Kunde hinzufügen
|
|
2. Kunde anzeigen
|
|
3. Kunde einchecken
|
|
4. Kunde auschecken
|
|
5. Freie Zimmer über Zeitraum anzeigen.
|
|
Hilfe
|
|
Abbrechen
|
|
|
|
""")
|
|
|
|
client = input().strip().lower()
|
|
if client == "hilfe":
|
|
print("""
|
|
Um eine der Aktionen durchzuführen, geben Sie die entsprechende Zahl ein.
|
|
|
|
1. Kunde hinzufügen:
|
|
Geben Sie zuerst den Vornamen des Kunden an, anschließend den Nachnamen.
|
|
|
|
2. Kunde anzeigen:
|
|
Geben Sie eine vorhandene Kundennummer ein, die sich in der Liste befindet.
|
|
|
|
3. Kunde einchecken:
|
|
Geben Sie eine vorhandene Rechnungsnummer ein, die sich in der Liste befindet.
|
|
Geben Sie einen vorhandenen Zimmernamen ein, der sich in der Liste befindet.
|
|
Geben Sie einen Aufenthaltszeitraum nach folgendem Schema ein:
|
|
Anreisetag
|
|
Anreisemonat
|
|
Abreisetag
|
|
Abreisemonat
|
|
|
|
Sie können über die Eingabe von abbrechen ins Hauptmenü zurückkehren.
|
|
""")
|
|
input()
|
|
clear()
|
|
continue
|
|
if client == "1":
|
|
print("Kunde hinzufügen\n")
|
|
c = add_client()
|
|
exec(c)
|
|
clear()
|
|
continue
|
|
|
|
if client == "2":
|
|
print("Kunde anzeigen\n")
|
|
print(all_clients)
|
|
while True:
|
|
k = input("Über welchen Kunden wollen sie sich Information\
|
|
anzeigen lassen? ")
|
|
if k in all_clients:
|
|
break
|
|
else:
|
|
print("Dieser Kunde ist leider nicht im System.")
|
|
c = str(k) + ".info()"
|
|
exec(c)
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if client == "3":
|
|
print("Kunde einchecken\n")
|
|
print("Welchen Kunden möchten Sie einchecken?")
|
|
|
|
print(client_list)
|
|
while True:
|
|
client = input()
|
|
if client in client_list:
|
|
break
|
|
while True:
|
|
print(reference)
|
|
print("Zimmerauswahl")
|
|
room_ = input()
|
|
if room_ in reference:
|
|
break
|
|
else:
|
|
print("Dieses Zimmer ist in unserem Hotel leider nicht\
|
|
vorhanden.")
|
|
print("Aufenthaltszeitraum")
|
|
while True:
|
|
day_arrival = input("Anreisetag: ")
|
|
if day_arrival.isdigit() and 0 < int(day_arrival) and \
|
|
int(day_arrival) < 28:
|
|
break
|
|
while True:
|
|
month_arrival = input("Anreisemonat: ")
|
|
if month_arrival.isdigit() and 0 < int(month_arrival) and\
|
|
int(month_arrival) < 12:
|
|
break
|
|
while True:
|
|
day_depature = input("Abreisetag: ")
|
|
if day_depature.isdigit() and 0 < int(day_depature) and\
|
|
int(day_depature) < 28:
|
|
break
|
|
while True:
|
|
month_depature = input("Abreisemonat: ")
|
|
if month_depature.isdigit() and 0 < int(month_depature) \
|
|
and int(month_depature) < 12:
|
|
break
|
|
|
|
period = str(day_arrival) + "," +str(month_arrival) + "," + \
|
|
str(day_depature) + "," + str(month_depature)
|
|
|
|
check_ = "j = " + str(room_) + ".is_free(" + "'" + str(client)\
|
|
+ "'" + "," + "'" + str(room_) + "'" + "," + "'" + str(period) + "'" + ")"
|
|
|
|
try:
|
|
exec(check_)
|
|
except:
|
|
pass
|
|
try:
|
|
exec(j)
|
|
except:
|
|
pass
|
|
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if client == "4":
|
|
print("Auschecken\n")
|
|
print("Welchen Gast möchten Sie auschecken?")
|
|
print(checked_in_list)
|
|
while True:
|
|
client = input()
|
|
if client in checked_in_list:
|
|
checking_out = str(client) + ".check_out()"
|
|
exec(checking_out)
|
|
break
|
|
if client == "abbrechen":
|
|
break
|
|
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
|
|
if client == "5":
|
|
print("Freie Zimmer anzeigen\n")
|
|
while True:
|
|
print("In welchem Zeitraum möchten Sie schauen,\
|
|
ob Zimmer frei sind?")
|
|
print("Aufenthaltszeitraum")
|
|
while True:
|
|
day_arrival = input("Anreisetag: ")
|
|
if day_arrival.isdigit() and 0 < int(day_arrival) \
|
|
and int(day_arrival) < 28:
|
|
break
|
|
while True:
|
|
month_arrival = input("Anreisemonat: ")
|
|
if month_arrival.isdigit() and 0 < int(month_arrival) \
|
|
and int(month_arrival) < 12:
|
|
break
|
|
while True:
|
|
day_depature = input("Abreisetag: ")
|
|
if day_depature.isdigit() and 0 < int(day_depature) \
|
|
and int(day_depature) < 28:
|
|
break
|
|
while True:
|
|
month_depature = input("Abreisemonat: ")
|
|
if month_depature.isdigit() and 0 < \
|
|
int(month_depature) and int(month_depature) < 12:
|
|
break
|
|
|
|
period = str(day_arrival) + "," + str(month_arrival) +\
|
|
"," + str(day_depature) + "," + str(month_depature)
|
|
|
|
for i in reference:
|
|
k = str(i) + ".is_occupied(" + "'" + str(i) + "'"\
|
|
+ "," + "'" + str(period) + "'" + ")"
|
|
|
|
exec(k)
|
|
break
|
|
input()
|
|
clear()
|
|
continue
|
|
|
|
if client == "abbrechen":
|
|
input()
|
|
clear()
|
|
break
|
|
|
|
#"""-----------INTERFACE-----ROOM------------------"""
|
|
|
|
if system == "3": #Room
|
|
clear()
|
|
while True:
|
|
print("\nWillkommen in der Zimmerverwaltung")
|
|
print("Welche der folgenen Aktionen möchten Sie ausführen")
|
|
print("""
|
|
1. Zimmerstatus anzeigen
|
|
Hilfe
|
|
Abbrechen
|
|
""")
|
|
|
|
room_input = input().strip().lower()
|
|
if room_input == "hilfe":
|
|
print("""
|
|
Um eine der Aktionen durchzuführen, geben Sie die entsprechende Zahl ein.
|
|
|
|
1. Zimmerstatus anzeigen:
|
|
Geben Sie eine vorhandene Kundennummer ein, die sich in der Liste befindet.
|
|
Wählen Sie über die Eingabe der entsprechenden Zahl, das gewünschte
|
|
Ausgabeformat:
|
|
1. Alle Informationen
|
|
2. Nummer
|
|
3. Gast
|
|
|
|
Sie können über die Eingabe von abbrechen ins Hauptmenü zurückkehren.
|
|
""")
|
|
input()
|
|
clear()
|
|
continue
|
|
if room_input == "1":
|
|
while True:
|
|
print("Zimmerstatus anzeigen\n")
|
|
print(reference)
|
|
print("Name des Zimmers:")
|
|
dorm = input()
|
|
if dorm in reference:
|
|
print("""
|
|
1. Ale Informationen
|
|
2. Nummer
|
|
3.Gast""")
|
|
|
|
dorm_info = input()
|
|
if dorm_info == "1":
|
|
print("Zimmer:", dorm)
|
|
dorm_exec = str(dorm) + ".info()"
|
|
exec(dorm_exec)
|
|
input()
|
|
clear()
|
|
break
|
|
if dorm_info == "2":
|
|
print("Zimmer:", dorm)
|
|
dorm_exec = str(dorm) + ".info("+ "'Nummer'" +")"
|
|
exec(dorm_exec)
|
|
input()
|
|
clear()
|
|
break
|
|
if dorm_info == "3":
|
|
print("Zimmer:", dorm)
|
|
dorm_exec = str(dorm) + ".info("+ "'Gast'" +")"
|
|
exec(dorm_exec)
|
|
input()
|
|
clear()
|
|
break
|
|
if dorm_info == "abbrechen":
|
|
clear()
|
|
break
|
|
|
|
if room_input == "abbrechen":
|
|
clear()
|
|
break
|
|
|
|
|
|
if system == "4": #Key
|
|
clear()
|
|
while True:
|
|
print("Willkommen in der Schlüsselverwaltung")
|
|
print("Welche der folgenen Aktionen möchten Sie ausführen")
|
|
print("""
|
|
1. Schlüsselstatus anzeigen
|
|
Hilfe
|
|
Abbrechen""")
|
|
|
|
key_input = input().strip().lower()
|
|
if key_input == "hilfe":
|
|
print("""
|
|
Um eine der Aktionen durchzuführen, geben Sie die entsprechende Zahl ein.
|
|
|
|
1. Schlüsselstatus anzeigen:
|
|
Geben Sie eine vorhandene Schlüsselnummer ein,
|
|
die sich in der Liste befindet.
|
|
|
|
Sie können über die Eingabe von abbrechen ins Hauptmenü zurückkehren.
|
|
""")
|
|
input()
|
|
clear()
|
|
continue
|
|
if key_input == "1":
|
|
while True:
|
|
print("Schlüsselstatus anzeigen\n")
|
|
all_key_numbers = ["11", "12", "21", "22", \
|
|
"31", "32", "41", "42"]
|
|
print(all_key_numbers)
|
|
key_num = input("Schlüsselnummer ")
|
|
print("")
|
|
if key_num in all_key_numbers:
|
|
key_print = "key_" + key_num + ".status_key()"
|
|
exec(key_print)
|
|
input()
|
|
clear()
|
|
break
|
|
if key_num == "abbrechen":
|
|
clear()
|
|
break
|
|
else:
|
|
print("Was ist schief gelaufen")
|
|
if key_input == "abbrechen":
|
|
clear()
|
|
break
|
|
|
|
if system == "5": #duty_roster
|
|
clear()
|
|
|
|
|
|
def duty_roster_write():
|
|
"""Creates duty roster for hotel employees."""
|
|
|
|
with open('dienstplan.txt', 'w', encoding='utf8') as d:
|
|
employees = ['M. Gustave', 'Zero Mustafa', 'M. Jean',\
|
|
'Agatha', 'M. Chuck']
|
|
job = ['Concierge', 'Lobby-Boy', 'Rezeptionist', 'Portier']
|
|
i = 1
|
|
while i < 53:
|
|
random.shuffle(employees)
|
|
random.shuffle(job)
|
|
a = "KW" + str(i)
|
|
d.write(a + "#" + employees[0] + ": " + job[0] + "#" +\
|
|
employees[1] + ": " + job[1] + "#" + employees[2] + ": " + job[2] + "#" + \
|
|
employees[3] + ": " + job[3] + "#" + "frei: " + employees[4] + "\n")
|
|
i += 1
|
|
|
|
def duty_roster_read():
|
|
"""Prints duty roster of employees."""
|
|
|
|
with open('dienstplan.txt', 'r', encoding='utf8') as d:
|
|
for line in d:
|
|
print(line)
|
|
|
|
while True:
|
|
print("\nWillkommen dei den Dienstplänen")
|
|
print("Welche der folgenen Aktionen möchten Sie ausführen")
|
|
print("""
|
|
1. Dienstplan erstellen und anzeigen
|
|
2. Dienstplan exportieren
|
|
3. Dienstplan importieren
|
|
Hilfe
|
|
Abbrechen""")
|
|
|
|
duty = input().strip().lower()
|
|
if duty == "hilfe":
|
|
print("""
|
|
Um eine der Aktionen durchzuführen, geben Sie die entsprechende Zahl ein.
|
|
|
|
1. Dienstplan erstellen und anzeigen:
|
|
Der Dienstplan wird automatisch erstellt und angezeigt.
|
|
|
|
2. Dienstplan exportieren:
|
|
Der Dienstplan wird im Verzeichnis automatisch erstellt.
|
|
|
|
3. Dienstplan importieren:
|
|
Der Dienstplan, der sich im Verzeichnis befindet, wird angezeigt.
|
|
|
|
Sie können über die Eingabe von abbrechen ins Hauptmenü zurückkehren.
|
|
""")
|
|
input()
|
|
clear()
|
|
continue
|
|
if duty == "1":
|
|
try:
|
|
duty_roster_write()
|
|
duty_roster_read()
|
|
except:
|
|
print("Es konnte kein Dienstplan erstellt werden.")
|
|
input()
|
|
clear()
|
|
continue
|
|
if duty == "2":
|
|
try:
|
|
duty_roster_write()
|
|
print("Der Dienstplan wurde erfolgreich exportiert.")
|
|
except:
|
|
print("Der Diensplan konnte nicht exportiert werden.")
|
|
input()
|
|
clear()
|
|
continue
|
|
if duty == "3":
|
|
try:
|
|
duty_roster_read()
|
|
except:
|
|
print("Es konnte kein Dienstplan unter dem Namen \
|
|
dienstplan.txt im Verzeichnis gefunden werden.")
|
|
input()
|
|
clear()
|
|
continue
|
|
if duty == "abbrechen":
|
|
input()
|
|
clear()
|
|
break
|
|
|
|
if system == "beenden":
|
|
clear()
|
|
print("The Grand Budapest Hotel wünscht noch einen angenehmen Tag.")
|
|
print("Auf Wiedersehen!")
|
|
break
|