bdpformulas 1.0.42 → 1.0.44
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/strategies/agriculture/balanceAgr.strategy.js +5 -5
- package/build/strategies/agriculture/flujoProyAgr.strategy.js +1 -1
- package/build/strategies/common/balanceCalculos/balanceAux.calc.js +1 -1
- package/build/strategies/common/declaracionJurada.calc.js +6 -4
- package/build/strategies/common/flujoCalculos/flujoConstructor.js +26 -6
- package/build/strategies/common/flujoProyectado.calc.js +4 -1
- package/build/strategies/pecuary/balancePec.strategy.js +3 -3
- package/build/strategies/pecuary/flujoProyPec.strategy.js +27 -11
- package/build/strategies/production/balancePrd.strategy.d.ts +1 -1
- package/build/strategies/production/balancePrd.strategy.js +183 -2
- package/build/strategies/production/flujoProyPrd.strategy.js +151 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ class BalanceAgrStrategy {
|
|
|
7
7
|
}
|
|
8
8
|
execute(data) {
|
|
9
9
|
if (!this.actividades || this.actividades.length == 0)
|
|
10
|
-
|
|
10
|
+
return data;
|
|
11
11
|
let acumuladoActividades = null;
|
|
12
12
|
for (let actividad of this.actividades) {
|
|
13
13
|
let actividadCalculada = calcularActividad(actividad);
|
|
@@ -55,10 +55,10 @@ const calcularEERR = (eerrMap, eerr, consolidado) => {
|
|
|
55
55
|
if (eerrMap.get(rubroKey).MontoEmpresa == 0)
|
|
56
56
|
eerrMap.get(rubroKey).MontoEmpresa = value;
|
|
57
57
|
}
|
|
58
|
-
setValueInOtros('ACT_CN_41002', eerrMap, eerr, { MontoEmpresa: consolidado.costoTotal }, 'COSTOS AGR Costo Total');
|
|
59
|
-
setValueInOtros('ACT_CN_43002', eerrMap, eerr, { MontoEmpresa: consolidado.otrosGastos.GastosOperativos }, 'Gastos AGR Total Gastos Operativos');
|
|
60
|
-
setValueInOtros('ACT_CN_43004', eerrMap, eerr, { MontoFamiliar: consolidado.otrosGastos.GastosFamiliares }, 'Gastos AGR Total Gastos Familiares');
|
|
61
|
-
setValueInOtros('ACT_CN_45001', eerrMap, eerr, { MontoFamiliar: consolidado.otrosIngresos }, 'Ventas AGR
|
|
58
|
+
setValueInOtros('ACT_CN_41002', eerrMap, eerr, { MontoEmpresa: consolidado.costoTotal }, 'Costos de Ventas COSTOS AGR Costo Total');
|
|
59
|
+
setValueInOtros('ACT_CN_43002', eerrMap, eerr, { MontoEmpresa: consolidado.otrosGastos.GastosOperativos }, 'Gastos Administrativos/Operativos Gastos AGR Total Gastos Operativos');
|
|
60
|
+
setValueInOtros('ACT_CN_43004', eerrMap, eerr, { MontoFamiliar: consolidado.otrosGastos.GastosFamiliares }, 'Gastos Familiares Gastos AGR Total Gastos Familiares');
|
|
61
|
+
setValueInOtros('ACT_CN_45001', eerrMap, eerr, { MontoFamiliar: consolidado.otrosIngresos }, 'Otros Ingresos Ventas AGR');
|
|
62
62
|
}
|
|
63
63
|
return eerrMap;
|
|
64
64
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.anadirNuevoRubro = void 0;
|
|
4
4
|
const anadirNuevoRubro = (muestra, balanceMap, values, descripcion) => {
|
|
5
5
|
for (let i = 1; i <= muestra.Rango; i++) {
|
|
6
|
-
let newData = Object.assign(Object.assign({}, muestra), { Descripcion: `${
|
|
6
|
+
let newData = Object.assign(Object.assign({}, muestra), { Descripcion: `${descripcion}`, Fecha: null, Correlativo: i, MontoFamiliar: 0, MontoEmpresa: 0, IndicadorABM: 'N', Editable: false, Clasificador: 'CT' });
|
|
7
7
|
if (i == muestra.Rango) {
|
|
8
8
|
if (values.MontoEmpresa && values.MontoEmpresa > 0)
|
|
9
9
|
newData.MontoEmpresa = values.MontoEmpresa;
|
|
@@ -60,10 +60,12 @@ const anadirDeclaracionJurada = (balanceMap, balanceArray, declaracionJurada) =>
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
const keyCapital = `ACT_CN_30001_${rango}`;
|
|
63
|
-
balanceMap.get(keyCapital).MontoEmpresa
|
|
64
|
-
declaracionMap.get('Total').
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
if (balanceMap.get(keyCapital).MontoEmpresa == 0)
|
|
64
|
+
balanceMap.get(keyCapital).MontoEmpresa = declaracionMap.get('Total').TotalActivosE -
|
|
65
|
+
declaracionMap.get('Total').TotalPasivosE;
|
|
66
|
+
if (balanceMap.get(keyCapital).MontoFamiliar == 0)
|
|
67
|
+
balanceMap.get(keyCapital).MontoFamiliar = declaracionMap.get('Total').TotalActivosF -
|
|
68
|
+
declaracionMap.get('Total').TotalPasivosF;
|
|
67
69
|
};
|
|
68
70
|
exports.anadirDeclaracionJurada = anadirDeclaracionJurada;
|
|
69
71
|
const arrayValue = (array, key) => {
|
|
@@ -9,7 +9,7 @@ class FlujoConstructor {
|
|
|
9
9
|
this.proyectarCosto();
|
|
10
10
|
this.proyectarGasto();
|
|
11
11
|
this.agregarQuitarClones();
|
|
12
|
-
this.moverDetalledesdeMensual()
|
|
12
|
+
//this.moverDetalledesdeMensual()
|
|
13
13
|
this.calcularTotalDetalle(['ACT_CNFL_73000'], 'ACT_CNFL_73900');
|
|
14
14
|
this.calcularTotalDetalle(['ACT_CNFL_61001'], 'ACT_CNFL_61900');
|
|
15
15
|
this.calcularOtrosIngresosAnuales();
|
|
@@ -98,18 +98,27 @@ class FlujoConstructor {
|
|
|
98
98
|
const I10 = 0;
|
|
99
99
|
for (let i = 1; i <= this.rango; i++) {
|
|
100
100
|
if (i == 1) {
|
|
101
|
-
rowIngresos[`Monto${i}`] = rowTotalIngresoM[`
|
|
101
|
+
rowIngresos[`Monto${i}`] = rowTotalIngresoM[`MontoTotal`] * (1 + rowVariacionIngresos[`Monto${i}`] + I10);
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
rowIngresos[`Monto${i}`] = rowIngresos[`Monto${i - 1}`] * (1 + rowVariacionIngresos[`Monto${i}`] + I10);
|
|
105
105
|
}
|
|
106
106
|
rowIngresos[`Monto${i}`] = Math.round(rowIngresos[`Monto${i}`] * 100) / 100;
|
|
107
107
|
}
|
|
108
|
+
if (this.data.TipoConsolidad == 'GANADERIA' &&
|
|
109
|
+
this.data.ParametrosEngorde.Conclusion == 'DESARROLLO_HATO') {
|
|
110
|
+
for (let i = 1; i <= this.rango; i++) {
|
|
111
|
+
rowIngresos[`Monto${i}`] = this.data.ParametrosEngorde.SumaDesarrolloAnual[`C-${i}`] *
|
|
112
|
+
(1 + rowVariacionIngresos[`Monto${i}`] + I10);
|
|
113
|
+
rowIngresos[`Monto${i}`] = Math.round(rowIngresos[`Monto${i}`] * 100) / 100;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
108
116
|
};
|
|
109
117
|
this.proyectarCosto = () => {
|
|
110
118
|
const rowIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_40001_0');
|
|
111
119
|
const rowVariacionCostos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_30002_0');
|
|
112
120
|
const rowCosto = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_50001_0');
|
|
121
|
+
const rowTotalIngresoM = this.data.FlujoProyectadoMensualMap.get('ACT_CNFL_49000_0');
|
|
113
122
|
for (let i = 1; i <= this.rango; i++) {
|
|
114
123
|
if (i == 1) {
|
|
115
124
|
rowCosto[`Monto1`] = (rowIngresos[`Monto1`] * rowCosto.MontoCajaPercent / 100) + (1 + rowVariacionCostos[`Monto${i}`]);
|
|
@@ -119,6 +128,18 @@ class FlujoConstructor {
|
|
|
119
128
|
}
|
|
120
129
|
rowCosto[`Monto${i}`] = Math.round(rowCosto[`Monto${i}`] * 100) / 100;
|
|
121
130
|
}
|
|
131
|
+
if (this.data.TipoConsolidad == 'GANADERIA' &&
|
|
132
|
+
this.data.ParametrosEngorde.Conclusion != 'DESARROLLO_HATO') {
|
|
133
|
+
for (let i = 1; i <= this.rango; i++) {
|
|
134
|
+
if (i == 1) {
|
|
135
|
+
rowCosto[`Monto1`] = (rowTotalIngresoM[`MontoTotal`] * rowCosto.MontoCajaPercent / 100) * (1 + rowVariacionCostos[`Monto${i}`]);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
rowCosto[`Monto${i}`] = rowIngresos[`Monto${i - 1}`] * (1 + rowVariacionCostos[`Monto${i}`]);
|
|
139
|
+
}
|
|
140
|
+
rowCosto[`Monto${i}`] = Math.round(rowCosto[`Monto${i}`] * 100) / 100;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
122
143
|
};
|
|
123
144
|
this.proyectarGasto = () => {
|
|
124
145
|
const rowIngresos = this.data.FlujoProyectadoAnualMap.get('ACT_CNFL_40001_0');
|
|
@@ -162,10 +183,9 @@ class FlujoConstructor {
|
|
|
162
183
|
});
|
|
163
184
|
let anuales = this.array.filter((item) => item.Clasificador == 'DETL' || item.Clasificador == 'HABM');
|
|
164
185
|
for (let anualItem of anuales) {
|
|
165
|
-
let key = `${anualItem.RubroId}_${anualItem.UUID}`.replace('
|
|
166
|
-
if (!this.data.FlujoProyectadoMensualMap.has(key)) {
|
|
167
|
-
this.
|
|
168
|
-
item.UUID == anualItem.UUID);
|
|
186
|
+
let key = `${anualItem.RubroId}_${anualItem.UUID}`.replace('_CLONE', '');
|
|
187
|
+
if (!this.data.FlujoProyectadoMensualMap.has(key) && anualItem.UUID) {
|
|
188
|
+
this.data.FlujoProyectadoAnual = this.data.FlujoProyectadoAnual.filter((item) => item.UUID != anualItem.UUID);
|
|
169
189
|
}
|
|
170
190
|
}
|
|
171
191
|
};
|
|
@@ -11,7 +11,10 @@ const getFlujoMap = (data, rango) => {
|
|
|
11
11
|
if (item.Clasificador == 'HABM' || item.Clasificador == 'DETL')
|
|
12
12
|
key = `${item.RubroId}_${item.UUID ? item.UUID : '0'}`;
|
|
13
13
|
for (let i = 1; i <= rango; i++) {
|
|
14
|
-
|
|
14
|
+
if (!item[`Monto${i}`])
|
|
15
|
+
item[`Monto${i}`] = 0;
|
|
16
|
+
else
|
|
17
|
+
item[`Monto${i}`] = parseFloat(item[`Monto${i}`]);
|
|
15
18
|
}
|
|
16
19
|
acc.set(key, item);
|
|
17
20
|
return acc;
|
|
@@ -10,7 +10,7 @@ class BalancePecStrategy {
|
|
|
10
10
|
}
|
|
11
11
|
execute(data) {
|
|
12
12
|
if (!this.actividades || this.actividades.length == 0)
|
|
13
|
-
|
|
13
|
+
return data;
|
|
14
14
|
const cuentasIngresosCopy = getCuentasCopy(data, gCuentaIngreso);
|
|
15
15
|
const cuentasCostoCopy = getCuentasCopy(data, gCuentaCosto);
|
|
16
16
|
const cuentaGastoCopy = getCuentasCopy(data, gCuentaGasto);
|
|
@@ -148,11 +148,11 @@ const anadirOtrosIngresos = (actividad, data) => {
|
|
|
148
148
|
copy.Clasificador = 'CT';
|
|
149
149
|
if (rango == i && actividad.Ventas && actividad.Ventas.OtrosIngresos &&
|
|
150
150
|
actividad.Ventas.OtrosIngresos.length > 0) {
|
|
151
|
-
copy.
|
|
151
|
+
copy.MontoFamiliar = actividad.Ventas.OtrosIngresos.reduce((acc, item) => {
|
|
152
152
|
acc += parseFloat(item.Monto);
|
|
153
153
|
return acc;
|
|
154
154
|
}, 0);
|
|
155
|
-
copy.
|
|
155
|
+
copy.MontoFamiliar = Math.round(copy.MontoFamiliar * 100) / 100;
|
|
156
156
|
}
|
|
157
157
|
data.eerr.push(copy);
|
|
158
158
|
}
|
|
@@ -11,13 +11,15 @@ class FlujoProyectadoPecStrategy {
|
|
|
11
11
|
}
|
|
12
12
|
execute(data) {
|
|
13
13
|
if (!this.actividades || this.actividades.length == 0)
|
|
14
|
-
|
|
14
|
+
return data;
|
|
15
15
|
const copiaIngreso = getCuentaCopy(RUBRO_INGRESO, data);
|
|
16
16
|
const copiaCostos = getCuentaCopy(RUBRO_COSTOS, data);
|
|
17
17
|
const copiaGastos = getCuentaCopy(RUBRO_GASTOS, data);
|
|
18
18
|
const copiaOtrosIngresos = getCuentaCopy(RUBRO_OTROS_INGRESOS, data);
|
|
19
19
|
const copiaGastosFamiliares = getCuentaCopy(RUBRO_GASTOS_FAMILIARES, data);
|
|
20
20
|
let sumaDesarrollo = [];
|
|
21
|
+
//@ts-ignore
|
|
22
|
+
let sumaDesarrolloAnual = null;
|
|
21
23
|
for (let actividad of this.actividades) {
|
|
22
24
|
addIngresosM(actividad, data);
|
|
23
25
|
addCostosM(actividad, data);
|
|
@@ -25,13 +27,14 @@ class FlujoProyectadoPecStrategy {
|
|
|
25
27
|
otrosIngresoM(actividad, data);
|
|
26
28
|
gastosFamiliaresM(actividad, data);
|
|
27
29
|
sumaDesarrollo.push(getDesarrolloSuma(actividad));
|
|
30
|
+
sumaDesarrolloAnual = getSumaDesarrolloAnualByAnno(actividad, data, sumaDesarrolloAnual);
|
|
28
31
|
}
|
|
29
32
|
sumarizarCuenta(RUBRO_INGRESO, data, copiaIngreso);
|
|
30
33
|
sumarizarCuenta(RUBRO_COSTOS, data, copiaCostos);
|
|
31
34
|
sumarizarCuenta(RUBRO_GASTOS, data, copiaGastos);
|
|
32
35
|
sumarizarCuenta(RUBRO_OTROS_INGRESOS, data, copiaOtrosIngresos);
|
|
33
36
|
sumarizarCuenta(RUBRO_GASTOS_FAMILIARES, data, copiaGastosFamiliares);
|
|
34
|
-
addCalculosBase(data, sumaDesarrollo);
|
|
37
|
+
addCalculosBase(data, sumaDesarrollo, sumaDesarrolloAnual);
|
|
35
38
|
return data;
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -42,7 +45,7 @@ const getCuentaCopy = (rubroId, data) => {
|
|
|
42
45
|
};
|
|
43
46
|
const sumarizarCuenta = (rubroId, data, copia) => {
|
|
44
47
|
const cuenta = data.FlujoProyectadoMensualMap.get(`${rubroId}_0`);
|
|
45
|
-
const detalles = data.FlujoProyectadoMensual.filter((item) => item.RubroId ==
|
|
48
|
+
const detalles = data.FlujoProyectadoMensual.filter((item) => item.RubroId == `${rubroId}.1`);
|
|
46
49
|
for (let detalle of detalles) {
|
|
47
50
|
for (let i = 1; i <= 12; i++) {
|
|
48
51
|
if (copia[`Monto${i}`] == 0)
|
|
@@ -50,6 +53,17 @@ const sumarizarCuenta = (rubroId, data, copia) => {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
};
|
|
56
|
+
const getSumaDesarrolloAnualByAnno = (actividad, data, suma) => {
|
|
57
|
+
const CantidadProyeccion = data.DatosEvaluacion.CantidadProyeccion;
|
|
58
|
+
const ventasCantidad = actividad.Desarrollo.VentasCantidad.find((item) => item.RubroId == 'TOT01');
|
|
59
|
+
if (!suma) {
|
|
60
|
+
suma = {};
|
|
61
|
+
for (let i = 1; i <= CantidadProyeccion; i++) {
|
|
62
|
+
suma[`C-${i}`] = ventasCantidad[`C-${i}`];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return suma;
|
|
66
|
+
};
|
|
53
67
|
const getDesarrolloSuma = (actividad) => {
|
|
54
68
|
const ventasCantidad = actividad.Desarrollo.VentasCantidad.find((item) => item.RubroId == 'TOT01');
|
|
55
69
|
if (!ventasCantidad)
|
|
@@ -61,7 +75,7 @@ const getDesarrolloSuma = (actividad) => {
|
|
|
61
75
|
return result;
|
|
62
76
|
};
|
|
63
77
|
const addIngresosM = (actividad, data) => {
|
|
64
|
-
const rubro = data.FlujoProyectadoMensualMap.get(
|
|
78
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_INGRESO}_0`);
|
|
65
79
|
const ingresos = actividad.Ventas.EstacionalidadCalc.find((item) => item.RubroId == 'TOT01');
|
|
66
80
|
if (!ingresos)
|
|
67
81
|
throw new Error('No se encontro la estacionalidad Calc de la actividad');
|
|
@@ -77,7 +91,7 @@ const addIngresosM = (actividad, data) => {
|
|
|
77
91
|
data.FlujoProyectadoMensual.push(row);
|
|
78
92
|
};
|
|
79
93
|
const addCostosM = (actividad, data) => {
|
|
80
|
-
const rubro = data.FlujoProyectadoMensualMap.get(
|
|
94
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_COSTOS}_0`);
|
|
81
95
|
const costos = actividad.Costos.Calculo.find((item) => item.RubroId == 'TOT01');
|
|
82
96
|
if (!costos)
|
|
83
97
|
throw new Error('No se encontro el costo cálculo de la actividad');
|
|
@@ -93,7 +107,7 @@ const addCostosM = (actividad, data) => {
|
|
|
93
107
|
data.FlujoProyectadoMensual.push(row);
|
|
94
108
|
};
|
|
95
109
|
const addGastosM = (actividad, data) => {
|
|
96
|
-
const rubro = data.FlujoProyectadoMensualMap.get(
|
|
110
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_GASTOS}_0`);
|
|
97
111
|
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
98
112
|
if (!otrosGastos)
|
|
99
113
|
throw new Error('No se encontro los gastos de la actividad');
|
|
@@ -109,7 +123,7 @@ const addGastosM = (actividad, data) => {
|
|
|
109
123
|
data.FlujoProyectadoMensual.push(row);
|
|
110
124
|
};
|
|
111
125
|
const otrosIngresoM = (actividad, data) => {
|
|
112
|
-
const rubro = data.FlujoProyectadoMensualMap.get(
|
|
126
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_OTROS_INGRESOS}_0`);
|
|
113
127
|
const otrosIngresos = actividad.Ventas.OtrosIngresos;
|
|
114
128
|
if (!otrosIngresos)
|
|
115
129
|
throw new Error('No se encontro la estacionalidad Calc de la actividad');
|
|
@@ -141,7 +155,7 @@ const gastosFamiliaresM = (actividad, data) => {
|
|
|
141
155
|
if (!otrosGastos)
|
|
142
156
|
throw new Error('No se encontro los gastos de la actividad');
|
|
143
157
|
let row = Object.assign({}, rubro);
|
|
144
|
-
row.Descripcion = `(-) Gastos
|
|
158
|
+
row.Descripcion = `(-) Gastos Familiares ${actividad.Desarrollo.ActividadGanadera}`;
|
|
145
159
|
row.Clasificador = 'CT';
|
|
146
160
|
row.Editable = false;
|
|
147
161
|
row.UUID = `${RUBRO_GASTOS_FAMILIARES}_${actividad.Desarrollo.ActividadEconomicaId}`;
|
|
@@ -151,8 +165,8 @@ const gastosFamiliaresM = (actividad, data) => {
|
|
|
151
165
|
}
|
|
152
166
|
data.FlujoProyectadoMensual.push(row);
|
|
153
167
|
};
|
|
154
|
-
const addCalculosBase = (data, sumaDesarrollo) => {
|
|
155
|
-
const ingresos = data.FlujoProyectadoMensualMap.get(
|
|
168
|
+
const addCalculosBase = (data, sumaDesarrollo, sumaDesarrolloAnual) => {
|
|
169
|
+
const ingresos = data.FlujoProyectadoMensualMap.get(`${RUBRO_INGRESO}_0`);
|
|
156
170
|
let sumaIngresos = 0;
|
|
157
171
|
for (let i = 1; i <= 12; i++) {
|
|
158
172
|
sumaIngresos += parseFloat(ingresos[`Monto${i}`]);
|
|
@@ -161,19 +175,21 @@ const addCalculosBase = (data, sumaDesarrollo) => {
|
|
|
161
175
|
acc += item;
|
|
162
176
|
return acc;
|
|
163
177
|
}, 0);
|
|
164
|
-
const sumaProyectada = Math.round((sumaIngresos * data.
|
|
178
|
+
const sumaProyectada = Math.round((sumaIngresos * data.DatosEvaluacion.CantidadProyeccion) * 100) / 100;
|
|
165
179
|
let result = {
|
|
166
180
|
EsEngorde: data.Parametros.EsEngorde,
|
|
167
181
|
SumaAnnoBase: sumaProyectada,
|
|
168
182
|
SumaHato: sumaHato,
|
|
169
183
|
Conclusion: 'NA'
|
|
170
184
|
};
|
|
185
|
+
result.SumaDesarrolloAnual = sumaDesarrolloAnual;
|
|
171
186
|
if (result.EsEngorde == 'SI' || result.SumaAnnoBase < result.SumaHato)
|
|
172
187
|
result.Conclusion = 'FLUJO_HISTORICO';
|
|
173
188
|
else {
|
|
174
189
|
if (result.SumaHato < result.SumaAnnoBase)
|
|
175
190
|
result.Conclusion = 'DESARROLLO_HATO';
|
|
176
191
|
}
|
|
192
|
+
data.ParametrosEngorde = result;
|
|
177
193
|
};
|
|
178
194
|
const calcularOtrosGastos = (gastos) => {
|
|
179
195
|
const gastosOperativos = gastos.Operativos.reduce((acc, item) => {
|
|
@@ -1,11 +1,192 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const gCuentaIngreso = 'ACT_CN_40001';
|
|
4
|
+
const gCuentaCosto = 'ACT_CN_41002';
|
|
5
|
+
const gCuentaGasto = 'ACT_CN_43002';
|
|
6
|
+
const gCuentaGastoFamiliares = 'ACT_CN_45003';
|
|
7
|
+
const gCuentaOtrosIngresosDet = 'ACT_CN_45001';
|
|
8
|
+
class BalancePrdStrategy {
|
|
4
9
|
constructor() {
|
|
5
10
|
this.actividades = [];
|
|
6
11
|
}
|
|
7
12
|
execute(data) {
|
|
13
|
+
if (!this.actividades || this.actividades.length == 0)
|
|
14
|
+
return data;
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
const cuentasIngresosCopy = getCuentasCopy(data, gCuentaIngreso);
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
const cuentasCostoCopy = getCuentasCopy(data, gCuentaCosto);
|
|
19
|
+
//@ts-ignore
|
|
20
|
+
const cuentaGastoCopy = getCuentasCopy(data, gCuentaGasto);
|
|
21
|
+
const cuentaGastoFamiliarCopy = getCuentasCopy(data, gCuentaGastoFamiliares);
|
|
22
|
+
for (let actividad of this.actividades) {
|
|
23
|
+
anadirIngreso(actividad, data);
|
|
24
|
+
anadirCosto(actividad, data);
|
|
25
|
+
anadirGasto(actividad, data);
|
|
26
|
+
anadirOtrosIngresos(actividad, data);
|
|
27
|
+
anadirGastoFamiliares(actividad, data);
|
|
28
|
+
}
|
|
29
|
+
sumarizarCuentas(`${gCuentaIngreso}.1`, gCuentaIngreso, data, cuentasIngresosCopy);
|
|
30
|
+
sumarizarCuentas(`${gCuentaCosto}.1`, gCuentaCosto, data, cuentasCostoCopy);
|
|
31
|
+
sumarizarCuentas(`${gCuentaGasto}.1`, gCuentaGasto, data, cuentaGastoCopy);
|
|
32
|
+
sumarizarCuentas(`${gCuentaGastoFamiliares}.1`, gCuentaGastoFamiliares, data, cuentaGastoFamiliarCopy);
|
|
8
33
|
return data;
|
|
9
34
|
}
|
|
10
35
|
}
|
|
11
|
-
exports.default =
|
|
36
|
+
exports.default = BalancePrdStrategy;
|
|
37
|
+
const getCuentasCopy = (data, rubroId) => {
|
|
38
|
+
if (!data.eerr || data.eerr.length == 0)
|
|
39
|
+
throw new Error('Debe ingresar cuentas EERR');
|
|
40
|
+
let originalData = new Map();
|
|
41
|
+
const rango = data.eerr[0].Rango;
|
|
42
|
+
for (let i = 1; i <= rango; i++) {
|
|
43
|
+
let cuentaIngreso = data.eerrMap.get(`${rubroId}_${i}`);
|
|
44
|
+
cuentaIngreso.MontoEmpresa = Math.round(parseFloat(cuentaIngreso.MontoEmpresa) * 100) / 100;
|
|
45
|
+
cuentaIngreso.MontoFamiliar = Math.round(parseFloat(cuentaIngreso.MontoFamiliar) * 100) / 100;
|
|
46
|
+
originalData.set(`${rubroId}_${i}`, Object.assign({}, cuentaIngreso));
|
|
47
|
+
}
|
|
48
|
+
//console.log('originalData '+rubroId,Array.from(originalData.keys()) )
|
|
49
|
+
return originalData;
|
|
50
|
+
};
|
|
51
|
+
const anadirIngreso = (actividad, data) => {
|
|
52
|
+
const rango = data.eerr[0].Rango;
|
|
53
|
+
const productos = actividad.Ventas.Productos;
|
|
54
|
+
if (productos && productos.length > 0) {
|
|
55
|
+
for (const producto of productos) {
|
|
56
|
+
const subtotal = actividad.Ventas.
|
|
57
|
+
Ingresos.find((item) => item.Id == 'SUBTOTAL' && item.ProductoId == producto.ProductoId);
|
|
58
|
+
for (let i = 1; i <= rango; i++) {
|
|
59
|
+
const cuentaIngreso = data.eerrMap.get(`${gCuentaIngreso}_${i}`);
|
|
60
|
+
let copy = Object.assign({}, cuentaIngreso);
|
|
61
|
+
copy.RubroId = `${gCuentaIngreso}.1`;
|
|
62
|
+
copy.Descripcion = `Ingresos por Ventas ${producto.ProductoId} ${producto.Descripcion}`;
|
|
63
|
+
copy.UUID = `${gCuentaIngreso}_${actividad.ActividadEconomicaId}_${producto.ProductoId}_${i}`;
|
|
64
|
+
copy.MontoEmpresa = 0;
|
|
65
|
+
copy.MontoFamiliar = 0;
|
|
66
|
+
copy.Correlativo = i;
|
|
67
|
+
copy.Clasificador = 'CT';
|
|
68
|
+
if (subtotal && subtotal[`C-${i}`]) {
|
|
69
|
+
copy.MontoEmpresa = Math.round(parseFloat(subtotal[`C-${i}`]) * 100) / 100;
|
|
70
|
+
}
|
|
71
|
+
data.eerr.push(copy);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const anadirCosto = (actividad, data) => {
|
|
77
|
+
const rango = data.eerr[0].Rango;
|
|
78
|
+
const productos = actividad.Ventas.Productos;
|
|
79
|
+
if (productos && productos.length > 0) {
|
|
80
|
+
for (const producto of productos) {
|
|
81
|
+
const subtotal = actividad.
|
|
82
|
+
Costos.Meses.find((item) => item.ProductoId == producto.ProductoId);
|
|
83
|
+
for (let i = 1; i <= rango; i++) {
|
|
84
|
+
const cuentaIngreso = data.eerrMap.get(`${gCuentaCosto}_${i}`);
|
|
85
|
+
let copy = Object.assign({}, cuentaIngreso);
|
|
86
|
+
copy.RubroId = `${gCuentaCosto}.1`;
|
|
87
|
+
copy.Descripcion = `Ingresos por Ventas ${producto.ProductoId} ${producto.Descripcion}`;
|
|
88
|
+
copy.UUID = `${gCuentaCosto}_${actividad.ActividadEconomicaId}_${producto.ProductoId}_${i}`;
|
|
89
|
+
copy.MontoEmpresa = 0;
|
|
90
|
+
copy.MontoFamiliar = 0;
|
|
91
|
+
copy.Correlativo = i;
|
|
92
|
+
copy.Clasificador = 'CT';
|
|
93
|
+
if (i == rango && subtotal) {
|
|
94
|
+
copy.MontoEmpresa = Math.round(parseFloat(subtotal.Total) * 100) / 100;
|
|
95
|
+
}
|
|
96
|
+
data.eerr.push(copy);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const anadirGasto = (actividad, data) => {
|
|
102
|
+
const rango = data.eerr[0].Rango;
|
|
103
|
+
const cuentaGasto = data.eerrMap.get(`${gCuentaGasto}_${rango}`);
|
|
104
|
+
for (let i = 1; i <= rango; i++) {
|
|
105
|
+
let copy = Object.assign({}, cuentaGasto);
|
|
106
|
+
copy.RubroId = `${gCuentaGasto}.1`;
|
|
107
|
+
copy.UUID = `${gCuentaGasto}_${actividad.ActividadEconomicaId}_${i}`;
|
|
108
|
+
copy.Descripcion = `Gastos Administrativos Operativos Actividad: ${actividad.ActividadEconomicaId}`;
|
|
109
|
+
copy.MontoEmpresa = 0;
|
|
110
|
+
copy.MontoFamiliar = 0;
|
|
111
|
+
copy.Correlativo = i;
|
|
112
|
+
copy.Clasificador = 'CT';
|
|
113
|
+
if (rango == i) {
|
|
114
|
+
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
115
|
+
copy.MontoEmpresa = Math.round(parseFloat(otrosGastos.GastosOperativos) * 100) / 100;
|
|
116
|
+
}
|
|
117
|
+
data.eerr.push(copy);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const anadirGastoFamiliares = (actividad, data) => {
|
|
121
|
+
const rango = data.eerr[0].Rango;
|
|
122
|
+
const cuentaGasto = data.eerrMap.get(`${gCuentaGastoFamiliares}_${rango}`);
|
|
123
|
+
for (let i = 1; i <= rango; i++) {
|
|
124
|
+
let copy = Object.assign({}, cuentaGasto);
|
|
125
|
+
copy.RubroId = `${gCuentaGastoFamiliares}.1`;
|
|
126
|
+
copy.UUID = `${gCuentaGastoFamiliares}_${actividad.ActividadEconomicaId}_${i}`;
|
|
127
|
+
copy.Descripcion = `Gastos Familiares Actividad: ${actividad.ActividadEconomicaId}`;
|
|
128
|
+
copy.MontoEmpresa = 0;
|
|
129
|
+
copy.MontoFamiliar = 0;
|
|
130
|
+
copy.Correlativo = i;
|
|
131
|
+
copy.Clasificador = 'CT';
|
|
132
|
+
if (rango == i) {
|
|
133
|
+
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
134
|
+
copy.MontoFamiliar = Math.round(parseFloat(otrosGastos.GastosFamiliares) * 100) / 100;
|
|
135
|
+
}
|
|
136
|
+
data.eerr.push(copy);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const calcularOtrosGastos = (gastos) => {
|
|
140
|
+
const gastosOperativos = gastos.Operativos.reduce((acc, item) => {
|
|
141
|
+
acc += parseFloat(item.ImporteAnual);
|
|
142
|
+
return acc;
|
|
143
|
+
}, 0);
|
|
144
|
+
const gastosFamiliares = gastos.Familiares.reduce((acc, item) => {
|
|
145
|
+
acc += parseFloat(item.ImporteAnual);
|
|
146
|
+
return acc;
|
|
147
|
+
}, 0);
|
|
148
|
+
return {
|
|
149
|
+
GastosOperativos: Math.round(gastosOperativos * 100) / 100,
|
|
150
|
+
GastosFamiliares: Math.round(gastosFamiliares * 100) / 100
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
const anadirOtrosIngresos = (actividad, data) => {
|
|
154
|
+
const rango = data.eerr[0].Rango;
|
|
155
|
+
const cuentaOtrosIngresos = data.eerr.find((item) => item.RubroId == gCuentaOtrosIngresosDet);
|
|
156
|
+
for (let i = 1; i <= rango; i++) {
|
|
157
|
+
let copy = Object.assign({}, cuentaOtrosIngresos);
|
|
158
|
+
copy.UUID = `${gCuentaOtrosIngresosDet}_${actividad.ActividadEconomicaId}_${rango}`;
|
|
159
|
+
copy.Descripcion = `Otros Ingresos ${actividad.ActividadEconomicaId}`;
|
|
160
|
+
copy.MontoEmpresa = 0;
|
|
161
|
+
copy.MontoFamiliar = 0;
|
|
162
|
+
copy.Correlativo = i;
|
|
163
|
+
copy.Clasificador = 'CT';
|
|
164
|
+
if (rango == i && actividad.Ventas && actividad.Ventas.OtrosIngresos &&
|
|
165
|
+
actividad.Ventas.OtrosIngresos.length > 0) {
|
|
166
|
+
copy.MontoFamiliar = actividad.Ventas.OtrosIngresos.reduce((acc, item) => {
|
|
167
|
+
acc += parseFloat(item.Monto);
|
|
168
|
+
return acc;
|
|
169
|
+
}, 0);
|
|
170
|
+
copy.MontoFamiliar = Math.round(copy.MontoFamiliar * 100) / 100;
|
|
171
|
+
}
|
|
172
|
+
data.eerr.push(copy);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const sumarizarCuentas = (rubroOrigen, rubroDestino, data, dataOriginal) => {
|
|
176
|
+
const rango = data.eerr[0].Rango;
|
|
177
|
+
for (let i = 1; i <= rango; i++) {
|
|
178
|
+
const cuentaOrigen = data.eerr.find((item) => item.RubroId == rubroOrigen && item.Correlativo == i);
|
|
179
|
+
if (!cuentaOrigen)
|
|
180
|
+
throw new Error(`No existe el rubro Calculado ${rubroOrigen}_${i} en el EERR`);
|
|
181
|
+
const original = dataOriginal.get(`${rubroDestino}_${i}`);
|
|
182
|
+
if (original.MontoEmpresa == 0 || original.MontoFamiliar == 0) {
|
|
183
|
+
const cuentaDestino = data.eerrMap.get(`${rubroDestino}_${i}`);
|
|
184
|
+
if (original.MontoEmpresa == 0)
|
|
185
|
+
cuentaDestino.MontoEmpresa += cuentaOrigen.MontoEmpresa;
|
|
186
|
+
if (original.MontoFamiliar == 0)
|
|
187
|
+
cuentaDestino.MontoFamiliar += cuentaOrigen.MontoFamiliar;
|
|
188
|
+
cuentaDestino.MontoEmpresa = Math.round(cuentaDestino.MontoEmpresa * 100) / 100;
|
|
189
|
+
cuentaDestino.MontoFamiliar = Math.round(cuentaDestino.MontoFamiliar * 100) / 100;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
@@ -1,11 +1,162 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const RUBRO_INGRESO = 'ACT_CNFL_40001';
|
|
4
|
+
const RUBRO_COSTOS = 'ACT_CNFL_50001';
|
|
5
|
+
const RUBRO_GASTOS = 'ACT_CNFL_60001';
|
|
6
|
+
const RUBRO_OTROS_INGRESOS = 'ACT_CNFL_70001';
|
|
7
|
+
const RUBRO_GASTOS_FAMILIARES = 'ACT_CNFL_70002';
|
|
3
8
|
class FlujoProyectadoPrdStrategy {
|
|
4
9
|
constructor() {
|
|
5
10
|
this.actividades = [];
|
|
6
11
|
}
|
|
7
12
|
execute(data) {
|
|
13
|
+
const copiaIngreso = getCuentaCopy(RUBRO_INGRESO, data);
|
|
14
|
+
const copiaCostos = getCuentaCopy(RUBRO_COSTOS, data);
|
|
15
|
+
const copiaGastos = getCuentaCopy(RUBRO_GASTOS, data);
|
|
16
|
+
const copiaOtrosIngresos = getCuentaCopy(RUBRO_OTROS_INGRESOS, data);
|
|
17
|
+
const copiaGastosFamiliares = getCuentaCopy(RUBRO_GASTOS_FAMILIARES, data);
|
|
18
|
+
for (let actividad of this.actividades) {
|
|
19
|
+
addIngresosM(actividad, data);
|
|
20
|
+
addCostosM(actividad, data);
|
|
21
|
+
addGastosM(actividad, data);
|
|
22
|
+
otrosIngresoM(actividad, data);
|
|
23
|
+
gastosFamiliaresM(actividad, data);
|
|
24
|
+
}
|
|
25
|
+
sumarizarCuenta(RUBRO_INGRESO, data, copiaIngreso);
|
|
26
|
+
sumarizarCuenta(RUBRO_COSTOS, data, copiaCostos);
|
|
27
|
+
sumarizarCuenta(RUBRO_GASTOS, data, copiaGastos);
|
|
28
|
+
sumarizarCuenta(RUBRO_OTROS_INGRESOS, data, copiaOtrosIngresos);
|
|
29
|
+
sumarizarCuenta(RUBRO_GASTOS_FAMILIARES, data, copiaGastosFamiliares);
|
|
8
30
|
return data;
|
|
9
31
|
}
|
|
10
32
|
}
|
|
11
33
|
exports.default = FlujoProyectadoPrdStrategy;
|
|
34
|
+
const getCuentaCopy = (rubroId, data) => {
|
|
35
|
+
const cuenta = data.FlujoProyectadoMensualMap.get(`${rubroId}_0`);
|
|
36
|
+
return Object.assign({}, cuenta);
|
|
37
|
+
};
|
|
38
|
+
const sumarizarCuenta = (rubroId, data, copia) => {
|
|
39
|
+
const cuenta = data.FlujoProyectadoMensualMap.get(`${rubroId}_0`);
|
|
40
|
+
const detalles = data.FlujoProyectadoMensual.filter((item) => item.RubroId == `${rubroId}.1`);
|
|
41
|
+
for (let detalle of detalles) {
|
|
42
|
+
for (let i = 1; i <= 12; i++) {
|
|
43
|
+
if (copia[`Monto${i}`] == 0)
|
|
44
|
+
cuenta[`Monto${i}`] += parseFloat(detalle[`Monto${i}`]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const addIngresosM = (actividad, data) => {
|
|
49
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_INGRESO}_0`);
|
|
50
|
+
const productos = actividad.Ventas.Productos;
|
|
51
|
+
if (productos && productos.length > 0) {
|
|
52
|
+
for (const producto of productos) {
|
|
53
|
+
const ingresos = actividad.Ventas.EstacionalidadCalc.find((item) => item.ProductoId == producto.ProductoId);
|
|
54
|
+
if (!ingresos)
|
|
55
|
+
throw new Error('No se encontro la estacionalidad Calc de la actividad');
|
|
56
|
+
let row = Object.assign({}, rubro);
|
|
57
|
+
row.Descripcion = `Ingresos Actividad ${actividad.ActividadEconomicaId} - Producto ${ingresos.Descripcion}`;
|
|
58
|
+
row.Clasificador = 'CT';
|
|
59
|
+
row.Editable = false;
|
|
60
|
+
row.UUID = `${RUBRO_INGRESO}_${actividad.ActividadEconomicaId}_${producto.ProductoId}`;
|
|
61
|
+
row.RubroId = `${RUBRO_INGRESO}.1`;
|
|
62
|
+
for (let i = 1; i <= 12; i++) {
|
|
63
|
+
row[`Monto${i}`] = Math.round(parseFloat(ingresos[`C-${i}`]) * 100) / 100;
|
|
64
|
+
}
|
|
65
|
+
data.FlujoProyectadoMensual.push(row);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const addCostosM = (actividad, data) => {
|
|
70
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_COSTOS}_0`);
|
|
71
|
+
const productos = actividad.Ventas.Productos;
|
|
72
|
+
if (productos && productos.length > 0) {
|
|
73
|
+
for (const producto of productos) {
|
|
74
|
+
const costos = actividad.Costos.Meses.find((item) => item.ProductoId == producto.ProductoId);
|
|
75
|
+
if (!costos)
|
|
76
|
+
throw new Error(`No se encontro el costo cálculo para el producto ${producto.ProductoId}`);
|
|
77
|
+
let row = Object.assign({}, rubro);
|
|
78
|
+
row.Descripcion = `(-) Costos de Ventas Actividad: $${actividad.ActividadEconomicaId} Producto ${producto.ProductoId}`;
|
|
79
|
+
row.Clasificador = 'CT';
|
|
80
|
+
row.Editable = false;
|
|
81
|
+
row.UUID = `${RUBRO_COSTOS}_${actividad.ActividadEconomicaId}_${producto.ProductoId}`;
|
|
82
|
+
row.RubroId = `${RUBRO_COSTOS}.1`;
|
|
83
|
+
for (let i = 1; i <= 12; i++) {
|
|
84
|
+
row[`Monto${i}`] = Math.round(parseFloat(costos[`Monto${i}`]) * 100) / 100;
|
|
85
|
+
}
|
|
86
|
+
data.FlujoProyectadoMensual.push(row);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const addGastosM = (actividad, data) => {
|
|
91
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_GASTOS}_0`);
|
|
92
|
+
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
93
|
+
if (!otrosGastos)
|
|
94
|
+
throw new Error('No se encontro los gastos de la actividad');
|
|
95
|
+
let row = Object.assign({}, rubro);
|
|
96
|
+
row.Descripcion = `(-) Gastos Operativo ActividadId:${actividad.ActividadEconomicaId}`;
|
|
97
|
+
row.Clasificador = 'CT';
|
|
98
|
+
row.Editable = false;
|
|
99
|
+
row.UUID = `${RUBRO_GASTOS}_${actividad.ActividadEconomicaId}`;
|
|
100
|
+
row.RubroId = `${RUBRO_GASTOS}.1`;
|
|
101
|
+
for (let i = 1; i <= 12; i++) {
|
|
102
|
+
row[`Monto${i}`] = Math.round(parseFloat(otrosGastos.GastosOperativos) * 100) / 100;
|
|
103
|
+
}
|
|
104
|
+
data.FlujoProyectadoMensual.push(row);
|
|
105
|
+
};
|
|
106
|
+
const otrosIngresoM = (actividad, data) => {
|
|
107
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`${RUBRO_OTROS_INGRESOS}_0`);
|
|
108
|
+
const otrosIngresos = actividad.Ventas.OtrosIngresos;
|
|
109
|
+
if (!otrosIngresos)
|
|
110
|
+
throw new Error('No se encontro la estacionalidad Calc de la actividad');
|
|
111
|
+
let row = Object.assign({}, rubro);
|
|
112
|
+
row.Descripcion = `Otros Ingresos Familiares Actividad: ${actividad.ActividadEconomicaId}`;
|
|
113
|
+
row.Clasificador = 'CT';
|
|
114
|
+
row.Editable = false;
|
|
115
|
+
row.UUID = `${RUBRO_OTROS_INGRESOS}_${actividad.ActividadEconomicaId}`;
|
|
116
|
+
row.RubroId = `${RUBRO_OTROS_INGRESOS}.1`;
|
|
117
|
+
if (otrosIngresos.length == 0) {
|
|
118
|
+
const suma = otrosIngresos.reduce((acc, item) => {
|
|
119
|
+
acc += parseFloat(item.Monto);
|
|
120
|
+
return acc;
|
|
121
|
+
}, 0);
|
|
122
|
+
for (let i = 1; i <= 12; i++) {
|
|
123
|
+
row[`Monto${i}`] = suma;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
for (let i = 1; i <= 12; i++) {
|
|
128
|
+
row[`Monto${i}`] = Math.round(parseFloat(otrosIngresos[`C-${i}`]) * 100) / 100;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
data.FlujoProyectadoMensual.push(row);
|
|
132
|
+
};
|
|
133
|
+
const gastosFamiliaresM = (actividad, data) => {
|
|
134
|
+
const rubro = data.FlujoProyectadoMensualMap.get(`$${RUBRO_GASTOS_FAMILIARES}_0`);
|
|
135
|
+
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
136
|
+
if (!otrosGastos)
|
|
137
|
+
throw new Error('No se encontro los gastos de la actividad');
|
|
138
|
+
let row = Object.assign({}, rubro);
|
|
139
|
+
row.Descripcion = `(-) Gastos Familiares Actividad ${actividad.ActividadEconomicaId}`;
|
|
140
|
+
row.Clasificador = 'CT';
|
|
141
|
+
row.Editable = false;
|
|
142
|
+
row.UUID = `${RUBRO_GASTOS_FAMILIARES}_${actividad.ActividadEconomicaId}`;
|
|
143
|
+
row.RubroId = `${RUBRO_GASTOS_FAMILIARES}.1`;
|
|
144
|
+
for (let i = 1; i <= 12; i++) {
|
|
145
|
+
row[`Monto${i}`] = Math.round(parseFloat(otrosGastos.gastosFamiliares) * 100) / 100;
|
|
146
|
+
}
|
|
147
|
+
data.FlujoProyectadoMensual.push(row);
|
|
148
|
+
};
|
|
149
|
+
const calcularOtrosGastos = (gastos) => {
|
|
150
|
+
const gastosOperativos = gastos.Operativos.reduce((acc, item) => {
|
|
151
|
+
acc += parseFloat(item.ImporteMensual);
|
|
152
|
+
return acc;
|
|
153
|
+
}, 0);
|
|
154
|
+
const gastosFamiliares = gastos.Familiares.reduce((acc, item) => {
|
|
155
|
+
acc += parseFloat(item.ImporteMensual);
|
|
156
|
+
return acc;
|
|
157
|
+
}, 0);
|
|
158
|
+
return {
|
|
159
|
+
GastosOperativos: Math.round(gastosOperativos * 100) / 100,
|
|
160
|
+
GastosFamiliares: Math.round(gastosFamiliares * 100) / 100
|
|
161
|
+
};
|
|
162
|
+
};
|