diff --git a/frontend/src/pages/Cobranza.jsx b/frontend/src/pages/Cobranza.jsx index 0301f6a..c2532bc 100644 --- a/frontend/src/pages/Cobranza.jsx +++ b/frontend/src/pages/Cobranza.jsx @@ -339,8 +339,8 @@ export default function Cobranza() { // al menos un grupo expandido, o siempre en PROGRAMA. const conColsExtra = esPrograma || (expandidas.size > 0); const headers = !conColsExtra - ? ["GRUPO","CTA X COB. MES ANT.","COB. MES ANT.","% ANT","CTA X COB EN CURSO","COB. EN CURSO","% MES","CTA X COB TOTAL","COB. TOTAL","% TOTAL","SALDO","SALDO POR RETIRAR","OPC."] - : [(esPrograma?"PROGRAMA":"GRUPO"),"FREC.","N° CUOTA","VENCIMIENTO","CTA X COB. MES ANT.","COB. MES ANT.","% ANT","CTA X COB EN CURSO","COB. EN CURSO","% MES","CTA X COB TOTAL","COB. TOTAL","% TOTAL","SALDO","SALDO POR RETIRAR","OPC."]; + ? ["GRUPO","CTA X COB. MES ANT.","COB. MES ANT.","% ANT","CTA X COB EN CURSO","COB. EN CURSO","% MES","CTA X COB TOTAL","COB. TOTAL","% TOTAL","SALDO","RETIROS","DIFERENCIA","OPC."] + : [(esPrograma?"PROGRAMA":"GRUPO"),"FREC.","N° CUOTA","VENCIMIENTO","CTA X COB. MES ANT.","COB. MES ANT.","% ANT","CTA X COB EN CURSO","COB. EN CURSO","% MES","CTA X COB TOTAL","COB. TOTAL","% TOTAL","SALDO","RETIROS","DIFERENCIA","OPC."]; // Anchos para columnas redimensionables (1ª columna más ancha, resto estándar) const anchosCob = headers.map((h, i) => i === 0 ? (conColsExtra ? 280 : 200) : (h === "FREC." || h.startsWith("%") || h === "OPC." ? 80 : 120)); @@ -598,7 +598,7 @@ export default function Cobranza() {
{datos.map((fRaw, ri) => { const f = filaLayout(fRaw); // layout normalizado (15 o 12 cols) - const nCols = headers.length - 1; // sin OPC + const nCols = headers.length - 2; // sin RETIROS (calculada) ni OPC const sedeKey = String(f[0]).toUpperCase(); const abiertaSede = !esPrograma && expandidas.has(sedeKey); // Hijos a mostrar al expandir: en SEDE los programas de la sede; @@ -609,7 +609,14 @@ export default function Cobranza() { const av = !String(fila[LAY.ant[2]]||"").trim() || ["-","—"].includes(String(fila[LAY.ant[2]]).trim()); const mv = !String(fila[LAY.mes[2]]||"").trim() || ["-","—"].includes(String(fila[LAY.mes[2]]).trim()); const tv = !String(fila[LAY.tot[2]]||"").trim() || ["-","—"].includes(String(fila[LAY.tot[2]]).trim()); - return fila.slice(0, nCols).map((v, ci) => { + // RETIROS (calculada) = SALDO − SALDO POR RETIRAR de la propia fila. + const retiros = toMonto(fila[LAY.saldo]) - toMonto(fila[LAY.saldoRet]); + const celdaRetiros = ( +| clickOrden(i)}
style={{...stH, position:stH.position||"relative", cursor: ordenable?"pointer":"default", userSelect:"none"}}>
{c}{ordenable && _flecha(ordCol===i, ordDir)} | ;
@@ -1282,6 +1293,9 @@ function ModalEstadoCuenta({ grupo, ano, mes, sectorista, agrupacion, progFiltro
const totVacio = !String(f[12]||"").trim() || ["-","—"].includes(String(f[12]).trim());
const programa = f[14] || "-"; // programa del alumno (extra del backend)
const retira = porRetirar.has(String(f[0])); // alumno POR RETIRAR
+ // RETIROS (calculada) = SALDO − SALDO POR RETIRAR. Si el alumno está POR
+ // RETIRAR, todo su saldo es "por retirar" ⇒ RETIROS = 0; si no, = su saldo.
+ const retirosFila = retira ? 0 : saldo;
return (
|||
|---|---|---|---|
| + {"S/ " + retirosFila.toLocaleString("es-PE",{maximumFractionDigits:0})} + | {/* Botón INFO por alumno (estado + observaciones) */}); })} + {/* RETIROS total (calculada) */} + | + {"S/ " + retirosTot.toLocaleString("es-PE",{maximumFractionDigits:0})} + |