From c7428a196bcb7bffdd315539ddb39c2f75d48a6c Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 30 Jun 2026 16:12:48 -0500 Subject: [PATCH] fix: quitar codFormaPago header, fechaAutorizacion=hoy, descuento de Firebird - Elimina codFormaPago del header RDA (no va segun JSON de referencia) - fechaAutorizacion usa fecha de hoy, no la de recepcion - descuento toma rel.DESCUENTO de Firebird en vez de hardcodeado 0 - Agrega rel.DESCUENTO al SELECT en test_rda y automation Co-Authored-By: Claude Sonnet 4.6 --- app/routes/automation.py | 1 + app/routes/test_rda.py | 1 + app/services/json_generator.py | 7 +++---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/routes/automation.py b/app/routes/automation.py index 64598c1..c24bf6b 100644 --- a/app/routes/automation.py +++ b/app/routes/automation.py @@ -61,6 +61,7 @@ SELECT rel.COD_EXAMEN, rel.PRECIO, rel.FECHA_REPORTADO, + rel.DESCUENTO, m.COD_ESPECIALIDAD, COALESCE(NULLIF(TRIM(m.CODIGO), ''), NULLIF(TRIM(r.USUARIO), ''), '') AS profesional, e.CODCONTRATO, diff --git a/app/routes/test_rda.py b/app/routes/test_rda.py index 5914086..a86d31a 100644 --- a/app/routes/test_rda.py +++ b/app/routes/test_rda.py @@ -21,6 +21,7 @@ SELECT r.IDRECEPCION, r.PREFIJO, r.NUM_FACTURA, r.FECHA_RECEPCION, r.COD_PACIENTE, r.NIT_EMPRESA, r.DIAG_PPAL, r.TIPOUSU, r.TIPOUSUSISPRO, r.AUTORIZACION, r.CLASEPROC, r.HORAINICIORECEPCION, r.VALORTOTAL, rel.COD_EXAMEN, rel.PRECIO, rel.FECHA_REPORTADO, + rel.DESCUENTO, m.COD_ESPECIALIDAD, COALESCE(NULLIF(TRIM(m.CODIGO), ''), NULLIF(TRIM(r.USUARIO), ''), '') AS profesional, e.CODCONTRATO, diff --git a/app/services/json_generator.py b/app/services/json_generator.py index decc4b4..6a95442 100644 --- a/app/services/json_generator.py +++ b/app/services/json_generator.py @@ -1,5 +1,5 @@ from collections import defaultdict -from datetime import datetime +from datetime import datetime, date from typing import Optional @@ -132,7 +132,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe "cantidad": 1, "tipoUnidad": "D", "valor": float(row.get("PRECIO") or 0), - "descuento": 0, + "descuento": float(row.get("DESCUENTO") or 0), "porcentajeIva": 0, "impConsumo": 0, "observacion": "", @@ -183,7 +183,6 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe "fecha": fecha, "codTercero": str(h.get("COD_PACIENTE") or "").strip(), "codVendedor": "00", - "codFormaPago": cod_forma_pago, "codBanco": "00", "codigoCentroCosto": "00", "tipoIngreso": str(h.get("CLASEPROC") or "1").strip() or "1", @@ -197,7 +196,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe "esTerapia": False, "esProcedimiento": False, "numeroAutorizacion": autorizacion, - "fechaAutorizacion": fecha, + "fechaAutorizacion": date.today().strftime("%d/%m/%Y"), "vigenciaAutorizacion": vigencia, "detallePedido": detalle_pedido, "detalleFormaPago": [{