bdpformulas 1.0.48 → 1.0.50
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/context.js +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +3 -1
- package/build/models/eeff/admFinanciera/index.d.ts +144 -0
- package/build/models/eeff/admFinanciera/index.js +26 -0
- package/build/strategies/agriculture/balanceAgr.strategy.js +1 -0
- package/build/strategies/agriculture/costos.detail/costosCalc.js +1 -1
- package/build/strategies/agriculture/flujoProyAgr.strategy.js +3 -2
- package/build/strategies/agriculture/ventas.detail/ventas.calc.js +2 -1
- package/build/strategies/analisisFinancieros.strategy.js +20 -22
- package/build/strategies/balance.strategy.js +14 -2
- package/build/strategies/common/analisisFinCalculos/analisisGrafico.calc.js +47 -45
- package/build/strategies/common/analisisFinCalculos/ratios.calc.js +158 -157
- package/build/strategies/common/balance.calc.js +3 -1
- package/build/strategies/common/balanceCalculos/balanceAux.calc.js +11 -1
- package/build/strategies/common/balanceCalculos/flujoAux.calc.js +2 -11
- package/build/strategies/common/flujoCalculos/flujoConstructor.js +313 -308
- package/build/strategies/eeff/admFinanciera/amortizaciones.d.ts +8 -0
- package/build/strategies/eeff/admFinanciera/amortizaciones.js +31 -0
- package/build/strategies/eeff/admFinanciera/aplicacionesHandler.d.ts +16 -0
- package/build/strategies/eeff/admFinanciera/aplicacionesHandler.js +175 -0
- package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.d.ts +7 -0
- package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.js +40 -0
- package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.d.ts +13 -0
- package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.js +75 -0
- package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.d.ts +26 -0
- package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.js +267 -0
- package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.d.ts +20 -0
- package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.js +162 -0
- package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.d.ts +27 -0
- package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.js +219 -0
- package/build/strategies/eeff/admFinanciera/utils.d.ts +96 -0
- package/build/strategies/eeff/admFinanciera/utils.js +209 -0
- package/build/strategies/eeff/admFinanciera.strategy.d.ts +14 -0
- package/build/strategies/eeff/admFinanciera.strategy.js +139 -0
- package/build/strategies/eeff/balanceEEFF.strategy.js +3 -2
- package/build/strategies/eeff/flujoProyEEFF.strategy.js +3 -2
- package/build/strategies/general/balanceGeneral.strategy.js +2 -1
- package/build/strategies/general/flujoProyGeneral.strategy.js +2 -1
- package/build/strategies/pecuary/balancePec.strategy.js +7 -6
- package/build/strategies/pecuary/desarrollo.detail/desarrolloCalc.js +11 -3
- package/build/strategies/pecuary/desarrollo.strategy.js +2 -2
- package/build/strategies/pecuary/flujoProyPec.strategy.js +7 -6
- package/build/strategies/pecuary/ventas.detail/estacionalidadCalc.js +7 -1
- package/build/strategies/pecuary/ventas.detail/ventasIngresosCalc.js +7 -1
- package/build/strategies/production/balancePrd.strategy.js +7 -6
- package/build/strategies/production/costos.detail/costosCalc.js +1 -1
- package/build/strategies/production/flujoProyPrd.strategy.js +7 -6
- package/package.json +26 -21
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AdministracionFinancieraData, PrestamoLeasing } from "../../../models/eeff/admFinanciera";
|
|
2
|
+
interface HandlerData {
|
|
3
|
+
data: AdministracionFinancieraData;
|
|
4
|
+
prestamo: Partial<PrestamoLeasing>;
|
|
5
|
+
}
|
|
6
|
+
export declare class PrestamoLeasingHandler {
|
|
7
|
+
private data;
|
|
8
|
+
private prestamo;
|
|
9
|
+
constructor({ data, prestamo }: HandlerData);
|
|
10
|
+
handle(): Partial<PrestamoLeasing>;
|
|
11
|
+
private setTasa;
|
|
12
|
+
private setAuxiliares;
|
|
13
|
+
private setPlazo;
|
|
14
|
+
private setPlazoMultiplicado;
|
|
15
|
+
private setAmortizacionCapital;
|
|
16
|
+
private getGeneracionValorResidual;
|
|
17
|
+
private setPorcionesCorrientesNoCorrientes;
|
|
18
|
+
private setActivacionOperacion;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrestamoLeasingHandler = void 0;
|
|
4
|
+
const admFinanciera_1 = require("../../../models/eeff/admFinanciera");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const frecuencias = {
|
|
7
|
+
MENSUAL: 12,
|
|
8
|
+
BIMENSUAL: 6,
|
|
9
|
+
TRIMESTRAL: 4,
|
|
10
|
+
CUATRIMESTRAL: 3,
|
|
11
|
+
SEMESTRAL: 2,
|
|
12
|
+
ANUAL: 1,
|
|
13
|
+
};
|
|
14
|
+
class PrestamoLeasingHandler {
|
|
15
|
+
data;
|
|
16
|
+
prestamo;
|
|
17
|
+
constructor({ data, prestamo }) {
|
|
18
|
+
this.data = data;
|
|
19
|
+
this.prestamo = prestamo;
|
|
20
|
+
}
|
|
21
|
+
handle() {
|
|
22
|
+
this.setTasa();
|
|
23
|
+
this.setAuxiliares();
|
|
24
|
+
this.setActivacionOperacion();
|
|
25
|
+
this.setPorcionesCorrientesNoCorrientes();
|
|
26
|
+
return this.prestamo;
|
|
27
|
+
}
|
|
28
|
+
setTasa() {
|
|
29
|
+
if (this.prestamo.MontoOriginal && this.prestamo.TipoAmortizacion) {
|
|
30
|
+
const meses = frecuencias[this.prestamo.TipoAmortizacion];
|
|
31
|
+
const tasa = (0, utils_1.calcularTasaInteres)({
|
|
32
|
+
meses: (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * meses,
|
|
33
|
+
montoCuota: -(0, utils_1.ourParseFloat)(this.prestamo.MontoCuotaPeriodo),
|
|
34
|
+
montoOriginal: (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal)
|
|
35
|
+
});
|
|
36
|
+
this.prestamo.Tasa = (0, utils_1.ourParseFloat)(tasa, false) * 100 * meses;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
setAuxiliares() {
|
|
40
|
+
this.prestamo.Plazos = {};
|
|
41
|
+
this.prestamo.PlazosMultiplicados = {};
|
|
42
|
+
this.prestamo.AmortizacionesCapital = {};
|
|
43
|
+
this.prestamo.AmortizacionesCapitalFinal = {};
|
|
44
|
+
this.prestamo.AmortizacionesInteres = {};
|
|
45
|
+
this.prestamo.PorcionesNoCorrientes = {};
|
|
46
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
47
|
+
// plazos
|
|
48
|
+
this.setPlazo(i);
|
|
49
|
+
// plazos multiplicados
|
|
50
|
+
this.setPlazoMultiplicado(i);
|
|
51
|
+
//amortizacion capital
|
|
52
|
+
this.setAmortizacionCapital(i);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
setPlazo(gestion) {
|
|
56
|
+
if (this.prestamo.AnnoProyectadoInicio && this.prestamo.Plazo) {
|
|
57
|
+
if (gestion >= this.prestamo.AnnoProyectadoInicio) {
|
|
58
|
+
if (gestion == this.prestamo.AnnoProyectadoInicio) {
|
|
59
|
+
this.prestamo.Plazos[`Gestion${gestion}`] = this.prestamo.Plazo;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const anterior = (0, utils_1.ourParseFloat)(this.prestamo.Plazos?.[`Gestion${gestion - 1}`]);
|
|
63
|
+
if (anterior > 1) {
|
|
64
|
+
this.prestamo.Plazos[`Gestion${gestion}`] = anterior - 1;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
setPlazoMultiplicado(gestion) {
|
|
71
|
+
let value = 0;
|
|
72
|
+
if (this.prestamo.AnnoProyectadoInicio) {
|
|
73
|
+
const frecuencia = frecuencias[this.prestamo.TipoAmortizacion];
|
|
74
|
+
if (this.prestamo.AnnoProyectadoInicio == gestion) {
|
|
75
|
+
value = frecuencia;
|
|
76
|
+
}
|
|
77
|
+
else if (this.prestamo.AnnoProyectadoInicio <= gestion) {
|
|
78
|
+
value = (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + frecuencia;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this.prestamo.PlazosMultiplicados[`Gestion${gestion}`] = value;
|
|
82
|
+
}
|
|
83
|
+
setAmortizacionCapital(gestion) {
|
|
84
|
+
const plazo = this.prestamo.Plazos[`Gestion${gestion}`];
|
|
85
|
+
let value;
|
|
86
|
+
if (plazo && this.prestamo.TipoAmortizacion) {
|
|
87
|
+
const frecuencia = frecuencias[this.prestamo.TipoAmortizacion];
|
|
88
|
+
const tasaPeriodica = (0, utils_1.ourParseFloat)(this.prestamo.Tasa) / 100 / frecuencia;
|
|
89
|
+
const numeroPagos = (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * frecuencia;
|
|
90
|
+
const montoPrestamo = (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal);
|
|
91
|
+
let periodoInicial = 1;
|
|
92
|
+
const periodoFinal = (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion}`]);
|
|
93
|
+
const añoProyectadoInicio = (0, utils_1.ourParseFloat)(this.prestamo.AnnoProyectadoInicio);
|
|
94
|
+
let valueInteres;
|
|
95
|
+
if (añoProyectadoInicio > gestion) {
|
|
96
|
+
value = 0;
|
|
97
|
+
valueInteres = 0;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (añoProyectadoInicio < gestion) {
|
|
101
|
+
periodoInicial = (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + 1;
|
|
102
|
+
}
|
|
103
|
+
value = (0, utils_1.calcularPagoPrincipalEntre)({
|
|
104
|
+
tasaPeriodica,
|
|
105
|
+
numeroPagos,
|
|
106
|
+
montoPrestamo,
|
|
107
|
+
periodoInicial,
|
|
108
|
+
periodoFinal
|
|
109
|
+
});
|
|
110
|
+
valueInteres = (0, utils_1.calcularPagoInteresEntre)({
|
|
111
|
+
tasaPeriodica,
|
|
112
|
+
numeroPagos,
|
|
113
|
+
montoPrestamo,
|
|
114
|
+
periodoInicial,
|
|
115
|
+
periodoFinal
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
this.prestamo.AmortizacionesCapital[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(value);
|
|
119
|
+
this.prestamo.AmortizacionesInteres[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(valueInteres);
|
|
120
|
+
}
|
|
121
|
+
this.prestamo.AmortizacionesCapitalFinal[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(value) + (0, utils_1.ourParseFloat)(this.getGeneracionValorResidual(gestion));
|
|
122
|
+
}
|
|
123
|
+
getGeneracionValorResidual(gestion) {
|
|
124
|
+
if ((0, utils_1.ourParseFloat)(this.prestamo.Plazos[`Gestion${gestion}`]) == 1) {
|
|
125
|
+
return this.prestamo.MontoValorResidual;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
setPorcionesCorrientesNoCorrientes() {
|
|
129
|
+
this.prestamo.PorcionesCorrientes = {};
|
|
130
|
+
this.prestamo.PorcionesNoCorrientes = {};
|
|
131
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
132
|
+
let index = i;
|
|
133
|
+
if (this.prestamo.TipoOperacion2 === admFinanciera_1.TipoOperacionExistencia.Antigua) {
|
|
134
|
+
index++;
|
|
135
|
+
}
|
|
136
|
+
const porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalFinal?.[`Gestion${index}`]) + (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesInteres?.[`Gestion${index}`]);
|
|
137
|
+
this.prestamo.PorcionesCorrientes[`Gestion${i}`] = porcionCorriente;
|
|
138
|
+
const plazo = (0, utils_1.ourParseFloat)(this.prestamo.Plazos?.[`Gestion${i}`]);
|
|
139
|
+
if (plazo && this.prestamo.TipoAmortizacion) {
|
|
140
|
+
let value;
|
|
141
|
+
const frecuencia = frecuencias[this.prestamo.TipoAmortizacion];
|
|
142
|
+
const cuotaPeriodo = (0, utils_1.ourParseFloat)(this.prestamo.MontoCuotaPeriodo);
|
|
143
|
+
const valorResidual = (0, utils_1.ourParseFloat)(this.prestamo.MontoValorResidual);
|
|
144
|
+
if (this.prestamo.TipoOperacion2 === admFinanciera_1.TipoOperacionExistencia.Antigua) {
|
|
145
|
+
if (plazo > 1) {
|
|
146
|
+
value = ((plazo - 1) * cuotaPeriodo * frecuencia + valorResidual) - porcionCorriente;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
value = (plazo * cuotaPeriodo * frecuencia + valorResidual) - porcionCorriente;
|
|
151
|
+
}
|
|
152
|
+
this.prestamo.PorcionesNoCorrientes[`Gestion${i}`] = (0, utils_1.ourParseFloat)(value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
setActivacionOperacion() {
|
|
157
|
+
if (this.prestamo.TipoOperacion2 === admFinanciera_1.TipoOperacionExistencia.Nueva) {
|
|
158
|
+
this.prestamo.ActivacionOperacion = (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) + (0, utils_1.ourParseFloat)(this.prestamo.MontoAporteInicial) + (0, utils_1.ourParseFloat)(this.prestamo.MontoValorResidual);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.PrestamoLeasingHandler = PrestamoLeasingHandler;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AdministracionFinancieraCalcData, ProyeccionPrestamo } from "../../../models/eeff/admFinanciera";
|
|
2
|
+
interface AplicacionesData {
|
|
3
|
+
data: AdministracionFinancieraCalcData;
|
|
4
|
+
}
|
|
5
|
+
export declare class ProyeccionPrestamosDirectosHandler {
|
|
6
|
+
private data;
|
|
7
|
+
private proyeccion;
|
|
8
|
+
constructor({ data }: AplicacionesData);
|
|
9
|
+
handle(): Partial<ProyeccionPrestamo>[];
|
|
10
|
+
private setProyecciones;
|
|
11
|
+
private setKOPorcionCPBDP;
|
|
12
|
+
private setKIPorcionCPBDP;
|
|
13
|
+
private setKOPorcionCPOtras;
|
|
14
|
+
private setKIPorcionCPOtras;
|
|
15
|
+
private setOtrasPorcionCPOtras;
|
|
16
|
+
private setLCMixtaBDP;
|
|
17
|
+
private setLCMixtaOtras;
|
|
18
|
+
private setInteresesLineasMixtas;
|
|
19
|
+
private setPorcionLPBDP;
|
|
20
|
+
private setPorcionLPOtras;
|
|
21
|
+
private setLeasingCP;
|
|
22
|
+
private setLeasingLP;
|
|
23
|
+
private setInteresLeasing;
|
|
24
|
+
private setInteresesPrestamosDirectos;
|
|
25
|
+
private setInteresesLineaKO;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProyeccionPrestamosDirectosHandler = void 0;
|
|
4
|
+
const admFinanciera_1 = require("../../../models/eeff/admFinanciera");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const filas = {
|
|
7
|
+
'KO - Porción CP - BDP SAM': 0,
|
|
8
|
+
'KI - Porción CP - BDP SAM': 1,
|
|
9
|
+
'L/C Mixta - Porción CP - BDP SAM': 2,
|
|
10
|
+
'Porción LP - BDP SAM': 3,
|
|
11
|
+
'KO - Porción CP - Otras EIFs': 4,
|
|
12
|
+
'KI - Porción CP - Otras EIFs': 5,
|
|
13
|
+
'Otros - Porción CP - Otras EIFs': 6,
|
|
14
|
+
'L/C Mixta - Porción CP - Otras EIFs': 7,
|
|
15
|
+
'Porción LP - Otras EIFs': 8,
|
|
16
|
+
'Intereses y Comisiones - Prestamos Directos': 9,
|
|
17
|
+
'Intereses y Comisiones - Linea de Credito 100% KO': 10,
|
|
18
|
+
'Intereses y Comisiones - Linea de Credito Mixta': 11,
|
|
19
|
+
'Interes - MANUAL': 12,
|
|
20
|
+
'Total Intereses (BDP y Otras EIFs)': 13,
|
|
21
|
+
'Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs': 14,
|
|
22
|
+
'Leasing LP - Otras EIFs': 15,
|
|
23
|
+
'Intereses Leasing': 16,
|
|
24
|
+
'Interes Leasing - MANUAL': 17,
|
|
25
|
+
'TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM': 18,
|
|
26
|
+
'TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs': 19,
|
|
27
|
+
'TOTAL PORCIÓN LP - BDP SAM': 20,
|
|
28
|
+
'TOTAL PORCIÓN LP - Otras EIFs': 21
|
|
29
|
+
};
|
|
30
|
+
class ProyeccionPrestamosDirectosHandler {
|
|
31
|
+
data;
|
|
32
|
+
proyeccion;
|
|
33
|
+
constructor({ data }) {
|
|
34
|
+
this.data = data;
|
|
35
|
+
const filaInteresManual = this.data.ProyeccionPrestamosDirectos.find(pr => pr.RubroId === admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesManual);
|
|
36
|
+
const filaInteresLeasingManual = this.data.ProyeccionPrestamosDirectos.find(pr => pr.RubroId === admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesLeasingManual);
|
|
37
|
+
this.proyeccion = [
|
|
38
|
+
{ Descripcion: 'KO - Porción CP - BDP SAM' },
|
|
39
|
+
{ Descripcion: 'KI - Porción CP - BDP SAM' },
|
|
40
|
+
{ Descripcion: 'L/C Mixta - Porción CP - BDP SAM' },
|
|
41
|
+
{ Descripcion: 'Porción LP - BDP SAM' },
|
|
42
|
+
{ Descripcion: 'KO - Porción CP - Otras EIFs' },
|
|
43
|
+
{ Descripcion: 'KI - Porción CP - Otras EIFs' },
|
|
44
|
+
{ Descripcion: 'Otros - Porción CP - Otras EIFs' },
|
|
45
|
+
{ Descripcion: 'L/C Mixta - Porción CP - Otras EIFs' },
|
|
46
|
+
{ Descripcion: 'Porción LP - Otras EIFs' },
|
|
47
|
+
{ Descripcion: 'Intereses y Comisiones - Prestamos Directos' },
|
|
48
|
+
{ Descripcion: 'Intereses y Comisiones - Linea de Credito 100% KO' },
|
|
49
|
+
{ Descripcion: 'Intereses y Comisiones - Linea de Credito Mixta' },
|
|
50
|
+
{ ...filaInteresManual, Descripcion: 'Interes - MANUAL', Editable: true, RubroId: admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesManual },
|
|
51
|
+
{ Descripcion: 'Total Intereses (BDP y Otras EIFs)' },
|
|
52
|
+
{ Descripcion: 'Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs' },
|
|
53
|
+
{ Descripcion: 'Leasing LP - Otras EIFs' },
|
|
54
|
+
{ Descripcion: 'Intereses Leasing' },
|
|
55
|
+
{ ...filaInteresLeasingManual, Descripcion: 'Interes Leasing - MANUAL', Editable: true, RubroId: admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesLeasingManual },
|
|
56
|
+
{ Descripcion: 'TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM' },
|
|
57
|
+
{ Descripcion: 'TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs' },
|
|
58
|
+
{ Descripcion: 'TOTAL PORCIÓN LP - BDP SAM' },
|
|
59
|
+
{ Descripcion: 'TOTAL PORCIÓN LP - Otras EIFs' }
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
handle() {
|
|
63
|
+
this.setProyecciones();
|
|
64
|
+
return this.proyeccion;
|
|
65
|
+
}
|
|
66
|
+
setProyecciones() {
|
|
67
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
68
|
+
this.setKOPorcionCPBDP(i);
|
|
69
|
+
this.setKIPorcionCPBDP(i);
|
|
70
|
+
this.setKOPorcionCPOtras(i);
|
|
71
|
+
this.setKIPorcionCPOtras(i);
|
|
72
|
+
this.setOtrasPorcionCPOtras(i);
|
|
73
|
+
this.setLCMixtaBDP(i);
|
|
74
|
+
this.setLCMixtaOtras(i);
|
|
75
|
+
this.setInteresesPrestamosDirectos(i);
|
|
76
|
+
this.setInteresesLineaKO(i);
|
|
77
|
+
this.setInteresesLineasMixtas(i);
|
|
78
|
+
this.setPorcionLPBDP(i);
|
|
79
|
+
this.setPorcionLPOtras(i);
|
|
80
|
+
this.setLeasingCP(i);
|
|
81
|
+
this.setLeasingLP(i);
|
|
82
|
+
this.setInteresLeasing(i);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
setKOPorcionCPBDP(gestion) {
|
|
86
|
+
const fila = this.proyeccion[filas["KO - Porción CP - BDP SAM"]];
|
|
87
|
+
const filaTotalesCPBDP = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM"]];
|
|
88
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter(pr => pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion && pr.EsNuestroBanco);
|
|
89
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
90
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
91
|
+
filaTotalesCPBDP[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
|
|
92
|
+
}
|
|
93
|
+
setKIPorcionCPBDP(gestion) {
|
|
94
|
+
const fila = this.proyeccion[filas["KI - Porción CP - BDP SAM"]];
|
|
95
|
+
const filaTotalesCPBDP = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM"]];
|
|
96
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter(pr => pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion && pr.EsNuestroBanco);
|
|
97
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
98
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
99
|
+
filaTotalesCPBDP[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
|
|
100
|
+
}
|
|
101
|
+
setKOPorcionCPOtras(gestion) {
|
|
102
|
+
const fila = this.proyeccion[filas["KO - Porción CP - Otras EIFs"]];
|
|
103
|
+
const filaTotalesCPOtras = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs"]];
|
|
104
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter(pr => pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion && !pr.EsNuestroBanco);
|
|
105
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
106
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
107
|
+
filaTotalesCPOtras[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
108
|
+
}
|
|
109
|
+
setKIPorcionCPOtras(gestion) {
|
|
110
|
+
const fila = this.proyeccion[filas["KI - Porción CP - Otras EIFs"]];
|
|
111
|
+
const filaTotalesCPOtras = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs"]];
|
|
112
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter(pr => pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion && !pr.EsNuestroBanco);
|
|
113
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
114
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
115
|
+
filaTotalesCPOtras[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
116
|
+
}
|
|
117
|
+
setOtrasPorcionCPOtras(gestion) {
|
|
118
|
+
const fila = this.proyeccion[filas["Otros - Porción CP - Otras EIFs"]];
|
|
119
|
+
const filaTotalesCPOtras = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs"]];
|
|
120
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter(pr => pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.Otros && !pr.EsNuestroBanco);
|
|
121
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
122
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
123
|
+
filaTotalesCPOtras[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
124
|
+
}
|
|
125
|
+
setLCMixtaBDP(gestion) {
|
|
126
|
+
const totalVencimiento = this.data.LineasMixtasBDP.find(lin => lin.Clasificador === 'T' && lin.RubroId === admFinanciera_1.rubros.lineasMixtas.vencimientoCorrienteLargoPlazo);
|
|
127
|
+
const filaTotalesCPBDP = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM"]];
|
|
128
|
+
if (totalVencimiento) {
|
|
129
|
+
const fila = this.proyeccion[filas["L/C Mixta - Porción CP - BDP SAM"]];
|
|
130
|
+
const valor = (0, utils_1.ourParseFloat)(totalVencimiento[`Gestion${gestion}`]);
|
|
131
|
+
fila[`Gestion${gestion}`] = valor;
|
|
132
|
+
filaTotalesCPBDP[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + valor;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
setLCMixtaOtras(gestion) {
|
|
136
|
+
const totalVencimiento = this.data.LineasMixtasOtros.find(lin => lin.Clasificador === 'T' && lin.RubroId === admFinanciera_1.rubros.lineasMixtas.vencimientoCorrienteLargoPlazo);
|
|
137
|
+
const filaTotalesCPOtras = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs"]];
|
|
138
|
+
if (totalVencimiento) {
|
|
139
|
+
const fila = this.proyeccion[filas["L/C Mixta - Porción CP - Otras EIFs"]];
|
|
140
|
+
const valor = (0, utils_1.ourParseFloat)(totalVencimiento[`Gestion${gestion}`]);
|
|
141
|
+
fila[`Gestion${gestion}`] = valor;
|
|
142
|
+
filaTotalesCPOtras[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + valor;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
setInteresesLineasMixtas(gestion) {
|
|
146
|
+
const totalGastos = this.data.LineasMixtasOtros.find(lin => lin.Clasificador === 'T' && lin.RubroId === admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones);
|
|
147
|
+
const filaTotales = this.proyeccion[filas["Total Intereses (BDP y Otras EIFs)"]];
|
|
148
|
+
const filaInteresesManuales = this.proyeccion[filas["Interes - MANUAL"]];
|
|
149
|
+
if (totalGastos) {
|
|
150
|
+
const fila = this.proyeccion[filas["Intereses y Comisiones - Linea de Credito Mixta"]];
|
|
151
|
+
const valor = (0, utils_1.ourParseFloat)(totalGastos[`Gestion${gestion}`]);
|
|
152
|
+
fila[`Gestion${gestion}`] = valor;
|
|
153
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor + (0, utils_1.ourParseFloat)(filaInteresesManuales[`Gestion${gestion}`]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
setPorcionLPBDP(gestion) {
|
|
157
|
+
const fila = this.proyeccion[filas["Porción LP - BDP SAM"]];
|
|
158
|
+
const porcionesNoCorrientes = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.filter(p => p.EsNuestroBanco)
|
|
159
|
+
.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]), 0));
|
|
160
|
+
const totalDeudaFinancieraLineas = this.data.LineasMixtasBDP.find(lin => lin.Clasificador === 'T' && lin.RubroId === admFinanciera_1.rubros.lineasMixtas.deudaFinancieraLargoPlazo);
|
|
161
|
+
const total = porcionesNoCorrientes + (0, utils_1.ourParseFloat)(totalDeudaFinancieraLineas?.[`Gestion${gestion}`]);
|
|
162
|
+
fila[`Gestion${gestion}`] = total;
|
|
163
|
+
this.proyeccion[filas["TOTAL PORCIÓN LP - BDP SAM"]][`Gestion${gestion}`] = total;
|
|
164
|
+
}
|
|
165
|
+
setPorcionLPOtras(gestion) {
|
|
166
|
+
const fila = this.proyeccion[filas["Porción LP - Otras EIFs"]];
|
|
167
|
+
const filaTotales = this.proyeccion[filas["TOTAL PORCIÓN LP - Otras EIFs"]];
|
|
168
|
+
const porcionesNoCorrientes = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.filter(p => !p.EsNuestroBanco)
|
|
169
|
+
.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]), 0));
|
|
170
|
+
const totalDeudaFinancieraLineas = this.data.LineasMixtasOtros.find(lin => lin.Clasificador === 'T' && lin.RubroId === admFinanciera_1.rubros.lineasMixtas.deudaFinancieraLargoPlazo);
|
|
171
|
+
const total = porcionesNoCorrientes + (0, utils_1.ourParseFloat)(totalDeudaFinancieraLineas?.[`Gestion${gestion}`]);
|
|
172
|
+
fila[`Gestion${gestion}`] = total;
|
|
173
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + total;
|
|
174
|
+
}
|
|
175
|
+
setLeasingCP(gestion) {
|
|
176
|
+
const fila = this.proyeccion[filas["Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs"]];
|
|
177
|
+
const filaTotales = this.proyeccion[filas["TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs"]];
|
|
178
|
+
const valor = (0, utils_1.ourParseFloat)(this.data.PrestamoLeasing.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.PorcionesCorrientes?.[`Gestion${gestion}`]), 0));
|
|
179
|
+
fila[`Gestion${gestion}`] = valor;
|
|
180
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
181
|
+
}
|
|
182
|
+
setLeasingLP(gestion) {
|
|
183
|
+
const fila = this.proyeccion[filas["Leasing LP - Otras EIFs"]];
|
|
184
|
+
const filaTotales = this.proyeccion[filas["TOTAL PORCIÓN LP - Otras EIFs"]];
|
|
185
|
+
const valor = (0, utils_1.ourParseFloat)(this.data.PrestamoLeasing.reduce((acc, curr) => {
|
|
186
|
+
const value = (0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]);
|
|
187
|
+
return acc + (value > 0 ? value : 0);
|
|
188
|
+
}, 0));
|
|
189
|
+
fila[`Gestion${gestion}`] = valor;
|
|
190
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
191
|
+
}
|
|
192
|
+
setInteresLeasing(gestion) {
|
|
193
|
+
if (gestion > 1) {
|
|
194
|
+
const fila = this.proyeccion[filas["Intereses Leasing"]];
|
|
195
|
+
fila[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(this.data.PrestamoLeasing.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesInteres?.[`Gestion${gestion - 1}`]), 0));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
setInteresesPrestamosDirectos(gestion) {
|
|
199
|
+
const filaTotales = this.proyeccion[filas["Total Intereses (BDP y Otras EIFs)"]];
|
|
200
|
+
const fila = this.proyeccion[filas["Intereses y Comisiones - Prestamos Directos"]];
|
|
201
|
+
const totalAmortizacionesInteres = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.AmortizacionesInteres?.[`Gestion${gestion}`]), 0));
|
|
202
|
+
const totalPagoCostosFinancieros = this.data.ProyeccionPrestamosBajoLineas.find(p => p.Clasificador == 'T')?.[`Gestion${gestion}`];
|
|
203
|
+
const totalGastosFinancieroBDP = this.data.LineasMixtasBDP.find(p => p.Clasificador == 'T' && p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
|
|
204
|
+
const totalGastosFinancieroOtros = this.data.LineasMixtasOtros.find(p => p.Clasificador == 'T' && p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
|
|
205
|
+
const costosMasGastos = (0, utils_1.ourParseFloat)(totalPagoCostosFinancieros) + (0, utils_1.ourParseFloat)(totalGastosFinancieroBDP) + (0, utils_1.ourParseFloat)(totalGastosFinancieroOtros);
|
|
206
|
+
const total = totalAmortizacionesInteres + costosMasGastos;
|
|
207
|
+
const valor = total - costosMasGastos;
|
|
208
|
+
fila[`Gestion${gestion}`] = valor;
|
|
209
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
210
|
+
}
|
|
211
|
+
setInteresesLineaKO(gestion) {
|
|
212
|
+
const fila = this.proyeccion[filas["Intereses y Comisiones - Linea de Credito 100% KO"]];
|
|
213
|
+
const filaTotales = this.proyeccion[filas["Total Intereses (BDP y Otras EIFs)"]];
|
|
214
|
+
const totalPagoCostosFinancieros = (0, utils_1.ourParseFloat)(this.data.ProyeccionPrestamosBajoLineas.find(p => p.Clasificador == 'T')?.[`Gestion${gestion}`]);
|
|
215
|
+
fila[`Gestion${gestion}`] = totalPagoCostosFinancieros;
|
|
216
|
+
filaTotales[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + totalPagoCostosFinancieros;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.ProyeccionPrestamosDirectosHandler = ProyeccionPrestamosDirectosHandler;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ProyeccionPrestamo } from "../../../models/eeff/admFinanciera";
|
|
2
|
+
export type Frecuencia = "ANUAL" | "BIMENSUAL" | "CUATRIMESTRAL" | "MENSUAL" | "SEMESTRAL" | "TRIMESTRAL";
|
|
3
|
+
export type TipoCuota = "FIJA" | "VARIABLE" | "CORTOPLAZO";
|
|
4
|
+
export declare const frecuenciaMeses: Record<Frecuencia, number>;
|
|
5
|
+
interface SimuladorParametros {
|
|
6
|
+
monto: number;
|
|
7
|
+
plazo: number;
|
|
8
|
+
frecuencia: Frecuencia;
|
|
9
|
+
tipoCuota: TipoCuota;
|
|
10
|
+
periodoGracia?: number;
|
|
11
|
+
tasaInteres?: number;
|
|
12
|
+
polizaSD?: number;
|
|
13
|
+
plazoMeses?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface Cuota {
|
|
16
|
+
nroCuota: number;
|
|
17
|
+
amortizacion: number;
|
|
18
|
+
interes: number;
|
|
19
|
+
cuotaCredito: number;
|
|
20
|
+
poliza: number;
|
|
21
|
+
cuotaTotal: number;
|
|
22
|
+
saldoCapital: number;
|
|
23
|
+
tiempoDias: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ResumenAnual {
|
|
26
|
+
anio: number;
|
|
27
|
+
capitalAnual: number;
|
|
28
|
+
interesAnual: number;
|
|
29
|
+
cuotaAnual: number;
|
|
30
|
+
}
|
|
31
|
+
export interface SimuladorResultado {
|
|
32
|
+
simulador: Cuota[];
|
|
33
|
+
pagosAnuales: ResumenAnual[];
|
|
34
|
+
}
|
|
35
|
+
export declare function simuladorCuotas({ monto, plazo, frecuencia, tipoCuota, periodoGracia, tasaInteres, polizaSD, plazoMeses }: SimuladorParametros): SimuladorResultado;
|
|
36
|
+
interface ResultadoPorcionPagada {
|
|
37
|
+
cuotasPagadas: number;
|
|
38
|
+
porcionCorrientePagada: number;
|
|
39
|
+
}
|
|
40
|
+
interface CalcularPorcionCorrienteParams {
|
|
41
|
+
simulador: Cuota[];
|
|
42
|
+
fechaDesembolso: string;
|
|
43
|
+
fechaInicial: string;
|
|
44
|
+
frecuencia: Frecuencia;
|
|
45
|
+
}
|
|
46
|
+
export declare function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador }: CalcularPorcionCorrienteParams): ResultadoPorcionPagada;
|
|
47
|
+
export declare function ourParseFloat(num: any, round?: boolean): number;
|
|
48
|
+
/**
|
|
49
|
+
* Calcula la tasa de interés periódica (similar a la función TASA de Excel).
|
|
50
|
+
*
|
|
51
|
+
* @param params - Objeto con los parámetros necesarios.
|
|
52
|
+
* @param params.meses - Número de períodos (meses).
|
|
53
|
+
* @param params.montoCuota - Monto de la cuota por período (negativo, por ser un flujo de salida).
|
|
54
|
+
* @param params.montoOriginal - Monto original del préstamo.
|
|
55
|
+
* @param params.guess - Estimación inicial de la tasa de interés (por defecto: 0.1 o 10%).
|
|
56
|
+
* @param params.maxIteraciones - Número máximo de iteraciones para el cálculo (por defecto: 100).
|
|
57
|
+
* @param params.tolerancia - Precisión deseada para el resultado (por defecto: 1e-6).
|
|
58
|
+
* @returns La tasa de interés periódica como decimal o undefined si no converge.
|
|
59
|
+
*/
|
|
60
|
+
export declare function calcularTasaInteres({ meses, montoCuota, montoOriginal, guess, maxIteraciones, tolerancia, }: {
|
|
61
|
+
meses: number;
|
|
62
|
+
montoCuota: number;
|
|
63
|
+
montoOriginal: number;
|
|
64
|
+
guess?: number;
|
|
65
|
+
maxIteraciones?: number;
|
|
66
|
+
tolerancia?: number;
|
|
67
|
+
}): number | undefined;
|
|
68
|
+
export declare function getColumnSum<T>(data: T[], column: keyof T): number;
|
|
69
|
+
type SumKeysParams = {
|
|
70
|
+
baseKey: string;
|
|
71
|
+
endIndex: number;
|
|
72
|
+
startIndex?: number;
|
|
73
|
+
data: Record<string, any>;
|
|
74
|
+
};
|
|
75
|
+
export declare function sumCorrelativeKeys(params: SumKeysParams): number;
|
|
76
|
+
interface GeneratePlazosParams {
|
|
77
|
+
cantidadProyeccion: number;
|
|
78
|
+
inicio?: number;
|
|
79
|
+
valor?: number;
|
|
80
|
+
}
|
|
81
|
+
export declare function generatePlazos({ inicio, cantidadProyeccion, valor }: GeneratePlazosParams): Partial<ProyeccionPrestamo>;
|
|
82
|
+
export declare function calcularPagoPrincipalEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial, periodoFinal, }: {
|
|
83
|
+
tasaPeriodica: number;
|
|
84
|
+
numeroPagos: number;
|
|
85
|
+
montoPrestamo: number;
|
|
86
|
+
periodoInicial?: number;
|
|
87
|
+
periodoFinal: number;
|
|
88
|
+
}): number;
|
|
89
|
+
export declare function calcularPagoInteresEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial, periodoFinal, }: {
|
|
90
|
+
tasaPeriodica: number;
|
|
91
|
+
numeroPagos: number;
|
|
92
|
+
montoPrestamo: number;
|
|
93
|
+
periodoInicial?: number;
|
|
94
|
+
periodoFinal: number;
|
|
95
|
+
}): number;
|
|
96
|
+
export {};
|