bdpformulas 1.0.53 → 1.0.55

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.
@@ -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,7 +22,7 @@ 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.InicioProyeccion).endOf('month');
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
27
  const diferenciaAños = Math.floor(fechaVencimiento.diff(fechaInicio, 'years').years);
28
28
  if (diferenciaAños > 0) {
@@ -129,14 +129,13 @@ class PrestamoDirectoHandler {
129
129
  porcion = (0, utils_1.ourParseFloat)(pagado.porcionCorrientePagada);
130
130
  cuotas = pagado.cuotasPagadas;
131
131
  if (this.prestamo.TipoFacilidad === 'FIJA') {
132
- const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) -
133
- (0, utils_1.ourParseFloat)(this.prestamo.CuotasPagadas);
132
+ const dif = (0, utils_1.ourParseFloat)(this.prestamo.Gracia) - (0, utils_1.ourParseFloat)(cuotas);
134
133
  const periodoGracia = dif > 0 ? dif : 0;
135
134
  this.simuladorFijo2 = (0, utils_1.simuladorCuotas)({
136
135
  monto: (0, utils_1.ourParseFloat)(this.prestamo.MontoOriginal) -
137
- (0, utils_1.ourParseFloat)(this.prestamo.PorcionPagada),
136
+ (0, utils_1.ourParseFloat)(porcion),
138
137
  plazo: (0, utils_1.ourParseFloat)(this.prestamo.Plazo) * 12 -
139
- (0, utils_1.ourParseFloat)(this.prestamo.CuotasPagadas),
138
+ (0, utils_1.ourParseFloat)(cuotas),
140
139
  frecuencia: this.prestamo.TipoPeriodicidadId ?? 'MENSUAL',
141
140
  tipoCuota: this.prestamo.TipoFacilidad ?? 'VARIABLE',
142
141
  periodoGracia,
@@ -200,6 +199,7 @@ class PrestamoDirectoHandler {
200
199
  if (!this.prestamo.EsBajoLinea && añoProyectadoInicio >= 1) {
201
200
  let value;
202
201
  for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
202
+ value = 0;
203
203
  const plazo = (0, utils_1.ourParseFloat)(plazos?.[`Gestion${i}`]);
204
204
  if (this.prestamo.TipoFacilidad === 'VARIABLE') {
205
205
  if (i === 1) {
@@ -215,7 +215,7 @@ class PrestamoDirectoHandler {
215
215
  }
216
216
  }
217
217
  else {
218
- if (añoProyectadoInicio <= i) {
218
+ if (plazo && añoProyectadoInicio <= i) {
219
219
  if ((0, utils_1.ourParseFloat)(this.prestamo.PlazoRemanenteAños) < (0, utils_1.ourParseFloat)(plazo)) {
220
220
  value = this.prestamo.MontoOriginal;
221
221
  }
@@ -269,6 +269,7 @@ class PrestamoDirectoHandler {
269
269
  if (this.prestamo.EsBajoLinea) {
270
270
  let value;
271
271
  for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
272
+ value = 0;
272
273
  const plazo = plazos?.[`Gestion${i}`];
273
274
  if (i === 1) {
274
275
  if (plazo && this.prestamo.AnnoProyectadoInicio === 1) {
@@ -14,8 +14,11 @@ class AdmFinancieraStrategy {
14
14
  this.data = null;
15
15
  }
16
16
  execute(data) {
17
- if (!data || !data?.CantidadProyeccion || !data?.InicioProyeccion) {
18
- throw new Error('La data o Cantidad Proyeccion o Inicio Proyeccion no estan definidos');
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 = {
@@ -285,7 +285,8 @@ const data = {
285
285
  };
286
286
  console.log(JSON.stringify(strategy.execute({
287
287
  CantidadProyeccion: 12,
288
- InicioProyeccion: '2024-03-08T00:00:00.000Z',
288
+ InicioProyeccion: '2025-03-01T00:00:00.000Z',
289
+ UltimaGestion: '2024-03-01T00:00:00.000Z',
289
290
  PrestamoDirecto: [
290
291
  {
291
292
  ActividadDeudaId: 65,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdpformulas",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",