fix: cast FECHAFACT to TIMESTAMP for BETWEEN comparison

FACTURA_DIAN.FECHAFACT is DATE type, incompatible with datetime strings.
CAST to TIMESTAMP allows comparison with :fecha_ini/:fecha_fin params.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-28 16:55:17 -05:00
co-authored by Claude Sonnet 4.6
parent 33bd25c6c8
commit c1925ef6da
+1 -1
View File
@@ -178,7 +178,7 @@ JOIN RELACION rel ON rel.IDRECEPCION = r.IDRECEPCION
LEFT JOIN EXAMEN ex ON TRIM(ex.CODIGO) = TRIM(rel.COD_EXAMEN)
LEFT JOIN EMPRESA e ON e.NIT = r.NIT_EMPRESA
LEFT JOIN TARIFA t ON TRIM(t.COD_EXAMEN) = TRIM(rel.COD_EXAMEN) AND t.TARIFA = e.TARIFA
WHERE fd.FECHAFACT BETWEEN :fecha_ini AND :fecha_fin
WHERE CAST(fd.FECHAFACT AS TIMESTAMP) BETWEEN :fecha_ini AND :fecha_fin
AND (fd.ANULADA IS NULL OR fd.ANULADA = 'F')
AND r.PREFIJO = 'CMXC'
ORDER BY r.NUM_FACTURA, r.IDRECEPCION