Refactored alignment PalletPrintController page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m33s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Laravel Pint / pint (pull_request) Successful in 2m33s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
This commit is contained in:
@@ -44,17 +44,17 @@ class PalletPrintController extends Controller
|
|||||||
// ->values();
|
// ->values();
|
||||||
|
|
||||||
$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)
|
||||||
->get()
|
->get()
|
||||||
->map(function ($row) {
|
->map(function ($row) {
|
||||||
return (object) [
|
return (object) [
|
||||||
'code' => $row->item->code,
|
'code' => $row->item->code,
|
||||||
'description' => $row->item->description,
|
'description' => $row->item->description,
|
||||||
'box_count' => 1, // each row = one box
|
'box_count' => 1, // each row = one box
|
||||||
'weight' => $row->weight,
|
'weight' => $row->weight,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
$masterBox = WireMasterPacking::where('plant_id', $plant)
|
$masterBox = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
@@ -105,12 +105,11 @@ class PalletPrintController extends Controller
|
|||||||
->pluck('wire_packing_number')
|
->pluck('wire_packing_number')
|
||||||
->values();
|
->values();
|
||||||
|
|
||||||
|
|
||||||
$index = $completedPallets->search($pallet);
|
$index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
||||||
|
|
||||||
$boxLabel = $currentPalletNo . '/' . $totalBoxes;
|
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||||
|
|
||||||
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
// ->select('wire_packing_number')
|
// ->select('wire_packing_number')
|
||||||
@@ -127,7 +126,7 @@ class PalletPrintController extends Controller
|
|||||||
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
|
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
|
||||||
|
|
||||||
$grossWeight = $items->sum('weight');
|
$grossWeight = $items->sum('weight');
|
||||||
$widthPt = 85 * 2.83465; // 85mm → points
|
$widthPt = 85 * 2.83465; // 85mm → points
|
||||||
$heightPt = 100 * 2.83465; // 100mm → points
|
$heightPt = 100 * 2.83465; // 100mm → points
|
||||||
|
|
||||||
$plantName = Plant::where('id', $plant)->value('name');
|
$plantName = Plant::where('id', $plant)->value('name');
|
||||||
@@ -135,18 +134,18 @@ class PalletPrintController extends Controller
|
|||||||
$plantAddress = Plant::where('id', $plant)->value('address');
|
$plantAddress = Plant::where('id', $plant)->value('address');
|
||||||
|
|
||||||
$pdf = Pdf::loadView('pdf.wire-pallet', [
|
$pdf = Pdf::loadView('pdf.wire-pallet', [
|
||||||
'product' => 'Submersible Winding Wire',
|
'product' => 'Submersible Winding Wire',
|
||||||
'plantName' => $plantName,
|
'plantName' => $plantName,
|
||||||
'plantAddress' => $plantAddress,
|
'plantAddress' => $plantAddress,
|
||||||
'monthYear' => now()->format('M-y'),
|
'monthYear' => now()->format('M-y'),
|
||||||
'branch' => '',
|
'branch' => '',
|
||||||
'customerCode' => $customerCode,
|
'customerCode' => $customerCode,
|
||||||
'customerName' => $customerName,
|
'customerName' => $customerName,
|
||||||
'masterBox' => $boxLabel,
|
'masterBox' => $boxLabel,
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
'grossWeight' => $grossWeight,
|
'grossWeight' => $grossWeight,
|
||||||
'netWeight' => $grossWeight - 3.05,
|
'netWeight' => $grossWeight - 3.05,
|
||||||
'pallet' => $pallet,
|
'pallet' => $pallet,
|
||||||
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
||||||
|
|
||||||
return $pdf->stream("Pallet-{$pallet}.pdf");
|
return $pdf->stream("Pallet-{$pallet}.pdf");
|
||||||
@@ -178,7 +177,6 @@ class PalletPrintController extends Controller
|
|||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// public function print(Request $request, $pallet, $plant)
|
// public function print(Request $request, $pallet, $plant)
|
||||||
// {
|
// {
|
||||||
// $customerId = $request->query('customer');
|
// $customerId = $request->query('customer');
|
||||||
@@ -205,7 +203,6 @@ 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)
|
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
// ->where('customer_po_master_id', $customerId)
|
// ->where('customer_po_master_id', $customerId)
|
||||||
// ->distinct('wire_packing_number')
|
// ->distinct('wire_packing_number')
|
||||||
@@ -223,7 +220,6 @@ class PalletPrintController extends Controller
|
|||||||
// ->pluck('wire_packing_number')
|
// ->pluck('wire_packing_number')
|
||||||
// ->values();
|
// ->values();
|
||||||
|
|
||||||
|
|
||||||
// $index = $completedPallets->search($pallet);
|
// $index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
// $currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
// $currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user