sigo-package 1.2.70 → 1.2.71

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/dist/index.d.mts CHANGED
@@ -384,10 +384,7 @@ interface ResumenLiquidacionesTypeChile {
384
384
  MatStockAlmacen: MatStockPersonalType[];
385
385
  }
386
386
  interface MatStockPersonalType {
387
- ID_Trabajo: number;
388
- Identificacion: string;
389
- Codigo: string;
390
- CodigoLlave: string;
387
+ ID_StockPersonal: number;
391
388
  Cantidad: number;
392
389
  }
393
390
  interface MatUtilizadosType {
package/dist/index.d.ts CHANGED
@@ -384,10 +384,7 @@ interface ResumenLiquidacionesTypeChile {
384
384
  MatStockAlmacen: MatStockPersonalType[];
385
385
  }
386
386
  interface MatStockPersonalType {
387
- ID_Trabajo: number;
388
- Identificacion: string;
389
- Codigo: string;
390
- CodigoLlave: string;
387
+ ID_StockPersonal: number;
391
388
  Cantidad: number;
392
389
  }
393
390
  interface MatUtilizadosType {
package/dist/index.js CHANGED
@@ -200,16 +200,11 @@ var ActualizarDataResumenLiquidaciones = /* @__PURE__ */ __name((ManoObra, Reser
200
200
  if (StockPersonal && Array.isArray(StockPersonal)) {
201
201
  for (const stockPersonal of StockPersonal) {
202
202
  stockPersonal.Liquidacion = 0;
203
- const stock = ResumenPreLiquidado.MatStockPersonal.find((e) => e.ID_Trabajo === stockPersonal.ID_Trabajo && e.Identificacion === stockPersonal.Personal.Identificacion && e.Codigo === stockPersonal.Reserva);
204
- if (stock) {
205
- if (stock.Cantidad > stockPersonal.Despacho) {
206
- stockPersonal.Liquidacion = stockPersonal.Despacho;
207
- stock.Cantidad = stock.Cantidad - stockPersonal.Despacho;
208
- } else {
209
- stockPersonal.Liquidacion = stock.Cantidad;
210
- stock.Cantidad = 0;
211
- }
203
+ const stock = ResumenPreLiquidado.MatStockPersonal.filter((e) => e.ID_StockPersonal === stockPersonal.ID_StockPersonal);
204
+ if (stock.length !== 1) {
205
+ throw new Error(`Hay ${stock.length} resultados para stock ID_StockPersonal: ${stockPersonal.ID_StockPersonal}`);
212
206
  }
207
+ stockPersonal.Liquidacion = stock[0].Cantidad;
213
208
  }
214
209
  }
215
210
  }, "ActualizarDataResumenLiquidaciones");
@@ -14841,13 +14836,13 @@ var CalcularResumenLiquidaciones = /* @__PURE__ */ __name((trabajo, trabajos) =>
14841
14836
  Codigo: mu.Codigo,
14842
14837
  Cantidad: mu.Cantidad
14843
14838
  });
14844
- const matStockPersonal = MatStockPersonal.find((e) => e.ID_Trabajo === trabajoDB.ID_Trabajo && e.Codigo === mu.Codigo && e.Identificacion === trabajoDB.Ultima_asignacion.Personal[0].Identificacion);
14839
+ const matStockPersonal = MatStockPersonal.find((e) => e.ID_StockPersonal === mu.ID_StockPersonal);
14845
14840
  if (matStockPersonal) matStockPersonal.Cantidad += mu.Cantidad;
14846
14841
  else MatStockPersonal.push({
14847
- ID_Trabajo: trabajoDB.ID_Trabajo,
14848
- Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14849
- CodigoLlave: mu.CodigoLlave,
14850
- Codigo: mu.Codigo,
14842
+ ID_StockPersonal: mu.ID_StockPersonal,
14843
+ // Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14844
+ // CodigoLlave: mu.CodigoLlave,
14845
+ // Codigo: mu.Codigo,
14851
14846
  Cantidad: mu.Cantidad
14852
14847
  });
14853
14848
  }
package/dist/index.mjs CHANGED
@@ -58,16 +58,11 @@ var ActualizarDataResumenLiquidaciones = /* @__PURE__ */ __name((ManoObra, Reser
58
58
  if (StockPersonal && Array.isArray(StockPersonal)) {
59
59
  for (const stockPersonal of StockPersonal) {
60
60
  stockPersonal.Liquidacion = 0;
61
- const stock = ResumenPreLiquidado.MatStockPersonal.find((e) => e.ID_Trabajo === stockPersonal.ID_Trabajo && e.Identificacion === stockPersonal.Personal.Identificacion && e.Codigo === stockPersonal.Reserva);
62
- if (stock) {
63
- if (stock.Cantidad > stockPersonal.Despacho) {
64
- stockPersonal.Liquidacion = stockPersonal.Despacho;
65
- stock.Cantidad = stock.Cantidad - stockPersonal.Despacho;
66
- } else {
67
- stockPersonal.Liquidacion = stock.Cantidad;
68
- stock.Cantidad = 0;
69
- }
61
+ const stock = ResumenPreLiquidado.MatStockPersonal.filter((e) => e.ID_StockPersonal === stockPersonal.ID_StockPersonal);
62
+ if (stock.length !== 1) {
63
+ throw new Error(`Hay ${stock.length} resultados para stock ID_StockPersonal: ${stockPersonal.ID_StockPersonal}`);
70
64
  }
65
+ stockPersonal.Liquidacion = stock[0].Cantidad;
71
66
  }
72
67
  }
73
68
  }, "ActualizarDataResumenLiquidaciones");
@@ -14699,13 +14694,13 @@ var CalcularResumenLiquidaciones = /* @__PURE__ */ __name((trabajo, trabajos) =>
14699
14694
  Codigo: mu.Codigo,
14700
14695
  Cantidad: mu.Cantidad
14701
14696
  });
14702
- const matStockPersonal = MatStockPersonal.find((e) => e.ID_Trabajo === trabajoDB.ID_Trabajo && e.Codigo === mu.Codigo && e.Identificacion === trabajoDB.Ultima_asignacion.Personal[0].Identificacion);
14697
+ const matStockPersonal = MatStockPersonal.find((e) => e.ID_StockPersonal === mu.ID_StockPersonal);
14703
14698
  if (matStockPersonal) matStockPersonal.Cantidad += mu.Cantidad;
14704
14699
  else MatStockPersonal.push({
14705
- ID_Trabajo: trabajoDB.ID_Trabajo,
14706
- Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14707
- CodigoLlave: mu.CodigoLlave,
14708
- Codigo: mu.Codigo,
14700
+ ID_StockPersonal: mu.ID_StockPersonal,
14701
+ // Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14702
+ // CodigoLlave: mu.CodigoLlave,
14703
+ // Codigo: mu.Codigo,
14709
14704
  Cantidad: mu.Cantidad
14710
14705
  });
14711
14706
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.70",
3
+ "version": "1.2.71",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",