Skip to content

Commit

Permalink
Enhance error logging in print job processing and ensure total calcul…
Browse files Browse the repository at this point in the history
…ations handle float values correctly
  • Loading branch information
alevilar committed Dec 13, 2024
1 parent 2071774 commit 6f8899f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/common/ComandosHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/common/EscPComandos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 6f8899f

Please sign in to comment.