From b2078cf6176a1460b09e81b212e0dd5f78b4b4ee Mon Sep 17 00:00:00 2001 From: Bar Date: Fri, 13 Sep 2024 21:56:16 +0200 Subject: [PATCH] veranderingen --- plugins/POS.py | 2 +- plugins/declaratie.py | 7 ++++--- plugins/stock.py | 4 ++-- plugins/undo.py | 6 +++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/POS.py b/plugins/POS.py index b8ead8f..7ebe2fb 100644 --- a/plugins/POS.py +++ b/plugins/POS.py @@ -209,7 +209,7 @@ def slowwrite(self, y): def bon(self, bonID): if bonID in self.bonnetjes: self.open() - self.slowwrite(self.bonnetjes[bonID]["bon"].encode()) + self.slowwrite(self.bonnetjes[bonID]["bon"]) return True return False diff --git a/plugins/declaratie.py b/plugins/declaratie.py index 5bea3b2..a8fd2b9 100644 --- a/plugins/declaratie.py +++ b/plugins/declaratie.py @@ -56,12 +56,13 @@ def amount(self, text): return True try: value = float(text) - if 0 < value < 5000: + if -5000 < value < 5000: self.value = value if self.soort == "verkoop": self.master.send_message( True, "message", "Why do you give us E %.2f?" % self.value ) + self.value = -self.value elif self.soort == "declaratie": self.master.send_message( True, "message", "Where did you spend E %.2f on?" % self.value @@ -138,7 +139,7 @@ def runasbar(self, text): return True try: value = float(text) - if 0 < value < 5000: + if -5000 < value < 5000: if value > self.value: return self.askbar( "E %.2f is larger than E %.2f ; " % (value, self.value) @@ -229,7 +230,7 @@ def runasbank(self, text): return True try: value = float(text) - if 0 < value < 5000: + if -5000 < value < 5000: if value > (self.value - self.asbar - self.ascash): return self.askbank( "E %.2f is larger than E %.2f ; " diff --git a/plugins/stock.py b/plugins/stock.py index 2037f25..29326dc 100644 --- a/plugins/stock.py +++ b/plugins/stock.py @@ -78,12 +78,12 @@ def writestock(self): def voorraad_amount(self, text): try: aantal = int(text) - if not 0 < aantal < 5000: + if not -1 < aantal < 5000: self.master.donext(self, "voorraad_amount") self.master.send_message( True, "message", - "Please enter a number between 1 and 4999, how much " + "Please enter a number between 0 and 4999, how much " + self.prod + " is in stock?", ) diff --git a/plugins/undo.py b/plugins/undo.py index d20b251..1decec2 100644 --- a/plugins/undo.py +++ b/plugins/undo.py @@ -79,6 +79,9 @@ def doundo(self, text): ), ) return True + else: + print(self.undo.keys()) + print(f"transID not in undo: {transID}") self.listundo() return True except: @@ -131,7 +134,8 @@ def listundo(self, restore=False): for transID in self.undo.keys(): txt = "" for usr in self.undo[transID]["totals"].keys(): - txt += usr + " €" + "%.2f" % self.undo[transID]["totals"][usr] + " " + txt += " €" + "%.2f" % self.undo[transID]["totals"][usr] + " " + #txt += usr + " €" + "%.2f" % self.undo[transID]["totals"][usr] + " " txt += time.strftime( "%Y-%m-%d %H:%M:%S", time.localtime(transID + 1300000000) )