bdpformulas 1.0.58 → 1.0.60
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 +1 -102
- package/build/strategies/balance.strategy.d.ts +2 -0
- package/build/strategies/balance.strategy.js +159 -23
- package/build/strategies/common/balance.calc.d.ts +0 -1
- package/build/strategies/common/balance.calc.js +1 -3
- package/build/strategies/common/flujoCalculos/flujoConstructor.d.ts +2 -2
- package/build/strategies/common/flujoCalculos/flujoConstructor.js +90 -83
- package/build/strategies/common/flujoCalculos/supuestos.calc.d.ts +2 -2
- package/build/strategies/pecuary/Constantes.d.ts +1 -1
- package/build/strategies/pecuary/anexo.strategy.d.ts +2 -2
- package/build/strategies/pecuary/anexo.strategy.js +10 -5
- package/build/strategies/pecuary/balancePec.strategy.d.ts +2 -1
- package/build/strategies/pecuary/balancePec.strategy.js +124 -72
- package/build/strategies/pecuary/flujoProyPec.strategy.d.ts +9 -1
- package/build/strategies/pecuary/flujoProyPec.strategy.js +285 -87
- package/build/strategies/production/balancePrd.strategy.d.ts +2 -1
- package/build/strategies/production/balancePrd.strategy.js +66 -32
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -7,8 +7,29 @@ const gCuentaGastoFamiliares = 'ACT_CN_45003';
|
|
|
7
7
|
const gCuentaOtrosIngresosDet = 'ACT_CN_45001';
|
|
8
8
|
class BalancePrdStrategy {
|
|
9
9
|
actividades;
|
|
10
|
+
camposCalculadosDefinidos;
|
|
10
11
|
constructor() {
|
|
11
12
|
this.actividades = [];
|
|
13
|
+
this.camposCalculadosDefinidos = [
|
|
14
|
+
{
|
|
15
|
+
RubroId: 'ACT_CN_41002',
|
|
16
|
+
Correlativos: '*',
|
|
17
|
+
Familiar: true,
|
|
18
|
+
Empresa: true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
RubroId: 'ACT_CN_43001',
|
|
22
|
+
Correlativos: 'ultima',
|
|
23
|
+
Familiar: false,
|
|
24
|
+
Empresa: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
RubroId: 'ACT_CN_45003',
|
|
28
|
+
Correlativos: 'ultima',
|
|
29
|
+
Familiar: true,
|
|
30
|
+
Empresa: false
|
|
31
|
+
}
|
|
32
|
+
];
|
|
12
33
|
}
|
|
13
34
|
execute(data) {
|
|
14
35
|
if (!this.actividades || this.actividades.length == 0)
|
|
@@ -20,7 +41,7 @@ class BalancePrdStrategy {
|
|
|
20
41
|
//@ts-ignore
|
|
21
42
|
const cuentaGastoCopy = getCuentasCopy(data, gCuentaGasto);
|
|
22
43
|
const cuentaGastoFamiliarCopy = getCuentasCopy(data, gCuentaGastoFamiliares);
|
|
23
|
-
for (
|
|
44
|
+
for (const actividad of this.actividades) {
|
|
24
45
|
anadirIngreso(actividad, data);
|
|
25
46
|
anadirCosto(actividad, data);
|
|
26
47
|
anadirGasto(actividad, data);
|
|
@@ -31,6 +52,7 @@ class BalancePrdStrategy {
|
|
|
31
52
|
sumarizarCuentas(`${gCuentaCosto}.1`, gCuentaCosto, data, cuentasCostoCopy);
|
|
32
53
|
sumarizarCuentas(`${gCuentaGasto}.1`, gCuentaGasto, data, cuentaGastoCopy);
|
|
33
54
|
sumarizarCuentas(`${gCuentaGastoFamiliares}.1`, gCuentaGastoFamiliares, data, cuentaGastoFamiliarCopy);
|
|
55
|
+
data.camposCalculadosDefinidos = this.camposCalculadosDefinidos;
|
|
34
56
|
return data;
|
|
35
57
|
}
|
|
36
58
|
}
|
|
@@ -38,12 +60,14 @@ exports.default = BalancePrdStrategy;
|
|
|
38
60
|
const getCuentasCopy = (data, rubroId) => {
|
|
39
61
|
if (!data.eerr || data.eerr.length == 0)
|
|
40
62
|
throw new Error('Debe ingresar cuentas EERR');
|
|
41
|
-
|
|
63
|
+
const originalData = new Map();
|
|
42
64
|
const rango = data.eerr[0].Rango;
|
|
43
65
|
for (let i = 1; i <= rango; i++) {
|
|
44
|
-
|
|
45
|
-
cuentaIngreso.MontoEmpresa =
|
|
46
|
-
|
|
66
|
+
const cuentaIngreso = data.eerrMap.get(`${rubroId}_${i}`);
|
|
67
|
+
cuentaIngreso.MontoEmpresa =
|
|
68
|
+
Math.round(parseFloat(cuentaIngreso.MontoEmpresa) * 100) / 100;
|
|
69
|
+
cuentaIngreso.MontoFamiliar =
|
|
70
|
+
Math.round(parseFloat(cuentaIngreso.MontoFamiliar) * 100) / 100;
|
|
47
71
|
originalData.set(`${rubroId}_${i}`, { ...cuentaIngreso });
|
|
48
72
|
}
|
|
49
73
|
return originalData;
|
|
@@ -53,11 +77,11 @@ const anadirIngreso = (actividad, data) => {
|
|
|
53
77
|
const productos = actividad.Ventas.Productos;
|
|
54
78
|
if (productos && productos.length > 0) {
|
|
55
79
|
for (const producto of productos) {
|
|
56
|
-
const subtotal = actividad.Ventas.
|
|
57
|
-
|
|
80
|
+
const subtotal = actividad.Ventas.Ingresos.find((item) => item.Id == 'SUBTOTAL' &&
|
|
81
|
+
item.ProductoId == producto.ProductoId);
|
|
58
82
|
for (let i = 1; i <= rango; i++) {
|
|
59
83
|
const cuentaIngreso = data.eerrMap.get(`${gCuentaIngreso}_${i}`);
|
|
60
|
-
|
|
84
|
+
const copy = { ...cuentaIngreso };
|
|
61
85
|
copy.RubroId = `${gCuentaIngreso}.1`;
|
|
62
86
|
copy.Descripcion = `Ingresos por Ventas ${producto.ProductoId} ${producto.Descripcion}`;
|
|
63
87
|
copy.UUID = `${gCuentaIngreso}_${actividad.ActividadEconomicaId}_${producto.ProductoId}_${i}`;
|
|
@@ -66,7 +90,8 @@ const anadirIngreso = (actividad, data) => {
|
|
|
66
90
|
copy.Correlativo = i;
|
|
67
91
|
copy.Clasificador = 'CT';
|
|
68
92
|
if (subtotal && subtotal[`C-${i}`]) {
|
|
69
|
-
copy.MontoEmpresa =
|
|
93
|
+
copy.MontoEmpresa =
|
|
94
|
+
Math.round(parseFloat(subtotal[`C-${i}`]) * 100) / 100;
|
|
70
95
|
}
|
|
71
96
|
data.eerr.push(copy);
|
|
72
97
|
}
|
|
@@ -78,11 +103,10 @@ const anadirCosto = (actividad, data) => {
|
|
|
78
103
|
const productos = actividad.Ventas.Productos;
|
|
79
104
|
if (productos && productos.length > 0) {
|
|
80
105
|
for (const producto of productos) {
|
|
81
|
-
const subtotal = actividad.
|
|
82
|
-
Costos.Meses.find((item) => item.ProductoId == producto.ProductoId);
|
|
106
|
+
const subtotal = actividad.Costos.Meses.find((item) => item.ProductoId == producto.ProductoId);
|
|
83
107
|
for (let i = 1; i <= rango; i++) {
|
|
84
108
|
const cuentaIngreso = data.eerrMap.get(`${gCuentaCosto}_${i}`);
|
|
85
|
-
|
|
109
|
+
const copy = { ...cuentaIngreso };
|
|
86
110
|
copy.RubroId = `${gCuentaCosto}.1`;
|
|
87
111
|
copy.Descripcion = `Ingresos por Ventas ${producto.ProductoId} ${producto.Descripcion}`;
|
|
88
112
|
copy.UUID = `${gCuentaCosto}_${actividad.ActividadEconomicaId}_${producto.ProductoId}_${i}`;
|
|
@@ -91,7 +115,8 @@ const anadirCosto = (actividad, data) => {
|
|
|
91
115
|
copy.Correlativo = i;
|
|
92
116
|
copy.Clasificador = 'CT';
|
|
93
117
|
if (i == rango && subtotal) {
|
|
94
|
-
copy.MontoEmpresa =
|
|
118
|
+
copy.MontoEmpresa =
|
|
119
|
+
Math.round(parseFloat(subtotal.Total) * 100) / 100;
|
|
95
120
|
}
|
|
96
121
|
data.eerr.push(copy);
|
|
97
122
|
}
|
|
@@ -102,7 +127,7 @@ const anadirGasto = (actividad, data) => {
|
|
|
102
127
|
const rango = data.eerr[0].Rango;
|
|
103
128
|
const cuentaGasto = data.eerrMap.get(`${gCuentaGasto}_${rango}`);
|
|
104
129
|
for (let i = 1; i <= rango; i++) {
|
|
105
|
-
|
|
130
|
+
const copy = { ...cuentaGasto };
|
|
106
131
|
copy.RubroId = `${gCuentaGasto}.1`;
|
|
107
132
|
copy.UUID = `${gCuentaGasto}_${actividad.ActividadEconomicaId}_${i}`;
|
|
108
133
|
copy.Descripcion = `Gastos Administrativos Operativos Actividad: ${actividad.ActividadEconomicaId}`;
|
|
@@ -112,7 +137,8 @@ const anadirGasto = (actividad, data) => {
|
|
|
112
137
|
copy.Clasificador = 'CT';
|
|
113
138
|
if (rango == i) {
|
|
114
139
|
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
115
|
-
copy.MontoEmpresa =
|
|
140
|
+
copy.MontoEmpresa =
|
|
141
|
+
Math.round(parseFloat(otrosGastos.GastosOperativos) * 100) / 100;
|
|
116
142
|
}
|
|
117
143
|
data.eerr.push(copy);
|
|
118
144
|
}
|
|
@@ -121,7 +147,7 @@ const anadirGastoFamiliares = (actividad, data) => {
|
|
|
121
147
|
const rango = data.eerr[0].Rango;
|
|
122
148
|
const cuentaGasto = data.eerrMap.get(`${gCuentaGastoFamiliares}_${rango}`);
|
|
123
149
|
for (let i = 1; i <= rango; i++) {
|
|
124
|
-
|
|
150
|
+
const copy = { ...cuentaGasto };
|
|
125
151
|
copy.RubroId = `${gCuentaGastoFamiliares}.1`;
|
|
126
152
|
copy.UUID = `${gCuentaGastoFamiliares}_${actividad.ActividadEconomicaId}_${i}`;
|
|
127
153
|
copy.Descripcion = `Gastos Familiares Actividad: ${actividad.ActividadEconomicaId}`;
|
|
@@ -131,7 +157,8 @@ const anadirGastoFamiliares = (actividad, data) => {
|
|
|
131
157
|
copy.Clasificador = 'CT';
|
|
132
158
|
if (rango == i) {
|
|
133
159
|
const otrosGastos = calcularOtrosGastos(actividad.OtrosGastos);
|
|
134
|
-
copy.MontoFamiliar =
|
|
160
|
+
copy.MontoFamiliar =
|
|
161
|
+
Math.round(parseFloat(otrosGastos.GastosFamiliares) * 100) / 100;
|
|
135
162
|
}
|
|
136
163
|
data.eerr.push(copy);
|
|
137
164
|
}
|
|
@@ -154,14 +181,16 @@ const anadirOtrosIngresos = (actividad, data) => {
|
|
|
154
181
|
const rango = data.eerr[0].Rango;
|
|
155
182
|
const cuentaOtrosIngresos = data.eerr.find((item) => item.RubroId == gCuentaOtrosIngresosDet);
|
|
156
183
|
for (let i = 1; i <= rango; i++) {
|
|
157
|
-
|
|
184
|
+
const copy = { ...cuentaOtrosIngresos };
|
|
158
185
|
copy.UUID = `${gCuentaOtrosIngresosDet}_${actividad.ActividadEconomicaId}_${rango}`;
|
|
159
186
|
copy.Descripcion = `Otros Ingresos ${actividad.ActividadEconomicaId}`;
|
|
160
187
|
copy.MontoEmpresa = 0;
|
|
161
188
|
copy.MontoFamiliar = 0;
|
|
162
189
|
copy.Correlativo = i;
|
|
163
190
|
copy.Clasificador = 'CT';
|
|
164
|
-
if (rango == i &&
|
|
191
|
+
if (rango == i &&
|
|
192
|
+
actividad.Ventas &&
|
|
193
|
+
actividad.Ventas.OtrosIngresos &&
|
|
165
194
|
actividad.Ventas.OtrosIngresos.length > 0) {
|
|
166
195
|
copy.MontoFamiliar = actividad.Ventas.OtrosIngresos.reduce((acc, item) => {
|
|
167
196
|
acc += parseFloat(item.Monto);
|
|
@@ -175,18 +204,23 @@ const anadirOtrosIngresos = (actividad, data) => {
|
|
|
175
204
|
const sumarizarCuentas = (rubroOrigen, rubroDestino, data, dataOriginal) => {
|
|
176
205
|
const rango = data.eerr[0].Rango;
|
|
177
206
|
for (let i = 1; i <= rango; i++) {
|
|
178
|
-
const cuentaOrigen = data.eerr.
|
|
179
|
-
if (!cuentaOrigen)
|
|
180
|
-
throw new Error(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
207
|
+
const cuentaOrigen = data.eerr.filter((item) => item.RubroId == rubroOrigen && item.Correlativo == i);
|
|
208
|
+
if (!cuentaOrigen || cuentaOrigen.length == 0)
|
|
209
|
+
throw new Error('No existe el rubro Calculado ${rubroOrigen}_${i} en el EERR');
|
|
210
|
+
cuentaOrigen.forEach((itemCuentaOrigen) => {
|
|
211
|
+
const original = dataOriginal.get(`${rubroDestino}_${i}`);
|
|
212
|
+
if (original.MontoEmpresa == 0 || original.MontoFamiliar == 0) {
|
|
213
|
+
const cuentaDestino = data.eerrMap.get(`${rubroDestino}_${i}`);
|
|
214
|
+
if (original.MontoEmpresa == 0)
|
|
215
|
+
cuentaDestino.MontoEmpresa += itemCuentaOrigen.MontoEmpresa;
|
|
216
|
+
if (original.MontoFamiliar == 0)
|
|
217
|
+
cuentaDestino.MontoFamiliar +=
|
|
218
|
+
itemCuentaOrigen.MontoFamiliar;
|
|
219
|
+
cuentaDestino.MontoEmpresa =
|
|
220
|
+
Math.round(cuentaDestino.MontoEmpresa * 100) / 100;
|
|
221
|
+
cuentaDestino.MontoFamiliar =
|
|
222
|
+
Math.round(cuentaDestino.MontoFamiliar * 100) / 100;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
191
225
|
}
|
|
192
226
|
};
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
|
|
83
83
|
/* Type Checking */
|
|
84
84
|
"strict": true, /* Enable all strict type-checking options. */
|
|
85
|
-
|
|
85
|
+
"noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
86
86
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
87
87
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
88
88
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|