fix(conciliacion): complementos de pago usan fecha_pago_p y campos faltantes en visor
- conciliacion.service.ts: filtros y ordenamiento ahora usan
COALESCE(fecha_pago_p, fecha_emision). Los CFDIs tipo P
(complementos de pago) aparecen en el periodo del pago real,
no de la emision del CFDI.
- conciliacion.service.ts: agrega fechaPagoP al SELECT y a la
interfaz ConciliacionCfdi.
- conciliacion/page.tsx: tablas y export Excel usan
fechaPagoP || fechaEmision para mostrar la fecha.
- cfdi-invoice.tsx: para tipo P con fechaPagoP, muestra
'Pago: {fecha}' en el encabezado.
- conciliacion.ts: actualiza interfaz ConciliacionCfdi con
todos los campos que ya devuelve el backend.
Refs: docs/CAMBIOS-2026-05-09.md secciones 7 y 8
This commit is contained in:
@@ -25,6 +25,7 @@ export interface ConciliacionCfdi {
|
||||
usoCfdi: string | null;
|
||||
status: string | null;
|
||||
fechaCertSat: string | null;
|
||||
fechaPagoP: string | null;
|
||||
ivaTraslado: number;
|
||||
ivaRetencion: number;
|
||||
isrRetencion: number;
|
||||
@@ -66,11 +67,11 @@ export async function getCfdisConConciliacion(
|
||||
}
|
||||
|
||||
if (filters.fechaInicio) {
|
||||
where += ` AND c.fecha_emision >= $${idx++}::date`;
|
||||
where += ` AND COALESCE(c.fecha_pago_p, c.fecha_emision) >= $${idx++}::date`;
|
||||
params.push(filters.fechaInicio);
|
||||
}
|
||||
if (filters.fechaFin) {
|
||||
where += ` AND c.fecha_emision <= ($${idx++}::date + interval '1 day')`;
|
||||
where += ` AND COALESCE(c.fecha_pago_p, c.fecha_emision) <= ($${idx++}::date + interval '1 day')`;
|
||||
params.push(filters.fechaFin);
|
||||
}
|
||||
if (filters.regimen) {
|
||||
@@ -106,6 +107,7 @@ export async function getCfdisConConciliacion(
|
||||
c.uso_cfdi as "usoCfdi",
|
||||
c.status,
|
||||
c.fecha_cert_sat as "fechaCertSat",
|
||||
c.fecha_pago_p as "fechaPagoP",
|
||||
c.iva_traslado as "ivaTraslado",
|
||||
c.iva_retencion as "ivaRetencion",
|
||||
c.isr_retencion as "isrRetencion",
|
||||
@@ -119,7 +121,7 @@ export async function getCfdisConConciliacion(
|
||||
LEFT JOIN conciliaciones con ON con.id_cfdi = c.id
|
||||
LEFT JOIN bancos b ON b.id = con.id_banco
|
||||
${where}
|
||||
ORDER BY c.fecha_emision DESC
|
||||
ORDER BY COALESCE(c.fecha_pago_p, c.fecha_emision) DESC
|
||||
`, params);
|
||||
|
||||
return rows.map((r: any) => ({
|
||||
@@ -150,6 +152,7 @@ export async function getCfdisConConciliacion(
|
||||
usoCfdi: r.usoCfdi,
|
||||
status: r.status,
|
||||
fechaCertSat: r.fechaCertSat,
|
||||
fechaPagoP: r.fechaPagoP,
|
||||
ivaTraslado: Number(r.ivaTraslado || 0),
|
||||
ivaRetencion: Number(r.ivaRetencion || 0),
|
||||
isrRetencion: Number(r.isrRetencion || 0),
|
||||
|
||||
Reference in New Issue
Block a user