From ae1196cce55b9c28898bb0d47ffe58df1d1fc343 Mon Sep 17 00:00:00 2001 From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com> Date: Thu, 26 Dec 2024 15:18:03 +0530 Subject: [PATCH] feat: update item quantity matching the barcode --- src/pages/POS/POS.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/POS/POS.vue b/src/pages/POS/POS.vue index 8987f3e9..a6e04c95 100644 --- a/src/pages/POS/POS.vue +++ b/src/pages/POS/POS.vue @@ -477,7 +477,7 @@ export default defineComponent({ this.transferRefNo = ref; }, - async addItem(item: POSItem | Item | undefined) { + async addItem(item: POSItem | Item | undefined, quantity?: number) { await this.sinvDoc.runFormulas(); if (!item) { @@ -500,7 +500,9 @@ export default defineComponent({ ] ?? 0; if (itemQty < qtyInBatch) { - invItem.quantity = (invItem.quantity as number) + 1; + invItem.quantity = quantity + ? (invItem.quantity as number) + quantity + : (invItem.quantity as number) + 1; invItem.rate = item.rate as Money; await this.applyPricingRule(); @@ -528,7 +530,9 @@ export default defineComponent({ existingItems[0].rate = item.rate as Money; } - existingItems[0].quantity = (existingItems[0].quantity as number) + 1; + existingItems[0].quantity = quantity + ? (existingItems[0].quantity as number) + quantity + : (existingItems[0].quantity as number) + 1; await this.applyPricingRule(); await this.sinvDoc.runFormulas(); @@ -550,6 +554,7 @@ export default defineComponent({ await this.sinvDoc.append('items', { rate: item.rate as Money, item: item.name, + quantity: quantity ? quantity : 0, }); if (this.sinvDoc.priceList) {