Book keeping lauffähig und ready

This commit is contained in:
david_g 2021-02-02 10:48:39 +01:00
parent 853fb3b50a
commit c830ff3eac
1 changed files with 21 additions and 19 deletions

View File

@ -1,15 +1,20 @@
import gc
class Accounting(): class Accounting():
all_bills = [] all_bills = []
counter = 0 counter = 0
def __init__(self, name:str, surname:str, room_num, key_num, period:str, bill_num:str, bill_status:bool): def __init__(self, name:str, surname:str, room_num, key_num, period:str, bill_num:str, bill_status:bool):
print("Wird Ausgeführt")
self.name = name self.name = name
self.surname = surname self.surname = surname
self.room_num = room_num self.room_num = room_num
self.key_num = key_num self.key_num = key_num
self.period = period self.period = period
Accounting.counter += 1 self.bill_num = bill_num
self.bill_status = bill_status self.bill_status = bill_status
Accounting.counter += 1
gc.get_objects()
gc.get_threshold()
def show_bill(self): def show_bill(self):
@ -50,8 +55,8 @@ class Accounting():
lines[3].append( '│Kunde: {} {} '.format(self.name, self.surname)) lines[3].append( '│Kunde: {} {} '.format(self.name, self.surname))
lines[4].append( '│Zimmer: {} '.format(self.room_num)) lines[4].append( '│Zimmer: {} '.format(self.room_num))
lines[5].append( '│Anz. Tage:{} '.format(days)) lines[5].append( '│Anz. Tage:{} '.format(days))
lines[6].append( '│pro Nacht:{} '.format(self.room_num)) lines[6].append( '│pro Nacht:{} '.format(self.room_num))
lines[7].append( '│Kosten: {} '.format(costs)) lines[7].append( '│Kosten: {}'.format(costs))
lines[8].append( '') lines[8].append( '')
lines[9].append( '│Rech. Nr.:{} '.format(self.bill_num,)) lines[9].append( '│Rech. Nr.:{} '.format(self.bill_num,))
lines[10].append('│Beglichen:{} '.format(self.bill_status)) lines[10].append('│Beglichen:{} '.format(self.bill_status))
@ -64,14 +69,15 @@ class Accounting():
def pay_bill(self): def pay_bill(self):
self.bill_status = True self.bill_status = True
print("Rechnung", self.bill_num, "wurde bezahlt.")
def __del__(self): def __del__(self):
print("Rechnung wurde storniert.") print("Rechnung wurde storniert.")
r43 = Accounting("Karl", "Otto", 16, 21,"2,3,4,5", "", False) #r43 = Accounting("Karl", "Otto", 16, 21,"2,3,4,5", "", False)
bill_list = ["r43"] bill_list = []
def add_bill(): def add_bill():
@ -81,19 +87,13 @@ def add_bill():
room_num = input("Zimmernummer :") room_num = input("Zimmernummer :")
period = input("Aufenthaltszeitraum :") period = input("Aufenthaltszeitraum :")
key_num = input("Schlüsselnummer :") key_num = input("Schlüsselnummer :")
bill_num = "r" + str(Accounting.counter) bill_numb = "r" + str(Accounting.counter)
c = bill_num + " = Accounting(" + '"' + str(name) + '"' + "," + '"' + \ c = bill_numb + " = Accounting(" + '"' + str(name) + '"' + "," + '"' + \
str(surname) + '"' + "," + '"' + str(room_num) + '"' + "," + '"' + str(key_num) \ str(surname) + '"' + "," + '"' + str(room_num) + '"' + "," + '"' + str(key_num) \
+ '"' + "," + '"' + str(period) + '"' + "," + '"'+ str(bill_num) + '"' + ", False)" + '"' + "," + '"' + str(period) + '"' + "," + '"'+ str(bill_numb) + '"' + ", False)"
try: bill_list.append(bill_numb)
exec(c) return c
bill_list.append(bill_num)
except:
print("Konnte nicht ausgeführt werden")
print(c)
print(bill_list)
def show_single_bill(): def show_single_bill():
while True: while True:
@ -103,9 +103,11 @@ def show_single_bill():
c = str(k) + ".show_bill()" c = str(k) + ".show_bill()"
exec(c) exec(c)
"""
def delete_bill(): def delete_bill():
input_ = input("Rechnungsnummer: ") input_ = input("Rechnungsnummer: ")
delete = "del " + input_ delete = "del " + input_
exec(delete) exec(delete)
"""
#while True:
# k = add_bill()
# exec(k)