bdpformulas 1.0.101 → 1.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/strategies/common/declaracionJurada.calc.js +1 -2
- package/build/strategies/common/flujoCalculos/flujoConstructor.js +101 -22
- package/build/strategies/eeff/deudas/administracionLinea.js +9 -3
- package/build/strategies/eeff/deudas/aplicactionesCuadro.d.ts +6 -7
- package/build/strategies/eeff/deudas/aplicactionesCuadro.js +252 -118
- package/build/strategies/eeff/deudas/deudas.strategy.js +66 -14
- package/build/strategies/eeff/deudas/resumenFinanciamiento.js +2 -2
- package/build/strategies/production/flujoProyPrd.strategy.js +11 -1
- package/package.json +1 -1
|
@@ -40,12 +40,11 @@ const anadirDeclaracionJurada = (balanceMap, balanceArray, declaracionJurada) =>
|
|
|
40
40
|
const referencia = [];
|
|
41
41
|
referencia.push(arrayValue(['SOL_ACT_001'], 'ACT_CN_11001'));
|
|
42
42
|
referencia.push(arrayValue(['SOL_ACT_002'], 'ACT_CN_11002'));
|
|
43
|
-
referencia.push(arrayValue(['SOL_ACT_011', 'SOL_ACT_007'], 'ACT_CN_11003'));
|
|
43
|
+
referencia.push(arrayValue(['SOL_ACT_011', 'SOL_ACT_007', 'SOL_ACT_009'], 'ACT_CN_11003'));
|
|
44
44
|
referencia.push(arrayValue(['SOL_ACT_003'], 'ACT_CN_12001'));
|
|
45
45
|
referencia.push(arrayValue([
|
|
46
46
|
'SOL_ACT_005',
|
|
47
47
|
'SOL_ACT_008',
|
|
48
|
-
'SOL_ACT_009',
|
|
49
48
|
'SOL_ACT_010'
|
|
50
49
|
], 'ACT_CN_12002'));
|
|
51
50
|
referencia.push(arrayValue(['SOL_ACT_004'], 'ACT_CN_12003'));
|
|
@@ -169,18 +169,54 @@ class FlujoConstructor {
|
|
|
169
169
|
}
|
|
170
170
|
rowAcumulado.MontoTotal = rowAcumulado[`Monto${this.rango}`];
|
|
171
171
|
};
|
|
172
|
+
// calcularTotal = (
|
|
173
|
+
// sumandosArray: string[],
|
|
174
|
+
// total: string,
|
|
175
|
+
// data = this.array
|
|
176
|
+
// ) => {
|
|
177
|
+
// const rows = data.filter(
|
|
178
|
+
// (item: any) =>
|
|
179
|
+
// item.IndicadorABM !== 'B' &&
|
|
180
|
+
// sumandosArray.includes(item.RubroId)
|
|
181
|
+
// )
|
|
182
|
+
// const destino = this.mapObject.get(`${total}_0`)
|
|
183
|
+
// rows.map((item: any) => {
|
|
184
|
+
// for (let i = 1; i <= this.rango; i++) {
|
|
185
|
+
// destino[`Monto${i}`] += parseFloat(item[`Monto${i}`])
|
|
186
|
+
// // destino[`Monto${i}`] =
|
|
187
|
+
// // Math.round(destino[`Monto${i}`] * 100) / 100
|
|
188
|
+
// destino[`Monto${i}`] = Math.round(destino[`Monto${i}`])
|
|
189
|
+
// }
|
|
190
|
+
// })
|
|
191
|
+
// }
|
|
172
192
|
calcularTotal = (sumandosArray, total, data = this.array) => {
|
|
173
193
|
const rows = data.filter((item) => item.IndicadorABM !== 'B' &&
|
|
174
194
|
sumandosArray.includes(item.RubroId));
|
|
175
|
-
const
|
|
176
|
-
|
|
195
|
+
const destinoKey = `${total}_0`;
|
|
196
|
+
const destino = this.mapObject.get(destinoKey);
|
|
197
|
+
if (!destino) {
|
|
198
|
+
console.error(` NO SE ENCONTRÓ EL DESTINO: ${destinoKey}`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (let i = 1; i <= this.rango; i++) {
|
|
202
|
+
const montoKey = `Monto${i}`;
|
|
203
|
+
if (destino[montoKey] === null ||
|
|
204
|
+
destino[montoKey] === undefined ||
|
|
205
|
+
isNaN(destino[montoKey])) {
|
|
206
|
+
destino[montoKey] = 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
rows.forEach((item) => {
|
|
177
210
|
for (let i = 1; i <= this.rango; i++) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
destino[`Monto${i}`] = Math.round(destino[`Monto${i}`]);
|
|
211
|
+
const montoKey = `Monto${i}`;
|
|
212
|
+
const montoValor = (0, utils_1.ourParseFloat)(item[montoKey]) || 0; // Asegurar que sea número
|
|
213
|
+
destino[montoKey] += montoValor;
|
|
182
214
|
}
|
|
183
215
|
});
|
|
216
|
+
// Redondear al final
|
|
217
|
+
for (let i = 1; i <= this.rango; i++) {
|
|
218
|
+
destino[`Monto${i}`] = Math.round(destino[`Monto${i}`]);
|
|
219
|
+
}
|
|
184
220
|
};
|
|
185
221
|
replicarCuenta = (cuentaOrigen, cuentaDestino) => {
|
|
186
222
|
const rows = this.array.filter((item) => item.RubroId === cuentaOrigen);
|
|
@@ -264,37 +300,71 @@ class FlujoConstructor {
|
|
|
264
300
|
}
|
|
265
301
|
};
|
|
266
302
|
agregarQuitarClones = () => {
|
|
267
|
-
const filter = this.data.FlujoProyectadoMensual.filter((item) =>
|
|
268
|
-
|
|
303
|
+
const filter = this.data.FlujoProyectadoMensual.filter((item) =>
|
|
304
|
+
// item.IndicadorABM !== 'B' &&
|
|
305
|
+
item.Clasificador == 'DETL' || item.Clasificador == 'HABM');
|
|
306
|
+
const borrados = this.data.FlujoProyectadoMensual.filter((item) => item.IndicadorABM === 'B' &&
|
|
307
|
+
(item.Clasificador == 'DETL' || item.Clasificador == 'HABM')).map((item) => `CLONE_${item.UUID}`);
|
|
308
|
+
if (borrados.length > 0) {
|
|
309
|
+
this.data.FlujoProyectadoAnual =
|
|
310
|
+
this.data.FlujoProyectadoAnual.filter((item) => !borrados.includes(item.UUID));
|
|
311
|
+
this.array = this.array.filter((item) => !borrados.includes(item.UUID));
|
|
312
|
+
borrados.forEach((uuid) => {
|
|
313
|
+
const key = Object.keys(this.mapObject).find((key) => this.mapObject.get(key)?.UUID === uuid);
|
|
314
|
+
if (key) {
|
|
315
|
+
this.mapObject.delete(key);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
269
319
|
filter.forEach((item) => {
|
|
270
320
|
const key = `${item.RubroId}_CLONE_${item.UUID}`;
|
|
271
321
|
const UUID = `CLONE_${item.UUID}`;
|
|
272
|
-
|
|
322
|
+
if (item.IndicadorABM === 'B') {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
273
325
|
let totalMensual = 0;
|
|
274
326
|
for (let i = 1; i <= this.rango; i++) {
|
|
275
327
|
totalMensual += (0, utils_1.ourParseFloat)(item[`Monto${i}`] || 0);
|
|
276
328
|
}
|
|
277
329
|
const existingClone = this.array.find((el) => el.UUID === UUID);
|
|
278
|
-
if (item.
|
|
279
|
-
|
|
280
|
-
|
|
330
|
+
if (item.IndicadorABM === 'A' && !existingClone) {
|
|
331
|
+
const newClone = {
|
|
332
|
+
...item,
|
|
333
|
+
UUID: UUID,
|
|
334
|
+
Clasificador: 'DETL',
|
|
335
|
+
IndicadorABM: 'A',
|
|
336
|
+
Monto1: totalMensual,
|
|
337
|
+
...Array.from({ length: this.rango - 1 }, (_, i) => ({
|
|
338
|
+
[`Monto${i + 2}`]: 0
|
|
339
|
+
})).reduce((acc, curr) => ({ ...acc, ...curr }), {}),
|
|
340
|
+
MontoTotal: totalMensual
|
|
341
|
+
};
|
|
342
|
+
this.array.push(newClone);
|
|
343
|
+
this.mapObject.set(key, newClone);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (existingClone &&
|
|
347
|
+
(item.RubroId === 'ACT_CNFL_61001' ||
|
|
348
|
+
item.RubroId === 'ACT_CNFL_73000')) {
|
|
349
|
+
const updatedClone = {
|
|
281
350
|
...existingClone,
|
|
351
|
+
Descripcion: item.Descripcion,
|
|
282
352
|
Comprar: item.Comprar,
|
|
283
353
|
Operacion: item.Operacion,
|
|
354
|
+
IndicadorABM: item.IndicadorABM,
|
|
284
355
|
Monto1: totalMensual
|
|
285
356
|
};
|
|
286
357
|
let nuevoTotal = totalMensual;
|
|
287
358
|
for (let i = 2; i <= this.rango; i++) {
|
|
288
359
|
nuevoTotal += (0, utils_1.ourParseFloat)(existingClone[`Monto${i}`] || 0);
|
|
289
360
|
}
|
|
290
|
-
|
|
361
|
+
updatedClone.MontoTotal = nuevoTotal;
|
|
291
362
|
const index = this.array.findIndex((el) => el.UUID === UUID);
|
|
292
363
|
if (index >= 0)
|
|
293
|
-
this.array[index] =
|
|
294
|
-
this.mapObject.set(key,
|
|
364
|
+
this.array[index] = updatedClone;
|
|
365
|
+
this.mapObject.set(key, updatedClone);
|
|
295
366
|
return;
|
|
296
367
|
}
|
|
297
|
-
// FIN EDICION
|
|
298
368
|
const clone = {
|
|
299
369
|
...item,
|
|
300
370
|
UUID
|
|
@@ -316,12 +386,21 @@ class FlujoConstructor {
|
|
|
316
386
|
}
|
|
317
387
|
this.mapObject.set(key, clone);
|
|
318
388
|
});
|
|
319
|
-
const borrados = this.data.FlujoProyectadoMensual.filter(
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
this.data.
|
|
389
|
+
// const borrados = this.data.FlujoProyectadoMensual.filter(
|
|
390
|
+
// (item: any) =>
|
|
391
|
+
// item.IndicadorABM === 'B' &&
|
|
392
|
+
// (item.Clasificador == 'DETL' || item.Clasificador == 'HABM')
|
|
393
|
+
// ).map((item: any) => `CLONE_${item.UUID}`)
|
|
394
|
+
// this.data.FlujoProyectadoMensual =
|
|
395
|
+
// this.data.FlujoProyectadoMensual.filter(
|
|
396
|
+
// (item: any) => item.IndicadorABM !== 'B'
|
|
397
|
+
// )
|
|
398
|
+
// this.array = this.array.filter(
|
|
399
|
+
// (item: any) => !borrados.includes(item.UUID)
|
|
400
|
+
// )
|
|
401
|
+
// this.data.FlujoProyectadoAnual = this.data.FlujoProyectadoAnual.filter(
|
|
402
|
+
// (item: any) => !borrados.includes(item.UUID)
|
|
403
|
+
// )
|
|
325
404
|
const anuales = this.array.filter((item) => item.Clasificador == 'DETL' || item.Clasificador == 'HABM');
|
|
326
405
|
for (const anualItem of anuales) {
|
|
327
406
|
const key = `${anualItem.RubroId}_${anualItem.UUID}`.replace('_CLONE', '');
|
|
@@ -70,13 +70,19 @@ class AdministacionLineas {
|
|
|
70
70
|
linea.entidad =
|
|
71
71
|
items.find((item) => item.RubroId === rubroId)
|
|
72
72
|
?.Descripcion || '';
|
|
73
|
-
const monto1 =
|
|
74
|
-
|
|
73
|
+
// const monto1 =
|
|
74
|
+
// items.find((item: any) => item.RubroId === rubroId)?.Monto1 || 0
|
|
75
|
+
// const monto2 =
|
|
76
|
+
// items.find((item: any) => item.RubroId === rubroId)?.Monto1 || 0
|
|
77
|
+
const monto = items.find((item) => item.RubroId === rubroId)?.Monto1 || 0;
|
|
75
78
|
// linea.monto =
|
|
76
79
|
// Math.round(
|
|
77
80
|
// parseFloat(monto1.value) + parseFloat(monto2.value) * 100
|
|
78
81
|
// ) / 100
|
|
79
|
-
linea.monto = Math.round(
|
|
82
|
+
// linea.monto = Math.round(
|
|
83
|
+
// parseFloat(monto1.value) + parseFloat(monto2.value)
|
|
84
|
+
// )
|
|
85
|
+
linea.monto = Math.round(parseFloat(monto.value));
|
|
80
86
|
linea = this.mapDataToLineas(linea);
|
|
81
87
|
linea.saldo = linea.monto - linea.usado;
|
|
82
88
|
linea.interes =
|
|
@@ -10,11 +10,10 @@ export default class AplicacionesCuadroAlternativo {
|
|
|
10
10
|
constructor(deudas: any, cantidadProyeccion: number, proyecta: boolean, admLineas: any, resumenFinanciamiento: any, calculoAuxiliar1: number, calculoAuxiliar2: number);
|
|
11
11
|
getCalculation(): any[];
|
|
12
12
|
private addMontos;
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
-
private caculate006;
|
|
13
|
+
private generateKOLineaCredito;
|
|
14
|
+
private generateKOPrestamoDirecto;
|
|
15
|
+
private generateKIPrestamoDirecto;
|
|
16
|
+
private generateOtros;
|
|
17
|
+
private generateKILeasingFinanciero;
|
|
18
|
+
private generateKIKOLineasMixtas;
|
|
20
19
|
}
|
|
@@ -21,44 +21,12 @@ class AplicacionesCuadroAlternativo {
|
|
|
21
21
|
this.result = [];
|
|
22
22
|
}
|
|
23
23
|
getCalculation() {
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
id: 'ACT_DEU_76002',
|
|
31
|
-
grupo: 'TOTAL',
|
|
32
|
-
descripction: 'KO - Prestamo Directo'
|
|
33
|
-
});
|
|
34
|
-
this.result.push({
|
|
35
|
-
id: 'ACT_DEU_76003',
|
|
36
|
-
grupo: 'TOTAL',
|
|
37
|
-
descripction: 'KI - Prestamo Directo'
|
|
38
|
-
});
|
|
39
|
-
this.result.push({
|
|
40
|
-
id: 'ACT_DEU_76004',
|
|
41
|
-
grupo: 'TOTAL',
|
|
42
|
-
descripction: 'OTROS - Pagares, Bonos, Etc.'
|
|
43
|
-
});
|
|
44
|
-
this.result.push({
|
|
45
|
-
id: 'ACT_DEU_76005',
|
|
46
|
-
grupo: 'TOTAL',
|
|
47
|
-
descripction: 'KI - Leasing Financiero'
|
|
48
|
-
});
|
|
49
|
-
this.result.push({
|
|
50
|
-
id: 'ACT_DEU_76006',
|
|
51
|
-
grupo: 'TOTAL',
|
|
52
|
-
descripction: 'KI - KO - Línea de Crédito Mixta'
|
|
53
|
-
});
|
|
54
|
-
for (const row of this.result.filter((item) => item.grupo == 'TOTAL')) {
|
|
55
|
-
this.caculate001(row);
|
|
56
|
-
this.caculate002(row);
|
|
57
|
-
this.caculate003(row);
|
|
58
|
-
this.caculate004(row);
|
|
59
|
-
this.caculate005(row);
|
|
60
|
-
this.caculate006(row);
|
|
61
|
-
}
|
|
24
|
+
this.generateKOLineaCredito();
|
|
25
|
+
this.generateKOPrestamoDirecto();
|
|
26
|
+
this.generateKIPrestamoDirecto();
|
|
27
|
+
this.generateOtros();
|
|
28
|
+
this.generateKILeasingFinanciero();
|
|
29
|
+
this.generateKIKOLineasMixtas();
|
|
62
30
|
return this.result;
|
|
63
31
|
}
|
|
64
32
|
addMontos(row) {
|
|
@@ -66,128 +34,294 @@ class AplicacionesCuadroAlternativo {
|
|
|
66
34
|
row[`Monto${i}`] = 0;
|
|
67
35
|
}
|
|
68
36
|
}
|
|
69
|
-
|
|
70
|
-
|
|
37
|
+
generateKOLineaCredito() {
|
|
38
|
+
const filaTotales = {
|
|
39
|
+
id: 'ACT_DEU_76001',
|
|
40
|
+
grupo: 'TOTAL',
|
|
41
|
+
descripction: 'KO - Línea de Crédito 100% KO'
|
|
42
|
+
};
|
|
43
|
+
this.addMontos(filaTotales);
|
|
44
|
+
const filasDetalle = [];
|
|
71
45
|
const filterLineas = this.admLineas.filter((item) => item.rubroId === 'ACT_DEU_71003');
|
|
72
46
|
for (let item of filterLineas) {
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
47
|
+
let filaDetalle = {
|
|
48
|
+
id: 'ACT_DEU_76001',
|
|
49
|
+
grupo: item.uuid,
|
|
50
|
+
descripction: item.entidad
|
|
51
|
+
};
|
|
52
|
+
this.addMontos(filaDetalle);
|
|
53
|
+
if (item.estado == 'Existente') {
|
|
54
|
+
filaDetalle.Monto1 = parseFloat(item.saldo);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
filaDetalle.Monto1 = parseFloat(item.monto);
|
|
58
|
+
}
|
|
59
|
+
filaTotales.Monto1 += filaDetalle.Monto1;
|
|
82
60
|
for (let i = 2; i <= this.cantidadProyeccion; i++) {
|
|
83
61
|
const codes = item.uuid.split('_');
|
|
84
62
|
const deudaLinea = this.deudas.find((item) => item.RubroId == 'ACT_DEU_50001' &&
|
|
85
63
|
item.Secuencia == parseInt(codes[3]));
|
|
86
|
-
|
|
87
|
-
deudaLinea[`Monto${i}`]
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
64
|
+
if (deudaLinea) {
|
|
65
|
+
const montoActual = parseFloat(deudaLinea[`Monto${i}`]?.value || 0);
|
|
66
|
+
const montoAnterior = parseFloat(deudaLinea[`Monto${i - 1}`]?.value || 0);
|
|
67
|
+
filaDetalle[`Monto${i}`] = montoActual - montoAnterior;
|
|
68
|
+
filaDetalle[`Monto${i}`] = Math.round(filaDetalle[`Monto${i}`] || 0);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
filaDetalle[`Monto${i}`] = 0;
|
|
72
|
+
}
|
|
73
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`];
|
|
92
74
|
}
|
|
93
|
-
|
|
75
|
+
filasDetalle.push(filaDetalle);
|
|
94
76
|
}
|
|
77
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
95
78
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
generateKOPrestamoDirecto() {
|
|
80
|
+
const filaTotales = {
|
|
81
|
+
id: 'ACT_DEU_76002',
|
|
82
|
+
grupo: 'TOTAL',
|
|
83
|
+
descripction: 'KO - Prestamo Directo'
|
|
84
|
+
};
|
|
85
|
+
this.addMontos(filaTotales);
|
|
86
|
+
const filasDetalle = [];
|
|
87
|
+
const rubros = [
|
|
88
|
+
['ACT_DEU_10001', 'ACT_DEU_10002'],
|
|
89
|
+
['ACT_DEU_40001', 'ACT_DEU_40002']
|
|
90
|
+
];
|
|
91
|
+
let deudasEncontradas = false;
|
|
92
|
+
for (let rubro of rubros) {
|
|
93
|
+
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0] &&
|
|
94
|
+
item.Destino === 'KO' &&
|
|
95
|
+
item.Operacion == 'NUEVA');
|
|
96
|
+
if (filtered.length > 0) {
|
|
97
|
+
deudasEncontradas = true;
|
|
98
|
+
}
|
|
100
99
|
for (const debt of filtered) {
|
|
101
100
|
const companion = this.deudas.find((item) => item.RubroId == rubro[1] &&
|
|
102
|
-
item.Secuencia == debt.Secuencia
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
item.Secuencia == debt.Secuencia);
|
|
102
|
+
let filaDetalle = {
|
|
103
|
+
id: 'ACT_DEU_76002',
|
|
104
|
+
grupo: debt.UUID,
|
|
105
|
+
descripction: debt.Descripcion
|
|
106
|
+
};
|
|
107
|
+
this.addMontos(filaDetalle);
|
|
108
108
|
for (let i = 1; i <= this.cantidadProyeccion; i++) {
|
|
109
109
|
if (i == 1 ||
|
|
110
110
|
(i > 1 &&
|
|
111
|
-
parseFloat(debt[`Monto${i - 1}`]) +
|
|
112
|
-
parseFloat(companion[`Monto${i - 1}`]) ==
|
|
111
|
+
parseFloat(debt[`Monto${i - 1}`]?.value || 0) +
|
|
112
|
+
parseFloat(companion[`Monto${i - 1}`]?.value || 0) ==
|
|
113
113
|
0)) {
|
|
114
|
-
|
|
115
|
-
parseFloat(debt[`Monto${i}`]) +
|
|
116
|
-
parseFloat(companion[`Monto${i}`]);
|
|
117
|
-
|
|
118
|
-
// Math.round(parseFloat(nuevo[`Monto${i}`]) * 100) /
|
|
119
|
-
// 100
|
|
120
|
-
nuevo[`Monto${i}`] = Math.round(parseFloat(nuevo[`Monto${i}`]));
|
|
114
|
+
filaDetalle[`Monto${i}`] =
|
|
115
|
+
parseFloat(debt[`Monto${i}`]?.value || 0) +
|
|
116
|
+
parseFloat(companion[`Monto${i}`]?.value || 0);
|
|
117
|
+
filaDetalle[`Monto${i}`] = Math.round(parseFloat(filaDetalle[`Monto${i}`] || 0));
|
|
121
118
|
}
|
|
122
|
-
|
|
119
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`] || 0;
|
|
123
120
|
}
|
|
121
|
+
filasDetalle.push(filaDetalle);
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
['ACT_DEU_10001', 'ACT_DEU_10002'],
|
|
130
|
-
['ACT_DEU_40001', 'ACT_DEU_40002']
|
|
131
|
-
], 'KO');
|
|
132
|
-
if (this.proyecta)
|
|
133
|
-
row.Monto1 = row.Monto1 - this.calculoAuxiliar1;
|
|
124
|
+
if (this.proyecta) {
|
|
125
|
+
filaTotales.Monto1 = filaTotales.Monto1 - this.calculoAuxiliar1;
|
|
126
|
+
}
|
|
134
127
|
const koPorcionBDP = this.resumenFinanciamiento.find((item) => item.id == 'ACT_DEU_75001');
|
|
135
|
-
const kiPorcionBDP = this.resumenFinanciamiento.find((item) => item.id == '
|
|
128
|
+
const kiPorcionBDP = this.resumenFinanciamiento.find((item) => item.id == 'ACT_DEU_75101');
|
|
136
129
|
for (let i = 2; i <= this.cantidadProyeccion; i++) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
const periodoAnterior = i - 1;
|
|
131
|
+
const porcionesPeriodoAnterior = (koPorcionBDP?.[`Monto${periodoAnterior}`] || 0) +
|
|
132
|
+
(kiPorcionBDP?.[`Monto${periodoAnterior}`] || 0);
|
|
133
|
+
filaTotales[`Monto${i}`] =
|
|
134
|
+
filaTotales[`Monto${i}`] - porcionesPeriodoAnterior;
|
|
140
135
|
}
|
|
136
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
141
137
|
}
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
generateKIPrestamoDirecto() {
|
|
139
|
+
const filaTotales = {
|
|
140
|
+
id: 'ACT_DEU_76003',
|
|
141
|
+
grupo: 'TOTAL',
|
|
142
|
+
descripction: 'KI - Prestamo Directo'
|
|
143
|
+
};
|
|
144
|
+
this.addMontos(filaTotales);
|
|
145
|
+
const filasDetalle = [];
|
|
146
|
+
const rubros = [
|
|
144
147
|
['ACT_DEU_10001', 'ACT_DEU_10002'],
|
|
145
148
|
['ACT_DEU_40001', 'ACT_DEU_40002']
|
|
146
|
-
]
|
|
149
|
+
];
|
|
150
|
+
for (let rubro of rubros) {
|
|
151
|
+
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0] &&
|
|
152
|
+
item.Destino === 'KI' &&
|
|
153
|
+
item.Operacion == 'NUEVA');
|
|
154
|
+
for (const debt of filtered) {
|
|
155
|
+
const companion = this.deudas.find((item) => item.RubroId == rubro[1] &&
|
|
156
|
+
item.Secuencia == debt.Secuencia);
|
|
157
|
+
if (!companion) {
|
|
158
|
+
console.log(`No se encontró companion para: ${debt.UUID}, Rubro: ${rubro[1]}`);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
let filaDetalle = {
|
|
162
|
+
id: 'ACT_DEU_76003',
|
|
163
|
+
grupo: debt.UUID,
|
|
164
|
+
descripction: debt.Descripcion
|
|
165
|
+
};
|
|
166
|
+
this.addMontos(filaDetalle);
|
|
167
|
+
for (let i = 1; i <= this.cantidadProyeccion; i++) {
|
|
168
|
+
if (i == 1 ||
|
|
169
|
+
(i > 1 &&
|
|
170
|
+
parseFloat(debt[`Monto${i - 1}`]?.value || 0) +
|
|
171
|
+
parseFloat(companion[`Monto${i - 1}`]?.value || 0) ==
|
|
172
|
+
0)) {
|
|
173
|
+
filaDetalle[`Monto${i}`] =
|
|
174
|
+
parseFloat(debt[`Monto${i}`]?.value || 0) +
|
|
175
|
+
parseFloat(companion[`Monto${i}`]?.value || 0);
|
|
176
|
+
filaDetalle[`Monto${i}`] = Math.round(parseFloat(filaDetalle[`Monto${i}`] || 0));
|
|
177
|
+
}
|
|
178
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`] || 0;
|
|
179
|
+
}
|
|
180
|
+
filasDetalle.push(filaDetalle);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
147
184
|
}
|
|
148
|
-
|
|
149
|
-
|
|
185
|
+
generateOtros() {
|
|
186
|
+
const filaTotales = {
|
|
187
|
+
id: 'ACT_DEU_76004',
|
|
188
|
+
grupo: 'TOTAL',
|
|
189
|
+
descripction: 'OTROS - Pagares, Bonos, Etc.'
|
|
190
|
+
};
|
|
191
|
+
this.addMontos(filaTotales);
|
|
192
|
+
const filasDetalle = [];
|
|
193
|
+
const rubros = [['ACT_DEU_10001', 'ACT_DEU_10002']];
|
|
194
|
+
for (let rubro of rubros) {
|
|
195
|
+
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0] &&
|
|
196
|
+
item.Destino == 'OTROS' &&
|
|
197
|
+
item.Operacion == 'NUEVA');
|
|
198
|
+
for (const debt of filtered) {
|
|
199
|
+
const companion = this.deudas.find((item) => item.RubroId == rubro[1] &&
|
|
200
|
+
item.Secuencia == debt.Secuencia);
|
|
201
|
+
if (!companion) {
|
|
202
|
+
console.log(`No se encontró companion para: ${debt.UUID}, Rubro: ${rubro[1]}`);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
let filaDetalle = {
|
|
206
|
+
id: 'ACT_DEU_76004',
|
|
207
|
+
grupo: debt.UUID,
|
|
208
|
+
descripction: debt.Descripcion
|
|
209
|
+
};
|
|
210
|
+
this.addMontos(filaDetalle);
|
|
211
|
+
for (let i = 1; i <= this.cantidadProyeccion; i++) {
|
|
212
|
+
if (i == 1 ||
|
|
213
|
+
(i > 1 &&
|
|
214
|
+
parseFloat(debt[`Monto${i - 1}`]?.value || 0) +
|
|
215
|
+
parseFloat(companion[`Monto${i - 1}`]?.value || 0) ==
|
|
216
|
+
0)) {
|
|
217
|
+
filaDetalle[`Monto${i}`] =
|
|
218
|
+
parseFloat(debt[`Monto${i}`]?.value || 0) +
|
|
219
|
+
parseFloat(companion[`Monto${i}`]?.value || 0);
|
|
220
|
+
filaDetalle[`Monto${i}`] = Math.round(parseFloat(filaDetalle[`Monto${i}`] || 0));
|
|
221
|
+
}
|
|
222
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`] || 0;
|
|
223
|
+
}
|
|
224
|
+
filasDetalle.push(filaDetalle);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
150
228
|
}
|
|
151
|
-
|
|
152
|
-
|
|
229
|
+
generateKILeasingFinanciero() {
|
|
230
|
+
const filaTotales = {
|
|
231
|
+
id: 'ACT_DEU_76005',
|
|
232
|
+
grupo: 'TOTAL',
|
|
233
|
+
descripction: 'KI - Leasing Financiero'
|
|
234
|
+
};
|
|
235
|
+
this.addMontos(filaTotales);
|
|
236
|
+
const filasDetalle = [];
|
|
237
|
+
// Procesar leasing financiero (similar a tu método caculate005)
|
|
238
|
+
const rubros = [['ACT_DEU_30001', 'ACT_DEU_30002']];
|
|
239
|
+
for (let rubro of rubros) {
|
|
240
|
+
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0] &&
|
|
241
|
+
item.Destino == 'KI' &&
|
|
242
|
+
item.Operacion == 'NUEVA');
|
|
243
|
+
for (const debt of filtered) {
|
|
244
|
+
const companion = this.deudas.find((item) => item.RubroId == rubro[1] &&
|
|
245
|
+
item.Secuencia == debt.Secuencia);
|
|
246
|
+
if (!companion) {
|
|
247
|
+
console.log(`No se encontró companion para: ${debt.UUID}, Rubro: ${rubro[1]}`);
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
let filaDetalle = {
|
|
251
|
+
id: 'ACT_DEU_76005',
|
|
252
|
+
grupo: debt.UUID,
|
|
253
|
+
descripction: debt.Descripcion
|
|
254
|
+
};
|
|
255
|
+
this.addMontos(filaDetalle);
|
|
256
|
+
for (let i = 1; i <= this.cantidadProyeccion; i++) {
|
|
257
|
+
if (i == 1 ||
|
|
258
|
+
(i > 1 &&
|
|
259
|
+
parseFloat(debt[`Monto${i - 1}`]?.value || 0) +
|
|
260
|
+
parseFloat(companion[`Monto${i - 1}`]?.value || 0) ==
|
|
261
|
+
0)) {
|
|
262
|
+
filaDetalle[`Monto${i}`] =
|
|
263
|
+
parseFloat(debt[`Monto${i}`]?.value || 0) +
|
|
264
|
+
parseFloat(companion[`Monto${i}`]?.value || 0);
|
|
265
|
+
filaDetalle[`Monto${i}`] = Math.round(parseFloat(filaDetalle[`Monto${i}`] || 0));
|
|
266
|
+
}
|
|
267
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`] || 0;
|
|
268
|
+
}
|
|
269
|
+
filasDetalle.push(filaDetalle);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
153
273
|
}
|
|
154
|
-
|
|
155
|
-
|
|
274
|
+
generateKIKOLineasMixtas() {
|
|
275
|
+
const filaTotales = {
|
|
276
|
+
id: 'ACT_DEU_76006',
|
|
277
|
+
grupo: 'TOTAL',
|
|
278
|
+
descripction: 'KI - KO - Línea de Crédito Mixta'
|
|
279
|
+
};
|
|
280
|
+
this.addMontos(filaTotales);
|
|
281
|
+
const filasDetalle = [];
|
|
282
|
+
// Procesar líneas mixtas (similar a tu método caculate006)
|
|
156
283
|
const rubros = [
|
|
157
284
|
['ACT_DEU_41001', 'ACT_DEU_41002'],
|
|
158
285
|
['ACT_DEU_20001', 'ACT_DEU_20002']
|
|
159
286
|
];
|
|
160
|
-
for (let rubro
|
|
161
|
-
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0]);
|
|
287
|
+
for (let rubro of rubros) {
|
|
288
|
+
const filtered = this.deudas.filter((item) => item.RubroId == rubro[0] && item.Operacion == 'NUEVA');
|
|
162
289
|
for (const debt of filtered) {
|
|
163
290
|
const companion = this.deudas.find((item) => item.RubroId == rubro[1] &&
|
|
164
|
-
item.Secuencia == debt.Secuencia
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
291
|
+
item.Secuencia == debt.Secuencia);
|
|
292
|
+
if (!companion) {
|
|
293
|
+
console.log(`No se encontró companion para: ${debt.UUID}, Rubro: ${rubro[1]}`);
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
let filaDetalle = {
|
|
297
|
+
id: 'ACT_DEU_76006',
|
|
298
|
+
grupo: debt.UUID,
|
|
299
|
+
descripction: debt.Descripcion
|
|
300
|
+
};
|
|
301
|
+
this.addMontos(filaDetalle);
|
|
170
302
|
for (let i = 1; i <= this.cantidadProyeccion; i++) {
|
|
171
303
|
if (i == 1) {
|
|
172
|
-
|
|
173
|
-
parseFloat(debt[`Monto${i}`]) +
|
|
174
|
-
parseFloat(companion[`Monto${i}`]);
|
|
304
|
+
filaDetalle[`Monto${i}`] =
|
|
305
|
+
parseFloat(debt[`Monto${i}`]?.value || 0) +
|
|
306
|
+
parseFloat(companion[`Monto${i}`]?.value || 0);
|
|
175
307
|
}
|
|
176
308
|
if (i > 1) {
|
|
177
|
-
|
|
178
|
-
parseFloat(companion[`Monto${i}`]) -
|
|
179
|
-
parseFloat(companion[`Monto${i - 1}`]) +
|
|
180
|
-
parseFloat(debt[`Monto${i}`]);
|
|
309
|
+
filaDetalle[`Monto${i}`] =
|
|
310
|
+
parseFloat(companion[`Monto${i}`]?.value || 0) -
|
|
311
|
+
parseFloat(companion[`Monto${i - 1}`]?.value || 0) +
|
|
312
|
+
parseFloat(debt[`Monto${i}`]?.value || 0);
|
|
181
313
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
nuevo[`Monto${i}`] = Math.round(parseFloat(nuevo[`Monto${i}`]));
|
|
185
|
-
row[`Monto${i}`] += nuevo[`Monto${i}`];
|
|
314
|
+
filaDetalle[`Monto${i}`] = Math.round(parseFloat(filaDetalle[`Monto${i}`] || 0));
|
|
315
|
+
filaTotales[`Monto${i}`] += filaDetalle[`Monto${i}`] || 0;
|
|
186
316
|
}
|
|
317
|
+
filasDetalle.push(filaDetalle);
|
|
187
318
|
}
|
|
188
319
|
}
|
|
189
|
-
|
|
190
|
-
|
|
320
|
+
// Ajuste específico para líneas mixtas
|
|
321
|
+
if (this.proyecta) {
|
|
322
|
+
filaTotales.Monto1 = filaTotales.Monto1 - this.calculoAuxiliar2;
|
|
323
|
+
}
|
|
324
|
+
this.result.push(...filasDetalle, filaTotales);
|
|
191
325
|
}
|
|
192
326
|
}
|
|
193
327
|
exports.default = AplicacionesCuadroAlternativo;
|
|
@@ -64,7 +64,6 @@ class DeudasStrategy {
|
|
|
64
64
|
let rows1 = this.data.Deudas.filter((item) => item.RubroId == params.rubro1);
|
|
65
65
|
let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == 1);
|
|
66
66
|
let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == 1);
|
|
67
|
-
//sumarizando
|
|
68
67
|
let row1 = rows1.reduce((sum, item) => {
|
|
69
68
|
if (!sum)
|
|
70
69
|
sum = { ...item };
|
|
@@ -77,6 +76,15 @@ class DeudasStrategy {
|
|
|
77
76
|
}
|
|
78
77
|
return sum;
|
|
79
78
|
}, null);
|
|
79
|
+
let totalCortoPlazoBLKO = 0;
|
|
80
|
+
if (this.data.CalculosAuxiliares && this.data.CalculosAuxiliares['1']) {
|
|
81
|
+
totalCortoPlazoBLKO = this.cleanNumber(this.data.CalculosAuxiliares['1'].TotalCortoPlazoBLKO);
|
|
82
|
+
}
|
|
83
|
+
if (row3[`Monto1`] == 0) {
|
|
84
|
+
row3[`Monto1`] =
|
|
85
|
+
(totalCortoPlazoBLKO * this.cleanNumber(row2[`Monto1`])) / 100;
|
|
86
|
+
row3[`Monto1`] = Math.round(row3[`Monto1`]);
|
|
87
|
+
}
|
|
80
88
|
for (let j = 2; j <= this.data.CantidadProyeccion; j++) {
|
|
81
89
|
if (row3[`Monto${j}`] == 0) {
|
|
82
90
|
row3[`Monto${j}`] =
|
|
@@ -110,25 +118,69 @@ class DeudasStrategy {
|
|
|
110
118
|
// }, null)
|
|
111
119
|
// return destino
|
|
112
120
|
// }
|
|
121
|
+
// sumarizador(params: any) {
|
|
122
|
+
// let destino = this.data.Deudas.find(
|
|
123
|
+
// (item: any) => item.RubroId == params.rubro2
|
|
124
|
+
// )
|
|
125
|
+
// this.data.Deudas.filter(
|
|
126
|
+
// (item: any) => item.RubroId == params.rubro1
|
|
127
|
+
// ).reduce((sum: any, item: any) => {
|
|
128
|
+
// console.log('SUM', sum)
|
|
129
|
+
// console.log('ITEM', item)
|
|
130
|
+
// if (!sum) {
|
|
131
|
+
// sum = { ...item }
|
|
132
|
+
// for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
133
|
+
// sum[`Monto${i}`] = this.cleanNumber(
|
|
134
|
+
// sum[`Monto${i}`]?.value ?? sum[`Monto${i}`]
|
|
135
|
+
// )
|
|
136
|
+
// }
|
|
137
|
+
// } else {
|
|
138
|
+
// for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
139
|
+
// const getVal = (m: any) => this.cleanNumber(m?.value ?? m)
|
|
140
|
+
// sum[`Monto${i}`] =
|
|
141
|
+
// getVal(sum[`Monto${i}`]) + getVal(item[`Monto${i}`])
|
|
142
|
+
// destino[`Monto${i}`] = sum[`Monto${i}`]
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
145
|
+
// return sum
|
|
146
|
+
// }, null)
|
|
147
|
+
// return destino
|
|
148
|
+
// }
|
|
113
149
|
sumarizador(params) {
|
|
114
150
|
let destino = this.data.Deudas.find((item) => item.RubroId == params.rubro2);
|
|
115
|
-
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
151
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
152
|
+
if (destino[`Monto${i}`] &&
|
|
153
|
+
typeof destino[`Monto${i}`] === 'object') {
|
|
154
|
+
destino[`Monto${i}`].value = 0;
|
|
155
|
+
destino[`Monto${i}`].isCalculated = true;
|
|
121
156
|
}
|
|
122
157
|
else {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
158
|
+
destino[`Monto${i}`] = 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const rubrosASumar = this.data.Deudas.filter((item) => item.RubroId == params.rubro1);
|
|
162
|
+
rubrosASumar.forEach((item) => {
|
|
163
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
164
|
+
let valorItem;
|
|
165
|
+
if (item[`Monto${i}`] &&
|
|
166
|
+
typeof item[`Monto${i}`] === 'object') {
|
|
167
|
+
valorItem = this.cleanNumber(item[`Monto${i}`].value ?? 0);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
valorItem = this.cleanNumber(item[`Monto${i}`] ?? 0);
|
|
171
|
+
}
|
|
172
|
+
if (destino[`Monto${i}`] &&
|
|
173
|
+
typeof destino[`Monto${i}`] === 'object') {
|
|
174
|
+
const valorActual = this.cleanNumber(destino[`Monto${i}`].value ?? 0);
|
|
175
|
+
destino[`Monto${i}`].value = valorActual + valorItem;
|
|
176
|
+
destino[`Monto${i}`].isCalculated = true;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
const valorActual = this.cleanNumber(destino[`Monto${i}`] ?? 0);
|
|
180
|
+
destino[`Monto${i}`] = valorActual + valorItem;
|
|
128
181
|
}
|
|
129
182
|
}
|
|
130
|
-
|
|
131
|
-
}, null);
|
|
183
|
+
});
|
|
132
184
|
return destino;
|
|
133
185
|
}
|
|
134
186
|
execute(data) {
|
|
@@ -230,7 +230,7 @@ class ResumenFinanciamiento {
|
|
|
230
230
|
'ACT_DEU_75202',
|
|
231
231
|
'ACT_DEU_75203',
|
|
232
232
|
'ACT_DEU_75204'
|
|
233
|
-
].includes(item.
|
|
233
|
+
].includes(item.id));
|
|
234
234
|
this.generateFilter(row, filter);
|
|
235
235
|
}
|
|
236
236
|
generateLeasingCP(row) {
|
|
@@ -258,7 +258,7 @@ class ResumenFinanciamiento {
|
|
|
258
258
|
'ACT_DEU_75101',
|
|
259
259
|
'ACT_DEU_75102',
|
|
260
260
|
'ACT_DEU_75103',
|
|
261
|
-
'
|
|
261
|
+
'ACT_DEU_75301'
|
|
262
262
|
].includes(item.id));
|
|
263
263
|
this.generateFilter(row, filter);
|
|
264
264
|
}
|
|
@@ -130,6 +130,15 @@ const addGastosM = (actividad, data) => {
|
|
|
130
130
|
data.FlujoProyectadoMensual.push(row);
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
+
const obtenerValorPorMes = (objeto, mes) => {
|
|
134
|
+
const patrones = [`C-${mes}`, `Gestion${mes}`, `Monto${mes}`, `Valor${mes}`];
|
|
135
|
+
for (const patron of patrones) {
|
|
136
|
+
if (objeto[patron] !== undefined && objeto[patron] !== null) {
|
|
137
|
+
return Math.round(parseFloat(objeto[patron]) || 0);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return 0;
|
|
141
|
+
};
|
|
133
142
|
const otrosIngresoM = (actividad, data) => {
|
|
134
143
|
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_OTROS_INGRESOS}_0`);
|
|
135
144
|
const otrosIngresos = actividad.Ventas.OtrosIngresos;
|
|
@@ -151,10 +160,11 @@ const otrosIngresoM = (actividad, data) => {
|
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
else {
|
|
163
|
+
const ingreso = otrosIngresos[0];
|
|
154
164
|
for (let i = 1; i <= 12; i++) {
|
|
155
165
|
// row[`Monto${i}`] =
|
|
156
166
|
// Math.round(parseFloat(otrosIngresos[`C-${i}`]) * 100) / 100
|
|
157
|
-
row[`Monto${i}`] =
|
|
167
|
+
row[`Monto${i}`] = obtenerValorPorMes(ingreso, i);
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
170
|
const existente = data.FlujoProyectadoMensual.findIndex((el) => el.UUID === row.UUID);
|