@zauru-sdk/utils 2.0.46 → 2.0.48

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.
@@ -104,7 +104,7 @@ export const register4pinosReception = async ({ cookie, idWebAppTable, agency_id
104
104
  const netWeight = Number(values.netWgt);
105
105
  const total_baskets = Number(values.totalBaskets);
106
106
  const netWeightByBasket = Number(netWeight) / total_baskets;
107
- const stockInteger = values.stockInteger == "true";
107
+ const pesoEnUnidades = values.stockInteger == "true";
108
108
  const buildArray = (keyIncludes, processValue) => {
109
109
  const regex = /\d/; // Expresión regular para buscar al menos un dígito.
110
110
  return keys
@@ -154,8 +154,10 @@ export const register4pinosReception = async ({ cookie, idWebAppTable, agency_id
154
154
  const weight = Number(values[key]);
155
155
  const detail_basket = Number(detail_baskets[index]);
156
156
  const detail_discount = Number(detail_discounts[index]) ?? 0;
157
- return ((weight - (stockInteger ? 0 : detail_basket * singleBasketWeight)) *
158
- ((100 - detail_discount) / 100));
157
+ const descuentoPesoCanasta = pesoEnUnidades
158
+ ? 0
159
+ : detail_basket * singleBasketWeight;
160
+ return ((weight - descuentoPesoCanasta) * ((100 - detail_discount) / 100));
159
161
  });
160
162
  const newPurchaseOrderDetails = detail_baskets.map((x, index) => {
161
163
  return {
@@ -305,7 +307,10 @@ export const register4pinosReception = async ({ cookie, idWebAppTable, agency_id
305
307
  qcMovementDetails.push({
306
308
  item_id: apiResponses.authorizedPO.purchase_order_details[0].item_id,
307
309
  lot_id: Number(lotResponse.data?.id),
308
- booked_quantity: total_qc_baskets * netWeightByBasket,
310
+ //Si es por unidad, se redondea al entero más cercano, por ejemplo 12.3 quedaría como
311
+ booked_quantity: pesoEnUnidades
312
+ ? Math.round(total_qc_baskets * netWeightByBasket)
313
+ : total_qc_baskets * netWeightByBasket,
309
314
  reference: "Verduras a control de calidad.",
310
315
  });
311
316
  const qcBasketShipment = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
4
4
  "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -26,9 +26,9 @@
26
26
  "@remix-run/node": "^2.8.1",
27
27
  "@zauru-sdk/common": "^2.0.44",
28
28
  "@zauru-sdk/config": "^2.0.0",
29
- "@zauru-sdk/graphql": "^2.0.46",
30
- "@zauru-sdk/services": "^2.0.46",
29
+ "@zauru-sdk/graphql": "^2.0.47",
30
+ "@zauru-sdk/services": "^2.0.47",
31
31
  "@zauru-sdk/types": "^2.0.44"
32
32
  },
33
- "gitHead": "aefd2b55a21a873eb419e284f872a40b2e6dec4d"
33
+ "gitHead": "23cf4319aea8a8e017a453c31a4aa327898bf3a1"
34
34
  }