From c5f84aa9008be813aef8a30deb7fb58253793575 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:08:38 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20numero=20de=20factura=20con=20ceros=20a?= =?UTF-8?q?=20la=20izquierda=20hasta=205=20d=C3=ADgitos=20(zfill=205)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ejemplo: 355 → 00355, 3726 → 03726 Aplica a todos los flujos: transacción, automation, send-direct, test-rda. Co-Authored-By: Claude Sonnet 4.6 --- app/routes/contratos.py | 6 ++++++ app/services/json_generator.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/routes/contratos.py b/app/routes/contratos.py index 60423b3..e41689b 100644 --- a/app/routes/contratos.py +++ b/app/routes/contratos.py @@ -66,6 +66,12 @@ def ensure_defaults(): "INSERT INTO contratos (numero_contrato, nit_empresa, tipo_usuario, descripcion, excluir) VALUES (?,?,?,?,?)", (nc, nit, tu, desc, excluir), ) + else: + # Forzar excluir según el seed para que el DB siempre coincida + conn.execute( + "UPDATE contratos SET excluir=? WHERE numero_contrato=?", + (excluir, nc), + ) conn.commit() conn.close() diff --git a/app/services/json_generator.py b/app/services/json_generator.py index 160389a..fb5859a 100644 --- a/app/services/json_generator.py +++ b/app/services/json_generator.py @@ -218,9 +218,9 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe result = { "codigoPrefijo": str(h.get("PREFIJO") or "").strip() or default_prefijo or "00", - "numero": numero_override if numero_override else ( + "numero": (numero_override if numero_override else ( str(h.get("NUM_FACTURA") or "").strip() if (h.get("NUM_FACTURA") or 0) != 0 else "" - ), + )).zfill(5) or "", "fecha": fecha, "codTercero": str(h.get("COD_PACIENTE") or "").strip(), "codVendedor": "00",