bdpformulas 1.0.36 → 1.0.37

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.
@@ -1,15 +1,94 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ventas_calc_1 = require("./ventas.detail/ventas.calc");
3
4
  class FlujoProyectadoAgrStrategy {
4
5
  constructor() {
5
6
  this.actividades = [];
6
7
  }
7
8
  execute(data) {
8
- data.eerr = calcular(data, this.actividades);
9
+ if (!this.actividades || this.actividades.length == 0)
10
+ throw new Error('Debe ingresar actividades Agrícolas');
11
+ calcularFlujoMensual(data, this.actividades);
9
12
  return data;
10
13
  }
11
14
  }
12
15
  exports.default = FlujoProyectadoAgrStrategy;
13
- const calcular = (data, actividades) => {
16
+ const calcularFlujoMensual = (data, actividades) => {
17
+ const consolidadoIngresos = [];
18
+ const consolidadoCostos = [];
19
+ const gastosOperativos = [];
20
+ const gastosFamiliares = [];
21
+ const consolidadoOtrosIngresos = [];
22
+ for (let actividad of actividades) {
23
+ (0, ventas_calc_1.addCalculoIngresosVentas)(actividad.Ventas);
24
+ consolidadoIngresos.push(getIngresoActividad(actividad));
25
+ consolidadoCostos.push(getCostosActividad(actividad));
26
+ gastosOperativos.push(getGastos(actividad, 'Operativos'));
27
+ gastosFamiliares.push(getGastos(actividad, 'Familiares'));
28
+ consolidadoOtrosIngresos.push(getOtrosIngresos(actividad));
29
+ }
30
+ for (let i = 1; i <= 12; i++) {
31
+ setValues(data, consolidadoIngresos, 'ACT_CNFL_40001', i);
32
+ setValues(data, consolidadoCostos, 'ACT_CNFL_50001', i);
33
+ setValues(data, gastosOperativos, 'ACT_CNFL_60001', i);
34
+ setValues(data, gastosFamiliares, 'ACT_CNFL_70002', i);
35
+ setValues(data, consolidadoOtrosIngresos, 'ACT_CNFL_70001', i);
36
+ }
14
37
  return data;
15
38
  };
39
+ //@ts-ignore
40
+ const setValues = (data, consolidado, rubroId, i) => {
41
+ let row = data.FlujoProyectadoMensualMap.get(`${rubroId}_0`);
42
+ if (parseFloat(row[`Monto${i}`]) == 0) {
43
+ consolidado.forEach((item) => {
44
+ if (item) {
45
+ row[`Monto${i}`] += item[`Monto${i}`];
46
+ }
47
+ });
48
+ row[`Monto${i}`] = Math.round(parseFloat(row[`Monto${i}`]) * 100) / 100;
49
+ }
50
+ };
51
+ //@ts-ignore
52
+ const getIngresoActividad = (actividad) => {
53
+ if (!actividad.Ventas.CalculoIngreso)
54
+ return null;
55
+ const total = actividad.Ventas.CalculoIngreso.find((item) => item.ActividadProductoId == 0);
56
+ let result = Object.assign(Object.assign({}, total), { Descripcion: `Ventas Act:${total.ActividadEconomicaId}` });
57
+ return result;
58
+ };
59
+ //@ts-ignore
60
+ const getCostosActividad = (actividad) => {
61
+ if (!actividad.Costos.Meses || actividad.Costos.Meses.length == 0)
62
+ return null;
63
+ const total = actividad.Costos.Meses.find((item) => item.ActividadProductoId == 0);
64
+ let result = Object.assign(Object.assign({}, total), { Descripcion: `Costos Act:${total.ActividadEconomicaId}` });
65
+ return result;
66
+ };
67
+ //@ts-ignore
68
+ const getGastos = (actividad, tipo) => {
69
+ if (!actividad.OtrosGastos[tipo] || actividad.OtrosGastos[tipo].length == 0)
70
+ return null;
71
+ const total = actividad.OtrosGastos[tipo].reduce((acc, item) => {
72
+ acc += Math.round(parseFloat(item.ImporteMensual) * 100) / 100;
73
+ return acc;
74
+ }, 0);
75
+ let result = { Descripcion: `Gastos ${tipo} Act:${total.ActividadEconomicaId}` };
76
+ for (let i = 1; i <= 12; i++) {
77
+ result[`Monto${i}`] = total;
78
+ }
79
+ return result;
80
+ };
81
+ //@ts-ignore
82
+ const getOtrosIngresos = (actividad) => {
83
+ if (!actividad.Ventas.OtrosIngresos || actividad.Ventas.OtrosIngresos.length == 0)
84
+ return null;
85
+ let result = actividad.Ventas.OtrosIngresos.reduce((acc, item) => {
86
+ for (let i = 1; i <= 12; i++) {
87
+ if (!acc[`Monto${i}`])
88
+ acc[`Monto${i}`] = 0;
89
+ acc[`Monto${i}`] += parseFloat(item[`Gestion${i}`]);
90
+ }
91
+ return acc;
92
+ }, { Descripcion: `` });
93
+ return result;
94
+ };
@@ -0,0 +1,2 @@
1
+ export declare const addCalculoIngresosVentas: (ventas: any) => void;
2
+ export declare const calcularIngreso: (producto: any) => any;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calcularIngreso = exports.addCalculoIngresosVentas = void 0;
4
+ const addCalculoIngresosVentas = (ventas) => {
5
+ if (!ventas || !ventas.Productos || ventas.Productos.length == 0)
6
+ return;
7
+ const calculoIngreso = ventas.Productos.reduce((acc, producto) => {
8
+ const ingreso = (0, exports.calcularIngreso)(producto);
9
+ if (!acc.has(0))
10
+ acc.set(0, Object.assign(Object.assign({}, ingreso), { ActividadProductoId: 0, ActividadProductoDesc: 'Total' }));
11
+ else {
12
+ for (let i = 1; i <= 12; i++) {
13
+ acc.get(0)[`Monto${i}`] += ingreso[`Monto${i}`];
14
+ }
15
+ }
16
+ acc.set(ingreso.ActividadProductoId, ingreso);
17
+ return acc;
18
+ }, new Map());
19
+ ventas.CalculoIngreso = Array.from(calculoIngreso.values());
20
+ };
21
+ exports.addCalculoIngresosVentas = addCalculoIngresosVentas;
22
+ const calcularIngreso = (producto) => {
23
+ let result = {};
24
+ const ingresoTotalCampanna = parseFloat(producto.IngresoTotalCampanna);
25
+ const estacionalidad = producto.Estacionalidad[0];
26
+ result.ActividadEconomicaId = estacionalidad.ActividadEconomicaId;
27
+ result.ActividadProductoId = estacionalidad.ActividadProductoId;
28
+ result.ActividadProductoDesc = estacionalidad.ActividadProductoDesc;
29
+ let acum = 0;
30
+ for (let i = 1; i <= 12; i++) {
31
+ result[`Monto${i}`] =
32
+ Math.round(ingresoTotalCampanna * parseFloat(estacionalidad[`Gestion${i}`]) * 100) / 100;
33
+ acum += result[`Monto${i}`];
34
+ }
35
+ result.Total = acum;
36
+ return result;
37
+ };
38
+ exports.calcularIngreso = calcularIngreso;
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const balanceCalc = __importStar(require("./common/balance.calc"));
27
27
  const commmon = __importStar(require("./common/balance.calc"));
28
- const declaracionJurada_calc_1 = require("./common/balanceCalculos/declaracionJurada.calc");
28
+ const declaracionJurada_calc_1 = require("./common/declaracionJurada.calc");
29
29
  const flujoAux_calc_1 = require("./common/balanceCalculos/flujoAux.calc");
30
30
  class Balance {
31
31
  execute(data) {
@@ -0,0 +1,2 @@
1
+ export declare const getCajaInicial: (declaracionJurada: any) => any;
2
+ export declare const anadirDeclaracionJurada: (balanceMap: any, balanceArray: any, declaracionJurada: any) => void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.anadirDeclaracionJurada = exports.getCajaInicial = void 0;
4
+ const balanceAux_calc_1 = require("./balanceCalculos/balanceAux.calc");
5
+ const getCajaInicial = (declaracionJurada) => {
6
+ if (!declaracionJurada || !declaracionJurada.Balance || declaracionJurada.Balance.length == 0)
7
+ return 0;
8
+ const disponibilidades = declaracionJurada.Balance.find((value) => value.RubroId === 'SOL_ACT_001');
9
+ if (!disponibilidades)
10
+ throw new Error('No se encontró el rubro de Disponibilidades en el balance de la declaración jurada');
11
+ return disponibilidades.MontoFamiliar;
12
+ };
13
+ exports.getCajaInicial = getCajaInicial;
14
+ const anadirDeclaracionJurada = (balanceMap, balanceArray, declaracionJurada) => {
15
+ const rango = balanceArray[0].Rango;
16
+ if (!declaracionJurada || declaracionJurada.length == 0)
17
+ throw new Error('Debe ingresar un Declaración Jurada válida');
18
+ const declaracionMap = declaracionJurada.reduce((acc, item) => {
19
+ acc.set(item.RubroId, item);
20
+ if (!acc.has('Total')) {
21
+ acc.set('Total', { TotalActivosE: 0, TotalPasivosE: 0, TotalActivosF: 0, TotalPasivosF: 0 });
22
+ }
23
+ if (item.TipoRubroId === 'ACTIVOS') {
24
+ acc.get('Total').TotalActivosE += parseFloat(item.MontoEmpresa);
25
+ acc.get('Total').TotalActivosF += parseFloat(item.MontoFamiliar);
26
+ }
27
+ if (item.TipoRubroId === 'PASIVOS') {
28
+ acc.get('Total').TotalPasivosE += parseFloat(item.MontoEmpresa);
29
+ acc.get('Total').TotalPasivosF += parseFloat(item.MontoFamiliar);
30
+ }
31
+ return acc;
32
+ }, new Map());
33
+ let referencia = [];
34
+ referencia.push(arrayValue(['SOL_ACT_001'], 'ACT_CN_11001'));
35
+ referencia.push(arrayValue(['SOL_ACT_002'], 'ACT_CN_11002'));
36
+ referencia.push(arrayValue(['SOL_ACT_011'], 'ACT_CN_11003'));
37
+ referencia.push(arrayValue(['SOL_ACT_003'], 'ACT_CN_12001'));
38
+ referencia.push(arrayValue(['SOL_ACT_005', 'SOL_ACT_007', 'SOL_ACT_008', 'SOL_ACT_009', 'SOL_ACT_010'], 'ACT_CN_12002'));
39
+ referencia.push(arrayValue(['SOL_ACT_004'], 'ACT_CN_12003'));
40
+ referencia.push(arrayValue(['SOL_ACT_006', 'SOL_ACT_012'], 'ACT_CN_12004'));
41
+ referencia.push(arrayValue(['SOL_PAS_001'], 'ACT_CN_21001'));
42
+ referencia.push(arrayValue(['SOL_PAS_002'], 'ACT_CN_21002'));
43
+ referencia.push(arrayValue(['SOL_PAS_003'], 'ACT_CN_22001'));
44
+ referencia.push(arrayValue(['SOL_PAS_004'], 'ACT_CN_22002'));
45
+ for (const item of referencia) {
46
+ const key = `${item.key}_${rango}`;
47
+ if (balanceMap.has(key)) {
48
+ if (balanceMap.get(key).MontoEmpresa == 0 || balanceMap.get(key).MontoFamiliar == 0) {
49
+ const values = getValuesFromDj(item.array, declaracionMap);
50
+ if (balanceMap.get(key).MontoEmpresa == 0)
51
+ balanceMap.get(key).MontoEmpresa = values.montoEmpresa;
52
+ if (balanceMap.get(key).MontoFamiliar == 0)
53
+ balanceMap.get(key).MontoFamiliar = values.montoFamiliar;
54
+ }
55
+ }
56
+ else {
57
+ const some = balanceArray.find((value) => value.RubroId === item.ley);
58
+ const values = getValuesFromDj(item.array, declaracionMap);
59
+ (0, balanceAux_calc_1.anadirNuevoRubro)(some, balanceMap, values, '(Declaración Jurada)');
60
+ }
61
+ }
62
+ const keyCapital = `ACT_CN_30001_${rango}`;
63
+ balanceMap.get(keyCapital).MontoEmpresa = declaracionMap.get('Total').TotalActivosE -
64
+ declaracionMap.get('Total').TotalPasivosE;
65
+ balanceMap.get(keyCapital).MontoFamiliar = declaracionMap.get('Total').TotalActivosF -
66
+ declaracionMap.get('Total').TotalPasivosF;
67
+ };
68
+ exports.anadirDeclaracionJurada = anadirDeclaracionJurada;
69
+ const arrayValue = (array, key) => {
70
+ return {
71
+ array: array,
72
+ key: key
73
+ };
74
+ };
75
+ const getValuesFromDj = (arrayDj, declaracionMap) => {
76
+ let montoFamiliar = 0;
77
+ let montoEmpresa = 0;
78
+ for (const djItem of arrayDj) {
79
+ montoEmpresa += parseFloat(declaracionMap.get(djItem).MontoEmpresa);
80
+ montoFamiliar += parseFloat(declaracionMap.get(djItem).MontoFamiliar);
81
+ }
82
+ return { montoFamiliar, montoEmpresa };
83
+ };
@@ -0,0 +1,24 @@
1
+ export default class FlujoConstructor {
2
+ tipo: string;
3
+ rango: number;
4
+ private mapObject;
5
+ private array;
6
+ private data;
7
+ constructor(tipo: string, data: any);
8
+ calcularFlujo: () => void;
9
+ calcularFlujoAcumuladoMensual: (data: any) => void;
10
+ calcularTotal: (sumandosArray: string[], total: string) => void;
11
+ calcularResta: (positivoRubro: string, negativoRubro: string, destinoRubro: string) => void;
12
+ proyectarIngreso: () => void;
13
+ proyectarCosto: () => void;
14
+ proyectarGasto: () => void;
15
+ moverDetalledesdeMensual: () => void;
16
+ calcularTotalDetalle: (sumandosArray: string[], total: string) => void;
17
+ calcularPorcentajeIngresCostos: () => void;
18
+ calcularOtrosIngresosAnuales: () => void;
19
+ calcularGastosFamiliares: () => void;
20
+ calcularFlujoInversiones: () => void;
21
+ calcularFlujoAcumuladoAnual: () => void;
22
+ adicionarCapacidadPago: () => void;
23
+ getFlujoEfectivo: () => void;
24
+ }
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class FlujoConstructor {
4
+ constructor(tipo, data) {
5
+ this.calcularFlujo = () => {
6
+ if (this.tipo == 'ANUAL') {
7
+ this.proyectarIngreso();
8
+ this.proyectarCosto();
9
+ this.proyectarGasto();
10
+ this.moverDetalledesdeMensual();
11
+ this.calcularTotalDetalle(['ACT_CNFL_73000'], 'ACT_CNFL_73900');
12
+ this.calcularTotalDetalle(['ACT_CNFL_61001'], 'ACT_CNFL_61900');
13
+ this.calcularOtrosIngresosAnuales();
14
+ this.calcularGastosFamiliares();
15
+ this.calcularFlujoInversiones();
16
+ }
17
+ this.calcularTotal(['ACT_CNFL_40001', 'ACT_CNFL_40002'], 'ACT_CNFL_49000'); //Total Ingresos
18
+ this.calcularTotal(['ACT_CNFL_50001', 'ACT_CNFL_50002'], 'ACT_CNFL_59000'); //Total Costos
19
+ this.calcularResta('ACT_CNFL_49000', 'ACT_CNFL_59000', 'ACT_CNFL_59999'); //Utilidad Bruta
20
+ this.calcularTotal(['ACT_CNFL_61001'], 'ACT_CNFL_61900'); //subtotal Gastos Operativos
21
+ this.calcularTotal(['ACT_CNFL_60001', 'ACT_CNFL_60002', 'ACT_CNFL_61900'], 'ACT_CNFL_69000'); //Total Gastos Operativos
22
+ this.calcularResta('ACT_CNFL_59999', 'ACT_CNFL_69000', 'ACT_CNFL_69999'); //Utilidad Operativa
23
+ this.calcularResta('ACT_CNFL_70001', 'ACT_CNFL_70002', 'ACT_CNFL_72000'); //Total Otros Ingresos e Egresos
24
+ this.calcularTotal(['ACT_CNFL_73000'], 'ACT_CNFL_73900');
25
+ this.calcularResta('ACT_CNFL_72000', 'ACT_CNFL_73900', 'ACT_CNFL_79000'); //Resultado Otros Ingresos e Egresos
26
+ this.calcularResta('ACT_CNFL_69999', 'ACT_CNFL_79000', 'ACT_CNFL_79999'); //Utilidad Neta
27
+ this.calcularTotal(['ACT_CNFL_80001', 'ACT_CNFL_80002'], 'ACT_CNFL_80900'); //Total Flujo de Inversión
28
+ this.calcularTotal(['ACT_CNFL_81001'], 'ACT_CNFL_81090'); //subtotal Ingresos de Efectivo
29
+ this.calcularTotal(['ACT_CNFL_81200'], 'ACT_CNFL_81290'); //subtotal Cuota BDP
30
+ this.calcularResta('ACT_CNFL_81090', 'ACT_CNFL_81290', 'ACT_CNFL_82100'); //Total Flujo financiero
31
+ if (this.tipo == 'MENSUAL') {
32
+ this.calcularTotal(['ACT_CNFL_79999', 'ACT_CNFL_80900', 'ACT_CNFL_82100'], 'ACT_CNFL_82200');
33
+ this.calcularFlujoAcumuladoMensual(this.data);
34
+ }
35
+ else if (this.tipo == 'ANUAL') {
36
+ this.calcularFlujoAcumuladoAnual();
37
+ this.calcularTotal(['ACT_CNFL_79999', 'ACT_CNFL_80900', 'ACT_CNFL_82100'], 'ACT_CNFL_82110');
38
+ this.adicionarCapacidadPago();
39
+ this.getFlujoEfectivo();
40
+ }
41
+ this.array.map((item) => {
42
+ item.MontoTotal = 0;
43
+ for (let i = 1; i <= this.rango; i++) {
44
+ item.MontoTotal += parseFloat(item[`Monto${i}`]);
45
+ }
46
+ item.MontoTotal = Math.round(item.MontoTotal * 100) / 100;
47
+ });
48
+ if (this.tipo == 'MENSUAL') {
49
+ this.calcularPorcentajeIngresCostos();
50
+ }
51
+ };
52
+ this.calcularFlujoAcumuladoMensual = (data) => {
53
+ let rowTotal = this.mapObject.get(`ACT_CNFL_82200_0`);
54
+ let rowAcumulado = this.mapObject.get(`ACT_CNFL_82300_0`);
55
+ for (let i = 1; i <= this.rango; i++) {
56
+ if (i == 1) {
57
+ rowAcumulado[`Monto${i}`] = parseFloat(rowTotal[`Monto${i}`]) + parseFloat(data.CajaInicial);
58
+ }
59
+ else {
60
+ rowAcumulado[`Monto${i}`] = rowTotal[`Monto${i}`] + rowAcumulado[`Monto${i - 1}`];
61
+ }
62
+ rowAcumulado[`Monto${i}`] = Math.round(rowAcumulado[`Monto${i}`] * 100) / 100;
63
+ }
64
+ };
65
+ this.calcularTotal = (sumandosArray, total) => {
66
+ const rows = this.array.filter((item) => sumandosArray.includes(item.RubroId));
67
+ let destino = this.mapObject.get(`${total}_0`);
68
+ rows.map((item) => {
69
+ for (let i = 1; i <= this.rango; i++) {
70
+ destino[`Monto${i}`] += parseFloat(item[`Monto${i}`]);
71
+ destino[`Monto${i}`] = Math.round(destino[`Monto${i}`] * 100) / 100;
72
+ }
73
+ });
74
+ };
75
+ this.calcularResta = (positivoRubro, negativoRubro, destinoRubro) => {
76
+ const positivo = this.mapObject.get(`${positivoRubro}_0`);
77
+ const negativo = this.mapObject.get(`${negativoRubro}_0`);
78
+ let destino = this.mapObject.get(`${destinoRubro}_0`);
79
+ for (let i = 1; i <= this.rango; i++) {
80
+ destino[`Monto${i}`] = positivo[`Monto${i}`] - negativo[`Monto${i}`];
81
+ destino[`Monto${i}`] = Math.round(destino[`Monto${i}`] * 100) / 100;
82
+ }
83
+ };
84
+ this.proyectarIngreso = () => {
85
+ const rowTotalIngresoM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_49000_0');
86
+ const rowVariacionIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_30001_0');
87
+ const rowIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_40001_0');
88
+ const I10 = 0;
89
+ for (let i = 1; i <= this.rango; i++) {
90
+ if (i == 1) {
91
+ rowIngresos[`Monto${i}`] = rowTotalIngresoM[`Monto12`] * (1 + rowVariacionIngresos[`Monto${i}`] + I10);
92
+ }
93
+ else {
94
+ rowIngresos[`Monto${i}`] = rowIngresos[`Monto${i - 1}`] * (1 + rowVariacionIngresos[`Monto${i}`] + I10);
95
+ }
96
+ rowIngresos[`Monto${i}`] = Math.round(rowIngresos[`Monto${i}`] * 100) / 100;
97
+ }
98
+ };
99
+ this.proyectarCosto = () => {
100
+ const rowIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_40001_0');
101
+ const rowVariacionCostos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_30002_0');
102
+ const rowCosto = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_50001_0');
103
+ for (let i = 1; i <= this.rango; i++) {
104
+ if (i == 1) {
105
+ rowCosto[`Monto1`] = (rowIngresos[`Monto1`] * rowCosto.MontoCajaPercent / 100) + (1 + rowVariacionCostos[`Monto${i}`]);
106
+ }
107
+ else {
108
+ rowCosto[`Monto${i}`] = rowIngresos[`Monto${i - 1}`] * (1 + rowVariacionCostos[`Monto${i}`]);
109
+ }
110
+ rowCosto[`Monto${i}`] = Math.round(rowCosto[`Monto${i}`] * 100) / 100;
111
+ }
112
+ };
113
+ this.proyectarGasto = () => {
114
+ const rowIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_40001_0');
115
+ const rowVariacionGastos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_30003_0');
116
+ const rowGasto = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_60001_0');
117
+ for (let i = 1; i <= this.rango; i++) {
118
+ if (i == 1) {
119
+ rowGasto[`Monto1`] = (rowIngresos[`Monto1`] *
120
+ rowGasto.MontoCajaPercent / 100) + (1 + rowVariacionGastos[`Monto${i}`]);
121
+ }
122
+ else {
123
+ rowGasto[`Monto${i}`] = rowIngresos[`Monto${i - 1}`] * (1 + rowVariacionGastos[`Monto${i}`]);
124
+ }
125
+ rowGasto[`Monto${i}`] = Math.round(rowGasto[`Monto${i}`] * 100) / 100;
126
+ }
127
+ };
128
+ this.moverDetalledesdeMensual = () => {
129
+ let filter = this.data.FlujoProyectadoMensual.filter((item) => item.RubroId == 'ACT_CNFL_61001' || item.RubroId == 'ACT_CNFL_73000');
130
+ filter.map((item) => {
131
+ if (this.mapObject.has(`${item.RubroId}_CLONE_${item.UUID}`)) {
132
+ let detalle = this.mapObject.get(`${item.RubroId}_CLONE_${item.UUID}`);
133
+ if (detalle.Monto1 == 0)
134
+ detalle.Monto1 = item.MontoTotal;
135
+ }
136
+ });
137
+ };
138
+ this.calcularTotalDetalle = (sumandosArray, total) => {
139
+ const rows = this.array.filter((item) => sumandosArray.includes(item.RubroId) && item.Comprar == 'NO');
140
+ let destino = this.mapObject.get(`${total}_0`);
141
+ rows.map((item) => {
142
+ for (let i = 1; i <= this.rango; i++) {
143
+ destino[`Monto${i}`] += parseFloat(item[`Monto${i}`]);
144
+ destino[`Monto${i}`] = Math.round(destino[`Monto${i}`] * 100) / 100;
145
+ }
146
+ });
147
+ };
148
+ this.calcularPorcentajeIngresCostos = () => {
149
+ const rowTotalIngresoM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_49000_0');
150
+ let costos = this.array.filter((item) => item.RubroId === 'ACT_CNFL_50001' || item.RubroId === 'ACT_CNFL_50002' ||
151
+ item.RubroId === 'ACT_CNFL_60001' || item.RubroId === 'ACT_CNFL_60002');
152
+ costos.map((item) => {
153
+ if (rowTotalIngresoM.MontoTotal != 0)
154
+ item.MontoCajaPercent = Math.round(parseFloat(item.MontoTotal) /
155
+ parseFloat(rowTotalIngresoM.MontoTotal) * 100);
156
+ else
157
+ item.MontoCajaPercent = 0;
158
+ if (item.RubroId == 'ACT_CNFL_50001' || item.RubroId === 'ACT_CNFL_60001') {
159
+ this.data.FlujoProyectadoAnualMap.get(`${item.RubroId}_0`).MontoCajaPercent = item.MontoCajaPercent;
160
+ }
161
+ });
162
+ this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_82300_0').MontoCajaPercent = this.data.CajaInicial;
163
+ };
164
+ this.calcularOtrosIngresosAnuales = () => {
165
+ const rowOtrosIngresosM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_70001_0');
166
+ let rowOtrosIngresosA = this.mapObject.get('ACT_CNFL_70001_0');
167
+ for (let i = 1; i <= this.rango; i++) {
168
+ rowOtrosIngresosA[`Monto${i}`] = rowOtrosIngresosM.MontoTotal;
169
+ rowOtrosIngresosA[`Monto${i}`] = Math.round(rowOtrosIngresosA[`Monto${i}`] * 100) / 100;
170
+ }
171
+ };
172
+ this.calcularGastosFamiliares = () => {
173
+ const rowOtrosIngresosM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_70002_0');
174
+ let rowGastosFamiliares = this.mapObject.get('ACT_CNFL_70002_0');
175
+ if (!rowGastosFamiliares.MontoCajaPercent)
176
+ rowGastosFamiliares.MontoCajaPercent = 0;
177
+ for (let i = 1; i <= this.rango; i++) {
178
+ if (i == 1) {
179
+ rowGastosFamiliares[`Monto${i}`] = rowOtrosIngresosM.MontoTotal *
180
+ (1 + (rowGastosFamiliares.MontoCajaPercent / 100));
181
+ }
182
+ else {
183
+ rowGastosFamiliares[`Monto${i}`] = rowGastosFamiliares[`Monto${i - 1}`] *
184
+ (1 + (rowGastosFamiliares.MontoCajaPercent / 100));
185
+ }
186
+ rowGastosFamiliares[`Monto${i}`] = Math.round(rowGastosFamiliares[`Monto${i}`] * 100) / 100;
187
+ }
188
+ };
189
+ this.calcularFlujoInversiones = () => {
190
+ const rowInversionM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_80001_0');
191
+ const rowAportePropioM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_80002_0');
192
+ let rowInversion = this.mapObject.get('ACT_CNFL_80001_0');
193
+ let rowAportePropio = this.mapObject.get('ACT_CNFL_80002_0');
194
+ if (rowInversion.Monto1 > 0)
195
+ rowInversion.Monto1 = rowInversionM.MontoTotal;
196
+ if (rowAportePropio.Monto1 > 0)
197
+ rowAportePropio.Monto1 = rowAportePropioM.MontoTotal;
198
+ };
199
+ this.calcularFlujoAcumuladoAnual = () => {
200
+ let flujoAcumulado = this.mapObject.get('ACT_CNFL_82300_0');
201
+ let excedente = this.mapObject.get('ACT_CNFL_82110_0');
202
+ let saldoInicialCaja = this.mapObject.get('ACT_CNFL_82120_0');
203
+ saldoInicialCaja.Monto1 = this.data.CajaInicial;
204
+ for (let i = 1; i <= this.rango; i++) {
205
+ if (i == 1) {
206
+ flujoAcumulado[`Monto${i}`] = parseFloat(excedente[`Monto${i}`]) +
207
+ parseFloat(saldoInicialCaja[`Monto${i}`]);
208
+ }
209
+ else {
210
+ flujoAcumulado[`Monto${i}`] = parseFloat(flujoAcumulado[`Monto${i - 1}`]) +
211
+ parseFloat(excedente[`Monto${i}`]);
212
+ }
213
+ flujoAcumulado[`Monto${i}`] = Math.round(flujoAcumulado[`Monto${i}`] * 100) / 100;
214
+ }
215
+ };
216
+ this.adicionarCapacidadPago = () => {
217
+ const utilidadNeta = this.mapObject.get('ACT_CNFL_82300_0');
218
+ const cuotaBdp = this.mapObject.get('ACT_CNFL_82300_0');
219
+ let result = {};
220
+ let acumulado = 0;
221
+ for (let i = 2; i <= this.rango; i++) {
222
+ if (utilidadNeta[`Monto${i}`] && utilidadNeta[`Monto${i}`] > 0)
223
+ result[`Monto${i}`] = cuotaBdp[`Monto${i}`] / utilidadNeta[`Monto${i}`];
224
+ else
225
+ result[`Monto${i}`] = 0;
226
+ result[`Monto${i}`] = Math.round(result[`Monto${i}`] * 100) / 100;
227
+ acumulado += result[`Monto${i}`];
228
+ }
229
+ result.PorcentajePromedio = Math.round(acumulado / this.rango * 100) / 100;
230
+ result.CapacidadMaxima = (acumulado / (this.rango - 1)) > 80 ? 'VERDADERO' : 'FALSO';
231
+ this.data.Pie = result;
232
+ };
233
+ this.getFlujoEfectivo = () => {
234
+ const tasaDescuento = Math.round(parseFloat(this.data.Parametros.TasaDescuento) * 100) / 100;
235
+ const totalFlujoInversiones = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_80900_0');
236
+ const excedente = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_82110_0');
237
+ let result = [];
238
+ let resultMap = new Map();
239
+ let indiceRentabilidad = 0;
240
+ for (let i = 0; i <= this.rango; i++) {
241
+ let value = {};
242
+ if (i == 0) {
243
+ value = { Anno: i, FlujoDeEfectivo: totalFlujoInversiones[`Monto1`] * -1, FlujoEfectivoDescontado: 0 };
244
+ result.push(value);
245
+ resultMap.set(i, value);
246
+ }
247
+ else {
248
+ value = { Anno: i, FlujoDeEfectivo: excedente[`Monto${i}`], FlujoEfectivoDescontado: 0 };
249
+ result.push(value);
250
+ resultMap.set(i, value);
251
+ }
252
+ value.FlujoEfectivoDescontado = value.FlujoDeEfectivo / Math.pow(1 + tasaDescuento, i);
253
+ indiceRentabilidad += value.FlujoDeEfectivo / Math.pow(1 + tasaDescuento, i);
254
+ }
255
+ indiceRentabilidad = Math.round((indiceRentabilidad / totalFlujoInversiones[`Monto1`]) * 100) / 100;
256
+ const VAN = calcularVAN(tasaDescuento, result.filter((item => item.Anno > 0)).
257
+ map((item) => item.FlujoDeEfectivo), totalFlujoInversiones[`Monto1`]);
258
+ const TIR = calcularTIR(result.map(item => item.FlujoDeEfectivo), totalFlujoInversiones[`Monto1`]);
259
+ let vars = [{ Descripcion: 'Tasa de descuento', Valor: tasaDescuento },
260
+ { Descripcion: 'VAN', Valor: VAN },
261
+ { Descripcion: 'TIR', Valor: TIR },
262
+ { Descripcion: 'Índice de Rentabilidad', Valor: indiceRentabilidad },
263
+ ];
264
+ this.data.FlujoDeEfectivo = result;
265
+ this.data.FlujoEfectivoVars = vars;
266
+ };
267
+ this.tipo = tipo;
268
+ if (tipo == 'MENSUAL') {
269
+ this.rango = 12;
270
+ this.mapObject = data.FlujoProyectadoMensualMap;
271
+ this.array = data.FlujoProyectadoMensual;
272
+ this.data = data;
273
+ }
274
+ else {
275
+ this.rango = data.DatosEvaluacion.CantidadProyeccion;
276
+ this.mapObject = data.FlujoProyectadoAnualMap;
277
+ this.array = data.FlujoProyectadoAnual;
278
+ this.data = data;
279
+ }
280
+ }
281
+ }
282
+ exports.default = FlujoConstructor;
283
+ const calcularVAN = (tasaDescuento, flujosDeCaja, inversionInicial) => {
284
+ let VAN = -inversionInicial;
285
+ for (let t = 0; t < flujosDeCaja.length; t++) {
286
+ VAN += flujosDeCaja[t] / Math.pow(1 + tasaDescuento, t + 1);
287
+ }
288
+ return VAN;
289
+ };
290
+ const calcularTIR = (flujosDeCaja, inversionInicial, precision = 1e-6) => {
291
+ let tasaMin = 0;
292
+ let tasaMax = 1;
293
+ let tasaMed = (tasaMin + tasaMax) / 2;
294
+ while ((tasaMax - tasaMin) > precision) {
295
+ let VAN = calcularVAN(tasaMed, flujosDeCaja, inversionInicial);
296
+ if (VAN > 0) {
297
+ tasaMin = tasaMed;
298
+ }
299
+ else {
300
+ tasaMax = tasaMed;
301
+ }
302
+ tasaMed = (tasaMin + tasaMax) / 2;
303
+ }
304
+ return tasaMed;
305
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getSupuestosEmpty: (data: any) => any[];
2
+ export declare const getSupuestos: (data: any) => any[];
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSupuestos = exports.getSupuestosEmpty = void 0;
4
+ const getSupuesto = (descripcion, descripcionCorta, valores) => {
5
+ let obj = {};
6
+ obj.Descripcion = descripcion;
7
+ obj.Corta = descripcionCorta;
8
+ obj.TipoValorFlujo = 'OTROS';
9
+ obj.ValorFlujo = 0;
10
+ obj.OtrosValor = 0;
11
+ obj.Valores = valores;
12
+ return obj;
13
+ };
14
+ const getValoresVacios = (rango) => {
15
+ let array = [];
16
+ for (let i = 1; i <= rango; i++) {
17
+ array.push({
18
+ Correlativo: i,
19
+ CorrelativoDesc: '-',
20
+ MontoPorcentual: 0
21
+ });
22
+ }
23
+ return array;
24
+ };
25
+ const getRango = (data) => {
26
+ let rango = 0;
27
+ if (!data.DatosEvaluacion || !data.DatosEvaluacion.Gestiones || data.DatosEvaluacion.Gestiones.length == 0)
28
+ throw new Error('No se encontraron gestiones definidas en la evaluación');
29
+ else
30
+ rango = data.DatosEvaluacion.Gestiones.length;
31
+ return rango;
32
+ };
33
+ const getSupuestosEmpty = (data) => {
34
+ let array = [];
35
+ let rango = getRango(data);
36
+ array.push(getSupuesto("% DE COSTOS", "% Costo", getValoresVacios(rango)));
37
+ array.push(getSupuesto("% GASTOS OPERATIVOS", "% G.O.", getValoresVacios(rango)));
38
+ return array;
39
+ };
40
+ exports.getSupuestosEmpty = getSupuestosEmpty;
41
+ const getSupuestos = (data) => {
42
+ let rango = getRango(data);
43
+ if (!data.balance || !data.balance.eerr)
44
+ return (0, exports.getSupuestosEmpty)(data);
45
+ let CostoVentasValuePercent = data.balance.eerr.find((item) => item.RubroId === 'ACT_CN_41001');
46
+ let GastosAdmValuePercent = data.balance.eerr.find((item) => item.RubroId === 'ACT_CN_43001');
47
+ CostoVentasValuePercent =
48
+ getSupuesto("% DE COSTOS", "% Costo", getValores(CostoVentasValuePercent, rango));
49
+ GastosAdmValuePercent =
50
+ getSupuesto("% GASTOS OPERATIVOS", "% G.O.", getValores(GastosAdmValuePercent, rango));
51
+ CostoVentasValuePercent = calcularValorOtros(CostoVentasValuePercent, data.FlujoProyectadoMensualMap, 'COSTOS');
52
+ GastosAdmValuePercent = calcularValorOtros(GastosAdmValuePercent, data.FlujoProyectadoMensualMap, 'GASTOS');
53
+ CostoVentasValuePercent = calcularValores(CostoVentasValuePercent, data.Parametros.PorcentajeCostos, rango);
54
+ GastosAdmValuePercent = calcularValores(GastosAdmValuePercent, data.Parametros.PorcentajeGastos, rango);
55
+ return [CostoVentasValuePercent, GastosAdmValuePercent];
56
+ };
57
+ exports.getSupuestos = getSupuestos;
58
+ const calcularValorOtros = (supuesto, data, tipo) => {
59
+ let rubroId = '';
60
+ if (tipo == 'COSTOS')
61
+ rubroId = 'ACT_CNFL_50001_0';
62
+ else if (tipo == 'GASTOS')
63
+ rubroId = 'ACT_CNFL_60001_0';
64
+ supuesto.OtrosValor =
65
+ data.get(rubroId).MontoCajaPercent;
66
+ return supuesto;
67
+ };
68
+ const calcularValores = (supuesto, tipoConfig, rango) => {
69
+ if (tipoConfig === 'PROMEDIO') {
70
+ let suma = supuesto.Valores.reduce((acc, item) => {
71
+ acc += item.MontoPorcentual;
72
+ return acc;
73
+ }, 0);
74
+ suma = Math.round(suma * 100) / 100;
75
+ supuesto.ValorFlujo = suma;
76
+ return supuesto;
77
+ }
78
+ else if (tipoConfig === 'PROMEDIO2') {
79
+ let suma = supuesto.Valores.reduce((acc, item) => {
80
+ if (item.Correlativo == rango - 1 || item.Correlativo == rango)
81
+ acc += item.MontoPorcentual;
82
+ return acc;
83
+ }, 0);
84
+ suma = Math.round(suma * 100) / 100;
85
+ supuesto.ValorFlujo = suma;
86
+ return;
87
+ }
88
+ else if (tipoConfig === 'MENOR') {
89
+ let menor = supuesto.Valores.reduce((acc, item) => {
90
+ if (acc > item.MontoPorcentual || acc == -1)
91
+ acc = item.MontoPorcentual;
92
+ return acc;
93
+ }, -1);
94
+ menor = Math.round(menor * 100) / 100;
95
+ supuesto.ValorFlujo = menor;
96
+ }
97
+ else if (tipoConfig === 'ULTIMA_GES') {
98
+ let ultimo = supuesto.Valores.reduce((acc, item) => {
99
+ if (item.Correlativo == rango)
100
+ acc = item.MontoPorcentual;
101
+ return acc;
102
+ }, 0);
103
+ ultimo = Math.round(ultimo * 100) / 100;
104
+ supuesto.ValorFlujo = ultimo;
105
+ }
106
+ else if (tipoConfig === 'OTROS') {
107
+ supuesto.ValorFlujo = supuesto.OtrosValor;
108
+ }
109
+ return supuesto;
110
+ };
111
+ const getValores = (rowEERR, rango) => {
112
+ if (!rowEERR)
113
+ return getValoresVacios(rango);
114
+ let array = [];
115
+ for (let i = 1; i <= rango; i++) {
116
+ array.push({
117
+ Correlativo: i,
118
+ CorrelativoDesc: rowEERR[`Fecha_${i}`],
119
+ MontoPorcentual: parseFloat(rowEERR[`MontoEmpresa_${i}`])
120
+ });
121
+ }
122
+ return array;
123
+ };
@@ -1,12 +1,4 @@
1
- export declare const getSupuestosEmpty: (data: any) => any[];
1
+ export declare const getFlujoMap: (data: any, rango: number) => any;
2
+ export declare const calcularFlujoMensual: (data: any) => void;
3
+ export declare const calcularFlujoAnual: (data: any) => void;
2
4
  export declare const getHistoricoFlujoCaja: (data: any) => any[];
3
- export declare const getFlujoEfectivo: (data: any) => {
4
- Anno: number;
5
- FlujoDeEfectivo: number;
6
- FlujoEfectivoDescontado: number;
7
- }[];
8
- export declare const getFlujoEfectivoExtra: (data: any) => {
9
- Descripcion: string;
10
- Valor: number;
11
- }[];
12
- export declare const getPieFlujo: (data: any) => any;
@@ -1,73 +1,39 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPieFlujo = exports.getFlujoEfectivoExtra = exports.getFlujoEfectivo = exports.getHistoricoFlujoCaja = exports.getSupuestosEmpty = void 0;
4
- const getSupuestos = (descripcion, descripcionCorta) => {
5
- let obj = {};
6
- obj.Descripcion = descripcion;
7
- obj.Corta = descripcionCorta;
8
- obj.TipoValorFlujo = 'OTROS';
9
- obj.ValorFlujo = 0;
10
- obj.OtrosValor = 0;
11
- obj.Valores = [
12
- {
13
- Correlativo: 1,
14
- CorrelativoDesc: '01-20XX',
15
- MontoPorcentual: 0
6
+ exports.getHistoricoFlujoCaja = exports.calcularFlujoAnual = exports.calcularFlujoMensual = exports.getFlujoMap = void 0;
7
+ const flujoConstructor_1 = __importDefault(require("./flujoCalculos/flujoConstructor"));
8
+ const getFlujoMap = (data, rango) => {
9
+ return data.reduce((acc, item) => {
10
+ let key = `${item.RubroId}_0`;
11
+ if (item.Clasificador == 'HABM' || item.Clasificador == 'DETL')
12
+ key = `${item.RubroId}_${item.UUID ? item.UUID : '0'}`;
13
+ for (let i = 1; i <= rango; i++) {
14
+ item[`Monto${i}`] = parseFloat(item[`Monto${i}`]);
16
15
  }
17
- ];
18
- return obj;
16
+ acc.set(key, item);
17
+ return acc;
18
+ }, new Map());
19
+ };
20
+ exports.getFlujoMap = getFlujoMap;
21
+ const calcularFlujoMensual = (data) => {
22
+ const flujoConstructor = new flujoConstructor_1.default('MENSUAL', data);
23
+ flujoConstructor.calcularFlujo();
19
24
  };
20
- const getSupuestosEmpty = (data) => {
21
- let array = [];
22
- array.push(getSupuestos("% DE COSTOS", "% Costo"));
23
- array.push(getSupuestos("% GASTOS OPERATIVOS", "% G.O."));
24
- return array;
25
+ exports.calcularFlujoMensual = calcularFlujoMensual;
26
+ const calcularFlujoAnual = (data) => {
27
+ const flujoConstructor = new flujoConstructor_1.default('ANUAL', data);
28
+ flujoConstructor.calcularFlujo();
25
29
  };
26
- exports.getSupuestosEmpty = getSupuestosEmpty;
30
+ exports.calcularFlujoAnual = calcularFlujoAnual;
27
31
  const getHistoricoFlujoCaja = (data) => {
28
- const meses = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
29
- const anoActual = new Date().getFullYear(); // Obtiene el año actual
30
32
  const datos = [];
31
- meses.forEach((mes, index) => {
32
- datos.push([`${mes}-${anoActual}`, 0]);
33
- });
33
+ const totalIngresos = data.FlujoProyectadoMensualMap.get('ACT_CNFL_49000_0');
34
+ for (let i = 1; i <= 12; i++) {
35
+ datos.push({ Fecha: totalIngresos[`Fecha${i}`], Monto: totalIngresos[`Monto${i}`] });
36
+ }
34
37
  return datos;
35
38
  };
36
39
  exports.getHistoricoFlujoCaja = getHistoricoFlujoCaja;
37
- const getFlujoEfectivo = (data) => {
38
- const value = [{ Anno: 0, FlujoDeEfectivo: 0, FlujoEfectivoDescontado: 0 },
39
- { Anno: 1, FlujoDeEfectivo: 0, FlujoEfectivoDescontado: 0 }];
40
- return value;
41
- };
42
- exports.getFlujoEfectivo = getFlujoEfectivo;
43
- const getFlujoEfectivoExtra = (data) => {
44
- const value = [{ Descripcion: 'Tasa de descuento', Valor: 0 },
45
- { Descripcion: 'VAN', Valor: 0 },
46
- { Descripcion: 'TIR', Valor: 0 },
47
- { Descripcion: 'Índice de Rentabilidad', Valor: 0 },
48
- ];
49
- return value;
50
- };
51
- exports.getFlujoEfectivoExtra = getFlujoEfectivoExtra;
52
- const getPieFlujo = (data) => {
53
- let result = {};
54
- result.PlazoAnnos = 0;
55
- result.CapacidadPago = 0;
56
- result.DescripcionResulta = "VERDADERO";
57
- result.PorcentajePagoPromedio = [
58
- { Correlativo: 1, MontoPorcentual: 0 },
59
- { Correlativo: 2, MontoPorcentual: 0 },
60
- { Correlativo: 3, MontoPorcentual: 0 },
61
- { Correlativo: 4, MontoPorcentual: 0 },
62
- { Correlativo: 5, MontoPorcentual: 0 },
63
- { Correlativo: 6, MontoPorcentual: 0 },
64
- { Correlativo: 7, MontoPorcentual: 0 },
65
- { Correlativo: 8, MontoPorcentual: 0 },
66
- { Correlativo: 9, MontoPorcentual: 0 },
67
- { Correlativo: 10, MontoPorcentual: 0 },
68
- { Correlativo: 11, MontoPorcentual: 0 },
69
- { Correlativo: 12, MontoPorcentual: 0 },
70
- ];
71
- return result;
72
- };
73
- exports.getPieFlujo = getPieFlujo;
@@ -1,18 +1,64 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ const commmon = __importStar(require("./common/balance.calc"));
27
+ //@ts-ignore
28
+ const supuestosCalc = __importStar(require("./common/flujoCalculos/supuestos.calc"));
29
+ //@ts-ignore
30
+ const declaracionJuradaCalc = __importStar(require("./common/declaracionJurada.calc"));
31
+ //@ts-ignore
32
+ const flujoProyectadoCalc = __importStar(require("./common/flujoProyectado.calc"));
33
+ //@ts-ignore
3
34
  const flujoProyectado_calc_1 = require("./common/flujoProyectado.calc");
4
- //import * as commmon from "./common/balance.calc";
5
35
  class FlujoProyectado {
6
36
  execute(data) {
7
37
  let result = {};
8
38
  result = data;
39
+ const cloneFlujoProyectadoMensual = commmon.clone(data.FlujoProyectadoMensual);
40
+ const cloneFlujoProyectadoAnual = commmon.clone(data.FlujoProyectadoAnual);
41
+ data.FlujoProyectadoMensualMap = (0, flujoProyectado_calc_1.getFlujoMap)(data.FlujoProyectadoMensual, 12);
42
+ data.FlujoProyectadoAnualMap = (0, flujoProyectado_calc_1.getFlujoMap)(data.FlujoProyectadoAnual, data.DatosEvaluacion.CantidadProyeccion);
43
+ if (data.strategy != null)
44
+ data = data.strategy.execute(data);
45
+ result.CajaInicial = declaracionJuradaCalc.getCajaInicial(data.declaracionJurada);
46
+ flujoProyectadoCalc.calcularFlujoMensual(data);
47
+ result.Supuestos = supuestosCalc.getSupuestos(data);
48
+ flujoProyectadoCalc.calcularFlujoAnual(data);
49
+ //result.HistoricoGrafico = getHistoricoFlujoCaja(data)
50
+ //
51
+ //result.FlujoEfectivo = getFlujoEfectivo(data)
52
+ //result.FlujoEfectivoVars = getFlujoEfectivoExtra(data)
53
+ // data.FlujoProyectadoMensual = Array.from(data.FlujoProyectadoMensualMap.values())
54
+ //data.FlujoProyectadoAnual = Array.from(data.FlujoProyectadoAnualMap.values())
55
+ delete result.FlujoProyectadoMensualMap;
56
+ delete result.FlujoProyectadoAnualMap;
57
+ result.DataOriginal = {
58
+ FlujoProyectadoMensual: cloneFlujoProyectadoMensual,
59
+ FlujoProyectadoAnual: cloneFlujoProyectadoAnual
60
+ };
9
61
  delete result.strategy;
10
- result.CajaInicial = 0;
11
- result.Supuestos = (0, flujoProyectado_calc_1.getSupuestosEmpty)(data);
12
- result.HistoricoGrafico = (0, flujoProyectado_calc_1.getHistoricoFlujoCaja)(data);
13
- result.FlujoEfectivo = (0, flujoProyectado_calc_1.getFlujoEfectivo)(data);
14
- result.FlujoEfectivoVars = (0, flujoProyectado_calc_1.getFlujoEfectivoExtra)(data);
15
- result.Pie = (0, flujoProyectado_calc_1.getPieFlujo)(data);
16
62
  return result;
17
63
  }
18
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bdpformulas",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",