fix: add rel.DESCUENTO to all SQL queries; update debug endpoint with discount check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-01 12:11:00 -05:00
co-authored by Claude Sonnet 4.6
parent 8732db9c1f
commit 8b2f8eb3be
3 changed files with 13 additions and 1 deletions
+11
View File
@@ -63,5 +63,16 @@ async def find_cups(request: Request, user: dict = Depends(get_current_user)):
results["muestra_articulo"] = rows5[0] if (ok5 and rows5) else "sin datos"
results["cod_examen_muestra"] = cod
# 5. Verificar si hay descuentos en RELACION
ok6, _, rows6 = fb.execute_query("""
SELECT FIRST 10
r.NUM_FACTURA, r.PREFIJO, rel.COD_EXAMEN, rel.DESCUENTO, rel.PRECIO
FROM RELACION rel
JOIN RECEPCION r ON r.IDRECEPCION = rel.IDRECEPCION
WHERE rel.DESCUENTO IS NOT NULL AND rel.DESCUENTO > 0
ORDER BY r.FECHA_RECEPCION DESC
""")
results["servicios_con_descuento"] = rows6 if ok6 else []
fb.disconnect()
return JSONResponse(results)