bdpformulas 1.0.83 → 1.0.85

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.
Files changed (24) hide show
  1. package/build/models/eeff/admFinanciera/index.d.ts +3 -0
  2. package/build/models/eeff/calculosAuxiliares.d.ts +1 -0
  3. package/build/strategies/eeff/admFinanciera/aplicacionesHandler.js +21 -6
  4. package/build/strategies/eeff/admFinanciera/index.d.ts +0 -0
  5. package/build/strategies/eeff/admFinanciera/index.js +1 -0
  6. package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.js +14 -7
  7. package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.d.ts +1 -1
  8. package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.js +34 -14
  9. package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.js +7 -7
  10. package/build/strategies/eeff/admFinanciera/utils.d.ts +2 -1
  11. package/build/strategies/eeff/admFinanciera/utils.js +4 -2
  12. package/build/strategies/eeff/calculosAuxiliares.strategy.js +46 -43
  13. package/build/strategies/eeff/deudas/administracionLinea.d.ts +10 -0
  14. package/build/strategies/eeff/deudas/administracionLinea.js +101 -0
  15. package/build/strategies/eeff/deudas/administracionLineaManuales.d.ts +5 -0
  16. package/build/strategies/eeff/deudas/administracionLineaManuales.js +19 -0
  17. package/build/strategies/eeff/deudas/aplicactionesCuadro.d.ts +20 -0
  18. package/build/strategies/eeff/deudas/aplicactionesCuadro.js +136 -0
  19. package/build/strategies/eeff/deudas/deudas.strategy.d.ts +13 -0
  20. package/build/strategies/eeff/deudas/deudas.strategy.js +118 -0
  21. package/build/strategies/eeff/deudas/resumenFinanciamiento.d.ts +31 -0
  22. package/build/strategies/eeff/deudas/resumenFinanciamiento.js +190 -0
  23. package/build/strategies/eeff/supuestos.strategy.js +2 -3
  24. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { Frecuencia, TipoCuota } from '../../../strategies/eeff/admFinanciera/utils';
2
+ import { CalculoAuxiliarCalc } from '../calculosAuxiliares';
2
3
  export type TipoOperacionLeasing = 'LEASING' | 'LEASEBACK';
3
4
  export declare enum TipoDestinoEnum {
4
5
  CapitalInversion = "KI",
@@ -123,6 +124,8 @@ export interface AdministracionFinancieraData {
123
124
  LineasMixtasBDP: Partial<LineaCreditoMixta>[];
124
125
  LineasMixtasOtros: Partial<LineaCreditoMixta>[];
125
126
  ProyeccionPrestamosDirectos: Partial<ProyeccionPrestamo>[];
127
+ CalculosAuxiliaresData: CalculoAuxiliarCalc;
128
+ CorrelativoCalculoAuxiliar: number | null;
126
129
  }
127
130
  export interface AdministracionFinancieraCalcData extends AdministracionFinancieraData {
128
131
  ProyeccionPrestamosBajoLineas: Partial<ProyeccionPrestamo>[];
@@ -29,6 +29,7 @@ export interface Pasivo {
29
29
  }
30
30
  export interface PasivosGestionCalc {
31
31
  Pasivos: Pasivo[];
32
+ IndicadorABM?: 'A' | 'N' | 'M' | 'B';
32
33
  TotalCortoPlazoBLKO?: number;
33
34
  TotalPorcionCPKO?: number;
34
35
  TotalBLMixta?: number;
@@ -44,8 +44,9 @@ class AplicacionesHandler {
44
44
  pr.TipoExistencia === 'NUEVA' &&
45
45
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion).map((pr) => {
46
46
  const proyeccion = {};
47
- if (pr.AnnoProyectadoInicio) {
48
- const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal);
47
+ if (pr.AnnoProyectadoInicio && pr.AnnoProyectadoInicio <= 3) {
48
+ const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal) -
49
+ (0, utils_1.ourParseFloat)(pr.PorcionPagada);
49
50
  proyeccion[`Gestion${pr.AnnoProyectadoInicio}`] = value;
50
51
  filaTotales[`Gestion${pr.AnnoProyectadoInicio}`] =
51
52
  (0, utils_1.ourParseFloat)(filaTotales[`Gestion${pr.AnnoProyectadoInicio}`]) + value;
@@ -61,6 +62,12 @@ class AplicacionesHandler {
61
62
  filaTotales[`Gestion${i}`] =
62
63
  (0, utils_1.ourParseFloat)(filaTotales[`Gestion${i}`]) - (KOBDP + KOOtros);
63
64
  }
65
+ if (this.data.CorrelativoCalculoAuxiliar) {
66
+ const totalPorcionCPKO = this.data.CalculosAuxiliaresData[this.data.CorrelativoCalculoAuxiliar]?.TotalPorcionCPKO;
67
+ filaTotales[`Gestion1`] =
68
+ (0, utils_1.ourParseFloat)(filaTotales[`Gestion1`]) -
69
+ (0, utils_1.ourParseFloat)(totalPorcionCPKO);
70
+ }
64
71
  this.data.ProyeccionAplicaciones.push(...filas, filaTotales);
65
72
  }
66
73
  setKIPrestamoDirecto() {
@@ -72,8 +79,9 @@ class AplicacionesHandler {
72
79
  pr.TipoExistencia === 'NUEVA' &&
73
80
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion).map((pr) => {
74
81
  const proyeccion = {};
75
- if (pr.AnnoProyectadoInicio) {
76
- const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal);
82
+ if (pr.AnnoProyectadoInicio && pr.AnnoProyectadoInicio <= 3) {
83
+ const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal) -
84
+ (0, utils_1.ourParseFloat)(pr.PorcionPagada);
77
85
  proyeccion[`Gestion${pr.AnnoProyectadoInicio}`] = value;
78
86
  filaTotales[`Gestion${pr.AnnoProyectadoInicio}`] =
79
87
  (0, utils_1.ourParseFloat)(filaTotales[`Gestion${pr.AnnoProyectadoInicio}`]) + value;
@@ -94,8 +102,9 @@ class AplicacionesHandler {
94
102
  pr.TipoExistencia === 'NUEVA' &&
95
103
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.Otros).map((pr) => {
96
104
  const proyeccion = {};
97
- if (pr.AnnoProyectadoInicio) {
98
- const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal);
105
+ if (pr.AnnoProyectadoInicio && pr.AnnoProyectadoInicio <= 3) {
106
+ const value = (0, utils_1.ourParseFloat)(pr.MontoOriginal) -
107
+ (0, utils_1.ourParseFloat)(pr.PorcionPagada);
99
108
  proyeccion[`Gestion${pr.AnnoProyectadoInicio}`] = value;
100
109
  filaTotales[`Gestion${pr.AnnoProyectadoInicio}`] =
101
110
  (0, utils_1.ourParseFloat)(filaTotales[`Gestion${pr.AnnoProyectadoInicio}`]) + value;
@@ -196,6 +205,12 @@ class AplicacionesHandler {
196
205
  }
197
206
  i += 4;
198
207
  }
208
+ if (this.data.CorrelativoCalculoAuxiliar) {
209
+ const totalBLMixta = this.data.CalculosAuxiliaresData[this.data.CorrelativoCalculoAuxiliar]?.TotalBLMixta;
210
+ filaTotales[`Gestion1`] =
211
+ (0, utils_1.ourParseFloat)(filaTotales[`Gestion1`]) -
212
+ (0, utils_1.ourParseFloat)(totalBLMixta);
213
+ }
199
214
  this.data.ProyeccionAplicaciones.push(...filas, filaTotales);
200
215
  }
201
216
  }
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -112,30 +112,37 @@ class PrestamoDirectoHandler {
112
112
  }
113
113
  }
114
114
  setPorcionNoCorriente(gestion) {
115
+ const porcionCorriente = this.prestamo.TipoFacilidad == 'VARIABLE'
116
+ ? (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`])
117
+ : (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapital?.[`Gestion${gestion}`]);
115
118
  this.prestamo.PorcionesNoCorrientes[`Gestion${gestion}`] =
116
119
  (0, utils_1.ourParseFloat)(this.prestamo.CuadroEfectoLinea?.[`Gestion${gestion}`]) +
117
120
  (0, utils_1.ourParseFloat)(this.prestamo.CuadroEfectoExposicion?.[`Gestion${gestion}`]) -
118
- (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]);
121
+ porcionCorriente;
119
122
  }
120
123
  setPorcionCuotasPagadas() {
121
124
  let porcion, cuotas;
122
- if (this.prestamo.FechaDesembolso) {
125
+ if (this.prestamo.FechaDesembolso &&
126
+ this.prestamo.AnnoProyectadoInicio) {
123
127
  const pagado = (0, utils_1.calcularPorcionCorrientePagada)({
124
128
  fechaInicial: this.data.InicioProyeccion,
125
129
  fechaDesembolso: this.prestamo.FechaDesembolso,
126
130
  frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
127
- simulador: this.simulador.simulador
131
+ simulador: this.simulador.simulador,
132
+ annoProyectadoInicio: this.prestamo.AnnoProyectadoInicio
128
133
  });
129
134
  porcion = (0, utils_1.ourParseFloat)(pagado.porcionCorrientePagada);
130
135
  cuotas = pagado.cuotasPagadas;
131
136
  if (this.prestamo.TipoFacilidad === 'FIJA') {
132
137
  const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) - (0, utils_1.ourParseFloat)(cuotas);
133
138
  const periodoGracia = dif > 0 ? dif : 0;
139
+ const monto = (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) -
140
+ (0, utils_1.ourParseFloat)(porcion);
141
+ const plazo = (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * 12 -
142
+ (0, utils_1.ourParseFloat)(cuotas);
134
143
  this.simuladorFijo2 = (0, utils_1.simuladorCuotas)({
135
- monto: (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) -
136
- (0, utils_1.ourParseFloat)(porcion),
137
- plazo: (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * 12 -
138
- (0, utils_1.ourParseFloat)(cuotas),
144
+ monto,
145
+ plazo,
139
146
  frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
140
147
  tipoCuota: this.prestamo.TipoFacilidad ?? 'VARIABLE',
141
148
  periodoGracia,
@@ -1,4 +1,4 @@
1
- import { AdministracionFinancieraData, PrestamoLeasing } from "../../../models/eeff/admFinanciera";
1
+ import { AdministracionFinancieraData, PrestamoLeasing } from '../../../models/eeff/admFinanciera';
2
2
  interface HandlerData {
3
3
  data: AdministracionFinancieraData;
4
4
  prestamo: Partial<PrestamoLeasing>;
@@ -9,7 +9,7 @@ const frecuencias = {
9
9
  TRIMESTRAL: 4,
10
10
  CUATRIMESTRAL: 3,
11
11
  SEMESTRAL: 2,
12
- ANUAL: 1,
12
+ ANUAL: 1
13
13
  };
14
14
  class PrestamoLeasingHandler {
15
15
  data;
@@ -56,12 +56,14 @@ class PrestamoLeasingHandler {
56
56
  if (this.prestamo.AnnoProyectadoInicio && this.prestamo.Plazo) {
57
57
  if (gestion >= this.prestamo.AnnoProyectadoInicio) {
58
58
  if (gestion == this.prestamo.AnnoProyectadoInicio) {
59
- this.prestamo.Plazos[`Gestion${gestion}`] = this.prestamo.Plazo;
59
+ this.prestamo.Plazos[`Gestion${gestion}`] =
60
+ this.prestamo.Plazo;
60
61
  }
61
62
  else {
62
63
  const anterior = (0, utils_1.ourParseFloat)(this.prestamo.Plazos?.[`Gestion${gestion - 1}`]);
63
64
  if (anterior > 1) {
64
- this.prestamo.Plazos[`Gestion${gestion}`] = anterior - 1;
65
+ this.prestamo.Plazos[`Gestion${gestion}`] =
66
+ anterior - 1;
65
67
  }
66
68
  }
67
69
  }
@@ -75,7 +77,8 @@ class PrestamoLeasingHandler {
75
77
  value = frecuencia;
76
78
  }
77
79
  else if (this.prestamo.AnnoProyectadoInicio <= gestion) {
78
- value = (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + frecuencia;
80
+ value =
81
+ (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + frecuencia;
79
82
  }
80
83
  }
81
84
  this.prestamo.PlazosMultiplicados[`Gestion${gestion}`] = value;
@@ -98,7 +101,8 @@ class PrestamoLeasingHandler {
98
101
  }
99
102
  else {
100
103
  if (añoProyectadoInicio < gestion) {
101
- periodoInicial = (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + 1;
104
+ periodoInicial =
105
+ (0, utils_1.ourParseFloat)(this.prestamo.PlazosMultiplicados?.[`Gestion${gestion - 1}`]) + 1;
102
106
  }
103
107
  value = (0, utils_1.calcularPagoPrincipalEntre)({
104
108
  tasaPeriodica,
@@ -115,10 +119,14 @@ class PrestamoLeasingHandler {
115
119
  periodoFinal
116
120
  });
117
121
  }
118
- this.prestamo.AmortizacionesCapital[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(value);
119
- this.prestamo.AmortizacionesInteres[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(valueInteres);
122
+ this.prestamo.AmortizacionesCapital[`Gestion${gestion}`] =
123
+ (0, utils_1.ourParseFloat)(value);
124
+ this.prestamo.AmortizacionesInteres[`Gestion${gestion}`] =
125
+ (0, utils_1.ourParseFloat)(valueInteres);
120
126
  }
121
- this.prestamo.AmortizacionesCapitalFinal[`Gestion${gestion}`] = (0, utils_1.ourParseFloat)(value) + (0, utils_1.ourParseFloat)(this.getGeneracionValorResidual(gestion));
127
+ this.prestamo.AmortizacionesCapitalFinal[`Gestion${gestion}`] =
128
+ (0, utils_1.ourParseFloat)(value) +
129
+ (0, utils_1.ourParseFloat)(this.getGeneracionValorResidual(gestion));
122
130
  }
123
131
  getGeneracionValorResidual(gestion) {
124
132
  if ((0, utils_1.ourParseFloat)(this.prestamo.Plazos[`Gestion${gestion}`]) == 1) {
@@ -133,7 +141,8 @@ class PrestamoLeasingHandler {
133
141
  if (this.prestamo.TipoOperacion2 === admFinanciera_1.TipoOperacionExistencia.Antigua) {
134
142
  index++;
135
143
  }
136
- const porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalFinal?.[`Gestion${index}`]) + (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesInteres?.[`Gestion${index}`]);
144
+ const porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalFinal?.[`Gestion${index}`]) +
145
+ (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesInteres?.[`Gestion${index}`]);
137
146
  this.prestamo.PorcionesCorrientes[`Gestion${i}`] = porcionCorriente;
138
147
  const plazo = (0, utils_1.ourParseFloat)(this.prestamo.Plazos?.[`Gestion${i}`]);
139
148
  if (plazo && this.prestamo.TipoAmortizacion) {
@@ -141,21 +150,32 @@ class PrestamoLeasingHandler {
141
150
  const frecuencia = frecuencias[this.prestamo.TipoAmortizacion];
142
151
  const cuotaPeriodo = (0, utils_1.ourParseFloat)(this.prestamo.MontoCuotaPeriodo);
143
152
  const valorResidual = (0, utils_1.ourParseFloat)(this.prestamo.MontoValorResidual);
144
- if (this.prestamo.TipoOperacion2 === admFinanciera_1.TipoOperacionExistencia.Antigua) {
153
+ if (this.prestamo.TipoOperacion2 ===
154
+ admFinanciera_1.TipoOperacionExistencia.Antigua) {
145
155
  if (plazo > 1) {
146
- value = ((plazo - 1) * cuotaPeriodo * frecuencia + valorResidual) - porcionCorriente;
156
+ value =
157
+ (plazo - 1) * cuotaPeriodo * frecuencia +
158
+ valorResidual -
159
+ porcionCorriente;
147
160
  }
148
161
  }
149
162
  else {
150
- value = (plazo * cuotaPeriodo * frecuencia + valorResidual) - porcionCorriente;
163
+ value =
164
+ plazo * cuotaPeriodo * frecuencia +
165
+ valorResidual -
166
+ porcionCorriente;
151
167
  }
152
- this.prestamo.PorcionesNoCorrientes[`Gestion${i}`] = (0, utils_1.ourParseFloat)(value);
168
+ this.prestamo.PorcionesNoCorrientes[`Gestion${i}`] =
169
+ (0, utils_1.ourParseFloat)(value);
153
170
  }
154
171
  }
155
172
  }
156
173
  setActivacionOperacion() {
157
174
  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);
175
+ this.prestamo.ActivacionOperacion =
176
+ (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) +
177
+ (0, utils_1.ourParseFloat)(this.prestamo.MontoAporteInicial) +
178
+ (0, utils_1.ourParseFloat)(this.prestamo.MontoValorResidual);
159
179
  }
160
180
  }
161
181
  }
@@ -111,7 +111,7 @@ class ProyeccionPrestamosDirectosHandler {
111
111
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion &&
112
112
  pr.EsNuestroBanco);
113
113
  const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
114
- (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
114
+ (0, utils_1.ourParseFloat)(curr.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]), 0));
115
115
  fila[`Gestion${gestion}`] = sumaGestion;
116
116
  filaTotalesCPBDP[`Gestion${gestion}`] =
117
117
  (0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
@@ -123,7 +123,7 @@ class ProyeccionPrestamosDirectosHandler {
123
123
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion &&
124
124
  pr.EsNuestroBanco);
125
125
  const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
126
- (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
126
+ (0, utils_1.ourParseFloat)(curr.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]), 0));
127
127
  fila[`Gestion${gestion}`] = sumaGestion;
128
128
  filaTotalesCPBDP[`Gestion${gestion}`] =
129
129
  (0, utils_1.ourParseFloat)(filaTotalesCPBDP[`Gestion${gestion}`]) + sumaGestion;
@@ -135,7 +135,7 @@ class ProyeccionPrestamosDirectosHandler {
135
135
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalOperacion &&
136
136
  !pr.EsNuestroBanco);
137
137
  const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
138
- (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
138
+ (0, utils_1.ourParseFloat)(curr.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]), 0));
139
139
  fila[`Gestion${gestion}`] = sumaGestion;
140
140
  filaTotalesCPOtras[`Gestion${gestion}`] =
141
141
  (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
@@ -147,7 +147,7 @@ class ProyeccionPrestamosDirectosHandler {
147
147
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.CapitalInversion &&
148
148
  !pr.EsNuestroBanco);
149
149
  const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
150
- (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
150
+ (0, utils_1.ourParseFloat)(curr.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]), 0));
151
151
  fila[`Gestion${gestion}`] = sumaGestion;
152
152
  filaTotalesCPOtras[`Gestion${gestion}`] =
153
153
  (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
@@ -159,7 +159,7 @@ class ProyeccionPrestamosDirectosHandler {
159
159
  pr.DestinoOperacionId === admFinanciera_1.TipoDestinoEnum.Otros &&
160
160
  !pr.EsNuestroBanco);
161
161
  const sumaGestion = (0, utils_1.ourParseFloat)(prestamosFiltrados.reduce((acc, curr) => acc +
162
- (0, utils_1.ourParseFloat)(curr.AmortizacionesCapital?.[`Gestion${gestion}`]), 0));
162
+ (0, utils_1.ourParseFloat)(curr.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]), 0));
163
163
  fila[`Gestion${gestion}`] = sumaGestion;
164
164
  filaTotalesCPOtras[`Gestion${gestion}`] =
165
165
  (0, utils_1.ourParseFloat)(filaTotalesCPOtras[`Gestion${gestion}`]) + sumaGestion;
@@ -264,9 +264,9 @@ class ProyeccionPrestamosDirectosHandler {
264
264
  (0, utils_1.ourParseFloat)(curr.AmortizacionesInteres?.[`Gestion${gestion}`]), 0));
265
265
  const totalPagoCostosFinancieros = this.data.ProyeccionPrestamosBajoLineas.find((p) => p.Clasificador == 'T')?.[`Gestion${gestion}`];
266
266
  const totalGastosFinancieroBDP = this.data.LineasMixtasBDP.find((p) => p.Clasificador == 'T' &&
267
- p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
267
+ p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion}`];
268
268
  const totalGastosFinancieroOtros = this.data.LineasMixtasOtros.find((p) => p.Clasificador == 'T' &&
269
- p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion + 1}`];
269
+ p.RubroId == admFinanciera_1.rubros.lineasMixtas.gastosFinancierosYComisiones)?.[`Gestion${gestion}`];
270
270
  const costosMasGastos = (0, utils_1.ourParseFloat)(totalPagoCostosFinancieros) +
271
271
  (0, utils_1.ourParseFloat)(totalGastosFinancieroBDP) +
272
272
  (0, utils_1.ourParseFloat)(totalGastosFinancieroOtros);
@@ -42,8 +42,9 @@ interface CalcularPorcionCorrienteParams {
42
42
  fechaDesembolso: string;
43
43
  fechaInicial: string;
44
44
  frecuencia: Frecuencia;
45
+ annoProyectadoInicio: number;
45
46
  }
46
- export declare function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador }: CalcularPorcionCorrienteParams): ResultadoPorcionPagada;
47
+ export declare function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador, annoProyectadoInicio }: CalcularPorcionCorrienteParams): ResultadoPorcionPagada;
47
48
  export declare function ourParseFloat(num: any, round?: boolean): number;
48
49
  /**
49
50
  * Calcula la tasa de interés periódica (similar a la función TASA de Excel).
@@ -88,8 +88,10 @@ function simuladorCuotas({ monto, plazo, frecuencia, tipoCuota, periodoGracia =
88
88
  return { simulador: cuotas, pagosAnuales };
89
89
  }
90
90
  exports.simuladorCuotas = simuladorCuotas;
91
- function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador }) {
92
- const inicial = getDateTime(fechaInicial).endOf('month');
91
+ function calcularPorcionCorrientePagada({ fechaDesembolso, fechaInicial, frecuencia, simulador, annoProyectadoInicio }) {
92
+ let inicial = getDateTime(fechaInicial).endOf('month');
93
+ if (annoProyectadoInicio)
94
+ inicial = inicial.plus({ years: annoProyectadoInicio - 1 });
93
95
  const desembolso = getDateTime(fechaDesembolso).endOf('month');
94
96
  const mesesPorFrecuencia = exports.frecuenciaMeses[frecuencia];
95
97
  const mesesTranscurridos = inicial.diff(desembolso, 'months').months;
@@ -13,49 +13,52 @@ class CalculosAuxiliaresStrategy {
13
13
  calculate(data) {
14
14
  const copy = (0, lodash_1.cloneDeep)(data);
15
15
  Object.values(copy).forEach((data) => {
16
- const active = data.Pasivos.filter((el) => el.IndicadorABM !== 'B');
17
- data.TotalCortoPlazoBLKO = active
18
- .filter((el) => el.DestinoOperacionId === calculosAuxiliares_1.ValoresDestino['B/L KO'])
19
- .reduce((acc, curr) => {
20
- return acc + this.getValue(curr.CortoPlazo);
21
- }, 0);
22
- data.TotalPorcionCPKO = active
23
- .filter((el) => el.DestinoOperacionId === calculosAuxiliares_1.ValoresDestino.KO)
24
- .reduce((acc, curr) => {
25
- return acc + this.getValue(curr.PorcionCP);
26
- }, 0);
27
- data.TotalBLMixta = active
28
- .filter((el) => el.DestinoOperacionId === calculosAuxiliares_1.ValoresDestino['B/L Mixta'])
29
- .reduce((acc, curr) => {
30
- return (acc +
31
- this.getValue(curr.PorcionLP) +
32
- this.getValue(curr.CortoPlazo));
33
- }, 0);
34
- data.TotalDeudasDirectasKIyKO = active
35
- .filter((el) => [calculosAuxiliares_1.ValoresDestino.KI, calculosAuxiliares_1.ValoresDestino.KO].includes(el.DestinoOperacionId))
36
- .reduce((acc, curr) => {
37
- return acc + this.getValue(curr.MontoOriginal);
38
- }, 0);
39
- data.TotalPorcionCPBDP = active
40
- .filter((el) => el.EsNuestroBanco)
41
- .reduce((acc, curr) => {
42
- return acc + this.getValue(curr.PorcionCP);
43
- }, 0);
44
- data.TotalPorcionCPOtros = active
45
- .filter((el) => !el.EsNuestroBanco)
46
- .reduce((acc, curr) => {
47
- return acc + this.getValue(curr.PorcionCP);
48
- }, 0);
49
- data.TotalPorcionLPBDP = active
50
- .filter((el) => el.EsNuestroBanco)
51
- .reduce((acc, curr) => {
52
- return acc + this.getValue(curr.PorcionLP);
53
- }, 0);
54
- data.TotalPorcionLPOtros = active
55
- .filter((el) => !el.EsNuestroBanco)
56
- .reduce((acc, curr) => {
57
- return acc + this.getValue(curr.PorcionLP);
58
- }, 0);
16
+ if (data.IndicadorABM !== 'B') {
17
+ const active = data.Pasivos.filter((el) => el.IndicadorABM !== 'B');
18
+ data.TotalCortoPlazoBLKO = active
19
+ .filter((el) => el.DestinoOperacionId === calculosAuxiliares_1.ValoresDestino['B/L KO'])
20
+ .reduce((acc, curr) => {
21
+ return acc + this.getValue(curr.CortoPlazo);
22
+ }, 0);
23
+ data.TotalPorcionCPKO = active
24
+ .filter((el) => el.DestinoOperacionId === calculosAuxiliares_1.ValoresDestino.KO)
25
+ .reduce((acc, curr) => {
26
+ return acc + this.getValue(curr.PorcionCP);
27
+ }, 0);
28
+ data.TotalBLMixta = active
29
+ .filter((el) => el.DestinoOperacionId ===
30
+ calculosAuxiliares_1.ValoresDestino['B/L Mixta'])
31
+ .reduce((acc, curr) => {
32
+ return (acc +
33
+ this.getValue(curr.PorcionLP) +
34
+ this.getValue(curr.CortoPlazo));
35
+ }, 0);
36
+ data.TotalDeudasDirectasKIyKO = active
37
+ .filter((el) => [calculosAuxiliares_1.ValoresDestino.KI, calculosAuxiliares_1.ValoresDestino.KO].includes(el.DestinoOperacionId))
38
+ .reduce((acc, curr) => {
39
+ return acc + this.getValue(curr.MontoOriginal);
40
+ }, 0);
41
+ data.TotalPorcionCPBDP = active
42
+ .filter((el) => el.EsNuestroBanco)
43
+ .reduce((acc, curr) => {
44
+ return acc + this.getValue(curr.PorcionCP);
45
+ }, 0);
46
+ data.TotalPorcionCPOtros = active
47
+ .filter((el) => !el.EsNuestroBanco)
48
+ .reduce((acc, curr) => {
49
+ return acc + this.getValue(curr.PorcionCP);
50
+ }, 0);
51
+ data.TotalPorcionLPBDP = active
52
+ .filter((el) => el.EsNuestroBanco)
53
+ .reduce((acc, curr) => {
54
+ return acc + this.getValue(curr.PorcionLP);
55
+ }, 0);
56
+ data.TotalPorcionLPOtros = active
57
+ .filter((el) => !el.EsNuestroBanco)
58
+ .reduce((acc, curr) => {
59
+ return acc + this.getValue(curr.PorcionLP);
60
+ }, 0);
61
+ }
59
62
  });
60
63
  return copy;
61
64
  }
@@ -0,0 +1,10 @@
1
+ export default class AdministacionLineas {
2
+ private deudas;
3
+ private lineas;
4
+ constructor(deudas: any, lineas: any);
5
+ getNewDeudas(): any;
6
+ private getLineasXRubro;
7
+ private getLineasXRubro2;
8
+ private mapDataToLineas;
9
+ private getInitLinea;
10
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class AdministacionLineas {
4
+ deudas;
5
+ lineas;
6
+ constructor(deudas, lineas) {
7
+ this.deudas = deudas;
8
+ this.lineas = lineas || [];
9
+ }
10
+ getNewDeudas() {
11
+ let result = [];
12
+ result.push(...this.getLineasXRubro('ACT_DEU_71001', 'ACT_DEU_41000', 'ACT_DEU_41001', 'ACT_DEU_41002', 'ACT_DEU_41003'));
13
+ result.push(...this.getLineasXRubro('ACT_DEU_71002', 'ACT_DEU_20000', 'ACT_DEU_20001', 'ACT_DEU_20002', 'ACT_DEU_20003'));
14
+ result.push(...this.getLineasXRubro2('ACT_DEU_71003', 'ACT_DEU_50001'));
15
+ return result;
16
+ }
17
+ //@ts-ignore
18
+ getLineasXRubro(definition, rubroId, rubroId2, rubroId3, rubroId4) {
19
+ const secuencias = this.deudas.filter((item) => (item.RubroId === rubroId ||
20
+ item.RubroId === rubroId2 ||
21
+ item.RubroId === rubroId3 ||
22
+ item.RubroId === rubroId4)).
23
+ reduce((acc, item) => {
24
+ if (!acc.has(`${item.Secuencia}`))
25
+ acc.set(`${item.Secuencia}`, [item]);
26
+ else
27
+ acc.get(`${item.Secuencia}`).push(item);
28
+ return acc;
29
+ }, new Map());
30
+ let result = [];
31
+ for (const [key, items] of secuencias) {
32
+ let linea = this.getInitLinea();
33
+ linea.uuid = `${definition}_${key}`;
34
+ linea.rubroId = definition;
35
+ linea.entidad = items.find((item) => item.RubroId === rubroId)?.Descripcion || '';
36
+ const monto1 = items.find((item) => item.RubroId === rubroId2)?.Monto1 || 0;
37
+ const monto2 = items.find((item) => item.RubroId === rubroId3)?.Monto1 || 0;
38
+ linea.monto = Math.round(parseFloat(monto1) + parseFloat(monto2) * 100) / 100;
39
+ linea = this.mapDataToLineas(linea);
40
+ linea.saldo = linea.monto - linea.usado;
41
+ result.push(linea);
42
+ }
43
+ return result;
44
+ }
45
+ //@ts-ignore
46
+ getLineasXRubro2(definition, rubroId) {
47
+ const secuencias = this.deudas.filter((item) => (item.RubroId === rubroId)).
48
+ reduce((acc, item) => {
49
+ if (!acc.has(`${item.Secuencia}`))
50
+ acc.set(`${item.Secuencia}`, [item]);
51
+ else
52
+ acc.get(`${item.Secuencia}`).push(item);
53
+ return acc;
54
+ }, new Map());
55
+ let result = [];
56
+ for (const [key, items] of secuencias) {
57
+ let linea = this.getInitLinea();
58
+ linea.uuid = `${definition}_${key}`;
59
+ linea.rubroId = definition;
60
+ linea.entidad = items.find((item) => item.RubroId === rubroId)?.Descripcion || '';
61
+ const monto1 = items.find((item) => item.RubroId === rubroId)?.Monto1 || 0;
62
+ const monto2 = items.find((item) => item.RubroId === rubroId)?.Monto1 || 0;
63
+ linea.monto = Math.round(parseFloat(monto1) + parseFloat(monto2) * 100) / 100;
64
+ linea = this.mapDataToLineas(linea);
65
+ linea.saldo = linea.monto - linea.usado;
66
+ linea.interes = Math.round(linea.montoConVenc * linea.interes / 100 * 100) / 100;
67
+ result.push(linea);
68
+ }
69
+ return result;
70
+ }
71
+ mapDataToLineas(linea) {
72
+ linea.estado = this.lineas.find((item) => item.uuid === linea.uuid)?.estado || null;
73
+ linea.destino = this.lineas.find((item) => item.uuid === linea.uuid)?.destino || null;
74
+ linea.usado = this.lineas.find((item) => item.uuid === linea.uuid)?.usado || null;
75
+ linea.fechaVenc = this.lineas.find((item) => item.uuid === linea.uuid)?.fechaVenc || null;
76
+ linea.montoConVenc = this.lineas.find((item) => item.uuid === linea.uuid)?.montoConVenc || null;
77
+ linea.tasa = this.lineas.find((item) => item.uuid === linea.uuid)?.tasa || null;
78
+ linea.interes = this.lineas.find((item) => item.uuid === linea.uuid)?.interes || null;
79
+ linea.montoConVenc = Math.round(parseFloat(linea.montoConVenc) * 100) / 100;
80
+ linea.tasa = Math.round(parseFloat(linea.tasa) * 100) / 100;
81
+ linea.interes = Math.round(parseFloat(linea.interes) * 100) / 100;
82
+ return linea;
83
+ }
84
+ getInitLinea() {
85
+ return {
86
+ uuid: '',
87
+ entidad: null,
88
+ destino: null,
89
+ estado: '',
90
+ monto: 0,
91
+ usado: 0,
92
+ saldo: 0,
93
+ fechaVenc: '',
94
+ detalle: 0,
95
+ montoConVenc: 0,
96
+ tasa: 0,
97
+ interes: 0
98
+ };
99
+ }
100
+ }
101
+ exports.default = AdministacionLineas;
@@ -0,0 +1,5 @@
1
+ export default class AdministracionLineasManuales {
2
+ private lineas;
3
+ constructor(lineas: any);
4
+ getLineasManuales(): any;
5
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class AdministracionLineasManuales {
4
+ lineas;
5
+ constructor(lineas) {
6
+ this.lineas = lineas || [];
7
+ }
8
+ getLineasManuales() {
9
+ if (this.lineas && this.lineas.length > 0) {
10
+ for (let linea of this.lineas) {
11
+ linea.monto = Math.round(parseFloat(linea.monto) * 100) / 100;
12
+ linea.usado = Math.round(parseFloat(linea.usado) * 100) / 100;
13
+ linea.saldo = linea.monto - linea.usado;
14
+ }
15
+ }
16
+ return this.lineas;
17
+ }
18
+ }
19
+ exports.default = AdministracionLineasManuales;
@@ -0,0 +1,20 @@
1
+ export default class AplicacionesCuadroAlternativo {
2
+ private deudas;
3
+ private proyecta;
4
+ private calculoAuxiliar1;
5
+ private calculoAuxiliar2;
6
+ private result;
7
+ private admLineas;
8
+ private resumenFinanciamiento;
9
+ private cantidadProyeccion;
10
+ constructor(deudas: any, cantidadProyeccion: number, proyecta: boolean, admLineas: any, resumenFinanciamiento: any, calculoAuxiliar1: number, calculoAuxiliar2: number);
11
+ getCalculation(): void;
12
+ private addMontos;
13
+ caculate001(row: any): void;
14
+ private calculateCustom;
15
+ private caculate002;
16
+ private caculate003;
17
+ private caculate004;
18
+ private caculate005;
19
+ private caculate006;
20
+ }
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class AplicacionesCuadroAlternativo {
4
+ ///@ts-ignore
5
+ deudas;
6
+ proyecta;
7
+ calculoAuxiliar1;
8
+ calculoAuxiliar2;
9
+ result;
10
+ admLineas;
11
+ resumenFinanciamiento;
12
+ cantidadProyeccion;
13
+ constructor(deudas, cantidadProyeccion, proyecta, admLineas, resumenFinanciamiento, calculoAuxiliar1, calculoAuxiliar2) {
14
+ this.deudas = deudas;
15
+ this.proyecta = proyecta;
16
+ this.calculoAuxiliar1 = calculoAuxiliar1;
17
+ this.calculoAuxiliar2 = calculoAuxiliar2;
18
+ this.admLineas = admLineas;
19
+ this.cantidadProyeccion = cantidadProyeccion;
20
+ this.resumenFinanciamiento = resumenFinanciamiento;
21
+ this.result = [];
22
+ }
23
+ getCalculation() {
24
+ this.result.push({ id: 'ACT_DEU_76001', grupo: 'TOTAL', descripction: 'KO - Línea de Crédito 100% KO' });
25
+ this.result.push({ id: 'ACT_DEU_76002', grupo: 'TOTAL', descripction: 'KO - Prestamo Directo' });
26
+ this.result.push({ id: 'ACT_DEU_76003', grupo: 'TOTAL', descripction: 'KI - Prestamo Directo' });
27
+ this.result.push({ id: 'ACT_DEU_76004', grupo: 'TOTAL', descripction: 'OTROS - Pagares, Bonos, Etc.' });
28
+ this.result.push({ id: 'ACT_DEU_76005', grupo: 'TOTAL', descripction: 'KI - Leasing Financiero' });
29
+ this.result.push({ id: 'ACT_DEU_76006', grupo: 'TOTAL', descripction: 'KI - KO - Línea de Crédito Mixta' });
30
+ for (const row in this.result) {
31
+ this.caculate001(row);
32
+ this.caculate002(row);
33
+ this.caculate003(row);
34
+ this.caculate004(row);
35
+ this.caculate005(row);
36
+ this.caculate006(row);
37
+ }
38
+ }
39
+ addMontos(row) {
40
+ for (let i = 1; i <= this.cantidadProyeccion; i++) {
41
+ row[`Monto${i}`] = 0;
42
+ }
43
+ }
44
+ caculate001(row) {
45
+ this.addMontos(row);
46
+ const filterLineas = this.admLineas.filter((item) => item.rubroId = 'ACT_DEU_71003');
47
+ for (let item of filterLineas) {
48
+ let nuevo = {};
49
+ nuevo.id = row.id;
50
+ nuevo.grupo = item.uuid;
51
+ nuevo.descripction = item.entidad;
52
+ if (item.estado == 'EXISTENTE')
53
+ nuevo.Monto1 = parseFloat(item.saldo);
54
+ else
55
+ nuevo.Monto1 = parseFloat(item.monto);
56
+ row.Monto1 += nuevo.Monto1;
57
+ for (let i = 2; i <= this.cantidadProyeccion; i++) {
58
+ const codes = item.uuid.split('_');
59
+ const deudaLinea = this.deudas.find((item) => (item.RubroId == 'ACT_DEU_50001'
60
+ && item.Secuencia == parseInt(codes[1])));
61
+ nuevo[`Monto${i}`] = deudaLinea[`Monto${i}`] - deudaLinea[`Monto${i - 1}`];
62
+ nuevo[`Monto${i}`] = Math.round(parseFloat(nuevo[`Monto${i}`]) * 100) / 100;
63
+ this.result.push(nuevo);
64
+ row[`Monto${i}`] += nuevo[`Monto${i}`];
65
+ }
66
+ }
67
+ }
68
+ calculateCustom(row, rubros, destino) {
69
+ this.addMontos(row);
70
+ for (let rubro in rubros) {
71
+ const filtered = this.deudas.filter((item) => (item.RubroId == rubro[0] && item.Destino == destino));
72
+ for (const debt of filtered) {
73
+ const companion = this.deudas.find((item) => (item.RubroId == rubro[1] && item.Secuencia == debt.Secuencia
74
+ && item.Operacion == 'NUEVA'));
75
+ let nuevo = {};
76
+ nuevo.id = row.id;
77
+ nuevo.grupo = debt.UUID;
78
+ nuevo.descripction = debt.Descripcion;
79
+ for (let i = 1; i <= this.cantidadProyeccion; i++) {
80
+ if (i == 1 || (i > 1 && parseFloat(debt[`Monto${i - 1}`]) + parseFloat(companion[`Monto${i - 1}`]) == 0)) {
81
+ nuevo[`Monto${i}`] = parseFloat(debt[`Monto${i}`]) + parseFloat(companion[`Monto${i}`]);
82
+ nuevo[`Monto${i}`] = Math.round(parseFloat(nuevo[`Monto${i}`]) * 100) / 100;
83
+ }
84
+ row[`Monto${i}`] += nuevo[`Monto${i}`];
85
+ }
86
+ }
87
+ }
88
+ }
89
+ caculate002(row) {
90
+ this.calculateCustom(row, [['ACT_DEU_10001', 'ACT_DEU_10002'], ['ACT_DEU_40001', 'ACT_DEU_40002']], 'KO');
91
+ if (this.proyecta)
92
+ row.Monto1 = row.Monto1 - this.calculoAuxiliar1;
93
+ const koPorcionBDP = this.resumenFinanciamiento.find((item) => item.id == 'ACT_DEU_75001');
94
+ const kiPorcionBDP = this.resumenFinanciamiento.find((item) => item.id == 'ACT_DEU_75002');
95
+ for (let i = 2; i <= this.cantidadProyeccion; i++) {
96
+ row[`Monto${i}`] = row[`Monto${i}`] - (koPorcionBDP[`Monto${i}`] + kiPorcionBDP[`Monto${i}`]);
97
+ }
98
+ }
99
+ caculate003(row) {
100
+ this.calculateCustom(row, [['ACT_DEU_10001', 'ACT_DEU_10002'], ['ACT_DEU_40001', 'ACT_DEU_40002']], 'KI');
101
+ }
102
+ caculate004(row) {
103
+ this.calculateCustom(row, [['ACT_DEU_10001', 'ACT_DEU_10002']], 'OTROS');
104
+ }
105
+ caculate005(row) {
106
+ this.calculateCustom(row, [['ACT_DEU_30001', 'ACT_DEU_30002']], 'KI');
107
+ }
108
+ caculate006(row) {
109
+ this.addMontos(row);
110
+ const rubros = [['ACT_DEU_41001', 'ACT_DEU_41002'], ['ACT_DEU_20001', 'ACT_DEU_20002']];
111
+ for (let rubro in rubros) {
112
+ const filtered = this.deudas.filter((item) => (item.RubroId == rubro[0]));
113
+ for (const debt of filtered) {
114
+ const companion = this.deudas.find((item) => (item.RubroId == rubro[1] && item.Secuencia == debt.Secuencia
115
+ && item.Operacion == 'NUEVA'));
116
+ let nuevo = {};
117
+ nuevo.id = row.id;
118
+ nuevo.grupo = debt.UUID;
119
+ nuevo.descripction = debt.Descripcion;
120
+ for (let i = 1; i <= this.cantidadProyeccion; i++) {
121
+ if (i == 1) {
122
+ nuevo[`Monto${i}`] = parseFloat(debt[`Monto${i}`]) + parseFloat(companion[`Monto${i}`]);
123
+ }
124
+ if (i > 1) {
125
+ nuevo[`Monto${i}`] = (parseFloat(companion[`Monto${i}`]) - parseFloat(companion[`Monto${i - 1}`])) + parseFloat(debt[`Monto${i}`]);
126
+ }
127
+ nuevo[`Monto${i}`] = Math.round(parseFloat(nuevo[`Monto${i}`]) * 100) / 100;
128
+ row[`Monto${i}`] += nuevo[`Monto${i}`];
129
+ }
130
+ }
131
+ }
132
+ if (this.proyecta)
133
+ row.Monto1 = row.Monto1 - this.calculoAuxiliar2;
134
+ }
135
+ }
136
+ exports.default = AplicacionesCuadroAlternativo;
@@ -0,0 +1,13 @@
1
+ import { Strategy } from "../../../strategy.interface";
2
+ export default class DeudasStrategy implements Strategy {
3
+ data: any;
4
+ constructor();
5
+ cleanNumber: (data: any) => number;
6
+ calcularDeuda(params: any): void;
7
+ calcularDeudaFilaPorcentaje(params: any): void;
8
+ calcularDeudaGridLinea(params: any): void;
9
+ sumarizador(params: any): any;
10
+ execute(data: any): any;
11
+ getAdministracionLineas(admLineas: any): any;
12
+ getAdministracionLineasManuales(lineasManuales: any): any;
13
+ }
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const administracionLinea_1 = __importDefault(require("./administracionLinea"));
7
+ const administracionLineaManuales_1 = __importDefault(require("./administracionLineaManuales"));
8
+ class DeudasStrategy {
9
+ data;
10
+ constructor() {
11
+ this.data = {};
12
+ }
13
+ cleanNumber = (data) => {
14
+ if (!data)
15
+ return 0;
16
+ else
17
+ return Math.round(parseFloat(data) * 100) / 100;
18
+ };
19
+ calcularDeuda(params) {
20
+ let i = 1;
21
+ do {
22
+ let row1 = this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i);
23
+ let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == i);
24
+ let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == i);
25
+ for (let j = 1; j <= this.data.CantidadProyeccion; j++) {
26
+ if (row3[`Monto${j}`] == 0) {
27
+ row3[`Monto${j}`] = (this.cleanNumber(row1[`Monto${j}`]) + this.cleanNumber(row2[`Monto${j}`])) * this.cleanNumber(row3.Variable) / 100;
28
+ row3[`Monto${j}`] = Math.round(row3[`Monto${j}`] * 100) / 100;
29
+ }
30
+ }
31
+ i++;
32
+ } while (this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i));
33
+ }
34
+ calcularDeudaFilaPorcentaje(params) {
35
+ let i = 1;
36
+ do {
37
+ let row1 = this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i);
38
+ let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == i);
39
+ let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == i);
40
+ for (let j = 1; j <= this.data.CantidadProyeccion; j++) {
41
+ if (row3[`Monto${j}`] == 0) {
42
+ row3[`Monto${j}`] = (this.cleanNumber(row1[`Monto${j}`]) * this.cleanNumber(row2[`Monto${j}`]) / 100);
43
+ row3[`Monto${j}`] = Math.round(row3[`Monto${j}`] * 100) / 100;
44
+ }
45
+ }
46
+ i++;
47
+ } while (this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i));
48
+ }
49
+ calcularDeudaGridLinea(params) {
50
+ let rows1 = this.data.Deudas.filter((item) => item.RubroId == params.rubro1);
51
+ let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == 1);
52
+ let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == 1);
53
+ //sumarizando
54
+ let row1 = rows1.reduce((sum, item) => {
55
+ if (!sum)
56
+ sum = { ...item };
57
+ else {
58
+ for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
59
+ sum[`Monto${i}`] = this.cleanNumber(sum[`Monto${i}`]) + this.cleanNumber(item[`Monto${i}`]);
60
+ }
61
+ }
62
+ return sum;
63
+ }, null);
64
+ for (let j = 2; j <= this.data.CantidadProyeccion; j++) {
65
+ if (row3[`Monto${j}`] == 0) {
66
+ row3[`Monto${j}`] = (this.cleanNumber(row1[`Monto${j - 1}`]) * this.cleanNumber(row2[`Monto${j - 1}`]) / 100);
67
+ row3[`Monto${j}`] = Math.round(row3[`Monto${j}`] * 100) / 100;
68
+ }
69
+ }
70
+ }
71
+ sumarizador(params) {
72
+ let destino = this.data.Deudas.find((item) => item.RubroId == params.rubro2);
73
+ this.data.Deudas.filter((item) => item.RubroId == params.rubro1).reduce((sum, item) => {
74
+ if (!sum)
75
+ sum = { ...item };
76
+ else {
77
+ for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
78
+ sum[`Monto${i}`] = this.cleanNumber(sum[`Monto${i}`]) + this.cleanNumber(item[`Monto${i}`]);
79
+ destino[`Monto${i}`] = sum[`Monto${i}`];
80
+ }
81
+ }
82
+ return sum;
83
+ }, null);
84
+ return destino;
85
+ }
86
+ execute(data) {
87
+ this.data = data;
88
+ this.calcularDeuda({ rubro1: 'ACT_DEU_10001', rubro2: 'ACT_DEU_10002', rubro3: 'ACT_DEU_10003' });
89
+ this.sumarizador({ rubro1: 'ACT_DEU_10001', rubro2: 'ACT_DEU_10100' });
90
+ this.sumarizador({ rubro1: 'ACT_DEU_10002', rubro2: 'ACT_DEU_10200' });
91
+ this.sumarizador({ rubro1: 'ACT_DEU_10003', rubro2: 'ACT_DEU_10300' });
92
+ this.calcularDeuda({ rubro1: 'ACT_DEU_20001', rubro2: 'ACT_DEU_20002', rubro3: 'ACT_DEU_20003' });
93
+ this.sumarizador({ rubro1: 'ACT_DEU_20001', rubro2: 'ACT_DEU_20100' });
94
+ this.sumarizador({ rubro1: 'ACT_DEU_20002', rubro2: 'ACT_DEU_20200' });
95
+ this.sumarizador({ rubro1: 'ACT_DEU_20003', rubro2: 'ACT_DEU_20300' });
96
+ this.calcularDeuda({ rubro1: 'ACT_DEU_30001', rubro2: 'ACT_DEU_30002', rubro3: 'ACT_DEU_30003' });
97
+ this.sumarizador({ rubro1: 'ACT_DEU_30001', rubro2: 'ACT_DEU_30100' });
98
+ this.sumarizador({ rubro1: 'ACT_DEU_30002', rubro2: 'ACT_DEU_30200' });
99
+ this.sumarizador({ rubro1: 'ACT_DEU_30003', rubro2: 'ACT_DEU_30300' });
100
+ this.calcularDeuda({ rubro1: 'ACT_DEU_40001', rubro2: 'ACT_DEU_40002', rubro3: 'ACT_DEU_40003' });
101
+ this.sumarizador({ rubro1: 'ACT_DEU_40001', rubro2: 'ACT_DEU_40100' });
102
+ this.sumarizador({ rubro1: 'ACT_DEU_40002', rubro2: 'ACT_DEU_40200' });
103
+ this.sumarizador({ rubro1: 'ACT_DEU_40003', rubro2: 'ACT_DEU_40300' });
104
+ this.calcularDeuda({ rubro1: 'ACT_DEU_41001', rubro2: 'ACT_DEU_41002', rubro3: 'ACT_DEU_41003' });
105
+ this.calcularDeudaGridLinea({ rubro1: 'ACT_DEU_50001', rubro2: 'ACT_DEU_50002', rubro3: 'ACT_DEU_50003' });
106
+ this.calcularDeudaFilaPorcentaje({ rubro1: 'ACT_DEU_60001', rubro2: 'ACT_DEU_60002', rubro3: 'ACT_DEU_60003' });
107
+ return this.data.Deudas;
108
+ }
109
+ getAdministracionLineas(admLineas) {
110
+ const calculator = new administracionLinea_1.default(this.data.Deudas, admLineas);
111
+ return calculator.getNewDeudas();
112
+ }
113
+ getAdministracionLineasManuales(lineasManuales) {
114
+ const calculator = new administracionLineaManuales_1.default(lineasManuales);
115
+ return calculator.getLineasManuales();
116
+ }
117
+ }
118
+ exports.default = DeudasStrategy;
@@ -0,0 +1,31 @@
1
+ export default class resumenFinanciamiento {
2
+ private deudas;
3
+ private cantidadProyeccion;
4
+ private result;
5
+ constructor(deudas: any, cantidadProyeccion: number);
6
+ generateResumen(): void;
7
+ private addRubros;
8
+ private generateFilter;
9
+ private generateKOBDP;
10
+ private generateKIBDP;
11
+ private lineaMixtaBDPSam;
12
+ private porcionLPBdSam;
13
+ private generateKOOtrasEFs;
14
+ private generateKIOtrasEFs;
15
+ private generateOtrosOtrasEFs;
16
+ private lineaMixtaOtrosEIfs;
17
+ private porcioLpOtrasEIFs;
18
+ generateIntComPrestamosDirectos(row: any): void;
19
+ generateIntComLinea100KO(row: any): void;
20
+ generateIntComLineaMixta(row: any): void;
21
+ generateIntComInteresManual(row: any): void;
22
+ generateTotalInteresBdpOtras(row: any): void;
23
+ generateLeasingCP(row: any): void;
24
+ generateLeasingLP(row: any): void;
25
+ generateInteresLeasing(row: any): void;
26
+ generateInteresLeasingManual(row: any): void;
27
+ totalPorcionCPBDP(row: any): void;
28
+ totalPorcionCPOtas(row: any): void;
29
+ totalPorcionLPBdp(row: any): void;
30
+ totalPorcionLPOtras(row: any): void;
31
+ }
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class resumenFinanciamiento {
4
+ deudas;
5
+ cantidadProyeccion;
6
+ result;
7
+ constructor(deudas, cantidadProyeccion) {
8
+ this.deudas = deudas;
9
+ this.cantidadProyeccion = cantidadProyeccion;
10
+ this.result = [];
11
+ }
12
+ generateResumen() {
13
+ this.addRubros();
14
+ for (let item of this.result) {
15
+ if (item.id == 'ACT_DEU_75001')
16
+ this.generateKOBDP(item);
17
+ if (item.id == 'ACT_DEU_75002')
18
+ this.generateKIBDP(item);
19
+ if (item.id == 'ACT_DEU_75003')
20
+ this.lineaMixtaBDPSam(item);
21
+ if (item.id == 'ACT_DEU_75004')
22
+ this.porcionLPBdSam(item);
23
+ if (item.id == 'ACT_DEU_75101')
24
+ this.generateKOOtrasEFs(item);
25
+ if (item.id == 'ACT_DEU_75102')
26
+ this.generateKIOtrasEFs(item);
27
+ if (item.id == 'ACT_DEU_75103')
28
+ this.generateOtrosOtrasEFs(item);
29
+ if (item.id == 'ACT_DEU_75104')
30
+ this.lineaMixtaOtrosEIfs(item);
31
+ if (item.id == 'ACT_DEU_75105')
32
+ this.porcioLpOtrasEIFs(item);
33
+ if (item.id == 'ACT_DEU_75201')
34
+ this.generateIntComPrestamosDirectos(item);
35
+ if (item.id == 'ACT_DEU_75202')
36
+ this.generateIntComLinea100KO(item);
37
+ if (item.id == 'ACT_DEU_75203')
38
+ this.generateIntComLineaMixta(item);
39
+ if (item.id == 'ACT_DEU_75204')
40
+ this.generateIntComInteresManual(item);
41
+ if (item.id == 'ACT_DEU_75205')
42
+ this.generateTotalInteresBdpOtras(item);
43
+ if (item.id == 'ACT_DEU_75301')
44
+ this.generateLeasingCP(item);
45
+ if (item.id == 'ACT_DEU_75302')
46
+ this.generateLeasingLP(item);
47
+ if (item.id == 'ACT_DEU_75303')
48
+ this.generateInteresLeasing(item);
49
+ if (item.id == 'ACT_DEU_75304')
50
+ this.generateInteresLeasingManual(item);
51
+ if (item.id == 'ACT_DEU_75401')
52
+ this.totalPorcionCPBDP(item);
53
+ if (item.id == 'ACT_DEU_75402')
54
+ this.totalPorcionCPOtas(item);
55
+ if (item.id == 'ACT_DEU_75403')
56
+ this.totalPorcionLPBdp(item);
57
+ if (item.id == 'ACT_DEU_75404')
58
+ this.totalPorcionLPOtras(item);
59
+ }
60
+ }
61
+ addRubros() {
62
+ this.result.push({ id: 'ACT_DEU_75001', descripction: 'K0 - Porción CP - BDP SAM' });
63
+ this.result.push({ id: 'ACT_DEU_75002', descripction: 'KI - Porción CP - BDP SAM' });
64
+ this.result.push({ id: 'ACT_DEU_75003', descripction: 'L/C Mixta - Porción CP - BDP SAM' });
65
+ this.result.push({ id: 'ACT_DEU_75004', descripction: 'Porción LP - BDP SAM' });
66
+ this.result.push({ id: 'ACT_DEU_75101', descripction: 'K0 - Porción CP - Otras EIFs' });
67
+ this.result.push({ id: 'ACT_DEU_75102', descripction: 'KI - Porción CP - Otras EIFs' });
68
+ this.result.push({ id: 'ACT_DEU_75103', descripction: 'Otros - Porción CP - Otras EIFs' });
69
+ this.result.push({ id: 'ACT_DEU_75104', descripction: 'L/C Mixta - Porción CP - Otras EIFs' });
70
+ this.result.push({ id: 'ACT_DEU_75105', descripction: 'Porción LP - Otras EIFs' });
71
+ this.result.push({ id: 'ACT_DEU_75201', descripction: 'Intereses y Comisiones - Préstamos Directos' });
72
+ this.result.push({ id: 'ACT_DEU_75202', descripction: 'Intereses y Comisiones - Línea de Crédito 100% KO' });
73
+ this.result.push({ id: 'ACT_DEU_75203', descripction: 'Intereses y Comisiones - Línea de Crédito Mixta' });
74
+ this.result.push({ id: 'ACT_DEU_75204', descripction: 'Interés - Manual' });
75
+ this.result.push({ id: 'ACT_DEU_75205', descripction: 'Total Intereses (BDP y Otras EIFs)' });
76
+ this.result.push({ id: 'ACT_DEU_75301', descripction: 'Leasing CP (Venc. Corriente + Deuda CP) - Otras EIFs' });
77
+ this.result.push({ id: 'ACT_DEU_75302', descripction: 'Leasing LP - Otras EIFs' });
78
+ this.result.push({ id: 'ACT_DEU_75303', descripction: 'Intereses Leasing' });
79
+ this.result.push({ id: 'ACT_DEU_75304', descripction: 'Interés Leasing - Manual' });
80
+ this.result.push({ id: 'ACT_DEU_75401', descripction: 'TOTAL PORCIÓN CP (Venc. Corriente) - BDP SAM' });
81
+ this.result.push({ id: 'ACT_DEU_75402', descripction: 'TOTAL PORCIÓN CP (Venc. Corriente) - Otras EIFs' });
82
+ this.result.push({ id: 'ACT_DEU_75403', descripction: 'TOTAL PORCIÓN LP - BDP SAM' });
83
+ this.result.push({ id: 'ACT_DEU_75404', descripction: 'TOTAL PORCIÓN LP - Otras EIFs' });
84
+ }
85
+ generateFilter(row, deudasFilter) {
86
+ for (let i = 1; i <= this.cantidadProyeccion; i++) {
87
+ row[`Monto${i}`] = deudasFilter.reduce((acc, item) => {
88
+ acc += Math.round(parseFloat(item[`Monto${i}`]) * 100) / 100;
89
+ return acc;
90
+ }, 0);
91
+ }
92
+ }
93
+ generateKOBDP(row) {
94
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_40001' && item.Destino == 'KO');
95
+ this.generateFilter(row, deudasFilter);
96
+ }
97
+ generateKIBDP(row) {
98
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_40001'
99
+ && (item.Destino == 'KI' || item.Destino == 'B/L-KI'));
100
+ this.generateFilter(row, deudasFilter);
101
+ }
102
+ lineaMixtaBDPSam(row) {
103
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_41001');
104
+ this.generateFilter(row, deudasFilter);
105
+ }
106
+ porcionLPBdSam(row) {
107
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_40200' || item.RubroId == 'ACT_DEU_41002'));
108
+ this.generateFilter(row, deudasFilter);
109
+ }
110
+ generateKOOtrasEFs(row) {
111
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_10001' && item.Destino == 'KO');
112
+ this.generateFilter(row, deudasFilter);
113
+ }
114
+ generateKIOtrasEFs(row) {
115
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_10001'
116
+ && (item.Destino == 'KI' || item.Destino == 'B/L-KI'));
117
+ this.generateFilter(row, deudasFilter);
118
+ }
119
+ generateOtrosOtrasEFs(row) {
120
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_10001' && item.Destino == 'OTROS');
121
+ this.generateFilter(row, deudasFilter);
122
+ }
123
+ lineaMixtaOtrosEIfs(row) {
124
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_20100');
125
+ this.generateFilter(row, deudasFilter);
126
+ }
127
+ porcioLpOtrasEIFs(row) {
128
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_20200' ||
129
+ item.RubroId == 'ACT_DEU_10200'));
130
+ this.generateFilter(row, deudasFilter);
131
+ }
132
+ generateIntComPrestamosDirectos(row) {
133
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_10300' ||
134
+ item.RubroId == 'ACT_DEU_40300'));
135
+ this.generateFilter(row, deudasFilter);
136
+ }
137
+ generateIntComLinea100KO(row) {
138
+ const deudasFilter = this.deudas.filter((item) => item.RubroId == 'ACT_DEU_50003');
139
+ this.generateFilter(row, deudasFilter);
140
+ }
141
+ generateIntComLineaMixta(row) {
142
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_41003' ||
143
+ item.RubroId == 'ACT_DEU_20003'));
144
+ this.generateFilter(row, deudasFilter);
145
+ }
146
+ generateIntComInteresManual(row) {
147
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_72001'));
148
+ this.generateFilter(row, deudasFilter);
149
+ }
150
+ generateTotalInteresBdpOtras(row) {
151
+ const filter = this.result.filter((item) => ['ACT_DEU_75201', 'ACT_DEU_75202',
152
+ 'ACT_DEU_75203', 'ACT_DEU_75204'].includes(item.RubroId));
153
+ this.generateFilter(row, filter);
154
+ }
155
+ generateLeasingCP(row) {
156
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_30100'));
157
+ this.generateFilter(row, deudasFilter);
158
+ }
159
+ generateLeasingLP(row) {
160
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_30200'));
161
+ this.generateFilter(row, deudasFilter);
162
+ }
163
+ generateInteresLeasing(row) {
164
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_30300'));
165
+ this.generateFilter(row, deudasFilter);
166
+ }
167
+ generateInteresLeasingManual(row) {
168
+ const deudasFilter = this.deudas.filter((item) => (item.RubroId == 'ACT_DEU_72002'));
169
+ this.generateFilter(row, deudasFilter);
170
+ }
171
+ totalPorcionCPBDP(row) {
172
+ const filter = this.result.filter((item) => ['ACT_DEU_75001', 'ACT_DEU_75002',
173
+ 'ACT_DEU_75003'].includes(item.RubroId));
174
+ this.generateFilter(row, filter);
175
+ }
176
+ totalPorcionCPOtas(row) {
177
+ const filter = this.result.filter((item) => ['ACT_DEU_75101', 'ACT_DEU_75102',
178
+ 'ACT_DEU_75103', 'ACT_DEU_75104'].includes(item.RubroId));
179
+ this.generateFilter(row, filter);
180
+ }
181
+ totalPorcionLPBdp(row) {
182
+ const filter = this.result.filter((item) => ['ACT_DEU_75004'].includes(item.RubroId));
183
+ this.generateFilter(row, filter);
184
+ }
185
+ totalPorcionLPOtras(row) {
186
+ const filter = this.result.filter((item) => ['ACT_DEU_75404', 'ACT_DEU_75105'].includes(item.RubroId));
187
+ this.generateFilter(row, filter);
188
+ }
189
+ }
190
+ exports.default = resumenFinanciamiento;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("./admFinanciera/utils");
3
4
  class SupuestosStrategy {
4
5
  cantidadGestiones;
5
6
  data;
@@ -18,8 +19,6 @@ class SupuestosStrategy {
18
19
  destinoRow.Gestion1 = this.cleanNumber(origenRow[`Gestion${this.cantidadGestiones}`]);
19
20
  else {
20
21
  destinoRow.Gestion1 = this.cleanNumber(origenRow[`Gestion${this.cantidadGestiones}%`] / 100);
21
- destinoRow.Gestion1 =
22
- Math.round(destinoRow.Gestion1 * 100) / 100;
23
22
  }
24
23
  }
25
24
  }
@@ -29,7 +28,7 @@ class SupuestosStrategy {
29
28
  else {
30
29
  if (data.toString().includes(','))
31
30
  data = data.toString().replace(/,/g, '');
32
- return Math.round(parseFloat(data) * 100) / 100;
31
+ return (0, utils_1.ourParseFloat)(data);
33
32
  }
34
33
  };
35
34
  execute(data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdpformulas",
3
- "version": "1.0.83",
3
+ "version": "1.0.85",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",