bdpformulas 1.0.130 → 1.0.140

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.
@@ -54,12 +54,14 @@ class LineasMixtasHandler {
54
54
  (0, utils_1.ourParseFloat)(filasTotales[2][`Gestion${j}`]) +
55
55
  (0, utils_1.ourParseFloat)(filaGastos?.[`Gestion${j}`]);
56
56
  if (esBdp) {
57
- this.setTotalPorcionesCorrientesBDP(filasTotales[0][`Gestion${j}`], j);
57
+ this.setTotalPorcionesCorrientesBDP(filaVencimiento?.[`Gestion${j}`], j);
58
58
  }
59
59
  else {
60
- this.setTotalPorcionesCorrientesOtros(filasTotales[0][`Gestion${j}`], j);
60
+ this.setTotalPorcionesCorrientesOtros(filaVencimiento?.[`Gestion${j}`], j);
61
61
  }
62
- this.setTotalCuadroFinancieroComisiones(filasTotales[2][`Gestion${j}`], j);
62
+ this.setTotalCuadroFinancieroComisiones(
63
+ // Add only this line, not the running subtotal of prior lines.
64
+ filaGastos?.[`Gestion${j}`], j);
63
65
  }
64
66
  i += 4;
65
67
  }
@@ -13,6 +13,7 @@ export declare class PrestamoDirectoHandler {
13
13
  private setMesesPorcionPagada;
14
14
  private setProyecciones;
15
15
  private setAmortizacionInteresVariable;
16
+ private calcularInteresesVariablesPrimerPeriodo;
16
17
  private setAmortizacionesInteresFija;
17
18
  private setPorcionNoCorriente;
18
19
  private setPorcionCuotasPagadas;
@@ -57,43 +57,43 @@ class PrestamoDirectoHandler {
57
57
  if (this.prestamo.TipoFacilidad === 'VARIABLE') {
58
58
  let value;
59
59
  const tasa = (0, utils_1.ourParseFloat)(this.prestamo.Tasa) / 100;
60
- const mesesPorcionPagada = (0, utils_1.ourParseFloat)(this.prestamo.MesesPorcionPagada);
61
- const plazo = (0, utils_1.ourParseFloat)(this.prestamo.Plazos?.[`Gestion${gestion}`]);
62
- let porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion}`]);
63
- let porcionNoCorriente = (0, utils_1.ourParseFloat)(this.prestamo.PorcionesNoCorrientes?.[`Gestion${gestion}`]);
64
- const porcionCorrientePagada = (0, utils_1.ourParseFloat)(this.prestamo.PorcionPagada);
65
60
  if (gestion == 1) {
66
- if ((0, utils_1.ourParseFloat)(this.prestamo.Gracia) / 12 > 0) {
67
- value =
68
- ((porcionCorriente + porcionNoCorriente) *
69
- tasa *
70
- mesesPorcionPagada) /
71
- 12;
72
- }
73
- else {
74
- if (plazo == this.prestamo.PlazoRemanenteAños) {
75
- value =
76
- ((porcionCorriente +
77
- porcionNoCorriente +
78
- porcionCorrientePagada) *
79
- tasa *
80
- mesesPorcionPagada) /
81
- 12;
82
- }
83
- else {
84
- value = (porcionCorriente + porcionNoCorriente) * tasa;
85
- }
86
- }
61
+ value = this.calcularInteresesVariablesPrimerPeriodo(tasa);
87
62
  }
88
63
  else {
89
- porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion - 1}`]);
90
- porcionNoCorriente = (0, utils_1.ourParseFloat)(this.prestamo.PorcionesNoCorrientes?.[`Gestion${gestion - 1}`]);
64
+ const porcionCorriente = (0, utils_1.ourParseFloat)(this.prestamo.AmortizacionesCapitalCuotaFinal?.[`Gestion${gestion - 1}`]);
65
+ const porcionNoCorriente = (0, utils_1.ourParseFloat)(this.prestamo.PorcionesNoCorrientes?.[`Gestion${gestion - 1}`]);
91
66
  value = (porcionCorriente + porcionNoCorriente) * tasa;
92
67
  }
93
68
  this.prestamo.AmortizacionesInteres[`Gestion${gestion}`] = value;
94
69
  this.setTotalCuadroFinancieroComisiones(value, gestion);
95
70
  }
96
71
  }
72
+ calcularInteresesVariablesPrimerPeriodo(tasa) {
73
+ if (!this.prestamo.FechaDesembolso)
74
+ return 0;
75
+ let fechaAnterior = (0, utils_1.getDateTime)(this.prestamo.FechaDesembolso).startOf('day');
76
+ const corte = (0, utils_1.getDateTime)(this.data.InicioProyeccion).endOf('month');
77
+ if (!fechaAnterior.isValid || !corte.isValid)
78
+ return 0;
79
+ const meses = utils_1.frecuenciaMeses[this.prestamo.TipoPeriodicidadId ?? 'MENSUAL'];
80
+ const vencimiento = fechaAnterior.plus({
81
+ months: (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * 12
82
+ });
83
+ let total = 0;
84
+ for (const cuota of this.simulador.simulador) {
85
+ const siguiente = fechaAnterior.plus({ months: meses });
86
+ const fechaPago = siguiente > vencimiento ? vencimiento : siguiente;
87
+ if (fechaPago > corte || fechaPago <= fechaAnterior)
88
+ break;
89
+ const dias = fechaPago.diff(fechaAnterior, 'days').days;
90
+ total +=
91
+ ((0, utils_1.ourParseFloat)(cuota.saldoCapital) * tasa * dias) / 360 +
92
+ (0, utils_1.ourParseFloat)(cuota.poliza);
93
+ fechaAnterior = fechaPago;
94
+ }
95
+ return total;
96
+ }
97
97
  setAmortizacionesInteresFija() {
98
98
  if (this.prestamo.TipoFacilidad === 'FIJA') {
99
99
  const tasa = (0, utils_1.ourParseFloat)(this.prestamo.Tasa) / 100;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdpformulas",
3
- "version": "1.0.130",
3
+ "version": "1.0.140",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",