bdpformulas 1.0.65 → 1.0.67

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/index.d.ts CHANGED
@@ -21,6 +21,7 @@ import BalanceGeneralStrategy from './strategies/general/balanceGeneral.strategy
21
21
  import FlujoProyectadoGeneralStrategy from './strategies/general/flujoProyGeneral.strategy';
22
22
  import AdmFinancieraStrategy from './strategies/eeff/admFinanciera.strategy';
23
23
  import SupuestosStrategy from './strategies/eeff/supuestos.strategy';
24
+ import DeudasStrategy from './strategies/eeff/deudas.strategy';
24
25
  declare const Pecuario: {
25
26
  Auxiliar: typeof Auxiliar;
26
27
  Desarrollo: typeof Desarrollo;
@@ -45,6 +46,7 @@ declare const EEFF: {
45
46
  FlujoProyectadoEEFFStrategy: typeof FlujoProyectadoEEFFStrategy;
46
47
  AdmFinancieraStrategy: typeof AdmFinancieraStrategy;
47
48
  SupuestosStrategy: typeof SupuestosStrategy;
49
+ DeudasStrategy: typeof DeudasStrategy;
48
50
  };
49
51
  declare const General: {
50
52
  BalanceGeneralStrategy: typeof BalanceGeneralStrategy;
package/build/index.js CHANGED
@@ -28,6 +28,7 @@ const balanceGeneral_strategy_1 = __importDefault(require("./strategies/general/
28
28
  const flujoProyGeneral_strategy_1 = __importDefault(require("./strategies/general/flujoProyGeneral.strategy"));
29
29
  const admFinanciera_strategy_1 = __importDefault(require("./strategies/eeff/admFinanciera.strategy"));
30
30
  const supuestos_strategy_1 = __importDefault(require("./strategies/eeff/supuestos.strategy"));
31
+ const deudas_strategy_1 = __importDefault(require("./strategies/eeff/deudas.strategy"));
31
32
  const Pecuario = {
32
33
  Auxiliar: anexo_strategy_1.default,
33
34
  Desarrollo: desarrollo_strategy_1.default,
@@ -54,7 +55,8 @@ const EEFF = {
54
55
  BalanceEEFFStrategy: balanceEEFF_strategy_1.default,
55
56
  FlujoProyectadoEEFFStrategy: flujoProyEEFF_strategy_1.default,
56
57
  AdmFinancieraStrategy: admFinanciera_strategy_1.default,
57
- SupuestosStrategy: supuestos_strategy_1.default
58
+ SupuestosStrategy: supuestos_strategy_1.default,
59
+ DeudasStrategy: deudas_strategy_1.default
58
60
  };
59
61
  exports.EEFF = EEFF;
60
62
  const General = {
@@ -0,0 +1,10 @@
1
+ import { Strategy } from "../../strategy.interface";
2
+ export default class DeudasStrategy implements Strategy {
3
+ data: any;
4
+ constructor();
5
+ cleanNumber: (data: any) => number;
6
+ calcularDeuda(params: any): void;
7
+ calcularDeudaFilaPorcentaje(params: any): void;
8
+ sumarizador(params: any): any;
9
+ execute(data: any): any;
10
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class DeudasStrategy {
4
+ data;
5
+ constructor() {
6
+ this.data = {};
7
+ }
8
+ cleanNumber = (data) => {
9
+ if (!data)
10
+ return 0;
11
+ else
12
+ return Math.round(parseFloat(data) * 100) / 100;
13
+ };
14
+ calcularDeuda(params) {
15
+ let i = 1;
16
+ do {
17
+ let row1 = this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i);
18
+ let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == i);
19
+ let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == i);
20
+ for (let j = 1; j <= this.data.CantidadProyeccion; j++) {
21
+ row3[`Monto${j}`] = (this.cleanNumber(row1[`Monto${j}`]) + this.cleanNumber(row2[`Monto${j}`])) * this.cleanNumber(row3.Variable) / 100;
22
+ row3[`Monto${j}`] = Math.round(row3[`Monto${j}`] * 100) / 100;
23
+ }
24
+ i++;
25
+ } while (this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i));
26
+ }
27
+ calcularDeudaFilaPorcentaje(params) {
28
+ let i = 1;
29
+ do {
30
+ let row1 = this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i);
31
+ let row2 = this.data.Deudas.find((item) => item.RubroId == params.rubro2 && item.Secuencia == i);
32
+ let row3 = this.data.Deudas.find((item) => item.RubroId == params.rubro3 && item.Secuencia == i);
33
+ for (let j = 1; j <= this.data.CantidadProyeccion; j++) {
34
+ row3[`Monto${j}`] = (this.cleanNumber(row1[`Monto${j}`]) * this.cleanNumber(row2[`Monto${j}`]) / 100);
35
+ row3[`Monto${j}`] = Math.round(row3[`Monto${j}`] * 100) / 100;
36
+ }
37
+ i++;
38
+ } while (this.data.Deudas.find((item) => item.RubroId == params.rubro1 && item.Secuencia == i));
39
+ }
40
+ sumarizador(params) {
41
+ let destino = this.data.Deudas.find((item) => item.RubroId == params.rubro2);
42
+ this.data.Deudas.filter((item) => item.RubroId == params.rubro1).reduce((sum, item) => {
43
+ if (!sum)
44
+ sum = item;
45
+ else {
46
+ for (let i = 1; i <= this.data.CantidadProyeccion; i++) {
47
+ sum[`Monto${i}`] = this.cleanNumber(sum[`Monto${i}`]) + this.cleanNumber(item[`Monto${i}`]);
48
+ destino[`Monto${i}`] = sum[`Monto${i}`];
49
+ }
50
+ }
51
+ return sum;
52
+ }, null);
53
+ return destino;
54
+ }
55
+ execute(data) {
56
+ this.data = data;
57
+ this.calcularDeuda({ rubro1: 'ACT_DEU_10001', rubro2: 'ACT_DEU_10002', rubro3: 'ACT_DEU_10003' });
58
+ this.sumarizador({ rubro1: 'ACT_DEU_10001', rubro2: 'ACT_DEU_10100' });
59
+ this.sumarizador({ rubro1: 'ACT_DEU_10002', rubro2: 'ACT_DEU_10200' });
60
+ this.sumarizador({ rubro1: 'ACT_DEU_10003', rubro2: 'ACT_DEU_10300' });
61
+ this.calcularDeuda({ rubro1: 'ACT_DEU_20001', rubro2: 'ACT_DEU_20002', rubro3: 'ACT_DEU_20003' });
62
+ this.calcularDeuda({ rubro1: 'ACT_DEU_30001', rubro2: 'ACT_DEU_30002', rubro3: 'ACT_DEU_30003' });
63
+ this.sumarizador({ rubro1: 'ACT_DEU_30001', rubro2: 'ACT_DEU_30100' });
64
+ this.sumarizador({ rubro1: 'ACT_DEU_30002', rubro2: 'ACT_DEU_30200' });
65
+ this.sumarizador({ rubro1: 'ACT_DEU_30003', rubro2: 'ACT_DEU_30300' });
66
+ this.calcularDeuda({ rubro1: 'ACT_DEU_40001', rubro2: 'ACT_DEU_40002', rubro3: 'ACT_DEU_40003' });
67
+ this.sumarizador({ rubro1: 'ACT_DEU_40001', rubro2: 'ACT_DEU_40100' });
68
+ this.sumarizador({ rubro1: 'ACT_DEU_40002', rubro2: 'ACT_DEU_40200' });
69
+ this.sumarizador({ rubro1: 'ACT_DEU_40003', rubro2: 'ACT_DEU_40300' });
70
+ this.calcularDeudaFilaPorcentaje({ rubro1: 'ACT_DEU_50001', rubro2: 'ACT_DEU_50002', rubro3: 'ACT_DEU_50003' });
71
+ this.calcularDeudaFilaPorcentaje({ rubro1: 'ACT_DEU_60001', rubro2: 'ACT_DEU_60002', rubro3: 'ACT_DEU_60003' });
72
+ return this.data.Deudas;
73
+ }
74
+ }
75
+ exports.default = DeudasStrategy;
@@ -1,5 +1,9 @@
1
1
  import { Strategy } from "../../strategy.interface";
2
2
  export default class SupuestosStrategy implements Strategy {
3
+ cantidadGestiones: number;
4
+ data: any;
3
5
  constructor();
6
+ private anadirPrecalculo;
7
+ private cleanNumber;
4
8
  execute(data: any): any;
5
9
  }
@@ -1,28 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class SupuestosStrategy {
4
+ cantidadGestiones;
5
+ data;
4
6
  constructor() {
7
+ this.cantidadGestiones = 0;
8
+ this.data = {};
5
9
  }
10
+ //@ts-ignore
11
+ anadirPrecalculo(origen, rubroOrigen, rubroDestino, percent = false) {
12
+ if (this.cantidadGestiones != 0) {
13
+ //@ts-ignore
14
+ const origenRow = origen.find((item) => item.RubroId == rubroOrigen);
15
+ //@ts-ignore
16
+ let destinoRow = this.data.find((item) => item.RubroId == rubroDestino);
17
+ if (!percent)
18
+ destinoRow.Gestion1 = this.cleanNumber(origenRow[`Gestion${this.cantidadGestiones}`]);
19
+ else {
20
+ destinoRow.Gestion1 = this.cleanNumber(origenRow[`Gestion${this.cantidadGestiones}%`] / 100);
21
+ destinoRow.Gestion1 = Math.round(destinoRow.Gestion1 * 100) / 100;
22
+ }
23
+ }
24
+ }
25
+ cleanNumber = (data) => {
26
+ if (!data)
27
+ return 0;
28
+ else
29
+ return Math.round(parseFloat(data) * 100) / 100;
30
+ };
6
31
  execute(data) {
32
+ this.data = data.Supuestos;
33
+ this.cantidadGestiones = data.CantidadGestiones;
7
34
  let rowDeprecCoef = data.Supuestos.find((item) => item.RubroId == 'ACT_SUP_10402');
8
35
  let rowDeprecValue = data.Supuestos.find((item) => item.RubroId == 'ACT_SUP_10403');
9
36
  let rowDeprecCoefLeasing = data.Supuestos.find((item) => item.RubroId == 'ACT_SUP_10404');
10
37
  let rowDeprecValueLeasing = data.Supuestos.find((item) => item.RubroId == 'ACT_SUP_10405');
11
- const cleanNumber = (data) => {
12
- if (!data)
13
- return 0;
14
- else
15
- return Math.round(parseFloat(data) * 100) / 100;
16
- };
17
38
  for (let i = 1; i <= data.CantidadProyeccion; i++) {
18
39
  const activosFijosNetos = data.BalanceProyectado.find((item) => item.Correlativo == i && item.RubroId == 'BP_ACT_EF_12003');
19
40
  const activosPorArrendamiento = data.BalanceProyectado.find((item) => item.Correlativo == i && item.RubroId == 'BP_ACT_EF_12004');
20
41
  if (rowDeprecValue != null)
21
- rowDeprecValue[`Gestion${i}`] = cleanNumber(rowDeprecCoef[`Gestion${i}`]) * cleanNumber(activosFijosNetos.Monto);
42
+ rowDeprecValue[`Gestion${i}`] = this.cleanNumber(rowDeprecCoef[`Gestion${i}`]) * this.cleanNumber(activosFijosNetos.Monto);
22
43
  if (rowDeprecValueLeasing != null)
23
- rowDeprecValueLeasing[`Gestion${i}`] = cleanNumber(rowDeprecCoefLeasing[`Gestion${i}`]) * cleanNumber(activosPorArrendamiento.Monto);
44
+ rowDeprecValueLeasing[`Gestion${i}`] = this.cleanNumber(rowDeprecCoefLeasing[`Gestion${i}`]) * this.cleanNumber(activosPorArrendamiento.Monto);
24
45
  }
25
- return data.Supuestos;
46
+ this.anadirPrecalculo(data.EEFF.eerr, 'ACT_EF_42000', 'ACT_SUP_10101');
47
+ this.anadirPrecalculo(data.EEFF.eerr, 'ACT_EF_44003', 'ACT_SUP_10104');
48
+ this.anadirPrecalculo(data.EEFF.eerr, 'ACT_EF_42001', 'ACT_SUP_10201', true);
49
+ this.anadirPrecalculo(data.EEFF.eerr, 'ACT_EF_43001', 'ACT_SUP_10202', true);
50
+ this.anadirPrecalculo(data.EEFF.eerr, 'ACT_EF_44004', 'ACT_SUP_10203');
51
+ this.anadirPrecalculo(data.EEFF.balance, 'ACT_EF_11008', 'ACT_SUP_20102');
52
+ return this.data;
26
53
  }
27
54
  }
28
55
  exports.default = SupuestosStrategy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdpformulas",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",