bdpformulas 1.0.49 → 1.0.51
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/models/eeff/admFinanciera/index.d.ts +143 -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 +202 -0
- package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.d.ts +7 -0
- package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.js +63 -0
- package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.d.ts +13 -0
- package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.js +80 -0
- package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.d.ts +26 -0
- package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.js +310 -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 +51 -0
- package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.js +291 -0
- package/build/strategies/eeff/admFinanciera/utils.d.ts +98 -0
- package/build/strategies/eeff/admFinanciera/utils.js +218 -0
- package/build/strategies/eeff/admFinanciera.strategy.d.ts +11 -7
- package/build/strategies/eeff/admFinanciera.strategy.js +139 -85
- package/build/strategies/eeff/balanceEEFF.strategy.js +3 -2
- package/build/strategies/eeff/flujoProyEEFF.strategy.js +3 -2
- package/build/strategies/eeff/index.d.ts +1 -0
- package/build/strategies/eeff/index.js +1509 -0
- 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,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProyeccionPrestamosDirectosHandler = exports.FILAS_PROYECCION_PRESTAMOS_DIRECTOS = 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
|
+
exports.FILAS_PROYECCION_PRESTAMOS_DIRECTOS = filas;
|
|
31
|
+
class ProyeccionPrestamosDirectosHandler {
|
|
32
|
+
data;
|
|
33
|
+
proyeccion;
|
|
34
|
+
constructor({ data }) {
|
|
35
|
+
this.data = data;
|
|
36
|
+
const filaInteresManual = this.data.ProyeccionPrestamosDirectos.find((pr) => pr.RubroId === admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesManual);
|
|
37
|
+
const filaInteresLeasingManual = this.data.ProyeccionPrestamosDirectos.find((pr) => pr.RubroId ===
|
|
38
|
+
admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesLeasingManual);
|
|
39
|
+
this.proyeccion = [
|
|
40
|
+
{ Descripcion: 'KO - Porción CP - BDP SAM' },
|
|
41
|
+
{ Descripcion: 'KI - Porción CP - BDP SAM' },
|
|
42
|
+
{ Descripcion: 'L/C Mixta - Porción CP - BDP SAM' },
|
|
43
|
+
{ Descripcion: 'Porción LP - BDP SAM' },
|
|
44
|
+
{ Descripcion: 'KO - Porción CP - Otras EIFs' },
|
|
45
|
+
{ Descripcion: 'KI - Porción CP - Otras EIFs' },
|
|
46
|
+
{ Descripcion: 'Otros - Porción CP - Otras EIFs' },
|
|
47
|
+
{ Descripcion: 'L/C Mixta - Porción CP - Otras EIFs' },
|
|
48
|
+
{ Descripcion: 'Porción LP - Otras EIFs' },
|
|
49
|
+
{ Descripcion: 'Intereses y Comisiones - Prestamos Directos' },
|
|
50
|
+
{
|
|
51
|
+
Descripcion: 'Intereses y Comisiones - Linea de Credito 100% KO'
|
|
52
|
+
},
|
|
53
|
+
{ Descripcion: 'Intereses y Comisiones - Linea de Credito Mixta' },
|
|
54
|
+
{
|
|
55
|
+
...filaInteresManual,
|
|
56
|
+
Descripcion: 'Interes - MANUAL',
|
|
57
|
+
Editable: true,
|
|
58
|
+
RubroId: admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesManual
|
|
59
|
+
},
|
|
60
|
+
{ Descripcion: 'Total Intereses (BDP y Otras EIFs)' },
|
|
61
|
+
{
|
|
62
|
+
Descripcion: 'Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs'
|
|
63
|
+
},
|
|
64
|
+
{ Descripcion: 'Leasing LP - Otras EIFs' },
|
|
65
|
+
{ Descripcion: 'Intereses Leasing' },
|
|
66
|
+
{
|
|
67
|
+
...filaInteresLeasingManual,
|
|
68
|
+
Descripcion: 'Interes Leasing - MANUAL',
|
|
69
|
+
Editable: true,
|
|
70
|
+
RubroId: admFinanciera_1.rubros.proyeccionPrestamosDirectos.interesLeasingManual
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
Descripcion: 'TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM',
|
|
74
|
+
Clasificador: 'T'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
Descripcion: 'TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs',
|
|
78
|
+
Clasificador: 'T'
|
|
79
|
+
},
|
|
80
|
+
{ Descripcion: 'TOTAL PORCIÓN LP - BDP SAM', Clasificador: 'T' },
|
|
81
|
+
{ Descripcion: 'TOTAL PORCIÓN LP - Otras EIFs', Clasificador: 'T' }
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
handle() {
|
|
85
|
+
this.setProyecciones();
|
|
86
|
+
return this.proyeccion;
|
|
87
|
+
}
|
|
88
|
+
setProyecciones() {
|
|
89
|
+
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
90
|
+
this.setKOPorcionCPBDP(i);
|
|
91
|
+
this.setKIPorcionCPBDP(i);
|
|
92
|
+
this.setKOPorcionCPOtras(i);
|
|
93
|
+
this.setKIPorcionCPOtras(i);
|
|
94
|
+
this.setOtrasPorcionCPOtras(i);
|
|
95
|
+
this.setLCMixtaBDP(i);
|
|
96
|
+
this.setLCMixtaOtras(i);
|
|
97
|
+
this.setInteresesPrestamosDirectos(i);
|
|
98
|
+
this.setInteresesLineaKO(i);
|
|
99
|
+
this.setInteresesLineasMixtas(i);
|
|
100
|
+
this.setPorcionLPBDP(i);
|
|
101
|
+
this.setPorcionLPOtras(i);
|
|
102
|
+
this.setLeasingCP(i);
|
|
103
|
+
this.setLeasingLP(i);
|
|
104
|
+
this.setInteresLeasing(i);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
setKOPorcionCPBDP(gestion) {
|
|
108
|
+
const fila = this.proyeccion[filas['KO - Porción CP - BDP SAM']];
|
|
109
|
+
const filaTotalesCPBDP = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM']];
|
|
110
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B' &&
|
|
111
|
+
pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion &&
|
|
112
|
+
pr.EsNuestroBanco);
|
|
113
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
|
|
114
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
115
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
116
|
+
filaTotalesCPBDP[`Gestion${gestion}`] =
|
|
117
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
|
|
118
|
+
}
|
|
119
|
+
setKIPorcionCPBDP(gestion) {
|
|
120
|
+
const fila = this.proyeccion[filas['KI - Porción CP - BDP SAM']];
|
|
121
|
+
const filaTotalesCPBDP = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM']];
|
|
122
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B' &&
|
|
123
|
+
pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion &&
|
|
124
|
+
pr.EsNuestroBanco);
|
|
125
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
|
|
126
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
127
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
128
|
+
filaTotalesCPBDP[`Gestion${gestion}`] =
|
|
129
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
|
|
130
|
+
}
|
|
131
|
+
setKOPorcionCPOtras(gestion) {
|
|
132
|
+
const fila = this.proyeccion[filas['KO - Porción CP - Otras EIFs']];
|
|
133
|
+
const filaTotalesCPOtras = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs']];
|
|
134
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B' &&
|
|
135
|
+
pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion &&
|
|
136
|
+
!pr.EsNuestroBanco);
|
|
137
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
|
|
138
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
139
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
140
|
+
filaTotalesCPOtras[`Gestion${gestion}`] =
|
|
141
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
142
|
+
}
|
|
143
|
+
setKIPorcionCPOtras(gestion) {
|
|
144
|
+
const fila = this.proyeccion[filas['KI - Porción CP - Otras EIFs']];
|
|
145
|
+
const filaTotalesCPOtras = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs']];
|
|
146
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B' &&
|
|
147
|
+
pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion &&
|
|
148
|
+
!pr.EsNuestroBanco);
|
|
149
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
|
|
150
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
151
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
152
|
+
filaTotalesCPOtras[`Gestion${gestion}`] =
|
|
153
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
154
|
+
}
|
|
155
|
+
setOtrasPorcionCPOtras(gestion) {
|
|
156
|
+
const fila = this.proyeccion[filas['Otros - Porción CP - Otras EIFs']];
|
|
157
|
+
const filaTotalesCPOtras = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs']];
|
|
158
|
+
const prestamosFiltrados = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B' &&
|
|
159
|
+
pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.Otros &&
|
|
160
|
+
!pr.EsNuestroBanco);
|
|
161
|
+
const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
|
|
162
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
|
|
163
|
+
fila[`Gestion${gestion}`] = sumaGestion;
|
|
164
|
+
filaTotalesCPOtras[`Gestion${gestion}`] =
|
|
165
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
|
|
166
|
+
}
|
|
167
|
+
setLCMixtaBDP(gestion) {
|
|
168
|
+
const totalVencimiento = this.data.LineasMixtasBDP.find((lin) => lin.Clasificador === 'T' &&
|
|
169
|
+
lin.RubroId ===
|
|
170
|
+
admFinanciera_1.rubros.lineasMixtas.vencimientoCorrienteLargoPlazo);
|
|
171
|
+
const filaTotalesCPBDP = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM']];
|
|
172
|
+
if (totalVencimiento) {
|
|
173
|
+
const fila = this.proyeccion[filas['L/C Mixta - Porción CP - BDP SAM']];
|
|
174
|
+
const valor = (0, utils_1.ourParseFloat)(totalVencimiento[`Gestion${gestion}`]);
|
|
175
|
+
fila[`Gestion${gestion}`] = valor;
|
|
176
|
+
filaTotalesCPBDP[`Gestion${gestion}`] =
|
|
177
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + valor;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
setLCMixtaOtras(gestion) {
|
|
181
|
+
const totalVencimiento = this.data.LineasMixtasOtros.find((lin) => lin.Clasificador === 'T' &&
|
|
182
|
+
lin.RubroId ===
|
|
183
|
+
admFinanciera_1.rubros.lineasMixtas.vencimientoCorrienteLargoPlazo);
|
|
184
|
+
const filaTotalesCPOtras = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs']];
|
|
185
|
+
if (totalVencimiento) {
|
|
186
|
+
const fila = this.proyeccion[filas['L/C Mixta - Porción CP - Otras EIFs']];
|
|
187
|
+
const valor = (0, utils_1.ourParseFloat)(totalVencimiento[`Gestion${gestion}`]);
|
|
188
|
+
fila[`Gestion${gestion}`] = valor;
|
|
189
|
+
filaTotalesCPOtras[`Gestion${gestion}`] =
|
|
190
|
+
(0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + valor;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
setInteresesLineasMixtas(gestion) {
|
|
194
|
+
const totalGastos = this.data.LineasMixtasOtros.find((lin) => lin.Clasificador === 'T' &&
|
|
195
|
+
lin.RubroId === admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones);
|
|
196
|
+
const filaTotales = this.proyeccion[filas['Total Intereses (BDP y Otras EIFs)']];
|
|
197
|
+
if (totalGastos) {
|
|
198
|
+
const fila = this.proyeccion[filas['Intereses y Comisiones - Linea de Credito Mixta']];
|
|
199
|
+
const valor = (0, utils_1.ourParseFloat)(totalGastos[`Gestion${gestion}`]);
|
|
200
|
+
fila[`Gestion${gestion}`] = valor;
|
|
201
|
+
filaTotales[`Gestion${gestion}`] =
|
|
202
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
setPorcionLPBDP(gestion) {
|
|
206
|
+
const fila = this.proyeccion[filas['Porción LP - BDP SAM']];
|
|
207
|
+
const porcionesNoCorrientes = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.filter((p) => p.IndicadorABM !== 'B' && p.EsNuestroBanco).reduce((acc, curr) => acc +
|
|
208
|
+
(0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]), 0));
|
|
209
|
+
const totalDeudaFinancieraLineas = this.data.LineasMixtasBDP.find((lin) => lin.Clasificador === 'T' &&
|
|
210
|
+
lin.RubroId === admFinanciera_1.rubros.lineasMixtas.deudaFinancieraLargoPlazo);
|
|
211
|
+
const total = porcionesNoCorrientes +
|
|
212
|
+
(0, utils_1.ourParseFloat)(totalDeudaFinancieraLineas?.[`Gestion${gestion}`]);
|
|
213
|
+
fila[`Gestion${gestion}`] = total;
|
|
214
|
+
this.proyeccion[filas['TOTAL PORCIÓN LP - BDP SAM']][`Gestion${gestion}`] = total;
|
|
215
|
+
}
|
|
216
|
+
setPorcionLPOtras(gestion) {
|
|
217
|
+
const fila = this.proyeccion[filas['Porción LP - Otras EIFs']];
|
|
218
|
+
const filaTotales = this.proyeccion[filas['TOTAL PORCIÓN LP - Otras EIFs']];
|
|
219
|
+
const porcionesNoCorrientes = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.filter((p) => p.IndicadorABM !== 'B' && !p.EsNuestroBanco).reduce((acc, curr) => acc +
|
|
220
|
+
(0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]), 0));
|
|
221
|
+
const totalDeudaFinancieraLineas = this.data.LineasMixtasOtros.find((lin) => lin.Clasificador === 'T' &&
|
|
222
|
+
lin.RubroId === admFinanciera_1.rubros.lineasMixtas.deudaFinancieraLargoPlazo);
|
|
223
|
+
const total = porcionesNoCorrientes +
|
|
224
|
+
(0, utils_1.ourParseFloat)(totalDeudaFinancieraLineas?.[`Gestion${gestion}`]);
|
|
225
|
+
fila[`Gestion${gestion}`] = total;
|
|
226
|
+
filaTotales[`Gestion${gestion}`] =
|
|
227
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + total;
|
|
228
|
+
}
|
|
229
|
+
setLeasingCP(gestion) {
|
|
230
|
+
const fila = this.proyeccion[filas['Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs']];
|
|
231
|
+
const filaTotales = this.proyeccion[filas['TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs']];
|
|
232
|
+
const prestamosLeasing = this.data.PrestamoLeasing.filter((pr) => pr.IndicadorABM !== 'B');
|
|
233
|
+
const valor = (0, utils_1.ourParseFloat)(prestamosLeasing.reduce((acc, curr) => acc +
|
|
234
|
+
(0, utils_1.ourParseFloat)(curr.PorcionesCorrientes?.[`Gestion${gestion}`]), 0));
|
|
235
|
+
fila[`Gestion${gestion}`] = valor;
|
|
236
|
+
filaTotales[`Gestion${gestion}`] =
|
|
237
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
238
|
+
}
|
|
239
|
+
setLeasingLP(gestion) {
|
|
240
|
+
const fila = this.proyeccion[filas['Leasing LP - Otras EIFs']];
|
|
241
|
+
const filaTotales = this.proyeccion[filas['TOTAL PORCIÓN LP - Otras EIFs']];
|
|
242
|
+
const prestamosLeasing = this.data.PrestamoLeasing.filter((pr) => pr.IndicadorABM !== 'B');
|
|
243
|
+
const valor = (0, utils_1.ourParseFloat)(prestamosLeasing.reduce((acc, curr) => {
|
|
244
|
+
const value = (0, utils_1.ourParseFloat)(curr.PorcionesNoCorrientes?.[`Gestion${gestion}`]);
|
|
245
|
+
return acc + (value > 0 ? value : 0);
|
|
246
|
+
}, 0));
|
|
247
|
+
fila[`Gestion${gestion}`] = valor;
|
|
248
|
+
filaTotales[`Gestion${gestion}`] =
|
|
249
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) + valor;
|
|
250
|
+
}
|
|
251
|
+
setInteresLeasing(gestion) {
|
|
252
|
+
if (gestion > 1) {
|
|
253
|
+
const fila = this.proyeccion[filas['Intereses Leasing']];
|
|
254
|
+
const prestamosLeasing = this.data.PrestamoLeasing.filter((pr) => pr.IndicadorABM !== 'B');
|
|
255
|
+
fila[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(prestamosLeasing.reduce((acc, curr) => acc +
|
|
256
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesInteres?.[`Gestion${gestion - 1}`]), 0));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
setInteresesPrestamosDirectos(gestion) {
|
|
260
|
+
const filaInteresesManuales = this.proyeccion[filas['Interes - MANUAL']];
|
|
261
|
+
const filaTotales = this.proyeccion[filas['Total Intereses (BDP y Otras EIFs)']];
|
|
262
|
+
const fila = this.proyeccion[filas['Intereses y Comisiones - Prestamos Directos']];
|
|
263
|
+
const totalAmortizacionesInteres = (0, utils_1.ourParseFloat)(this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B').reduce((acc, curr) => acc +
|
|
264
|
+
(0, utils_1.ourParseFloat)(curr.AmortizacionesInteres?.[`Gestion${gestion}`]), 0));
|
|
265
|
+
const totalPagoCostosFinancieros = this.data.ProyeccionPrestamosBajoLineas.find((p) => p.Clasificador == 'T')?.[`Gestion${gestion}`];
|
|
266
|
+
const totalGastosFinancieroBDP = this.data.LineasMixtasBDP.find((p) => p.Clasificador == 'T' &&
|
|
267
|
+
p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
|
|
268
|
+
const totalGastosFinancieroOtros = this.data.LineasMixtasOtros.find((p) => p.Clasificador == 'T' &&
|
|
269
|
+
p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
|
|
270
|
+
const costosMasGastos = (0, utils_1.ourParseFloat)(totalPagoCostosFinancieros) +
|
|
271
|
+
(0, utils_1.ourParseFloat)(totalGastosFinancieroBDP) +
|
|
272
|
+
(0, utils_1.ourParseFloat)(totalGastosFinancieroOtros);
|
|
273
|
+
const total = totalAmortizacionesInteres + costosMasGastos;
|
|
274
|
+
const valor = total - costosMasGastos;
|
|
275
|
+
fila[`Gestion${gestion}`] = valor;
|
|
276
|
+
filaTotales[`Gestion${gestion}`] =
|
|
277
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) +
|
|
278
|
+
valor +
|
|
279
|
+
(0, utils_1.ourParseFloat)(filaInteresesManuales[`Gestion${gestion}`]);
|
|
280
|
+
}
|
|
281
|
+
setInteresesLineaKO(gestion) {
|
|
282
|
+
const fila = this.proyeccion[filas['Intereses y Comisiones - Linea de Credito 100% KO']];
|
|
283
|
+
const filaTotales = this.proyeccion[filas['Total Intereses (BDP y Otras EIFs)']];
|
|
284
|
+
const totalPagoCostosFinancieros = (0, utils_1.ourParseFloat)(this.data.ProyeccionPrestamosBajoLineas.find((p) => p.Clasificador == 'T')?.[`Gestion${gestion}`]);
|
|
285
|
+
fila[`Gestion${gestion}`] = totalPagoCostosFinancieros;
|
|
286
|
+
filaTotales[`Gestion${gestion}`] =
|
|
287
|
+
(0, utils_1.ourParseFloat)(filaTotales[`Gestion${gestion}`]) +
|
|
288
|
+
totalPagoCostosFinancieros;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
exports.ProyeccionPrestamosDirectosHandler = ProyeccionPrestamosDirectosHandler;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { ProyeccionPrestamo } from '../../../models/eeff/admFinanciera';
|
|
3
|
+
export type Frecuencia = 'ANUAL' | 'BIMENSUAL' | 'CUATRIMESTRAL' | 'MENSUAL' | 'SEMESTRAL' | 'TRIMESTRAL';
|
|
4
|
+
export type TipoCuota = 'FIJA' | 'VARIABLE' | 'CORTOPLAZO';
|
|
5
|
+
export declare const frecuenciaMeses: Record<Frecuencia, number>;
|
|
6
|
+
interface SimuladorParametros {
|
|
7
|
+
monto: number;
|
|
8
|
+
plazo: number;
|
|
9
|
+
frecuencia: Frecuencia;
|
|
10
|
+
tipoCuota: TipoCuota;
|
|
11
|
+
periodoGracia?: number;
|
|
12
|
+
tasaInteres?: number;
|
|
13
|
+
polizaSD?: number;
|
|
14
|
+
plazoMeses?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface Cuota {
|
|
17
|
+
nroCuota: number;
|
|
18
|
+
amortizacion: number;
|
|
19
|
+
interes: number;
|
|
20
|
+
cuotaCredito: number;
|
|
21
|
+
poliza: number;
|
|
22
|
+
cuotaTotal: number;
|
|
23
|
+
saldoCapital: number;
|
|
24
|
+
tiempoDias: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ResumenAnual {
|
|
27
|
+
anio: number;
|
|
28
|
+
capitalAnual: number;
|
|
29
|
+
interesAnual: number;
|
|
30
|
+
cuotaAnual: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SimuladorResultado {
|
|
33
|
+
simulador: Cuota[];
|
|
34
|
+
pagosAnuales: ResumenAnual[];
|
|
35
|
+
}
|
|
36
|
+
export declare function simuladorCuotas({ monto, plazo, frecuencia, tipoCuota, periodoGracia, tasaInteres, polizaSD, plazoMeses }: SimuladorParametros): SimuladorResultado;
|
|
37
|
+
interface ResultadoPorcionPagada {
|
|
38
|
+
cuotasPagadas: number;
|
|
39
|
+
porcionCorrientePagada: number;
|
|
40
|
+
}
|
|
41
|
+
interface CalcularPorcionCorrienteParams {
|
|
42
|
+
simulador: Cuota[];
|
|
43
|
+
fechaDesembolso: string;
|
|
44
|
+
fechaInicial: string;
|
|
45
|
+
frecuencia: Frecuencia;
|
|
46
|
+
}
|
|
47
|
+
export declare function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador }: CalcularPorcionCorrienteParams): ResultadoPorcionPagada;
|
|
48
|
+
export declare function ourParseFloat(num: any, round?: boolean): number;
|
|
49
|
+
/**
|
|
50
|
+
* Calcula la tasa de interés periódica (similar a la función TASA de Excel).
|
|
51
|
+
*
|
|
52
|
+
* @param params - Objeto con los parámetros necesarios.
|
|
53
|
+
* @param params.meses - Número de períodos (meses).
|
|
54
|
+
* @param params.montoCuota - Monto de la cuota por período (negativo, por ser un flujo de salida).
|
|
55
|
+
* @param params.montoOriginal - Monto original del préstamo.
|
|
56
|
+
* @param params.guess - Estimación inicial de la tasa de interés (por defecto: 0.1 o 10%).
|
|
57
|
+
* @param params.maxIteraciones - Número máximo de iteraciones para el cálculo (por defecto: 100).
|
|
58
|
+
* @param params.tolerancia - Precisión deseada para el resultado (por defecto: 1e-6).
|
|
59
|
+
* @returns La tasa de interés periódica como decimal o undefined si no converge.
|
|
60
|
+
*/
|
|
61
|
+
export declare function calcularTasaInteres({ meses, montoCuota, montoOriginal, guess, maxIteraciones, tolerancia }: {
|
|
62
|
+
meses: number;
|
|
63
|
+
montoCuota: number;
|
|
64
|
+
montoOriginal: number;
|
|
65
|
+
guess?: number;
|
|
66
|
+
maxIteraciones?: number;
|
|
67
|
+
tolerancia?: number;
|
|
68
|
+
}): number | undefined;
|
|
69
|
+
export declare function getColumnSum<T>(data: T[], column: keyof T): number;
|
|
70
|
+
type SumKeysParams = {
|
|
71
|
+
baseKey: string;
|
|
72
|
+
endIndex: number;
|
|
73
|
+
startIndex?: number;
|
|
74
|
+
data: Record<string, any>;
|
|
75
|
+
};
|
|
76
|
+
export declare function sumCorrelativeKeys(params: SumKeysParams): number;
|
|
77
|
+
interface GeneratePlazosParams {
|
|
78
|
+
cantidadProyeccion: number;
|
|
79
|
+
inicio?: number;
|
|
80
|
+
valor?: number;
|
|
81
|
+
}
|
|
82
|
+
export declare function generatePlazos({ inicio, cantidadProyeccion, valor }: GeneratePlazosParams): Partial<ProyeccionPrestamo>;
|
|
83
|
+
export declare function calcularPagoPrincipalEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial, periodoFinal }: {
|
|
84
|
+
tasaPeriodica: number;
|
|
85
|
+
numeroPagos: number;
|
|
86
|
+
montoPrestamo: number;
|
|
87
|
+
periodoInicial?: number;
|
|
88
|
+
periodoFinal: number;
|
|
89
|
+
}): number;
|
|
90
|
+
export declare function calcularPagoInteresEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial, periodoFinal }: {
|
|
91
|
+
tasaPeriodica: number;
|
|
92
|
+
numeroPagos: number;
|
|
93
|
+
montoPrestamo: number;
|
|
94
|
+
periodoInicial?: number;
|
|
95
|
+
periodoFinal: number;
|
|
96
|
+
}): number;
|
|
97
|
+
export declare function getDateTime(date: string | Date): DateTime<true> | DateTime<false>;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDateTime = exports.calcularPagoInteresEntre = exports.calcularPagoPrincipalEntre = exports.generatePlazos = exports.sumCorrelativeKeys = exports.getColumnSum = exports.calcularTasaInteres = exports.ourParseFloat = exports.calcularPorcionCorrientePagada = exports.simuladorCuotas = exports.frecuenciaMeses = void 0;
|
|
4
|
+
const luxon_1 = require("luxon");
|
|
5
|
+
exports.frecuenciaMeses = {
|
|
6
|
+
MENSUAL: 1,
|
|
7
|
+
BIMENSUAL: 2,
|
|
8
|
+
TRIMESTRAL: 3,
|
|
9
|
+
CUATRIMESTRAL: 4,
|
|
10
|
+
SEMESTRAL: 6,
|
|
11
|
+
ANUAL: 12
|
|
12
|
+
};
|
|
13
|
+
function simuladorCuotas({ monto, plazo, frecuencia, tipoCuota, periodoGracia = 0, tasaInteres = 0, polizaSD = 0, plazoMeses = false }) {
|
|
14
|
+
const mesesPorFrecuencia = exports.frecuenciaMeses[frecuencia];
|
|
15
|
+
const plazoEnMeses = !plazoMeses ? plazo * 12 : plazo;
|
|
16
|
+
const cuotasTotales = Math.ceil(plazoEnMeses / mesesPorFrecuencia);
|
|
17
|
+
const tasaPorPeriodo = tasaInteres / (12 / mesesPorFrecuencia) / 100;
|
|
18
|
+
let saldoCapital = monto;
|
|
19
|
+
const cuotas = [];
|
|
20
|
+
const pagosAnuales = [];
|
|
21
|
+
let capitalAnual = 0;
|
|
22
|
+
let interesAnual = 0;
|
|
23
|
+
let cuotaAnual = 0;
|
|
24
|
+
let anioActual = 1;
|
|
25
|
+
// Calcular cuota fija si aplica
|
|
26
|
+
const cuotaFija = tipoCuota === 'FIJA'
|
|
27
|
+
? (monto * tasaPorPeriodo) /
|
|
28
|
+
(1 - Math.pow(1 + tasaPorPeriodo, -cuotasTotales))
|
|
29
|
+
: 0;
|
|
30
|
+
for (let i = 1; i <= cuotasTotales; i++) {
|
|
31
|
+
let amortizacion = 0;
|
|
32
|
+
let interes = 0;
|
|
33
|
+
let cuotaCredito = 0;
|
|
34
|
+
const tiempoDias = mesesPorFrecuencia * 30; // Aproximado.
|
|
35
|
+
if (i > Math.ceil(periodoGracia / mesesPorFrecuencia)) {
|
|
36
|
+
interes = saldoCapital * tasaPorPeriodo;
|
|
37
|
+
if (tipoCuota === 'FIJA') {
|
|
38
|
+
cuotaCredito = cuotaFija;
|
|
39
|
+
amortizacion = cuotaCredito - interes;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
amortizacion =
|
|
43
|
+
monto /
|
|
44
|
+
(cuotasTotales -
|
|
45
|
+
Math.ceil(periodoGracia / mesesPorFrecuencia));
|
|
46
|
+
cuotaCredito = amortizacion + interes;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const cuotaTotal = cuotaCredito + polizaSD;
|
|
50
|
+
cuotas.push({
|
|
51
|
+
nroCuota: i,
|
|
52
|
+
amortizacion,
|
|
53
|
+
interes,
|
|
54
|
+
cuotaCredito,
|
|
55
|
+
poliza: polizaSD,
|
|
56
|
+
cuotaTotal,
|
|
57
|
+
saldoCapital,
|
|
58
|
+
tiempoDias
|
|
59
|
+
});
|
|
60
|
+
saldoCapital -= amortizacion;
|
|
61
|
+
// Acumular valores anuales
|
|
62
|
+
capitalAnual += amortizacion;
|
|
63
|
+
interesAnual += interes;
|
|
64
|
+
cuotaAnual += cuotaTotal;
|
|
65
|
+
const mesActual = i * mesesPorFrecuencia;
|
|
66
|
+
if (mesActual % 12 === 0 || i === cuotasTotales) {
|
|
67
|
+
pagosAnuales.push({
|
|
68
|
+
anio: anioActual,
|
|
69
|
+
capitalAnual,
|
|
70
|
+
interesAnual,
|
|
71
|
+
cuotaAnual
|
|
72
|
+
});
|
|
73
|
+
anioActual++;
|
|
74
|
+
capitalAnual = 0;
|
|
75
|
+
interesAnual = 0;
|
|
76
|
+
cuotaAnual = 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { simulador: cuotas, pagosAnuales };
|
|
80
|
+
}
|
|
81
|
+
exports.simuladorCuotas = simuladorCuotas;
|
|
82
|
+
function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador }) {
|
|
83
|
+
const inicial = getDateTime(fechaInicial).endOf('month');
|
|
84
|
+
const desembolso = getDateTime(fechaDesembolso).endOf('month');
|
|
85
|
+
const mesesPorFrecuencia = exports.frecuenciaMeses[frecuencia];
|
|
86
|
+
const mesesTranscurridos = inicial.diff(desembolso, 'months').months;
|
|
87
|
+
const cuotasPagadas = Math.floor(mesesTranscurridos / mesesPorFrecuencia);
|
|
88
|
+
const cuotasPagadasArray = simulador.filter((cuota) => cuota.nroCuota <= cuotasPagadas);
|
|
89
|
+
const porcionCorrientePagada = cuotasPagadasArray.reduce((acumulado, cuota) => acumulado + cuota.amortizacion, 0);
|
|
90
|
+
return {
|
|
91
|
+
cuotasPagadas: cuotasPagadasArray.length,
|
|
92
|
+
porcionCorrientePagada
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
exports.calcularPorcionCorrientePagada = calcularPorcionCorrientePagada;
|
|
96
|
+
function ourParseFloat(num, round = true) {
|
|
97
|
+
let parsed = parseFloat(num);
|
|
98
|
+
if (isNaN(parsed))
|
|
99
|
+
parsed = 0;
|
|
100
|
+
//if (round) parsed = parseFloat(parsed.toFixed(2))
|
|
101
|
+
return parsed;
|
|
102
|
+
}
|
|
103
|
+
exports.ourParseFloat = ourParseFloat;
|
|
104
|
+
/**
|
|
105
|
+
* Calcula la tasa de interés periódica (similar a la función TASA de Excel).
|
|
106
|
+
*
|
|
107
|
+
* @param params - Objeto con los parámetros necesarios.
|
|
108
|
+
* @param params.meses - Número de períodos (meses).
|
|
109
|
+
* @param params.montoCuota - Monto de la cuota por período (negativo, por ser un flujo de salida).
|
|
110
|
+
* @param params.montoOriginal - Monto original del préstamo.
|
|
111
|
+
* @param params.guess - Estimación inicial de la tasa de interés (por defecto: 0.1 o 10%).
|
|
112
|
+
* @param params.maxIteraciones - Número máximo de iteraciones para el cálculo (por defecto: 100).
|
|
113
|
+
* @param params.tolerancia - Precisión deseada para el resultado (por defecto: 1e-6).
|
|
114
|
+
* @returns La tasa de interés periódica como decimal o undefined si no converge.
|
|
115
|
+
*/
|
|
116
|
+
function calcularTasaInteres({ meses, montoCuota, montoOriginal, guess = 0.1, maxIteraciones = 100, tolerancia = 1e-10 }) {
|
|
117
|
+
let tasa = guess;
|
|
118
|
+
for (let i = 0; i < maxIteraciones; i++) {
|
|
119
|
+
let f = 0; // Función objetivo f(x)
|
|
120
|
+
let fDerivada = 0; // Derivada f'(x)
|
|
121
|
+
for (let j = 1; j <= meses; j++) {
|
|
122
|
+
const factor = Math.pow(1 + tasa, -j);
|
|
123
|
+
f += montoCuota * factor;
|
|
124
|
+
fDerivada += (-j * montoCuota * factor) / (1 + tasa);
|
|
125
|
+
}
|
|
126
|
+
// Sumar flujo inicial (monto original)
|
|
127
|
+
f += montoOriginal;
|
|
128
|
+
// Calcular nueva tasa usando Newton-Raphson
|
|
129
|
+
const nuevoTasa = tasa - f / fDerivada;
|
|
130
|
+
if (Math.abs(nuevoTasa - tasa) < tolerancia) {
|
|
131
|
+
return nuevoTasa;
|
|
132
|
+
}
|
|
133
|
+
tasa = nuevoTasa;
|
|
134
|
+
}
|
|
135
|
+
// Si no converge después de todas las iteraciones
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
exports.calcularTasaInteres = calcularTasaInteres;
|
|
139
|
+
function getColumnSum(data, column) {
|
|
140
|
+
return data.reduce((sum, item) => sum + ourParseFloat(item[column]), 0);
|
|
141
|
+
}
|
|
142
|
+
exports.getColumnSum = getColumnSum;
|
|
143
|
+
function sumCorrelativeKeys(params) {
|
|
144
|
+
const { baseKey, endIndex, startIndex = 1, data } = params;
|
|
145
|
+
if (endIndex < startIndex) {
|
|
146
|
+
throw new Error('El índice final no puede ser menor que el índice inicial.');
|
|
147
|
+
}
|
|
148
|
+
let sum = 0;
|
|
149
|
+
for (let i = startIndex; i <= endIndex; i++) {
|
|
150
|
+
const key = `${baseKey}${i}`;
|
|
151
|
+
if (key in data) {
|
|
152
|
+
sum += ourParseFloat(data[key]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return sum;
|
|
156
|
+
}
|
|
157
|
+
exports.sumCorrelativeKeys = sumCorrelativeKeys;
|
|
158
|
+
function generatePlazos({ inicio, cantidadProyeccion, valor }) {
|
|
159
|
+
const plazos = {};
|
|
160
|
+
if (inicio && valor) {
|
|
161
|
+
let valorInicial = valor;
|
|
162
|
+
if (valorInicial) {
|
|
163
|
+
for (let i = inicio; i <= cantidadProyeccion; i++) {
|
|
164
|
+
if (valorInicial > 0) {
|
|
165
|
+
plazos[`Gestion${i}`] = valorInicial;
|
|
166
|
+
valorInicial--;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return plazos;
|
|
175
|
+
}
|
|
176
|
+
exports.generatePlazos = generatePlazos;
|
|
177
|
+
function calcularPagoPrincipalEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial = 1, periodoFinal }) {
|
|
178
|
+
// Cálculo de la cuota fija periódica (PMT)
|
|
179
|
+
const cuota = (tasaPeriodica * montoPrestamo) /
|
|
180
|
+
(1 - Math.pow(1 + tasaPeriodica, -numeroPagos));
|
|
181
|
+
let saldo = montoPrestamo; // Saldo inicial
|
|
182
|
+
let totalCapitalAmortizado = 0;
|
|
183
|
+
for (let periodo = 1; periodo <= periodoFinal; periodo++) {
|
|
184
|
+
const interesPeriodo = saldo * tasaPeriodica; // Intereses del período actual
|
|
185
|
+
const capitalAmortizado = cuota - interesPeriodo; // Parte de capital de la cuota
|
|
186
|
+
if (periodo >= periodoInicial) {
|
|
187
|
+
totalCapitalAmortizado += capitalAmortizado;
|
|
188
|
+
}
|
|
189
|
+
// Reducir el saldo restante para el siguiente período
|
|
190
|
+
saldo -= capitalAmortizado;
|
|
191
|
+
}
|
|
192
|
+
return totalCapitalAmortizado;
|
|
193
|
+
}
|
|
194
|
+
exports.calcularPagoPrincipalEntre = calcularPagoPrincipalEntre;
|
|
195
|
+
function calcularPagoInteresEntre({ tasaPeriodica, numeroPagos, montoPrestamo, periodoInicial = 1, periodoFinal }) {
|
|
196
|
+
// Cálculo de la cuota fija periódica (PMT)
|
|
197
|
+
const cuota = (tasaPeriodica * montoPrestamo) /
|
|
198
|
+
(1 - Math.pow(1 + tasaPeriodica, -numeroPagos));
|
|
199
|
+
let saldo = montoPrestamo; // Saldo inicial
|
|
200
|
+
let totalInteresesPagados = 0;
|
|
201
|
+
for (let periodo = 1; periodo <= periodoFinal; periodo++) {
|
|
202
|
+
const interesPeriodo = saldo * tasaPeriodica; // Intereses del período actual
|
|
203
|
+
if (periodo >= periodoInicial) {
|
|
204
|
+
totalInteresesPagados += interesPeriodo; // Suma intereses solo en el rango especificado
|
|
205
|
+
}
|
|
206
|
+
// Reducir el saldo restante para el siguiente período
|
|
207
|
+
const capitalAmortizado = cuota - interesPeriodo;
|
|
208
|
+
saldo -= capitalAmortizado;
|
|
209
|
+
}
|
|
210
|
+
return totalInteresesPagados; // Devuelve el valor negativo para igualar el comportamiento de Excel
|
|
211
|
+
}
|
|
212
|
+
exports.calcularPagoInteresEntre = calcularPagoInteresEntre;
|
|
213
|
+
function getDateTime(date) {
|
|
214
|
+
return date instanceof Date
|
|
215
|
+
? luxon_1.DateTime.fromJSDate(date, { zone: 'utc' })
|
|
216
|
+
: luxon_1.DateTime.fromISO(date, { zone: 'utc' });
|
|
217
|
+
}
|
|
218
|
+
exports.getDateTime = getDateTime;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdministracionFinancieraCalcData, AdministracionFinancieraData } from '../../models/eeff/admFinanciera';
|
|
2
|
+
import { Strategy } from '../../strategy.interface';
|
|
2
3
|
export default class AdmFinancieraStrategy implements Strategy {
|
|
3
|
-
data:
|
|
4
|
+
data: AdministracionFinancieraCalcData | null;
|
|
4
5
|
constructor();
|
|
5
|
-
execute(data:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
execute(data: AdministracionFinancieraData): AdministracionFinancieraCalcData;
|
|
7
|
+
private formatPrestamosDirectos;
|
|
8
|
+
private formatPrestamosBajoLinea;
|
|
9
|
+
private setProyeccionesBajoLinea;
|
|
10
|
+
private formatPrestamosLeasing;
|
|
11
|
+
private formatLineasMixtas;
|
|
12
|
+
private setProyeccionesPrestamosDirectos;
|
|
13
|
+
private setProyeccionesAplicaciones;
|
|
10
14
|
}
|