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)
|
||||
{
|
||||
|
||||
$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)
|
||||
->value('item_id');
|
||||
|
||||
$customerPoIds = CustomerPoMaster::where('plant_id', $plant)
|
||||
->where('customer_po', $customerPo)
|
||||
->where('item_id', $itemId)
|
||||
->pluck('id');
|
||||
->value('customer_po_master_id');
|
||||
|
||||
$items = WireMasterPacking::with('item')
|
||||
->where('plant_id', $plant)
|
||||
@@ -187,27 +182,13 @@ class PalletPrintController extends Controller
|
||||
];
|
||||
});
|
||||
|
||||
$masterBox = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('wire_packing_number', $pallet)
|
||||
->value('customer_po_master_id');
|
||||
|
||||
$customer = CustomerPoMaster::find($masterBox);
|
||||
$customer = CustomerPoMaster::find($customerPoMasterId);
|
||||
|
||||
$customerCode = $customer->customer_po ?? '';
|
||||
$customerName = $customer->customer_name ?? '';
|
||||
|
||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||
// ->where('customer_po_master_id', $customerId)
|
||||
// ->distinct('wire_packing_number')
|
||||
// ->count('wire_packing_number');
|
||||
|
||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||
// ->whereIn('customer_po_master_id', $customerPoIds)
|
||||
// ->distinct('wire_packing_number')
|
||||
// ->count('wire_packing_number');
|
||||
|
||||
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||
->whereIn('customer_po_master_id', $customerPoIds)
|
||||
->where('customer_po_master_id', $customerPoMasterId)
|
||||
->select('wire_packing_number')
|
||||
->groupBy('wire_packing_number')
|
||||
->havingRaw(
|
||||
@@ -216,20 +197,8 @@ class PalletPrintController extends Controller
|
||||
)
|
||||
->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)
|
||||
->whereIn('customer_po_master_id', $customerPoIds)
|
||||
->where('customer_po_master_id', $customerPoMasterId)
|
||||
->select('wire_packing_number')
|
||||
->groupBy('wire_packing_number')
|
||||
->havingRaw(
|
||||
|
||||
Reference in New Issue
Block a user