bdpformulas 1.0.49 → 1.0.51

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 (50) hide show
  1. package/build/context.js +1 -0
  2. package/build/models/eeff/admFinanciera/index.d.ts +143 -0
  3. package/build/models/eeff/admFinanciera/index.js +26 -0
  4. package/build/strategies/agriculture/balanceAgr.strategy.js +1 -0
  5. package/build/strategies/agriculture/costos.detail/costosCalc.js +1 -1
  6. package/build/strategies/agriculture/flujoProyAgr.strategy.js +3 -2
  7. package/build/strategies/agriculture/ventas.detail/ventas.calc.js +2 -1
  8. package/build/strategies/analisisFinancieros.strategy.js +20 -22
  9. package/build/strategies/balance.strategy.js +14 -2
  10. package/build/strategies/common/analisisFinCalculos/analisisGrafico.calc.js +47 -45
  11. package/build/strategies/common/analisisFinCalculos/ratios.calc.js +158 -157
  12. package/build/strategies/common/balance.calc.js +3 -1
  13. package/build/strategies/common/balanceCalculos/balanceAux.calc.js +11 -1
  14. package/build/strategies/common/balanceCalculos/flujoAux.calc.js +2 -11
  15. package/build/strategies/common/flujoCalculos/flujoConstructor.js +313 -308
  16. package/build/strategies/eeff/admFinanciera/amortizaciones.d.ts +8 -0
  17. package/build/strategies/eeff/admFinanciera/amortizaciones.js +31 -0
  18. package/build/strategies/eeff/admFinanciera/aplicacionesHandler.d.ts +16 -0
  19. package/build/strategies/eeff/admFinanciera/aplicacionesHandler.js +202 -0
  20. package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.d.ts +7 -0
  21. package/build/strategies/eeff/admFinanciera/lineasMixtasHandler.js +63 -0
  22. package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.d.ts +13 -0
  23. package/build/strategies/eeff/admFinanciera/prestamoBajoLineaHandler.js +80 -0
  24. package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.d.ts +26 -0
  25. package/build/strategies/eeff/admFinanciera/prestamoDirectoHandler.js +310 -0
  26. package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.d.ts +20 -0
  27. package/build/strategies/eeff/admFinanciera/prestamoLeasingHandler.js +162 -0
  28. package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.d.ts +51 -0
  29. package/build/strategies/eeff/admFinanciera/proyeccionPrestamosDirectosHandler.js +291 -0
  30. package/build/strategies/eeff/admFinanciera/utils.d.ts +98 -0
  31. package/build/strategies/eeff/admFinanciera/utils.js +218 -0
  32. package/build/strategies/eeff/admFinanciera.strategy.d.ts +11 -7
  33. package/build/strategies/eeff/admFinanciera.strategy.js +139 -85
  34. package/build/strategies/eeff/balanceEEFF.strategy.js +3 -2
  35. package/build/strategies/eeff/flujoProyEEFF.strategy.js +3 -2
  36. package/build/strategies/eeff/index.d.ts +1 -0
  37. package/build/strategies/eeff/index.js +1509 -0
  38. package/build/strategies/general/balanceGeneral.strategy.js +2 -1
  39. package/build/strategies/general/flujoProyGeneral.strategy.js +2 -1
  40. package/build/strategies/pecuary/balancePec.strategy.js +7 -6
  41. package/build/strategies/pecuary/desarrollo.detail/desarrolloCalc.js +11 -3
  42. package/build/strategies/pecuary/desarrollo.strategy.js +2 -2
  43. package/build/strategies/pecuary/flujoProyPec.strategy.js +7 -6
  44. package/build/strategies/pecuary/ventas.detail/estacionalidadCalc.js +7 -1
  45. package/build/strategies/pecuary/ventas.detail/ventasIngresosCalc.js +7 -1
  46. package/build/strategies/production/balancePrd.strategy.js +7 -6
  47. package/build/strategies/production/costos.detail/costosCalc.js +1 -1
  48. package/build/strategies/production/flujoProyPrd.strategy.js +7 -6
  49. package/package.json +26 -21
  50. package/tsconfig.json +1 -1
@@ -1,99 +1,153 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const getProyeccionBase = (cantidadProyeccion, inicioProyeccion) => {
4
- if (!inicioProyeccion)
5
- throw new Error('Inicio Proyeccion no definido');
6
- let result = {};
7
- for (let i = 1; i <= cantidadProyeccion; i++) {
8
- let date = new Date(inicioProyeccion);
9
- let newDate = `${date.getFullYear() + i}-${`0${date.getMonth()}`.slice(-2)}-${`0${date.getDay()}`.slice(-2)}`;
10
- result[`Gestion${i}`] = newDate;
11
- result[`Monto${i}`] = 0;
12
- }
13
- return result;
14
- };
3
+ const utils_1 = require("./admFinanciera/utils");
4
+ const lodash_1 = require("lodash");
5
+ const prestamoDirectoHandler_1 = require("./admFinanciera/prestamoDirectoHandler");
6
+ const prestamoBajoLineaHandler_1 = require("./admFinanciera/prestamoBajoLineaHandler");
7
+ const proyeccionPrestamosDirectosHandler_1 = require("./admFinanciera/proyeccionPrestamosDirectosHandler");
8
+ const lineasMixtasHandler_1 = require("./admFinanciera/lineasMixtasHandler");
9
+ const prestamoLeasingHandler_1 = require("./admFinanciera/prestamoLeasingHandler");
10
+ const aplicacionesHandler_1 = require("./admFinanciera/aplicacionesHandler");
15
11
  class AdmFinancieraStrategy {
12
+ data;
16
13
  constructor() {
17
- this.proyeccionAplicaciones = () => {
18
- let result = [];
19
- const proyeccionBase = getProyeccionBase(this.data.CantidadProyeccion, this.data.InicioProyeccion);
20
- const clasificaciones = [
21
- 'KO - Línea de Crédito 100% KO',
22
- 'KO - Prestamo Directo',
23
- 'KI - Prestamo Directo',
24
- 'MIXTO - Pagares, Bonos, Etc.',
25
- 'KI - Leasing Financiero',
26
- 'KI - KO - Línea de Crédito Mixta'
27
- ];
28
- for (let i = 0; i < clasificaciones.length; i++) {
29
- result.push(Object.assign({ id: i, Descripcion: clasificaciones[i] }, proyeccionBase));
30
- }
31
- return result;
32
- };
33
- this.data = {};
14
+ this.data = null;
34
15
  }
35
16
  execute(data) {
36
- this.data = data;
37
- this.data.ProyeccionPrestamosBajoLineas = this.proyeccionPrestamoBajoLineas();
38
- this.data.ProyeccionPrestamosDirectos = this.proyeccionPrestamosDirectos();
39
- this.data.ProyeccionAplicaciones = this.proyeccionAplicaciones();
40
- return data;
41
- }
42
- proyeccionLineasMixtas() {
43
- let result = [];
44
- const proyeccionBase = getProyeccionBase(this.data.CantidadProyeccion, this.data.InicioProyeccion);
45
- const clasificaciones = [
46
- 'Total Vencimiento Corriente de Deuda de Largo Plazo',
47
- 'Total Deuda financiera de largo plazo',
48
- 'Total Gastos Financieros y Comisiones',
49
- ];
50
- for (let i = 0; i < clasificaciones.length; i++) {
51
- result.push(Object.assign({ id: i, Descripcion: clasificaciones[i] }, proyeccionBase));
17
+ if (!data || !data?.CantidadProyeccion || !data?.InicioProyeccion) {
18
+ throw new Error('La data o Cantidad Proyeccion o Inicio Proyeccion no estan definidos');
52
19
  }
53
- return result;
20
+ const cloned = (0, lodash_1.cloneDeep)(data);
21
+ this.data = {
22
+ ...cloned,
23
+ ProyeccionPrestamosDirectos: cloned.ProyeccionPrestamosDirectos ?? [],
24
+ ProyeccionAplicaciones: [],
25
+ ProyeccionPrestamosBajoLineas: []
26
+ };
27
+ this.formatPrestamosDirectos();
28
+ this.formatPrestamosBajoLinea();
29
+ this.formatPrestamosLeasing();
30
+ this.formatLineasMixtas();
31
+ //proyecciones
32
+ this.setProyeccionesBajoLinea();
33
+ this.setProyeccionesPrestamosDirectos();
34
+ this.setProyeccionesAplicaciones();
35
+ return this.data;
54
36
  }
55
- proyeccionPrestamoBajoLineas() {
56
- let result = [];
57
- if (this.data.PrestamoBajoLinea && this.data.PrestamoBajoLinea.length > 0) {
58
- const proyeccionBase = getProyeccionBase(this.data.CantidadProyeccion, this.data.InicioProyeccion);
59
- result = this.data.PrestamoBajoLinea.map((item) => {
60
- let proyeccion = Object.assign({ id: item.ActividadDeudaId, Descripcion: item.Descripcion }, proyeccionBase);
61
- return proyeccion;
37
+ formatPrestamosDirectos() {
38
+ const prestamos = this.data.PrestamoDirecto.filter((pr) => pr.IndicadorABM !== 'B');
39
+ let totalMontoOriginal = 0;
40
+ let totalPorcionPagada = 0;
41
+ prestamos.forEach((prestamo) => {
42
+ const handled = new prestamoDirectoHandler_1.PrestamoDirectoHandler({
43
+ prestamo,
44
+ data: this.data
45
+ }).handle();
46
+ totalMontoOriginal += (0, utils_1.ourParseFloat)(handled.MontoOriginal);
47
+ totalPorcionPagada += (0, utils_1.ourParseFloat)(handled.PorcionPagada);
48
+ });
49
+ if (prestamos.length)
50
+ this.data?.PrestamoDirecto.push({
51
+ Descripcion: 'TOTAL PRÉSTAMOS AMORTIZABLES BS',
52
+ MontoOriginal: totalMontoOriginal,
53
+ PorcionPagada: totalPorcionPagada,
54
+ Clasificador: 'T'
55
+ });
56
+ }
57
+ formatPrestamosBajoLinea() {
58
+ const prestamos = this.data.PrestamoBajoLinea.filter((pr) => pr.IndicadorABM !== 'B');
59
+ const totalMonto = prestamos.reduce((acc, curr) => acc + (0, utils_1.ourParseFloat)(curr.MontoOriginal), 0);
60
+ let totalMontoUtilizado = 0;
61
+ let totalTasaPonderada = 0;
62
+ let totalSaldoLinea = 0;
63
+ prestamos.forEach((prestamo) => {
64
+ const handled = new prestamoBajoLineaHandler_1.PrestamoBajoLineaHandler(prestamo, this.data).handle();
65
+ totalMontoUtilizado += (0, utils_1.ourParseFloat)(handled.MontoUtilizado);
66
+ totalTasaPonderada += (0, utils_1.ourParseFloat)(handled.TasaPonderada, false);
67
+ totalSaldoLinea += (0, utils_1.ourParseFloat)(handled.SaldoLineaAplicar);
68
+ });
69
+ if (prestamos.length)
70
+ this.data?.PrestamoBajoLinea.push({
71
+ Descripcion: 'TOTAL LÍNEA DE CRÉDITO BS',
72
+ MontoOriginal: totalMonto,
73
+ MontoUtilizado: totalMontoUtilizado,
74
+ TasaPonderada: totalTasaPonderada,
75
+ SaldoLineaAplicar: totalSaldoLinea,
76
+ Clasificador: 'T'
62
77
  });
63
- result.push(Object.assign({ id: -1, Descripcion: 'Tasa de interes deuda de corto plazo y sobregiros' }, proyeccionBase));
64
- result.push(Object.assign({ id: -2, Descripcion: 'Pago Costos Financieros Bs.' }, proyeccionBase));
65
- }
66
- return result;
67
78
  }
68
- proyeccionPrestamosDirectos() {
69
- let result = [];
70
- const proyeccionBase = getProyeccionBase(this.data.CantidadProyeccion, this.data.InicioProyeccion);
71
- const clasificaciones = ['KO - Porción CP - BDP SAM',
72
- 'KI - Porción CP - BDP SAM',
73
- 'L/C Mixta - Porción CP - BDP SAM',
74
- 'Porción LP - BDP SAM',
75
- 'KO - Porción CP - Otras EIFs',
76
- 'KI - Porción CP - Otras EIFs',
77
- 'Otros - Porción CP - Otras EIFs',
78
- 'L/C Mixta - Porción CP - Otras EIFs',
79
- 'Porción LP - Otras EIFs',
80
- 'Intereses y Comisiones - Prestamos Directos',
81
- 'Intereses y Comisiones - Linea de Credito 100% KO',
82
- 'Intereses y Comisiones - Linea de Credito Mixta',
83
- 'Interes - MANUAL',
84
- 'Total Intereses (BDP y Otras EIFs)',
85
- 'Leasing CP (Venc.Corriente + Deuda CP) - Otras EIFs',
86
- 'Leasing LP - Otras EIFs',
87
- 'Intereses Leasing',
88
- 'Interes Leasing - MANUAL',
89
- 'TOTAL PORCIÓN CP (Venc.Corriente) - BDP SAM',
90
- 'TOTAL PORCIÓN CP (Venc.Corriente) - Otras EIFs',
91
- 'TOTAL PORCIÓN LP - BDP SAM',
92
- 'TOTAL PORCIÓN LP - Otras EIFs'];
93
- for (let i = 0; i < clasificaciones.length; i++) {
94
- result.push(Object.assign({ id: i, Descripcion: clasificaciones[i] }, proyeccionBase));
79
+ setProyeccionesBajoLinea() {
80
+ const prestamos = this.data.PrestamoBajoLinea.filter((pr) => pr.IndicadorABM !== 'B');
81
+ const filaTotales = prestamos.find((pr) => pr.Clasificador == 'T');
82
+ const totalTasaPonderada = (0, utils_1.ourParseFloat)(filaTotales?.TasaPonderada, false) / 100;
83
+ const proyecciones = prestamos
84
+ .filter((pr) => pr.Clasificador !== 'T')
85
+ .map((pr) => ({
86
+ Descripcion: pr.Descripcion,
87
+ ...pr.Proyecciones
88
+ }));
89
+ const pagoCostosFinancieros = {
90
+ id: -1,
91
+ Descripcion: 'Pago de Costos Financieros Bs.',
92
+ Clasificador: 'T'
93
+ };
94
+ for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
95
+ let value;
96
+ if (i == 1) {
97
+ const primeraFila = prestamos.at(0);
98
+ value =
99
+ (0, utils_1.ourParseFloat)(primeraFila?.MontoUtilizado) *
100
+ totalTasaPonderada;
101
+ }
102
+ else {
103
+ const sumaColumnaAnterior = (0, utils_1.getColumnSum)(proyecciones, `Gestion${i - 1}`);
104
+ value = sumaColumnaAnterior * totalTasaPonderada;
105
+ }
106
+ pagoCostosFinancieros[`Gestion${i}`] = value;
95
107
  }
96
- return result;
108
+ proyecciones.push(pagoCostosFinancieros);
109
+ this.data.ProyeccionPrestamosBajoLineas = proyecciones;
110
+ }
111
+ formatPrestamosLeasing() {
112
+ const prestamos = this.data.PrestamoLeasing.filter((pr) => pr.IndicadorABM !== 'B');
113
+ let totalMonto = 0;
114
+ let totalCuotaPeriodo = 0;
115
+ let totalAporteInicial = 0;
116
+ let totalValorResidual = 0;
117
+ let totalValorBien = 0;
118
+ prestamos.forEach((prestamo) => {
119
+ const handled = new prestamoLeasingHandler_1.PrestamoLeasingHandler({
120
+ data: this.data,
121
+ prestamo
122
+ }).handle();
123
+ totalMonto += (0, utils_1.ourParseFloat)(handled.MontoOriginal);
124
+ totalCuotaPeriodo += (0, utils_1.ourParseFloat)(handled.MontoCuotaPeriodo);
125
+ totalAporteInicial += (0, utils_1.ourParseFloat)(handled.MontoAporteInicial);
126
+ totalValorResidual += (0, utils_1.ourParseFloat)(handled.MontoValorResidual);
127
+ totalValorBien += (0, utils_1.ourParseFloat)(handled.MontoValorBien);
128
+ });
129
+ if (prestamos.length)
130
+ this.data?.PrestamoLeasing.push({
131
+ Descripcion: 'TOTAL LEASING BS',
132
+ MontoOriginal: totalMonto,
133
+ MontoCuotaPeriodo: totalCuotaPeriodo,
134
+ MontoAporteInicial: totalAporteInicial,
135
+ MontoValorResidual: totalValorResidual,
136
+ MontoValorBien: totalValorBien,
137
+ Clasificador: 'T'
138
+ });
139
+ }
140
+ formatLineasMixtas() {
141
+ new lineasMixtasHandler_1.LineasMixtasHandler(this.data).handle();
142
+ }
143
+ setProyeccionesPrestamosDirectos() {
144
+ const handler = new proyeccionPrestamosDirectosHandler_1.ProyeccionPrestamosDirectosHandler({
145
+ data: this.data
146
+ });
147
+ this.data.ProyeccionPrestamosDirectos = handler.handle();
148
+ }
149
+ setProyeccionesAplicaciones() {
150
+ new aplicacionesHandler_1.AplicacionesHandler({ data: this.data }).handle();
97
151
  }
98
152
  }
99
153
  exports.default = AdmFinancieraStrategy;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class BalanceEEFFStrategy {
4
+ actividades;
4
5
  constructor() {
5
6
  this.actividades = [];
6
7
  }
@@ -81,7 +82,7 @@ const anadirGrupoBalance = (actividad, rubros, grupoActividad, rubroDestino, dat
81
82
  }, null);
82
83
  for (let i = 1; i <= rango; i++) {
83
84
  const cuenta = data.find((item) => item.RubroId == rubroDestino);
84
- let copy = Object.assign({}, cuenta);
85
+ let copy = { ...cuenta };
85
86
  copy.RubroId = (esDetalle ? `${rubroDestino}` : `${rubroDestino}.1`);
86
87
  copy.Descripcion = `${cuenta.Descripcion} ${actividad.ActividadEconomicaId} ${actividad.Descripcion}`;
87
88
  copy.UUID = `${rubroDestino}_${actividad.ActividadEconomicaId}_${i}`;
@@ -124,7 +125,7 @@ const getCuentasCopy = (data, rubroId, map) => {
124
125
  let cuentaIngreso = map.get(`${rubroId}_${i}`);
125
126
  cuentaIngreso.MontoEmpresa = Math.round(parseFloat(cuentaIngreso.MontoEmpresa) * 100) / 100;
126
127
  cuentaIngreso.MontoFamiliar = Math.round(parseFloat(cuentaIngreso.MontoFamiliar) * 100) / 100;
127
- originalData.set(`${rubroId}_${i}`, Object.assign({}, cuentaIngreso));
128
+ originalData.set(`${rubroId}_${i}`, { ...cuentaIngreso });
128
129
  }
129
130
  return originalData;
130
131
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class FlujoProyectadoEEFFStrategy {
4
+ actividades;
4
5
  constructor() {
5
6
  this.actividades = [];
6
7
  }
@@ -53,7 +54,7 @@ const agregarGrupo = (rubros, actividad, grupoActividad, rubroDestino, data) =>
53
54
  return acc;
54
55
  }, null);
55
56
  const rubro = data.FlujoProyectadoAnual[0];
56
- let row = Object.assign({}, rubro);
57
+ let row = { ...rubro };
57
58
  row.RubroId = rubroDestino;
58
59
  row.Clasificador = 'CT';
59
60
  row.Descripcion = `Actividad: ${actividad.Descripcion}`;
@@ -79,5 +80,5 @@ const sumarizarCuenta = (rubroId, data) => {
79
80
  };
80
81
  const getCuentaCopy = (rubroId, data) => {
81
82
  const cuenta = data.FlujoProyectadoAnualMap.get(`${rubroId}_0`);
82
- return Object.assign({}, cuenta);
83
+ return { ...cuenta };
83
84
  };
@@ -0,0 +1 @@
1
+ export {};