From 6f8899f6542e416bed56b844acabd9af23a4e950 Mon Sep 17 00:00:00 2001 From: Ale Vilar Date: Fri, 13 Dec 2024 14:16:30 -0300 Subject: [PATCH] Enhance error logging in print job processing and ensure total calculations handle float values correctly --- src/common/ComandosHandler.py | 3 ++- src/common/EscPComandos.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/ComandosHandler.py b/src/common/ComandosHandler.py index cfacabd743..d766d97f2f 100644 --- a/src/common/ComandosHandler.py +++ b/src/common/ComandosHandler.py @@ -56,7 +56,8 @@ def process_print_jobs(): runTraductor(jsonTicket, q) except Exception as e: logging.error(f"Error al procesar el trabajo de impresiĆ³n: {e}") - + logging.error(traceback.format_exc()) + print_queue.task_done() # Iniciar el hilo que procesa la cola de trabajos de impresiĆ³n diff --git a/src/common/EscPComandos.py b/src/common/EscPComandos.py index b014a8ce22..22d7da21aa 100644 --- a/src/common/EscPComandos.py +++ b/src/common/EscPComandos.py @@ -362,12 +362,12 @@ def printFacturaElectronica(self, escpos: EscposIO, **kwargs): # si tiene el array de ivas tiene items, se detallan los IVAs if ivas: dsTotal = pad("SUBTOTAL:", self.desc_cols_ext - 1, " ", "l") - importeTotal = pad(f"{round(total,2):,.2f}",self.price_cols, " ", "r") + importeTotal = pad(f"{round(float(total),2):,.2f}",self.price_cols, " ", "r") escpos.writelines(f'{dsTotal}{self.signo}{importeTotal}', bold=True, align='left', height=2, width=2) printer.ln(); dsSinIva = pad("Neto sin IVA:", self.desc_cols_ext - 1, " ", "l") - importeSinIva = pad(f"{round(totalNeto, 2):,.2f}",self.price_cols, " ", "r") + importeSinIva = pad(f"{round(float(totalNeto), 2):,.2f}",self.price_cols, " ", "r") printer.set(font='a', height=1, align='left', normal_textsize=True) printer.text(f'{dsSinIva}{self.signo}{importeSinIva}\n')