bdpformulas 1.0.52 → 1.0.53

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.
@@ -24,7 +24,7 @@ class PrestamoBajoLineaHandler {
24
24
  this.prestamo.VencimientoLinea) {
25
25
  const fechaInicio = (0, utils_1.getDateTime)(this.data.InicioProyeccion).endOf('month');
26
26
  const fechaVencimiento = (0, utils_1.getDateTime)(this.prestamo.VencimientoLinea).endOf('month');
27
- const diferenciaAños = Math.ceil(Math.abs(fechaInicio.diff(fechaVencimiento, 'years').years));
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
- this.prestamo.MesesPorcionPagada = Math.floor(inicial.diff(desembolso, 'months').months);
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,8 +126,8 @@ class PrestamoDirectoHandler {
120
126
  frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
121
127
  simulador: this.simulador.simulador
122
128
  });
123
- this.prestamo.PorcionPagada = (0, utils_1.ourParseFloat)(pagado.porcionCorrientePagada);
124
- this.prestamo.CuotasPagadas = pagado.cuotasPagadas;
129
+ porcion = (0, utils_1.ourParseFloat)(pagado.porcionCorrientePagada);
130
+ cuotas = pagado.cuotasPagadas;
125
131
  if (this.prestamo.TipoFacilidad === 'FIJA') {
126
132
  const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) -
127
133
  (0, utils_1.ourParseFloat)(this.prestamo.CuotasPagadas);
@@ -139,6 +145,8 @@ class PrestamoDirectoHandler {
139
145
  });
140
146
  }
141
147
  }
148
+ this.prestamo.PorcionPagada = porcion;
149
+ this.prestamo.CuotasPagadas = cuotas;
142
150
  }
143
151
  setAmortizacionesCapital() {
144
152
  const añoProyectadoInicio = this.prestamo.AnnoProyectadoInicio;