Commit Graph
5 Commits
Author SHA1 Message Date
Lizandro GuarnizoandClaude Sonnet 4.6 22e42463c7 fix: ventas page uses same SQL as automation (FACTURA_DIAN + FECHAFACT)
- Hardcode _SQL_VENTAS and _SQL_VENTAS_BY_FACTURA matching automation.py
- Remove stored query selector from UI — ventas always queries CMXC by billing date
- send-one now fetches factura directly by PREFIJO+NUM_FACTURA (no date range requery)
- Remove query_id dependency from all endpoints and JS formParams

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-28 17:28:05 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 c0e66989ca fix: ventas page only shows CMXC records, remove duplicate column
- _query_rows now always filters by PREFIJO='CMXC' (unless user specifies another prefix in the factura field)
- Removed redundant first column IDRECEP from ventas table (factura_key and factura were identical)
- Renamed header to just Factura

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-28 17:23:16 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 8ed8f0999f fix: refactor ventas page to group by factura instead of idrecepcion
- _agrupar now keys by PREFIJO-NUM_FACTURA so all services of a factura are grouped together
- _is_sent checks by factura key instead of idrecepcion
- send-one and send endpoints accept/return factura_key instead of idrecepcion
- ventas.html JS updated: factura_key used throughout (filaHtml, marcarFila, enviarUno, enviarTodosPendientes, verDetalle)
- DOM element IDs sanitized with _safeId() to handle dashes in keys like CMXC-309
- onclick handlers now pass string keys with proper quoting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-28 17:08:20 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 73062af8bc feat: paso 4 ventas en automation + fixes varios
- Automation: agrega Paso 4 (Ventas/Crear) con fetch _SQL_VENTAS,
  filtro por excluded_ventas_set, loop de envío y log de actividad
- Automation: _guardar_envio ahora almacena idrecepcion y contrato
  para que /ventas reconozca registros enviados por automation
- Contratos: corrige NameError en toggle_excluir (faltaba request: Request)
- Ventas: agrega check if not q en send_one y send para evitar TypeError
- Ventas HTML: agrega columna Contrato en la tabla de facturas
- json_generator: normaliza etnia >2 chars a '99' (ej: 999 → 99)
- json_generator: agrega campo ciudadExp usando el mismo cod_ciudad

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-11 14:29:39 -05:00
Lizandro GuarnizoandClaude Sonnet 4.6 6b84ecfd90 feat: módulo de facturas venta (Ventas/Crear) para contrato 040
- generar_factura_venta en json_generator.py con mapeo completo del JSON
- Queries default tipo 'ventas' (por fecha y por número) filtradas a contrato 040
- Ruta /ventas con preview, send-one y send masivo
- Template ventas.html con tabla, resumen y modal JSON
- Link en navegación lateral

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-11 11:16:42 -05:00