changed month logic in pallet print
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m52s
Laravel Larastan / larastan (pull_request) Failing after 3m27s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m52s
Laravel Larastan / larastan (pull_request) Failing after 3m27s
This commit is contained in:
@@ -163,8 +163,6 @@ class PalletPrintController extends Controller
|
||||
public function print(Request $request, $pallet, $plant)
|
||||
{
|
||||
|
||||
// $customerPo = $request->query('customer');
|
||||
|
||||
$customerPoMasterId = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('wire_packing_number', $pallet)
|
||||
->value('customer_po_master_id');
|
||||
@@ -187,15 +185,15 @@ class PalletPrintController extends Controller
|
||||
$customerCode = $customer->customer_po ?? '';
|
||||
$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)
|
||||
->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();
|
||||
|
||||
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('customer_po_master_id', $customerPoMasterId)
|
||||
@@ -211,7 +209,7 @@ class PalletPrintController extends Controller
|
||||
|
||||
$index = $completedPallets->search($pallet);
|
||||
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 1;
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
@@ -223,11 +221,18 @@ class PalletPrintController extends Controller
|
||||
|
||||
$plantAddress = Plant::where('id', $plant)->value('address');
|
||||
|
||||
$scannedAt = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('wire_packing_number', $pallet)
|
||||
->value('scanned_at');
|
||||
|
||||
$pdf = Pdf::loadView('pdf.wire-pallet', [
|
||||
'product' => 'Submersible Winding Wire',
|
||||
'plantName' => $plantName,
|
||||
'plantAddress' => $plantAddress,
|
||||
'monthYear' => now()->format('M-y'),
|
||||
// 'monthYear' => now()->format('M-y'),
|
||||
'monthYear' => $scannedAt
|
||||
? \Carbon\Carbon::parse($scannedAt)->format('M-y')
|
||||
: '',
|
||||
'branch' => '',
|
||||
'customerCode' => $customerCode,
|
||||
'customerName' => $customerName,
|
||||
|
||||
Reference in New Issue
Block a user