sigo-package 1.2.70 → 1.2.72

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,15 +200,12 @@ 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}`);
206
+ }
207
+ if (stock.length === 1) {
208
+ stockPersonal.Liquidacion = stock[0].Cantidad;
212
209
  }
213
210
  }
214
211
  }
@@ -14841,13 +14838,13 @@ var CalcularResumenLiquidaciones = /* @__PURE__ */ __name((trabajo, trabajos) =>
14841
14838
  Codigo: mu.Codigo,
14842
14839
  Cantidad: mu.Cantidad
14843
14840
  });
14844
- const matStockPersonal = MatStockPersonal.find((e) => e.ID_Trabajo === trabajoDB.ID_Trabajo && e.Codigo === mu.Codigo && e.Identificacion === trabajoDB.Ultima_asignacion.Personal[0].Identificacion);
14841
+ const matStockPersonal = MatStockPersonal.find((e) => e.ID_StockPersonal === mu.ID_StockPersonal);
14845
14842
  if (matStockPersonal) matStockPersonal.Cantidad += mu.Cantidad;
14846
14843
  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,
14844
+ ID_StockPersonal: mu.ID_StockPersonal,
14845
+ // Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14846
+ // CodigoLlave: mu.CodigoLlave,
14847
+ // Codigo: mu.Codigo,
14851
14848
  Cantidad: mu.Cantidad
14852
14849
  });
14853
14850
  }
package/dist/index.mjs CHANGED
@@ -58,15 +58,12 @@ 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}`);
64
+ }
65
+ if (stock.length === 1) {
66
+ stockPersonal.Liquidacion = stock[0].Cantidad;
70
67
  }
71
68
  }
72
69
  }
@@ -14699,13 +14696,13 @@ var CalcularResumenLiquidaciones = /* @__PURE__ */ __name((trabajo, trabajos) =>
14699
14696
  Codigo: mu.Codigo,
14700
14697
  Cantidad: mu.Cantidad
14701
14698
  });
14702
- const matStockPersonal = MatStockPersonal.find((e) => e.ID_Trabajo === trabajoDB.ID_Trabajo && e.Codigo === mu.Codigo && e.Identificacion === trabajoDB.Ultima_asignacion.Personal[0].Identificacion);
14699
+ const matStockPersonal = MatStockPersonal.find((e) => e.ID_StockPersonal === mu.ID_StockPersonal);
14703
14700
  if (matStockPersonal) matStockPersonal.Cantidad += mu.Cantidad;
14704
14701
  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,
14702
+ ID_StockPersonal: mu.ID_StockPersonal,
14703
+ // Identificacion: trabajoDB.Ultima_asignacion.Personal[0].Identificacion,
14704
+ // CodigoLlave: mu.CodigoLlave,
14705
+ // Codigo: mu.Codigo,
14709
14706
  Cantidad: mu.Cantidad
14710
14707
  });
14711
14708
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.70",
3
+ "version": "1.2.72",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",