Merge pull request 'corrected logic pallet print controller' (#804) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 46s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 46s
Reviewed-on: #804
This commit was merged in pull request #804.
This commit is contained in:
@@ -163,16 +163,11 @@ class PalletPrintController extends Controller
|
|||||||
public function print(Request $request, $pallet, $plant)
|
public function print(Request $request, $pallet, $plant)
|
||||||
{
|
{
|
||||||
|
|
||||||
$customerPo = $request->query('customer');
|
// $customerPo = $request->query('customer');
|
||||||
|
|
||||||
$itemId = WireMasterPacking::where('plant_id', $plant)
|
$customerPoMasterId = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
->value('item_id');
|
->value('customer_po_master_id');
|
||||||
|
|
||||||
$customerPoIds = CustomerPoMaster::where('plant_id', $plant)
|
|
||||||
->where('customer_po', $customerPo)
|
|
||||||
->where('item_id', $itemId)
|
|
||||||
->pluck('id');
|
|
||||||
|
|
||||||
$items = WireMasterPacking::with('item')
|
$items = WireMasterPacking::with('item')
|
||||||
->where('plant_id', $plant)
|
->where('plant_id', $plant)
|
||||||
@@ -187,49 +182,23 @@ class PalletPrintController extends Controller
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
$masterBox = WireMasterPacking::where('plant_id', $plant)
|
$customer = CustomerPoMaster::find($customerPoMasterId);
|
||||||
->where('wire_packing_number', $pallet)
|
|
||||||
->value('customer_po_master_id');
|
|
||||||
|
|
||||||
$customer = CustomerPoMaster::find($masterBox);
|
|
||||||
|
|
||||||
$customerCode = $customer->customer_po ?? '';
|
$customerCode = $customer->customer_po ?? '';
|
||||||
$customerName = $customer->customer_name ?? '';
|
$customerName = $customer->customer_name ?? '';
|
||||||
|
|
||||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
// ->where('customer_po_master_id', $customerId)
|
->where('customer_po_master_id', $customerPoMasterId)
|
||||||
// ->distinct('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
// ->count('wire_packing_number');
|
->groupBy('wire_packing_number')
|
||||||
|
->havingRaw(
|
||||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
// ->whereIn('customer_po_master_id', $customerPoIds)
|
['Completed']
|
||||||
// ->distinct('wire_packing_number')
|
)
|
||||||
// ->count('wire_packing_number');
|
->count();
|
||||||
|
|
||||||
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
|
||||||
->whereIn('customer_po_master_id', $customerPoIds)
|
|
||||||
->select('wire_packing_number')
|
|
||||||
->groupBy('wire_packing_number')
|
|
||||||
->havingRaw(
|
|
||||||
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
|
||||||
['Completed']
|
|
||||||
)
|
|
||||||
->count();
|
|
||||||
|
|
||||||
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
|
||||||
// ->where('customer_po_master_id', $customerId)
|
|
||||||
// ->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)
|
||||||
->whereIn('customer_po_master_id', $customerPoIds)
|
->where('customer_po_master_id', $customerPoMasterId)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
|
|||||||
Reference in New Issue
Block a user