feat: campo descuento en RDA calculado desde VALORDESC/VALORTOTAL

descuento = round(VALORDESC * 100 / VALORTOTAL, 2), 0 si sin descuento

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-10 16:52:00 -05:00
co-authored by Claude Sonnet 4.6
parent eb9c57b324
commit d9a414396f
+5 -1
View File
@@ -213,9 +213,12 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
via_ingreso = "01"
modalidad = "01"
vigencia = 30
_total = float(h.get("VALORTOTAL") or 0)
_desc = float(h.get("VALORDESC") or 0)
descuento_pct = round(_desc * 100 / _total, 2) if _total > 0 else 0
result = {
"codigoPrefijo": str(h.get("PREFIJO") or "").strip() or default_prefijo or "00",
"numero": (numero_override if numero_override else (
@@ -230,6 +233,7 @@ def generar_rda_paciente(rows: list, default_profesional: str = "", default_espe
"fechaHoraEgreso": egreso,
"modalidadAtencion": modalidad,
"numeroContrato": cod_contrato,
"descuento": descuento_pct,
"diagnosticoprincipal": str(h.get("DIAG_PPAL") or "").strip(),
"tipousuario": tipoususispro,
"viaIngreso": via_ingreso,