@shushed/helpers 0.0.293 → 0.0.294
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.
|
@@ -273,7 +273,16 @@ function transformMasterOrder(payload) {
|
|
|
273
273
|
const returnedRemainingBySku = { ...returnedTotalBySkuCapped };
|
|
274
274
|
const itemsList = [];
|
|
275
275
|
sourceLines
|
|
276
|
-
.filter((line) =>
|
|
276
|
+
.filter((line) => {
|
|
277
|
+
if (line.type !== "Item")
|
|
278
|
+
return false;
|
|
279
|
+
const itemNo = String(line?.item_no || line?.no || '');
|
|
280
|
+
const variantCode = String(line?.variant_code || '');
|
|
281
|
+
const upper = itemNo.toUpperCase().replace(/\s+/g, '');
|
|
282
|
+
if (upper.includes('DELCHR') || upper.startsWith('GFT') || upper.startsWith('VCH'))
|
|
283
|
+
return false;
|
|
284
|
+
return itemNo.includes('-') && variantCode.trim().length > 0;
|
|
285
|
+
})
|
|
277
286
|
.forEach((line) => {
|
|
278
287
|
const itemNo = line.no || "";
|
|
279
288
|
const variant = line.variant_code || "";
|
|
@@ -409,7 +418,10 @@ function transformMasterOrder(payload) {
|
|
|
409
418
|
const invoicedLineNos = new Set((payload.invoices || []).flatMap((inv) => (inv?.invoice_lines || []).map((l) => Number(l?.order_line_no || -1))));
|
|
410
419
|
const isDeliveryItem = (line) => {
|
|
411
420
|
const desc = String(line?.description || '').trim().toLowerCase();
|
|
412
|
-
|
|
421
|
+
if (desc === 'delivery')
|
|
422
|
+
return true;
|
|
423
|
+
const itemNo = String(line?.item_no || line?.no || '').toUpperCase().replace(/\s+/g, '');
|
|
424
|
+
return itemNo.includes('DELCHR');
|
|
413
425
|
};
|
|
414
426
|
let invoicesGrossMinor = 0;
|
|
415
427
|
(payload.invoices || []).forEach((inv) => {
|