- 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
73 lines
1.9 KiB
TypeScript
73 lines
1.9 KiB
TypeScript
import { apiClient } from './client';
|
|
|
|
export interface ConciliacionCfdi {
|
|
id: number;
|
|
uuid: string;
|
|
type: string;
|
|
serie: string | null;
|
|
folio: string | null;
|
|
fechaEmision: string;
|
|
fechaPagoP: string | null;
|
|
rfcEmisor: string;
|
|
nombreEmisor: string;
|
|
rfcReceptor: string;
|
|
nombreReceptor: string;
|
|
total: number;
|
|
totalMxn: number;
|
|
subtotal: number;
|
|
descuento: number;
|
|
moneda: string;
|
|
tipoCambio: number;
|
|
tipoComprobante: string | null;
|
|
montoPagoMxn: number;
|
|
montoMxn: number;
|
|
metodoPago: string | null;
|
|
formaPago: string | null;
|
|
usoCfdi: string | null;
|
|
status: string | null;
|
|
fechaCertSat: string | null;
|
|
ivaTraslado: number;
|
|
ivaRetencion: number;
|
|
isrRetencion: number;
|
|
conciliado: string | null;
|
|
idConciliacion: number | null;
|
|
conciliacion: {
|
|
id: number;
|
|
fechaDePago: string;
|
|
banco: string;
|
|
terminacionCuenta: string;
|
|
} | null;
|
|
}
|
|
|
|
export async function getCfdisConConciliacion(params: {
|
|
tipo: string;
|
|
fechaInicio?: string;
|
|
fechaFin?: string;
|
|
regimen?: string;
|
|
estado?: string;
|
|
contribuyenteId?: string;
|
|
}): Promise<ConciliacionCfdi[]> {
|
|
const q = new URLSearchParams();
|
|
q.set('tipo', params.tipo);
|
|
if (params.fechaInicio) q.set('fechaInicio', params.fechaInicio);
|
|
if (params.fechaFin) q.set('fechaFin', params.fechaFin);
|
|
if (params.regimen) q.set('regimen', params.regimen);
|
|
if (params.estado) q.set('estado', params.estado);
|
|
if (params.contribuyenteId) q.set('contribuyenteId', params.contribuyenteId);
|
|
const res = await apiClient.get<ConciliacionCfdi[]>(`/conciliacion?${q}`);
|
|
return res.data;
|
|
}
|
|
|
|
export async function conciliar(data: {
|
|
cfdiIds: number[];
|
|
fechaDePago: string;
|
|
idBanco: number;
|
|
}): Promise<{ count: number }> {
|
|
const res = await apiClient.post<{ count: number }>('/conciliacion', data);
|
|
return res.data;
|
|
}
|
|
|
|
export async function desconciliar(id: number): Promise<void> {
|
|
await apiClient.delete(`/conciliacion/${id}`);
|
|
}
|