bdpformulas 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/models/pecuary/desarrolloResponse.Schema.d.ts +53 -53
  2. package/build/models/pecuary/desarrolloResponse.Schema.js +4 -4
  3. package/build/models/pecuary/sales.schema.d.ts +716 -0
  4. package/build/models/pecuary/sales.schema.js +30 -0
  5. package/build/strategies/pecuary/Constantes.d.ts +2 -0
  6. package/build/strategies/pecuary/Constantes.js +31 -3
  7. package/build/strategies/pecuary/desarrollo.detail/desarrolloCalc.d.ts +4 -15
  8. package/build/strategies/pecuary/desarrollo.detail/desarrolloCalc.js +28 -26
  9. package/build/strategies/pecuary/desarrollo.detail/hatoDisponibleCalc.d.ts +1 -0
  10. package/build/strategies/pecuary/desarrollo.detail/hatoDisponibleCalc.js +20 -2
  11. package/build/strategies/pecuary/desarrollo.detail/mortalidadCalc.d.ts +1 -0
  12. package/build/strategies/pecuary/desarrollo.detail/mortalidadCalc.js +21 -4
  13. package/build/strategies/pecuary/desarrollo.detail/proyeccionCalc.d.ts +1 -0
  14. package/build/strategies/pecuary/desarrollo.detail/proyeccionCalc.js +37 -12
  15. package/build/strategies/pecuary/desarrollo.detail/requerimientoCalc.js +1 -4
  16. package/build/strategies/pecuary/desarrollo.detail/ventasAnualesCalc.d.ts +1 -0
  17. package/build/strategies/pecuary/desarrollo.detail/ventasAnualesCalc.js +22 -2
  18. package/build/strategies/pecuary/desarrollo.detail/ventasCantidadCalc.d.ts +1 -0
  19. package/build/strategies/pecuary/desarrollo.detail/ventasCantidadCalc.js +18 -2
  20. package/build/strategies/pecuary/desarrollo.strategy.js +26 -20
  21. package/build/strategies/pecuary/ventas.detail/estacionalidadCalc.d.ts +3 -0
  22. package/build/strategies/pecuary/ventas.detail/estacionalidadCalc.js +64 -0
  23. package/build/strategies/pecuary/ventas.detail/ventasIngresosCalc.d.ts +1 -0
  24. package/build/strategies/pecuary/ventas.detail/ventasIngresosCalc.js +16 -0
  25. package/build/strategies/pecuary/ventas.strategy.d.ts +5 -0
  26. package/build/strategies/pecuary/ventas.strategy.js +44 -0
  27. package/package.json +1 -1
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VentasPecSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const auxiliar_schema_1 = require("./auxiliar.schema");
6
+ const desarrolloResponse_Schema_1 = require("./desarrolloResponse.Schema");
7
+ const ventas = zod_1.z.object({
8
+ RubroId: zod_1.z.string().max(50),
9
+ IndicadorABM: zod_1.z.enum(['N', 'M']),
10
+ Unidad: zod_1.z.string().max(50),
11
+ CicloId: zod_1.z.string().max(20),
12
+ });
13
+ const estacionalidad = zod_1.z.object({
14
+ IndicadorABM: zod_1.z.enum(['N', 'M']),
15
+ RubroId: zod_1.z.string().max(50),
16
+ Correlativo: zod_1.z.number(),
17
+ Monto: zod_1.z.number(),
18
+ });
19
+ exports.VentasPecSchema = zod_1.z.object({
20
+ EvaluacionId: zod_1.z.number(),
21
+ ActividadEconomicaId: zod_1.z.number(),
22
+ PID: zod_1.z.number(),
23
+ Ventas: zod_1.z.array(ventas),
24
+ Estacionalidad: zod_1.z.array(estacionalidad),
25
+ });
26
+ const CalcVentas = zod_1.z.object({
27
+ Auxiliar: auxiliar_schema_1.AuxiliarSchema,
28
+ Desarrollo: desarrolloResponse_Schema_1.DesarrolloSchema,
29
+ Ventas: exports.VentasPecSchema,
30
+ });
@@ -19,3 +19,5 @@ export declare const RUBROS: {
19
19
  ACT_PEC_M36: string;
20
20
  ACT_PEC_NOV: string;
21
21
  };
22
+ export declare const getOrden: (rubro: string) => 3 | 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
23
+ export declare const getMap: (array: any[], key: string) => any;
@@ -9,7 +9,7 @@
9
9
  // ACT_PEC_M36 TOROS
10
10
  // ACT_PEC_NOV NOVILLOS > 3 AÑOS
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RUBROS = exports.PARAMETROS = void 0;
12
+ exports.getMap = exports.getOrden = exports.RUBROS = exports.PARAMETROS = void 0;
13
13
  // ACT_PEC_DES01 Índice de parición
14
14
  // ACT_PEC_DES02 Índice de mortalidad < 1 año
15
15
  // ACT_PEC_DES03 Índice de mortalidad > 1 año
@@ -30,8 +30,8 @@ exports.PARAMETROS = {
30
30
  };
31
31
  exports.RUBROS = {
32
32
  ACT_PEC_H12: "ACT_PEC_H12",
33
- ACT_PEC_H1324: "ACT_PEC_H12",
34
- ACT_PEC_H2536: "ACT_PEC_H12",
33
+ ACT_PEC_H1324: "ACT_PEC_H1324",
34
+ ACT_PEC_H2536: "ACT_PEC_H2536",
35
35
  ACT_PEC_H36: "ACT_PEC_H36",
36
36
  ACT_PEC_M12: "ACT_PEC_M12",
37
37
  ACT_PEC_M1324: "ACT_PEC_M1324",
@@ -39,3 +39,31 @@ exports.RUBROS = {
39
39
  ACT_PEC_M36: "ACT_PEC_M36",
40
40
  ACT_PEC_NOV: "ACT_PEC_NOV"
41
41
  };
42
+ const getOrden = (rubro) => {
43
+ if (rubro == exports.RUBROS.ACT_PEC_M36)
44
+ return 1;
45
+ if (rubro == exports.RUBROS.ACT_PEC_H36)
46
+ return 2;
47
+ if (rubro == exports.RUBROS.ACT_PEC_M12)
48
+ return 3;
49
+ if (rubro == exports.RUBROS.ACT_PEC_H12)
50
+ return 4;
51
+ if (rubro == exports.RUBROS.ACT_PEC_H1324)
52
+ return 5;
53
+ if (rubro == exports.RUBROS.ACT_PEC_H2536)
54
+ return 6;
55
+ if (rubro == exports.RUBROS.ACT_PEC_M1324)
56
+ return 7;
57
+ if (rubro == exports.RUBROS.ACT_PEC_M2536)
58
+ return 8;
59
+ if (rubro == exports.RUBROS.ACT_PEC_NOV)
60
+ return 9;
61
+ };
62
+ exports.getOrden = getOrden;
63
+ const getMap = (array, key) => {
64
+ return array.reduce((acc, item) => {
65
+ const id = item[key];
66
+ acc.set(id, item);
67
+ }, new Map());
68
+ };
69
+ exports.getMap = getMap;
@@ -3,26 +3,15 @@ import { PropiedadesGanaderasType } from "../../../models/pecuary/auxiliar.schem
3
3
  export declare const getAvaluo: (avaluo: AvaluoSchemaType[], propiedades: PropiedadesGanaderasType[]) => {
4
4
  RubroId: string;
5
5
  Descripcion: string;
6
- PlanInversion: string | null;
7
- Equivalencia: string | null;
8
- Porcentaje: string | null;
6
+ PlanInversion: number | null;
7
+ Equivalencia: number | null;
8
+ Porcentaje: number | null;
9
9
  Justificaciones: string | null;
10
10
  HatoInicial?: number | null | undefined;
11
11
  PrecioVenta?: number | null | undefined;
12
12
  }[];
13
+ export declare const getTotalesAvaluo: (avaluo: Map<any, any>) => Map<any, any>;
13
14
  export declare const getProyectado: (avaluo: any[], CantidadProy: number, init?: number) => any;
14
- export declare const getEquivalencias: (avaluo: AvaluoSchemaType[]) => {
15
- RubroId: string;
16
- Descripcion: string;
17
- Equivalencia: string | null;
18
- PrecioVenta: number | null | undefined;
19
- }[];
20
- export declare const getDescartes: (avaluo: AvaluoSchemaType[]) => {
21
- RubroId: string;
22
- Descripcion: string;
23
- Porcentaje: string | null;
24
- Justificaciones: string | null;
25
- }[];
26
15
  export declare const getRequerimientoInit: () => {
27
16
  RubroId: string;
28
17
  Descripcion: string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRequerimientoInit = exports.getDescartes = exports.getEquivalencias = exports.getProyectado = exports.getAvaluo = void 0;
3
+ exports.getRequerimientoInit = exports.getProyectado = exports.getTotalesAvaluo = exports.getAvaluo = void 0;
4
+ const Constantes_1 = require("../Constantes");
4
5
  const getAvaluo = (avaluo, propiedades) => {
5
6
  const cantidad = propiedades.length;
6
7
  let sumatoria = Array.from(propiedades.reduce((acc, item) => {
@@ -22,16 +23,39 @@ const getAvaluo = (avaluo, propiedades) => {
22
23
  item.HatoInicial = 0;
23
24
  if (cantidad > 0) {
24
25
  const findx = sumatoria.find((rubro) => rubro.RubroId === item.RubroId);
25
- if (findx)
26
+ if (findx) {
26
27
  item.HatoInicial = findx.Cantidad;
27
- else
28
+ item.PrecioVenta = findx.PrecioVenta;
29
+ }
30
+ else {
28
31
  item.HatoInicial = 0;
32
+ item.PrecioVenta = 0;
33
+ }
29
34
  }
35
+ //@ts-ignore
36
+ item.Porcentaje = parseFloat(item.Porcentaje);
37
+ //@ts-ignore
38
+ item.Equivalencia = parseFloat(item.Equivalencia);
39
+ //@ts-ignore
40
+ item.PlanInversion = parseFloat(item.PlanInversion);
41
+ //@ts-ignore
42
+ item.Orden = (0, Constantes_1.getOrden)(item.RubroId);
30
43
  return item;
31
44
  });
32
45
  return avaluo;
33
46
  };
34
47
  exports.getAvaluo = getAvaluo;
48
+ const getTotalesAvaluo = (avaluo) => {
49
+ let total = { RubroId: 'TOT01', Descripcion: 'Totales en Cabezas', Orden: 10, HatoInicial: 0, PlanInversion: 0 };
50
+ //@ts-ignore
51
+ for (const [key, value] of avaluo) {
52
+ total.HatoInicial += value.HatoInicial;
53
+ total.PlanInversion += value.PlanInversion;
54
+ }
55
+ avaluo.set('TOT01', total);
56
+ return avaluo;
57
+ };
58
+ exports.getTotalesAvaluo = getTotalesAvaluo;
35
59
  const getProyectado = (avaluo, CantidadProy, init = 1) => {
36
60
  let result = {};
37
61
  result = avaluo.map((item) => {
@@ -39,7 +63,7 @@ const getProyectado = (avaluo, CantidadProy, init = 1) => {
39
63
  for (let i = init; i <= CantidadProy; i++) {
40
64
  data[`C-${i}`] = 0;
41
65
  }
42
- return Object.assign({ RubroId: item.RubroId, Descripcion: item.Descripcion }, data);
66
+ return Object.assign({ RubroId: item.RubroId, Descripcion: item.Descripcion, Orden: (0, Constantes_1.getOrden)(item.RubroId) }, data);
43
67
  });
44
68
  result = result.reduce((acc, item) => {
45
69
  acc.set(item.RubroId, Object.assign({}, item));
@@ -48,28 +72,6 @@ const getProyectado = (avaluo, CantidadProy, init = 1) => {
48
72
  return result;
49
73
  };
50
74
  exports.getProyectado = getProyectado;
51
- const getEquivalencias = (avaluo) => {
52
- return avaluo.map((item) => {
53
- return {
54
- RubroId: item.RubroId,
55
- Descripcion: item.Descripcion,
56
- Equivalencia: item.Equivalencia,
57
- PrecioVenta: item.PrecioVenta
58
- };
59
- });
60
- };
61
- exports.getEquivalencias = getEquivalencias;
62
- const getDescartes = (avaluo) => {
63
- return avaluo.map((item) => {
64
- return {
65
- RubroId: item.RubroId,
66
- Descripcion: item.Descripcion,
67
- Porcentaje: item.Porcentaje,
68
- Justificaciones: item.Justificaciones,
69
- };
70
- });
71
- };
72
- exports.getDescartes = getDescartes;
73
75
  const getRequerimientoInit = () => {
74
76
  return [{ RubroId: 'REQ01', Descripcion: '# de Vacas Período' },
75
77
  { RubroId: 'REQ02', Descripcion: 'Toros Actuales (Período Anterior)' },
@@ -1 +1,2 @@
1
1
  export declare const calcularData: (i: number, proyeccion: Map<any, any>, hatoDisponible: Map<any, any>, mortalidad: Map<any, any>) => Map<any, any>;
2
+ export declare const calcularTotal: (table: Map<any, any>, cantidad: number) => Map<any, any>;
@@ -1,10 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcularData = void 0;
3
+ exports.calcularTotal = exports.calcularData = void 0;
4
4
  const calcularData = (i, proyeccion, hatoDisponible, mortalidad) => {
5
5
  for (const [key, value] of hatoDisponible) {
6
- value[`C-${i}`] = Math.round(proyeccion.get(key)[`C-${i - 1}`] - mortalidad.get(key)[`C-${i}`]);
6
+ value[`C-${i}`] = Math.trunc(proyeccion.get(key)[`C-${i - 1}`] - mortalidad.get(key)[`C-${i}`]);
7
7
  }
8
8
  return hatoDisponible;
9
9
  };
10
10
  exports.calcularData = calcularData;
11
+ const calcularTotal = (table, cantidad) => {
12
+ let tot01;
13
+ for (let i = 1; i <= cantidad; i++) {
14
+ tot01 = 0;
15
+ for (const [key, value] of table) {
16
+ if (key == 'TOT01')
17
+ continue;
18
+ tot01 += value[`C-${i}`];
19
+ }
20
+ if (!table.has('TOT01'))
21
+ table.set('TOT01', { RubroId: 'TOT01', Descripcion: 'Total Cabezas Disponibles', Orden: 10 });
22
+ table.get('TOT01')[`C-${i}`] = tot01;
23
+ }
24
+ table.set('TOT02', { RubroId: 'TOT02', Descripcion: `Incremento del hato en ${cantidad}`,
25
+ [`C-${cantidad}`]: 100 - table.get('TOT01')[`C-${1}`] / table.get('TOT01')[`C-${cantidad}`] * 100 });
26
+ return table;
27
+ };
28
+ exports.calcularTotal = calcularTotal;
@@ -1 +1,2 @@
1
1
  export declare const calcularData: (i: number, proyeccion: Map<any, any>, mortalidad: Map<any, any>, parametros: Map<any, any>) => Map<any, any>;
2
+ export declare const calcularTotal: (table: Map<any, any>, cantidad: number) => Map<any, any>;
@@ -1,16 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcularData = void 0;
3
+ exports.calcularTotal = exports.calcularData = void 0;
4
4
  const Constantes_1 = require("../Constantes");
5
5
  const calcularData = (i, proyeccion, mortalidad, parametros) => {
6
6
  const I12 = parametros.get(Constantes_1.PARAMETROS.IND_MOR1).Porcentaje;
7
7
  const I13 = parametros.get(Constantes_1.PARAMETROS.IND_MOR2).Porcentaje;
8
8
  for (const [key, value] of mortalidad) {
9
- if (key == Constantes_1.RUBROS.ACT_PEC_H12 || key == Constantes_1.RUBROS.ACT_PEC_M12)
10
- value[`C-${i}`] = Math.round(proyeccion.get(key)[`C-${i - 1}`] * I12);
9
+ if (key == Constantes_1.RUBROS.ACT_PEC_H12 || key == Constantes_1.RUBROS.ACT_PEC_M12) {
10
+ value[`C-${i}`] = Math.trunc(proyeccion.get(key)[`C-${i - 1}`] * I12 / 100);
11
+ }
11
12
  else
12
- value[`C-${i}`] = Math.round(proyeccion.get(key)[`C-${i - 1}`] * I13);
13
+ value[`C-${i}`] = Math.trunc(proyeccion.get(key)[`C-${i - 1}`] * I13 / 100);
13
14
  }
14
15
  return mortalidad;
15
16
  };
16
17
  exports.calcularData = calcularData;
18
+ const calcularTotal = (table, cantidad) => {
19
+ let tot01;
20
+ for (let i = 1; i <= cantidad; i++) {
21
+ tot01 = 0;
22
+ for (const [key, value] of table) {
23
+ if (key == 'TOT01')
24
+ continue;
25
+ tot01 += value[`C-${i}`];
26
+ }
27
+ if (!table.has('TOT01'))
28
+ table.set('TOT01', { RubroId: 'TOT01', Descripcion: 'Total Mortalidad', Orden: 10 });
29
+ table.get('TOT01')[`C-${i}`] = tot01;
30
+ }
31
+ return table;
32
+ };
33
+ exports.calcularTotal = calcularTotal;
@@ -1 +1,2 @@
1
1
  export declare const calcularData: (i: number, proyeccion: Map<any, any>, avaluos: Map<any, any>, mortalidad: Map<any, any>, ventasAnuales: Map<any, any>, parametros: Map<any, any>) => any;
2
+ export declare const calcularTotal: (proyeccion: Map<any, any>, avaluo: Map<any, any>, parametros: Map<any, any>, cantidad: number) => Map<any, any>;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcularData = void 0;
3
+ exports.calcularTotal = exports.calcularData = void 0;
4
4
  const Constantes_1 = require("../Constantes");
5
5
  const formulaInicial = (proyeccion, avaluos) => {
6
6
  for (const [key, value] of proyeccion) {
7
7
  const avaluo = avaluos.get(key);
8
- value[`C-0`] = avaluo.HatoInicial * avaluo.PlanInversion;
8
+ value[`C-0`] = avaluo.HatoInicial + avaluo.PlanInversion;
9
9
  }
10
10
  return proyeccion;
11
11
  };
@@ -33,9 +33,34 @@ const calcularData = (i, proyeccion, avaluos, mortalidad, ventasAnuales, paramet
33
33
  if (key == Constantes_1.RUBROS.ACT_PEC_NOV)
34
34
  value[`C-${i}`] = formulaNovillos(i, proyeccion, mortalidad, ventasAnuales);
35
35
  }
36
+ return proyeccion;
36
37
  }
37
38
  };
38
39
  exports.calcularData = calcularData;
40
+ const calcularTotal = (proyeccion, avaluo, parametros, cantidad) => {
41
+ let tot01, tot02, tot03;
42
+ for (let i = 0; i <= cantidad; i++) {
43
+ tot01 = tot02 = tot03 = 0;
44
+ for (const [key, value] of proyeccion) {
45
+ if (key == 'TOT01' || key == 'TOT02' || key == 'TOT03')
46
+ continue;
47
+ tot01 += value[`C-${i}`];
48
+ tot02 += value[`C-${i}`] * avaluo.get(key).Equivalencia;
49
+ }
50
+ tot03 = tot02 * parametros.get(Constantes_1.PARAMETROS.REL_USO_CAMPO).Porcentaje;
51
+ if (!proyeccion.has('TOT01'))
52
+ proyeccion.set('TOT01', { RubroId: 'TOT01', Descripcion: 'Totales en Cabezas', Orden: 10 });
53
+ if (!proyeccion.has('TOT02'))
54
+ proyeccion.set('TOT02', { RubroId: 'TOT02', Descripcion: 'Totales en U.A.', Orden: 11 });
55
+ if (!proyeccion.has('TOT03'))
56
+ proyeccion.set('TOT03', { RubroId: 'TOT03', Descripcion: 'SUP. De Terreno REQ. (Has)', Orden: 12 });
57
+ proyeccion.get('TOT01')[`C-${i}`] = tot01;
58
+ proyeccion.get('TOT02')[`C-${i}`] = tot02;
59
+ proyeccion.get('TOT03')[`C-${i}`] = tot03;
60
+ }
61
+ return proyeccion;
62
+ };
63
+ exports.calcularTotal = calcularTotal;
39
64
  const formulaToros = (i, proyeccion, mortalidad, ventasAnuales) => {
40
65
  return proyeccion.get(Constantes_1.RUBROS.ACT_PEC_M36)[`C-${i - 1}`] +
41
66
  proyeccion.get(Constantes_1.RUBROS.ACT_PEC_NOV)[`C-${i - 1}`] -
@@ -45,19 +70,19 @@ const formulaToros = (i, proyeccion, mortalidad, ventasAnuales) => {
45
70
  const formulaVacas = (i, proyeccion, mortalidad, ventasAnuales) => {
46
71
  return proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H36)[`C-${i - 1}`] +
47
72
  proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H2536)[`C-${i - 1}`] -
48
- mortalidad.get(Constantes_1.RUBROS.ACT_PEC_M36)[`C-${i}`] -
49
- ventasAnuales.get(Constantes_1.RUBROS.ACT_PEC_M36)[`C-${i}`];
73
+ mortalidad.get(Constantes_1.RUBROS.ACT_PEC_H36)[`C-${i}`] -
74
+ ventasAnuales.get(Constantes_1.RUBROS.ACT_PEC_H36)[`C-${i}`];
50
75
  };
51
76
  const formulaTerneras = (i, proyeccion, parametros) => {
52
77
  const C25 = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H36)[`C-${i - 1}`];
53
- const C29 = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H1324)[`C-${i - 1}`];
54
- const C28 = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H2536)[`C-${i - 1}`];
55
- const I14 = parametros.get(Constantes_1.PARAMETROS.REL_HEM_MACH).Porcentaje;
56
- const I11 = parametros.get(Constantes_1.PARAMETROS.IND_PAR).Porcentaje;
57
- if (parametros.get(Constantes_1.PARAMETROS.PRE_VAQUILLA_1_2).Bandera)
78
+ const C29 = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H2536)[`C-${i - 1}`];
79
+ const C28 = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H1324)[`C-${i - 1}`];
80
+ const I14 = parametros.get(Constantes_1.PARAMETROS.REL_HEM_MACH).Porcentaje / 100;
81
+ const I11 = parametros.get(Constantes_1.PARAMETROS.IND_PAR).Porcentaje / 100;
82
+ if (parametros.get(Constantes_1.PARAMETROS.PRE_VAQUILLA_1_2).Bandera == 'SI')
58
83
  return ((C25 + C29 + C28) * I14 * I11);
59
84
  else {
60
- if (parametros.get(Constantes_1.PARAMETROS.PRE_VAQUILLA_2_3).Bandera)
85
+ if (parametros.get(Constantes_1.PARAMETROS.PRE_VAQUILLA_2_3).Bandera == 'SI')
61
86
  return ((C25 + C29) * I14 * I11);
62
87
  else
63
88
  return (C25 * I14 * I11);
@@ -85,6 +110,6 @@ const formulaTorillos23 = (i, proyeccion, mortalidad, ventasAnuales) => {
85
110
  };
86
111
  const formulaNovillos = (i, proyeccion, mortalidad, ventasAnuales) => {
87
112
  return proyeccion.get(Constantes_1.RUBROS.ACT_PEC_M2536)[`C-${i - 1}`] -
88
- mortalidad.get(Constantes_1.RUBROS.ACT_PEC_M1324)[`C-${i}`] -
89
- ventasAnuales.get(Constantes_1.RUBROS.ACT_PEC_M1324)[`C-${i}`];
113
+ mortalidad.get(Constantes_1.RUBROS.ACT_PEC_M2536)[`C-${i}`] -
114
+ ventasAnuales.get(Constantes_1.RUBROS.ACT_PEC_M2536)[`C-${i}`];
90
115
  };
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calcularData = void 0;
4
4
  const Constantes_1 = require("../Constantes");
5
5
  const calcularData = (i, proyeccion, requerimiento, parametros) => {
6
- console.log('REQ01');
7
6
  const I15 = parametros.get(Constantes_1.PARAMETROS.REL_VACA_TORO).Porcentaje;
8
- console.log('REQ02');
9
7
  for (const [key, value] of requerimiento) {
10
8
  if (key == 'REQ01') {
11
9
  value[`C-${i}`] = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_H36)[`C-${i - 1}`];
@@ -13,10 +11,9 @@ const calcularData = (i, proyeccion, requerimiento, parametros) => {
13
11
  if (key == 'REQ02')
14
12
  value[`C-${i}`] = proyeccion.get(Constantes_1.RUBROS.ACT_PEC_M36)[`C-${i - 1}`];
15
13
  }
16
- console.log('REQ03');
17
14
  for (const [key, value] of requerimiento) {
18
15
  if (key == 'REQ03')
19
- value[`C-${i}`] = Math.round(requerimiento.get('REQ01')[`C-${i}`] * I15);
16
+ value[`C-${i}`] = Math.trunc(requerimiento.get('REQ01')[`C-${i}`] * I15 / 100);
20
17
  if (key == 'REQ04')
21
18
  value[`C-${i}`] = requerimiento.get('REQ03')[`C-${i}`] -
22
19
  requerimiento.get('REQ02')[`C-${i}`];
@@ -1 +1,2 @@
1
1
  export declare const calcularData: (i: number, ventasAnuales: Map<any, any>, avaluos: Map<any, any>, hatoDisponible: Map<any, any>) => Map<any, any>;
2
+ export declare const calcularTotal: (table: Map<any, any>, avaluo: Map<any, any>, cantidad: number) => Map<any, any>;
@@ -1,10 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcularData = void 0;
3
+ exports.calcularTotal = exports.calcularData = void 0;
4
4
  const calcularData = (i, ventasAnuales, avaluos, hatoDisponible) => {
5
5
  for (const [key, value] of ventasAnuales) {
6
- value[`C-${i}`] = Math.round(hatoDisponible.get(key)[`C-${i}`] * avaluos.get(key).Porcentaje / 100);
6
+ value[`C-${i}`] = Math.trunc(hatoDisponible.get(key)[`C-${i}`] * avaluos.get(key).Porcentaje / 100);
7
7
  }
8
8
  return ventasAnuales;
9
9
  };
10
10
  exports.calcularData = calcularData;
11
+ const calcularTotal = (table, avaluo, cantidad) => {
12
+ let tot01, tot02;
13
+ for (let i = 1; i <= cantidad; i++) {
14
+ tot01 = tot02 = 0;
15
+ for (const [key, value] of table) {
16
+ if (key == 'TOT01' || key == 'TOT02')
17
+ continue;
18
+ tot01 += value[`C-${i}`];
19
+ tot02 += value[`C-${i}`] * avaluo.get(key).Equivalencia;
20
+ }
21
+ if (!table.has('TOT01'))
22
+ table.set('TOT01', { RubroId: 'TOT01', Descripcion: 'Total Venta Anual', Orden: 10 });
23
+ if (!table.has('TOT02'))
24
+ table.set('TOT02', { RubroId: 'TOT02', Descripcion: 'Totales en U.A.', Orden: 11 });
25
+ table.get('TOT01')[`C-${i}`] = tot01;
26
+ table.get('TOT02')[`C-${i}`] = tot02;
27
+ }
28
+ return table;
29
+ };
30
+ exports.calcularTotal = calcularTotal;
@@ -1 +1,2 @@
1
1
  export declare const calcularData: (i: number, ventasCantidad: Map<any, any>, ventasAnuales: Map<any, any>, avaluosMap: Map<any, any>) => Map<any, any>;
2
+ export declare const calcularTotal: (table: Map<any, any>, cantidad: number) => Map<any, any>;
@@ -1,11 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.calcularData = void 0;
3
+ exports.calcularTotal = exports.calcularData = void 0;
4
4
  const calcularData = (i, ventasCantidad, ventasAnuales, avaluosMap) => {
5
5
  for (const [key, value] of ventasCantidad) {
6
6
  value[`C-${i}`] = ventasAnuales.get(key)[`C-${i}`] *
7
- avaluosMap.get(key).Equivalencia;
7
+ avaluosMap.get(key).PrecioVenta;
8
8
  }
9
9
  return ventasCantidad;
10
10
  };
11
11
  exports.calcularData = calcularData;
12
+ const calcularTotal = (table, cantidad) => {
13
+ let tot01;
14
+ for (let i = 1; i <= cantidad; i++) {
15
+ tot01 = 0;
16
+ for (const [key, value] of table) {
17
+ if (key == 'TOT01')
18
+ continue;
19
+ tot01 += value[`C-${i}`];
20
+ }
21
+ if (!table.has('TOT01'))
22
+ table.set('TOT01', { RubroId: 'TOT01', Descripcion: 'Total Venta Anual', Orden: 10 });
23
+ table.get('TOT01')[`C-${i}`] = tot01;
24
+ }
25
+ return table;
26
+ };
27
+ exports.calcularTotal = calcularTotal;
@@ -24,21 +24,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  const proyeccionCalc = __importStar(require("./desarrollo.detail/proyeccionCalc"));
27
+ //@ts-ignore
27
28
  const requerimientoCal = __importStar(require("./desarrollo.detail/requerimientoCalc"));
28
29
  const mortalidadCalc = __importStar(require("./desarrollo.detail/mortalidadCalc"));
29
30
  const hatoDisponibleCalc = __importStar(require("./desarrollo.detail/hatoDisponibleCalc"));
31
+ //@ts-ignore
30
32
  const ventasCantidadCalc = __importStar(require("./desarrollo.detail/ventasCantidadCalc"));
31
33
  const ventasAnualesCalc = __importStar(require("./desarrollo.detail/ventasAnualesCalc"));
32
34
  const desarrolloCalc = __importStar(require("./desarrollo.detail/desarrolloCalc"));
35
+ const desarrolloCalc_1 = require("./desarrollo.detail/desarrolloCalc");
33
36
  const getProyDesarrollo = (avaluos, parametros, CantidadProy, CantidadHectareas) => {
34
- console.log('proy0001');
35
37
  let proyeccion = desarrolloCalc.getProyectado(avaluos, CantidadProy, 0);
36
38
  let requerimiento = desarrolloCalc.getProyectado(desarrolloCalc.getRequerimientoInit(), CantidadProy);
37
39
  let mortalidad = desarrolloCalc.getProyectado(avaluos, CantidadProy);
38
40
  let hatoDisponible = desarrolloCalc.getProyectado(avaluos, CantidadProy);
39
41
  let ventasCantidad = desarrolloCalc.getProyectado(avaluos, CantidadProy);
40
42
  let ventasAnuales = desarrolloCalc.getProyectado(avaluos, CantidadProy);
41
- console.log('proy0002');
42
43
  const paramsMap = parametros.reduce((acc, item) => {
43
44
  acc.set(item.RubroId, Object.assign({}, item));
44
45
  return acc;
@@ -47,42 +48,47 @@ const getProyDesarrollo = (avaluos, parametros, CantidadProy, CantidadHectareas)
47
48
  acc.set(item.RubroId, Object.assign({}, item));
48
49
  return acc;
49
50
  }, new Map());
50
- console.log('proy0003');
51
51
  for (let i = 0; i <= CantidadProy; i++) {
52
52
  if (i == 0) {
53
- console.log('proy0003.1');
54
53
  proyeccion = proyeccionCalc.calcularData(i, proyeccion, avaluosMap, new Map(), new Map(), new Map());
55
54
  }
56
55
  else {
57
- console.log('proy0003.2');
58
56
  mortalidad = mortalidadCalc.calcularData(i, proyeccion, mortalidad, paramsMap);
59
- console.log('proy0003.3');
60
57
  hatoDisponible = hatoDisponibleCalc.calcularData(i, proyeccion, hatoDisponible, mortalidad);
61
- console.log('proy0003.4');
62
58
  ventasAnuales = ventasAnualesCalc.calcularData(i, ventasAnuales, avaluosMap, hatoDisponible);
63
- console.log('proy0003.5');
64
59
  proyeccion = proyeccionCalc.calcularData(i, proyeccion, avaluosMap, mortalidad, ventasAnuales, paramsMap);
65
- console.log('proy0003.6');
66
60
  requerimiento = requerimientoCal.calcularData(i, proyeccion, requerimiento, paramsMap);
67
- console.log('proy0003.7');
68
61
  ventasCantidad = ventasCantidadCalc.calcularData(i, ventasCantidad, ventasAnuales, avaluosMap);
69
62
  }
70
63
  }
71
- console.log('proy0004');
72
- return { proyeccion, requerimiento, mortalidad, hatoDisponible, ventasCantidad, ventasAnuales };
64
+ proyeccion = proyeccionCalc.calcularTotal(proyeccion, avaluosMap, paramsMap, CantidadProy);
65
+ mortalidad = mortalidadCalc.calcularTotal(mortalidad, CantidadProy);
66
+ hatoDisponible = hatoDisponibleCalc.calcularTotal(hatoDisponible, CantidadProy);
67
+ ventasAnuales = ventasAnualesCalc.calcularTotal(ventasAnuales, avaluosMap, CantidadProy);
68
+ ventasCantidad = ventasCantidadCalc.calcularTotal(ventasCantidad, CantidadProy);
69
+ let result = {};
70
+ result.avaluos = Array.from((0, desarrolloCalc_1.getTotalesAvaluo)(avaluosMap).values());
71
+ result.proyeccion = Array.from(proyeccion.values());
72
+ result.requerimiento = Array.from(requerimiento.values());
73
+ result.mortalidad = Array.from(mortalidad.values());
74
+ result.hatoDisponible = Array.from(hatoDisponible.values());
75
+ result.ventasCantidad = Array.from(ventasCantidad.values());
76
+ result.ventasAnuales = Array.from(ventasAnuales.values());
77
+ return result;
73
78
  };
74
79
  class Desarrollo {
75
80
  execute(data) {
76
81
  let result = data.Desarrollo;
77
- console.log('dev0001');
78
- result.Avaluo = desarrolloCalc.getAvaluo(data.Desarrollo.Avaluo, data.Auxiliar.PropiedadesGanaderas);
82
+ const avaluosMap = desarrolloCalc.getAvaluo(data.Desarrollo.Avaluo, data.Auxiliar.PropiedadesGanaderas);
79
83
  result.Parametros = data.Desarrollo.Parametros;
80
- console.log('dev0002');
81
- result.ProyeccionDesarrollo = getProyDesarrollo(result.Avaluo, result.Parametros, result.CantidadProyeccion, result.TamannoHectareas);
82
- console.log('dev0003');
83
- result.Equivalencias = desarrolloCalc.getEquivalencias(result.Avaluo);
84
- console.log('dev0004');
85
- result.Descarte = desarrolloCalc.getDescartes(result.Avaluo);
84
+ const { proyeccion, mortalidad, hatoDisponible, ventasCantidad, ventasAnuales, requerimiento, avaluos } = getProyDesarrollo(avaluosMap, result.Parametros, result.CantidadProyeccion, result.TamannoHectareas);
85
+ result.Avaluo = avaluos;
86
+ result.Proyeccion = proyeccion;
87
+ result.Requerimiento = requerimiento;
88
+ result.Mortalidad = mortalidad;
89
+ result.HatoDisponible = hatoDisponible;
90
+ result.VentasAnuales = ventasAnuales;
91
+ result.VentasCantidad = ventasCantidad;
86
92
  return result;
87
93
  }
88
94
  }
@@ -0,0 +1,3 @@
1
+ export declare const estacionalidadCalc: (ventasPrimitivo: any, ventasIngresos: any[]) => any;
2
+ export declare const getEstacionalidadPorcentaje: (estacionalidad: any) => unknown[];
3
+ export declare const getEstacionalidadCalc: (estacionalidad: any) => unknown[];
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEstacionalidadCalc = exports.getEstacionalidadPorcentaje = exports.estacionalidadCalc = void 0;
4
+ const Constantes_1 = require("../Constantes");
5
+ const estacionalidadCalc = (ventasPrimitivo, ventasIngresos) => {
6
+ const ingresosMap = (0, Constantes_1.getMap)(ventasIngresos, 'RubroId');
7
+ const ventasCalc = ventasPrimitivo.Estacionalidad.map((item) => {
8
+ return Object.assign(Object.assign({}, item), { IngresoTotal: ingresosMap.get(item.RubroId).IngresoTotal, CalculoIngreso: ingresosMap.get(item.RubroId).IngresoTotal * item.Monto });
9
+ });
10
+ return ventasCalc;
11
+ };
12
+ exports.estacionalidadCalc = estacionalidadCalc;
13
+ const getEstacionalidadPorcentaje = (estacionalidad) => {
14
+ const result = estacionalidad.reduce((acc, item) => {
15
+ if (!acc.has('TOT01')) {
16
+ acc.set('TOT01', {
17
+ RubroId: 'TOT01',
18
+ Descripcion: 'TOTAL',
19
+ IngresoTotal: 0,
20
+ Total: 0
21
+ });
22
+ }
23
+ if (!acc.has(item.RubroId)) {
24
+ acc.set(item.RubroId, {
25
+ RubroId: estacionalidad.RubroId,
26
+ Descripcion: estacionalidad.Descripcion,
27
+ IngresoTotal: estacionalidad.IngresoTotal,
28
+ Total: 0
29
+ });
30
+ acc.get('TOT01').IngresoTotal += estacionalidad.IngresoTotal;
31
+ }
32
+ acc.get(item.RubroId)[`C-${item.Correlativo}`] = item.Monto;
33
+ acc.get(item.RubroId)[`label-${item.Correlativo}`] = item.CorrelativoDesc;
34
+ acc.get(item.RubroId).Total += item.Monto;
35
+ }, new Map());
36
+ return Array.from(result);
37
+ };
38
+ exports.getEstacionalidadPorcentaje = getEstacionalidadPorcentaje;
39
+ const getEstacionalidadCalc = (estacionalidad) => {
40
+ const result = estacionalidad.reduce((acc, item) => {
41
+ const TOT01 = 'TOT01';
42
+ if (!acc.has(TOT01)) {
43
+ acc.set(TOT01, {
44
+ RubroId: TOT01,
45
+ Descripcion: 'TOTAL',
46
+ Total: 0
47
+ });
48
+ }
49
+ if (!acc.has(item.RubroId)) {
50
+ acc.set(item.RubroId, {
51
+ RubroId: estacionalidad.RubroId,
52
+ Descripcion: estacionalidad.Descripcion,
53
+ IngresoTotal: estacionalidad.IngresoTotal,
54
+ Total: 0
55
+ });
56
+ }
57
+ acc.get(item.RubroId)[`C-${item.Correlativo}`] = item.CalculoIngreso;
58
+ acc.get(item.RubroId)[`label-${item.Correlativo}`] = item.CorrelativoDesc;
59
+ acc.get(TOT01)[`C-${item.Correlativo}`] += item.CalculoIngreso;
60
+ acc.get(item.RubroId).Total += item.CalculoIngreso;
61
+ }, new Map());
62
+ return Array.from(result);
63
+ };
64
+ exports.getEstacionalidadCalc = getEstacionalidadCalc;
@@ -0,0 +1 @@
1
+ export declare const calcular: (ventasPrimitivo: any, auxiliarPrimitivo: any, desarrolloCalculado: any) => any;