This commit is contained in:
Lizandro Guarnizo
2026-04-10 23:04:28 -05:00
parent 64495816a9
commit c8bef9d9c4
8 changed files with 273 additions and 77 deletions
+18 -2
View File
@@ -812,6 +812,22 @@ async function cargarReportePagos() {
const cliente = f.tipo_cliente === 'seguro' && f.seguro_nombre
? `Seguro: ${esc(f.seguro_nombre)}`
: esc(f.tipo_cliente || 'particular');
// Columna modo: usar parcialidades si existen, sino legacy
const detalle = f.pagos_detalle || [];
const modoHtml = pagoEst === 'pagado'
? (detalle.length
? detalle.map(p => `${esc(MODO_LABEL[p.modo] || p.modo)}: $${Number(p.monto).toLocaleString('es-CO')}`).join('<br>')
: esc(MODO_LABEL[f.pago_modo] || f.pago_modo || '—'))
: '—';
// Monto total recibido
const montoTotal = pagoEst === 'pagado'
? (detalle.length
? detalle.reduce((s, p) => s + parseFloat(p.monto || 0), 0)
: parseFloat(f.pago_monto || 0))
: 0;
return `<tr class="${pagoEst === 'pagado' ? '' : 'opacity-75'}">
<td class="ps-3 text-muted">${f.id}</td>
<td class="text-nowrap">${esc(f.fecha_programada?.slice(0,10) || '—')}</td>
@@ -823,9 +839,9 @@ async function cargarReportePagos() {
<td class="text-center">
<span class="badge bg-${PAGO_BADGE[pagoEst] || 'secondary'}">${esc(pagoEst)}</span>
</td>
<td class="text-center text-muted small">${esc(f.pago_modo) || '—'}</td>
<td class="text-start small" style="white-space:pre-line">${modoHtml}</td>
<td class="text-end fw-semibold ${pagoEst === 'pagado' ? 'text-success' : 'text-muted'}">
${pagoEst === 'pagado' ? fmtMoney(f.pago_monto) : '—'}
${pagoEst === 'pagado' ? fmtMoney(montoTotal) : '—'}
</td>
<td class="text-nowrap text-muted small">${f.pago_fecha ? esc(f.pago_fecha.slice(0,16)) : '—'}</td>
<td>