changed logic in pallet print controller #823
@@ -167,6 +167,16 @@ class PalletPrintController extends Controller
|
|||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
->value('customer_po_master_id');
|
->value('customer_po_master_id');
|
||||||
|
|
||||||
|
$masterIds = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
->where('wire_packing_number', $pallet)
|
||||||
|
->pluck('customer_po_master_id');
|
||||||
|
|
||||||
|
$customerPo = CustomerPoMaster::whereIn('id', $masterIds)
|
||||||
|
->value('customer_po');
|
||||||
|
|
||||||
|
$customerPoMasterIds = CustomerPoMaster::where('customer_po', $customerPo)
|
||||||
|
->pluck('id');
|
||||||
|
|
||||||
$items = WireMasterPacking::with('item')
|
$items = WireMasterPacking::with('item')
|
||||||
->where('plant_id', $plant)
|
->where('plant_id', $plant)
|
||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
@@ -185,8 +195,18 @@ class PalletPrintController extends Controller
|
|||||||
$customerCode = $customer->customer_po ?? '';
|
$customerCode = $customer->customer_po ?? '';
|
||||||
$customerName = $customer->customer_name ?? '';
|
$customerName = $customer->customer_name ?? '';
|
||||||
|
|
||||||
|
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->count();
|
||||||
|
|
||||||
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
@@ -195,17 +215,29 @@ class PalletPrintController extends Controller
|
|||||||
)
|
)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
|
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->orderBy('wire_packing_number')
|
||||||
|
// ->pluck('wire_packing_number')
|
||||||
|
// ->values();
|
||||||
|
|
||||||
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
['Completed']
|
['Completed']
|
||||||
)
|
)
|
||||||
->orderBy('wire_packing_number')
|
->orderBy('wire_packing_number')
|
||||||
->pluck('wire_packing_number')
|
->pluck('wire_packing_number')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
$index = $completedPallets->search($pallet);
|
$index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user