Commit Graph
11 Commits
Author SHA1 Message Date
Lizandro GuarnizoandClaude Sonnet 4.6 531fb29122 fix: group terceros by cedula not fecha-as-factura
For terceros, _guardar_envio stores the automation date in the factura
field (not a patient id), so COALESCE(factura, cedula) still collapsed
all terceros into one row. Now GROUP BY uses cedula for tipo=terceros
and factura for transaccion/ventas. Template hides the date in the
factura column for terceros rows.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-26 21:45:14 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 4b70f6f2fa fix: resumen - group terceros by cedula, prioritize success over warning
GROUP BY COALESCE(factura, cedula) fixes terceros (factura=NULL)
collapsing into one row — each paciente now gets its own row.
CASE WHEN in estado_final explicitly prioritizes success > warning > error
instead of relying on alphabetical MAX which returned warning over success.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-26 21:34:45 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 6e9ee32646 fix: group resumen by factura+tipo only, not cedula
Grouping by cedula caused envíos with null/different cedula to split
into separate groups, making success envíos invisible — factura 4989
showed error persistente despite having a success send.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-26 18:09:42 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 ab2ef167f9 feat: add Resumen Diario TNS page as submodule
Groups envios by factura+tipo per day and shows estado_final
(exitoso if any send succeeded, error persistente if all failed).
Supports inline reenvío and JSON detail modal. Added to sidebar
under Historial TNS and as TNS submodule link.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-26 17:59:42 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 6a452cd950 feat: sistema de 3 estados (success/warning/error) para envíos TNS
- _parse_tns_resp retorna 'success'|'warning'|'error' en lugar de bool
- 'ya existe/registrado/autorización' → warning (sin reenvío, no es error real)
- errores reales → error (con reenvío)
- Guarda JSON crudo completo en respuesta_api
- logs.html: badge amarillo para warning, verde para success, rojo para error
- Filtro de historial incluye opción 'warning'
- reenvío en logs.py solo disponible para status='error'
- reenvío en logs.py usa misma lógica _parse_tns_resp y soporta ventas

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-24 10:45:15 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 599391739f feat(logs): filtro por cédula de paciente en historial de envíos
- Agrega columna cedula a tabla envios (migración automática)
- _guardar_envio almacena la cédula en los 4 pasos de automation
- pac_map (COD_PACIENTE→DOCIDENT) para RDA/preserv/ventas
- logs.py busca por cedula LIKE en vez de idrecepcion/contrato
- logs.html etiqueta el input como "Cédula paciente"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-22 22:37:40 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 cb3b327938 Add reenviar button in /logs for failed envios
POST /logs/reenviar/{id} re-sends stored JSON to TNS and updates
status to 'success' in-place if it succeeds. Button appears only
on error rows with saved JSON; updates row color and badge without reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-11 09:24:22 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 c20e1a7476 feat: log de actividad por usuario
- Tabla activity_log en SQLite (migración automática)
- Registra: login, login_fallido, rda_enviado, rda_masivo, rda_directo,
  automation_run, contrato_creado, contrato_editado, contrato_toggle
- Endpoint GET /logs/actividad con filtros por usuario, acción y fecha
- UI /logs/actividad con badges de color por tipo de acción
- Enlace "Actividad" en navegación lateral

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-10 17:11:33 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 07038ac431 fix: clean time spaces in logs view without modifying stored data
Applies _clean_times when serving json_enviado in /logs/detalle
so old records with "12: 47: 37" display correctly as "12:47:37".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 17:36:45 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 7699303a53 Mejora Transacción y Historial: estado por fila, envío individual y filtros avanzados
- Transacción: tabla con estado Enviado/Pendiente/Error por IDRECEPCION, botón enviar fila a fila o masivo, modal con JSON + respuesta TNS por registro
- Historial: filtros por fecha, tipo, IDRECEPCION/contrato; paginación 50 por página; modal con 3 tabs (JSON enviado / Respuesta TNS / Mensaje)
- DB: migración automática para agregar columnas idrecepcion, contrato, mensaje_tns a tabla envios
- Logs route: nuevo endpoint /logs/detalle/{id} para cargar detalle completo vía JS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-26 19:40:11 -05:00
Lizandro Guarnizo 8ae3b44bc9 Initial commit: RIPS Manager web system 2026-06-17 13:22:39 -05:00