From 62259d4afeab22d92d74ac184b2ee601ddab9d48 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 15 May 2026 12:48:00 +0530 Subject: [PATCH] Changed logic for checking exustng weight with total quantity --- .../Pages/CreateWireMasterPacking.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php b/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php index 70bb860..8ff8334 100644 --- a/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php +++ b/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php @@ -247,7 +247,14 @@ class CreateWireMasterPacking extends CreateRecord return; } - if((float)$weight > (float)$customerPoRecord->quantity) + $alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPo) + ->where('plant_id', $plantId) + ->where('item_id', $itemId) + ->sum('weight'); + + $totalQty = (float)$alreadyScannedQty + (float)$weight; + + if($totalQty > (float)$customerPoRecord->quantity) { Notification::make() ->title("Scanned Weight Exceeds PO Quantity")