bdpformulas 1.0.52 → 1.0.54
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/models/eeff/admFinanciera/index.d.ts +1 -0
- package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.js +2 -2
- package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.js +14 -7
- package/build/strategies/eeff/admFinanciera.strategy.js +5 -2
- package/build/strategies/eeff/index.js +196 -1123
- package/package.json +1 -1
|
@@ -115,6 +115,7 @@ export interface ProyeccionPrestamo {
|
|
|
115
115
|
export interface AdministracionFinancieraData {
|
|
116
116
|
CantidadProyeccion: number;
|
|
117
117
|
InicioProyeccion: string;
|
|
118
|
+
UltimaGestion: string;
|
|
118
119
|
PrestamoDirecto: Partial<PrestamoDirecto>[];
|
|
119
120
|
PrestamoBajoLinea: Partial<PrestamoBajoLinea>[];
|
|
120
121
|
PrestamoLeasing: Partial<PrestamoLeasing>[];
|
|
@@ -22,9 +22,9 @@ class PrestamoBajoLineaHandler {
|
|
|
22
22
|
let cantidadAños;
|
|
23
23
|
if (this.prestamo.TipoExistencia == 'EXISTENTE' &&
|
|
24
24
|
this.prestamo.VencimientoLinea) {
|
|
25
|
-
const fechaInicio = (0, utils_1.getDateTime)(this.data.
|
|
25
|
+
const fechaInicio = (0, utils_1.getDateTime)(this.data.UltimaGestion).endOf('month');
|
|
26
26
|
const fechaVencimiento = (0, utils_1.getDateTime)(this.prestamo.VencimientoLinea).endOf('month');
|
|
27
|
-
const diferenciaAños = Math.
|
|
27
|
+
const diferenciaAños = Math.floor(fechaVencimiento.diff(fechaInicio, 'years').years);
|
|
28
28
|
if (diferenciaAños > 0) {
|
|
29
29
|
cantidadAños = diferenciaAños;
|
|
30
30
|
}
|
|
@@ -35,11 +35,16 @@ class PrestamoDirectoHandler {
|
|
|
35
35
|
return this.prestamo;
|
|
36
36
|
}
|
|
37
37
|
setMesesPorcionPagada() {
|
|
38
|
+
let value;
|
|
38
39
|
if (this.prestamo.FechaDesembolso) {
|
|
39
40
|
const inicial = (0, utils_1.getDateTime)(this.data.InicioProyeccion).endOf('month');
|
|
40
41
|
const desembolso = (0, utils_1.getDateTime)(this.prestamo.FechaDesembolso).endOf('month');
|
|
41
|
-
|
|
42
|
+
const diferencia = Math.floor(inicial.diff(desembolso, 'months').months);
|
|
43
|
+
if (diferencia > 0) {
|
|
44
|
+
value = diferencia;
|
|
45
|
+
}
|
|
42
46
|
}
|
|
47
|
+
this.prestamo.MesesPorcionPagada = value;
|
|
43
48
|
}
|
|
44
49
|
setProyecciones() {
|
|
45
50
|
for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
|
|
@@ -113,6 +118,7 @@ class PrestamoDirectoHandler {
|
|
|
113
118
|
(0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]);
|
|
114
119
|
}
|
|
115
120
|
setPorcionCuotasPagadas() {
|
|
121
|
+
let porcion, cuotas;
|
|
116
122
|
if (this.prestamo.FechaDesembolso) {
|
|
117
123
|
const pagado = (0, utils_1.calcularPorcionCorrientePagada)({
|
|
118
124
|
fechaInicial: this.data.InicioProyeccion,
|
|
@@ -120,17 +126,16 @@ class PrestamoDirectoHandler {
|
|
|
120
126
|
frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
|
|
121
127
|
simulador: this.simulador.simulador
|
|
122
128
|
});
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
porcion = (0, utils_1.ourParseFloat)(pagado.porcionCorrientePagada);
|
|
130
|
+
cuotas = pagado.cuotasPagadas;
|
|
125
131
|
if (this.prestamo.TipoFacilidad === 'FIJA') {
|
|
126
|
-
const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) -
|
|
127
|
-
(0, utils_1.ourParseFloat)(this.prestamo.CuotasPagadas);
|
|
132
|
+
const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) - (0, utils_1.ourParseFloat)(cuotas);
|
|
128
133
|
const periodoGracia = dif > 0 ? dif : 0;
|
|
129
134
|
this.simuladorFijo2 = (0, utils_1.simuladorCuotas)({
|
|
130
135
|
monto: (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) -
|
|
131
|
-
(0, utils_1.ourParseFloat)(
|
|
136
|
+
(0, utils_1.ourParseFloat)(porcion),
|
|
132
137
|
plazo: (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * 12 -
|
|
133
|
-
(0, utils_1.ourParseFloat)(
|
|
138
|
+
(0, utils_1.ourParseFloat)(cuotas),
|
|
134
139
|
frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
|
|
135
140
|
tipoCuota: this.prestamo.TipoFacilidad ?? 'VARIABLE',
|
|
136
141
|
periodoGracia,
|
|
@@ -139,6 +144,8 @@ class PrestamoDirectoHandler {
|
|
|
139
144
|
});
|
|
140
145
|
}
|
|
141
146
|
}
|
|
147
|
+
this.prestamo.PorcionPagada = porcion;
|
|
148
|
+
this.prestamo.CuotasPagadas = cuotas;
|
|
142
149
|
}
|
|
143
150
|
setAmortizacionesCapital() {
|
|
144
151
|
const añoProyectadoInicio = this.prestamo.AnnoProyectadoInicio;
|
|
@@ -14,8 +14,11 @@ class AdmFinancieraStrategy {
|
|
|
14
14
|
this.data = null;
|
|
15
15
|
}
|
|
16
16
|
execute(data) {
|
|
17
|
-
if (!data ||
|
|
18
|
-
|
|
17
|
+
if (!data ||
|
|
18
|
+
!data?.CantidadProyeccion ||
|
|
19
|
+
!data?.InicioProyeccion ||
|
|
20
|
+
!data?.UltimaGestion) {
|
|
21
|
+
throw new Error('La data o Cantidad Proyeccion o Inicio Proyeccion o fecha de Ultima Gestion no estan definidos');
|
|
19
22
|
}
|
|
20
23
|
const cloned = (0, lodash_1.cloneDeep)(data);
|
|
21
24
|
this.data = {
|