From 9a3692b06b23770cba68526e7a7270e54133f171 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 3 Sep 2026 17:07:51 +0530 Subject: [PATCH 1/8] Removed unwanted line --- app/Policies/SparePackingPolicy.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Policies/SparePackingPolicy.php b/app/Policies/SparePackingPolicy.php index 0108163..76f29ea 100644 --- a/app/Policies/SparePackingPolicy.php +++ b/app/Policies/SparePackingPolicy.php @@ -2,7 +2,6 @@ namespace App\Policies; -use Illuminate\Auth\Access\Response; use App\Models\SparePacking; use App\Models\User; -- 2.49.1 From 9437ee4a4b3e7191e60d3c8e2d1bea8d686fb5ae Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 11:39:17 +0530 Subject: [PATCH 2/8] Added migration file for gernr column --- ...ernr_column_to_request_characteristics.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 database/migrations/2026_09_04_113627_add_gernr_column_to_request_characteristics.php diff --git a/database/migrations/2026_09_04_113627_add_gernr_column_to_request_characteristics.php b/database/migrations/2026_09_04_113627_add_gernr_column_to_request_characteristics.php new file mode 100644 index 0000000..2cf0398 --- /dev/null +++ b/database/migrations/2026_09_04_113627_add_gernr_column_to_request_characteristics.php @@ -0,0 +1,32 @@ + Date: Fri, 4 Sep 2026 11:40:22 +0530 Subject: [PATCH 3/8] Added gernr column on model file --- app/Models/RequestCharacteristic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Models/RequestCharacteristic.php b/app/Models/RequestCharacteristic.php index 67a2339..f4afad0 100644 --- a/app/Models/RequestCharacteristic.php +++ b/app/Models/RequestCharacteristic.php @@ -19,6 +19,7 @@ class RequestCharacteristic extends Model 'item_id', 'characteristic_approver_master_id', 'aufnr', + 'gernr', 'characteristic_name', 'current_value', 'update_value', -- 2.49.1 From 6e07f4957b1904b8ddf91b712667e61a70003254 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 13:01:56 +0530 Subject: [PATCH 4/8] Added gernr column on resource file --- .../RequestCharacteristicResource.php | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/app/Filament/Resources/RequestCharacteristicResource.php b/app/Filament/Resources/RequestCharacteristicResource.php index 305ef1e..f76f84b 100644 --- a/app/Filament/Resources/RequestCharacteristicResource.php +++ b/app/Filament/Resources/RequestCharacteristicResource.php @@ -95,6 +95,7 @@ class RequestCharacteristicResource extends Resource $set('machine_id', null); $set('item_id', null); $set('aufnr', null); + $set('gernr', null); $set('machine_name', null); $set('characteristic_approver_master_id', null); $set('approver_type', null); @@ -126,6 +127,7 @@ class RequestCharacteristicResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get) { $set('item_id', null); $set('aufnr', null); + $set('gernr', null); $set('machine_name', null); $set('characteristic_approver_master_id', null); $set('approver_type', null); @@ -213,6 +215,7 @@ class RequestCharacteristicResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get) { if (! $state) { $set('aufnr', null); + $set('gernr', null); } $set('updated_by', Filament::auth()->user()?->name); }) @@ -237,6 +240,9 @@ class RequestCharacteristicResource extends Resource return false; }) ->afterStateUpdated(function ($state, callable $set, callable $get) { + if (! $state) { + $set('gernr', null); + } $set('updated_by', Filament::auth()->user()?->name); }) ->default(function () { @@ -246,6 +252,32 @@ class RequestCharacteristicResource extends Resource }) ->readOnly(fn ($get) => ($get('item_id') == null)) ->disabled(fn ($get) => self::isFieldDisabled($get)), + Forms\Components\TextInput::make('gernr') + ->label('Serial Number') + ->reactive() + ->minLength(13) + ->readOnly(fn (callable $get) => (! $get('aufnr'))) + ->afterStateUpdated(function (callable $set) { + $set('updated_by', Filament::auth()->user()?->name); + }) + // ->rules([ + // function (callable $get) { + // return Rule::unique('class_characteristics', 'gernr') + // ->where('plant_id', $get('plant_id')) + // ->ignore($get('id')); + // }, + // ]) + // ->validationMessages([ + // 'unique' => "The 'GERNR' has already been taken.", // The GERNR has already been taken for this plant. + // ]) + ->required(function (callable $get) { + $appTyp = $get('approver_type'); + if ($appTyp == 'Stop') { + return true; + } + + return false; + }), Forms\Components\Select::make('machine_name') ->label('Machine Name') ->reactive() @@ -333,6 +365,9 @@ class RequestCharacteristicResource extends Resource $set('current_value', null); $set('update_value', null); } + if ($appTyp != 'Stop') { + $set('gernr', null); + } $set('updated_by', Filament::auth()->user()?->name); }) ->default(function () { @@ -443,8 +478,9 @@ class RequestCharacteristicResource extends Resource $plantId = $get('plant_id'); $jobNo = $get('aufnr'); + $sNo = $get('gernr'); $updId = $get('id'); - $pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('characteristic_name', $value)->latest()->first(); + $pendingExists = RequestCharacteristic::where('plant_id', $plantId)->where('aufnr', $jobNo)->where('gernr', $sNo)->where('characteristic_name', $value)->latest()->first(); if ($pendingExists) { if ($updId && $pendingExists->id == $updId) { @@ -966,6 +1002,11 @@ class RequestCharacteristicResource extends Resource ->alignCenter() ->searchable() ->sortable(), + Tables\Columns\TextColumn::make('gernr') + ->label('Serial Number') + ->alignCenter() + ->searchable() + ->sortable(), Tables\Columns\TextColumn::make('characteristicApproverMaster.machine_name') ->label('Machine Name') ->alignCenter() @@ -1236,8 +1277,11 @@ class RequestCharacteristicResource extends Resource ->label('Job Number') ->placeholder('Enter Job Number') ->numeric() - ->minlength(7) ->maxlength(10), + TextInput::make('gernr') + ->label('Serial Number') + ->placeholder('Enter Serial Number') + ->numeric(), TextInput::make('work_flow_id') ->label('Work Flow ID') ->placeholder('Enter Work Flow ID'), @@ -1313,7 +1357,7 @@ class RequestCharacteristicResource extends Resource ]) ->query(function ($query, array $data) { // Hide all records initially if no filters are applied - if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) { + if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['model_type']) && empty($data['work_flow_id']) && empty($data['machine_name']) && empty($data['request_type']) && empty($data['master_characteristic_field']) && empty($data['approver_status1']) && empty($data['approver_status2']) && empty($data['approver_status3']) && empty($data['approver_status']) && empty($data['created_from']) && empty($data['created_to'])) { return $query->whereRaw('1 = 0'); } @@ -1339,6 +1383,10 @@ class RequestCharacteristicResource extends Resource $query->where('aufnr', 'like', '%'.$data['aufnr'].'%'); } + if (! empty($data['gernr'])) { + $query->where('gernr', 'like', '%'.$data['gernr'].'%'); + } + if (! empty($data['model_type'])) { $query->where('model_type', 'like', '%'.$data['model_type'].'%'); } @@ -1436,6 +1484,10 @@ class RequestCharacteristicResource extends Resource $indicators[] = 'Job No: '.$data['aufnr']; } + if (! empty($data['gernr'])) { + $indicators[] = 'Serial No: '.$data['gernr']; + } + if (! empty($data['model_type'])) { $indicators[] = 'Model Type: '.$data['model_type']; } -- 2.49.1 From 1162bc81c97d855f415726de8b9d627b70c2dc54 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 14:08:33 +0530 Subject: [PATCH 5/8] Added spare master print page --- app/Filament/Pages/SpareMasterPrint.php | 301 ++++++++++++++++++ .../pages/spare-master-print.blade.php | 36 +++ 2 files changed, 337 insertions(+) create mode 100644 app/Filament/Pages/SpareMasterPrint.php create mode 100644 resources/views/filament/pages/spare-master-print.blade.php diff --git a/app/Filament/Pages/SpareMasterPrint.php b/app/Filament/Pages/SpareMasterPrint.php new file mode 100644 index 0000000..e932578 --- /dev/null +++ b/app/Filament/Pages/SpareMasterPrint.php @@ -0,0 +1,301 @@ +form->fill([ + 'plant_id'=>$this->plantId, + 'pallet_quantity' => 0, + ]); + } + + public function form(Form $form): Form + { + return $form + ->statePath('filters') + ->schema([ + Section::make('') + ->schema([ + Select::make('plant_id') + ->label('Plant') + ->reactive() + // ->options(Plant::pluck('name', 'id')) + ->options(function (callable $get) { + $userHas = Filament::auth()->user()->plant_id; + return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray(); + }) + ->required(), + Select::make('sale_order_master_id') + ->label('Sale Order Number') + ->reactive() + ->searchable() + ->options(function (callable $get) { + $plantId = $get('plant_id'); + if (empty($plantId)) { + return []; + } + + return SaleOrderMaster::where('plant_id', $plantId)->distinct()->pluck('sale_order_number', 'sale_order_number'); //->pluck('customer_po', 'id'); ->distinct() + }) + ->required() + ->afterStateUpdated(function ($state, callable $set) { + $set('scan_pallet_no', null); + }), + Select::make('scan_pallet_no') + ->label('Scan Pallet No') + ->reactive() + ->searchable() + ->options(function ($get) { + + $plantId = $get('plant_id'); + $saleOrder = $get('sale_order_master_id'); + + if (! $plantId || ! $saleOrder) + { + return []; + } + + $poIds = SaleOrderMaster::where('plant_id', $plantId)->where('sale_order_number', $saleOrder)->pluck('id'); + $palletNumbers = SparePacking::query() + ->where('plant_id', $plantId) + ->whereIn('sale_order_master_id', $poIds) + ->whereNotNull('spare_packing_number') + ->groupBy('spare_packing_number') + ->havingRaw('COUNT(*) = COUNT(spare_packing_status)') + ->havingRaw("SUM(CASE WHEN TRIM(spare_packing_status) = '' THEN 1 ELSE 0 END) = 0") + ->orderBy('spare_packing_number') + ->pluck('spare_packing_number') + ->toArray(); + return collect($palletNumbers) ->mapWithKeys(fn ($number) => [$number => $number]) ->toArray(); + }) + ->afterStateUpdated(function ($state, callable $set, $get) { + $palletNo = $state; + $plantId = $get('plant_id'); + + $this->dispatch('loadData', $palletNo, $plantId); + }) + ->extraAttributes([ + 'wire:keydown.enter' => 'processPalletNo($event.target.value)', + ]), + // TextInput::make('customer_name') + // ->label('Customer Name') + // ->required() + // ->reactive(), + ]) + ->columns(3) + ]); + } + + public function processPalletNo($palletNo) + { + $plantId = $this->form->getState()['plant_id']; + + $plantId = trim($plantId) ?? null; + + $palletNo= $this->form->getState()['scan_pallet_no']; + + $palletNo = trim($palletNo) ?? null; + + $operatorName = Filament::auth()->user()->name; + + if ($palletNo == null || $palletNo == '') + { + Notification::make() + ->title("Pallet number can't be empty!") + ->danger() + ->duration(5000) + ->send(); + + $this->dispatch('loadLocator' ,'',$plantId); + $this->form->fill + ([ + 'plant_id' => $plantId, + 'scan_serial_no' => null, + 'scan_pallet_no' => null, + 'scan_locator_no' => null, + 'pallet_quantity' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + // else if (strlen($palletNo) < 10) + // { + // Notification::make() + // ->title("Pallet number '$palletNo' must be at least 10 digits.") + // ->danger() + // ->duration(5000) + // ->send(); + + // $this->dispatch('loadLocator' ,'',$plantId); + // $this->form->fill + // ([ + // 'plant_id' => $plantId, + // 'scan_serial_no' => null, + // 'scan_pallet_no' => null, + // 'scan_locator_no' => null, + // 'pallet_quantity' => 0, + // 'created_by' => $operatorName, + // 'scanned_by' => $operatorName, + // ]); + // return; + // } + + $Palletexists = WireMasterPacking::where('wire_packing_number', $palletNo) + ->where('plant_id', $plantId)->first(); + if(!$Palletexists) + { + Notification::make() + ->title("Pallet number '$palletNo' does not found in wire master packing table.") + ->danger() + ->duration(5000) + ->send(); + + $this->dispatch('loadData' ,'',$plantId); + $this->form->fill + ([ + 'plant_id' => $plantId, + 'scan_pallet_no' => null, + 'pallet_quantity' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + else + { + $this->snoCount = WireMasterPacking::where('plant_id', $plantId) + ->where('wire_packing_number', $palletNo) + ->count(); + + $this->dispatch('loadData', $palletNo, $plantId); + $this->form->fill + ([ + 'plant_id' => $plantId, + 'scan_pallet_no' => $palletNo, + 'pallet_quantity' => $this->snoCount, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + } + + public function saveCustomerPO(){ + $plantId = $this->form->getState()['plant_id']; + + $plantId = trim($plantId) ?? null; + + $palletNo= $this->form->getState()['scan_pallet_no']; + + $palletNo = trim($palletNo) ?? null; + + $customerPO = $this->form->getState()['customer_po']; + + $customerPO = trim($customerPO) ?? null; + + $customerName = $this->form->getState()['customer_name']; + + $customerName = trim($customerName) ?? null; + + if (!$plantId || !$palletNo) { + return; // optional validation + } + + $record = WireMasterPacking::where('plant_id', $plantId) + ->where('wire_packing_number', $palletNo) + ->update([ + 'customer_po' => $customerPO, + 'customer_name' => $customerName, + 'updated_at' => now(), + ]); + + if($record){ + Notification::make() + ->title("Customer PO updated successfully for the pallet number '$palletNo'") + ->success() + ->send(); + return; + } + else + { + Notification::make() + ->title("Customer PO updation failed for the pallet number '$palletNo'") + ->success() + ->send(); + return; + } + } + + public function printPallet() + { + $palletNumber = $this->form->getState()['scan_pallet_no'] ?? null; + $plantId = $this->form->getState()['plant_id'] ?? null; + $customerId = $this->form->getState()['customer_po_master_id'] ?? null; + + $state = $this->form->getState(); + + // $customerCode = $state['customer_po'] ?? null; + // $customerName = $state['customer_name'] ?? null; + + if (!$palletNumber) { + Notification::make() + ->title("Pallet number cant't be empty!") + ->danger() + ->duration(5000) + ->send(); + return; + } + + $this->dispatch('open-pdf', url: route('print.sparepallet', [ + 'pallet' => $state['scan_pallet_no'], + 'plant' => $state['plant_id'], + 'customer' => $state['sale_order_master_id'], + ])); + } + + public static function canAccess(): bool + { + return Auth::check() && Auth::user()->can('view spare master print page'); + } +} diff --git a/resources/views/filament/pages/spare-master-print.blade.php b/resources/views/filament/pages/spare-master-print.blade.php new file mode 100644 index 0000000..7c2950d --- /dev/null +++ b/resources/views/filament/pages/spare-master-print.blade.php @@ -0,0 +1,36 @@ + + +
+ {{-- Render the Select form fields --}} +
+ {{ $this->form }} +
+ + {{-- Add Pallet and Remove Pallet buttons --}} +
+ + {{-- --}} +
+
+ +
+
+ + +
-- 2.49.1 From bb541802776dad3f2fe45290840f148d3499a01a Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 14:09:49 +0530 Subject: [PATCH 6/8] Added printSpare in pallet print controller --- .../Controllers/PalletPrintController.php | 102 +++++++++++++++++- 1 file changed, 99 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PalletPrintController.php b/app/Http/Controllers/PalletPrintController.php index cdb9c3a..92b4654 100644 --- a/app/Http/Controllers/PalletPrintController.php +++ b/app/Http/Controllers/PalletPrintController.php @@ -4,6 +4,8 @@ namespace App\Http\Controllers; use App\Models\CustomerPoMaster; use App\Models\Plant; +use App\Models\SaleOrderMaster; +use App\Models\SparePacking; use App\Models\WireMasterPacking; use Barryvdh\DomPDF\Facade\Pdf; use Illuminate\Http\Request; @@ -279,9 +281,6 @@ class PalletPrintController extends Controller } - - - public function store(Request $request) { // @@ -310,4 +309,101 @@ class PalletPrintController extends Controller { // } + + public function printSpare(Request $request, $pallet, $plant) + { + + $customerPoMasterId = SparePacking::where('plant_id', $plant) + ->where('spare_packing_number', $pallet) + ->value('sale_order_master_id'); + + $masterIds = SparePacking::where('plant_id', $plant) + ->where('spare_packing_number', $pallet) + ->pluck('sale_order_master_id'); + + $customerPo = SaleOrderMaster::whereIn('id', $masterIds) + ->value('sale_order_number'); + + $customerPoMasterIds = SaleOrderMaster::where('sale_order_number', $customerPo) + ->pluck('id'); + + $items = SparePacking::with('item') + ->where('plant_id', $plant) + ->where('spare_packing_number', $pallet) + ->get() + ->map(function ($row) { + return (object) [ + 'code' => $row->item->code, + 'description' => $row->item->description, + 'box_count' => 1, // each row = one box + 'weight' => $row->quantity, + ]; + }); + + $customer = SaleOrderMaster::find($customerPoMasterId); + + $customerCode = $customer->sale_order_number ?? ''; + $customerName = $customer->supplier_name ?? ''; + + $totalBoxes = SparePacking::where('plant_id', $plant) + ->whereIn('sale_order_master_id', $customerPoMasterIds) + ->select('spare_packing_number') + ->groupBy('spare_packing_number') + ->havingRaw( + 'COUNT(*) = COUNT(CASE WHEN spare_packing_status = ? THEN 1 END)', + ['Completed'] + ) + ->count(); + + $completedPallets = SparePacking::where('plant_id', $plant) + ->whereIn('sale_order_master_id', $customerPoMasterIds) + ->select('spare_packing_number') + ->groupBy('spare_packing_number') + ->havingRaw( + 'COUNT(*) = COUNT(CASE WHEN spare_packing_status = ? THEN 1 END)', + ['Completed'] + ) + ->orderBy('spare_packing_number') + ->pluck('spare_packing_number') + ->values(); + + $index = $completedPallets->search($pallet); + + $currentPalletNo = ($index !== false) ? $index + 1 : 0; + + $boxLabel = $currentPalletNo.'/'.$totalBoxes; + + $grossWeight = $items->sum('weight'); + $widthPt = 85 * 2.83465; // 85mm → points + $heightPt = 100 * 2.83465; // 100mm → points + + $plantName = Plant::where('id', $plant)->value('name'); + + $plantAddress = Plant::where('id', $plant)->value('address'); + + $scannedAt = SparePacking::where('plant_id', $plant) + ->where('spare_packing_number', $pallet) + ->value('scanned_at'); + + $pdf = Pdf::loadView('pdf.spare-pallet', [ + 'product' => 'Spare Packing List', + 'plantName' => $plantName, + 'plantAddress' => $plantAddress, + // 'monthYear' => now()->format('M-y'), + 'monthYear' => $scannedAt + ? \Carbon\Carbon::parse($scannedAt)->format('M-y') + : '', + 'branch' => '', + 'customerCode' => $customerCode, + 'customerName' => $customerName, + 'masterBox' => $boxLabel, + 'items' => $items, + 'grossWeight' => $grossWeight + 3.050, + 'netWeight' => $grossWeight, + 'pallet' => $pallet, + ])->setPaper([0, 0, $widthPt, $heightPt], 'portrait'); + + return $pdf->stream("Pallet-{$pallet}.pdf"); + + } } -- 2.49.1 From 37cabbc93d1c9b56cc3295068a4cd1f6feb4657a Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 14:11:34 +0530 Subject: [PATCH 7/8] Added print spare pallet api route --- routes/api.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/routes/api.php b/routes/api.php index 8272e6b..bddd6b6 100644 --- a/routes/api.php +++ b/routes/api.php @@ -192,6 +192,10 @@ Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf Route::get('laser/item/get-quality-master-data', [StickerMasterController::class, 'get_quality_master']); +// ..Model Master - Laser + +// Route::get('laser/model-master/get', [StickerMasterController::class, 'get_master']); + // ..Part Validation Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']); @@ -264,8 +268,12 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet'); +Route::get('/print-spare-pallet/{pallet}/{plant}', [PalletPrintController::class, 'printSpare'])->name('print.sparepallet'); + Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']); // Item Code Route::get('item-code', [PlantController::class, 'getItemCode']); + +// Route::post('laser-stop-report', [SapFileController::class, 'laserStopReport']); -- 2.49.1 From f46e59ab7050df1925e860af28d747a4cfa09d08 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 4 Sep 2026 14:12:59 +0530 Subject: [PATCH 8/8] Added spare pallet blade file --- resources/views/pdf/spare-pallet.blade.php | 458 +++++++++++++++++++++ 1 file changed, 458 insertions(+) create mode 100644 resources/views/pdf/spare-pallet.blade.php diff --git a/resources/views/pdf/spare-pallet.blade.php b/resources/views/pdf/spare-pallet.blade.php new file mode 100644 index 0000000..59aacf6 --- /dev/null +++ b/resources/views/pdf/spare-pallet.blade.php @@ -0,0 +1,458 @@ + + + + + SpareLabel + + @php + + $pageHeightMm = 292; + $pageWidthMm = 100; + $paddingMm = 1.3; + + $headerRows = [ + 'MFG. MONTH & YEAR' => $monthYear, + 'SALE ORDER NO' => $customerCode, + 'SUPPLIER NAME' => $customerName, + 'MASTER BOX NO.' => $masterBox, + ]; + + + $titleHeight = 10; + $headerRowHeight = 5; + $itemHeaderHeight = 14; + + // FOOTER SECTION + $grossWeightHeight = 5; + $netWeightHeight = 5; + $licenseHeight = 5; + $companyInfoHeight = 6.9; + + $logoHeight = $titleHeight * 0.8; + $logoMaxWidth = 20; + + $isilogoHeight = $titleHeight * 0.9; + $isilogoMaxWidth = 11; + + $availableHeight = $pageHeightMm - (2 * $paddingMm); + + $itemPages = collect($items)->chunk(40); + + if ($itemPages->isEmpty()) { + $itemPages = collect([ + collect() + ]); + } + + $qrBase64 = 'data:image/png;base64,' . base64_encode( + QrCode::format('png') + ->size(120) + ->margin(0) + ->generate($pallet) + ); + + @endphp + + + + + + + + +@foreach ($itemPages as $pageItems) + + @php + + $numItems = count($pageItems) ?: 1; + + $fixedSpace = $titleHeight + (4 * $headerRowHeight) + $itemHeaderHeight + $netWeightHeight + $licenseHeight + $companyInfoHeight; + + $fixedRowCount = 1 /* title */ + + 4 /* header rows */ + + 1 /* items header */ + + 1 /* net weight */ + + 1 /* license */ + + 1; /* company info */ + + $desiredBottomGap = 5; + + $spaceForItemsOnly = $availableHeight - $fixedSpace + ($fixedRowCount * 0.6) - $desiredBottomGap; + + $itemRowHeight = ($spaceForItemsOnly / $numItems) + 0.6; + + $maxItemRowHeight = 5; + + if ($itemRowHeight > $maxItemRowHeight) { + $itemRowHeight = $maxItemRowHeight; + } + + $itemRowHeight = floor($itemRowHeight * 10) / 10; + + if ($itemRowHeight < 3) { + + $itemFontSize = '5.5px'; + + $itemPadding = '0.1mm 0.3mm'; + + } elseif ($itemRowHeight < 3.5) { + + $itemFontSize = '6px'; + + $itemPadding = '0.1mm 0.4mm'; + + } elseif ($itemRowHeight < 4) { + + $itemFontSize = '6.5px'; + + $itemPadding = '0.1mm 0.5mm'; + + } else { + + $itemFontSize = '7px'; + + $itemPadding = '0.2mm 0.5mm'; + } + + $compensatedItemHeight = $itemRowHeight - 0.6; + + $pageTotalQuantity = $pageItems->sum('weight'); + + @endphp + +
+ + + + + + + + + + + + $value): ?> + + + + + + + + + + + + + + + + + + + @if ($pageItems->count() > 0) + + @foreach ($pageItems as $item) + + + + + + + + + + + + + + @endforeach + + @else + + + + + + + + @endif + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + Master Packing Slip +
+ +
+ + + +
MATERIAL CODEDESCRIPTIONQTY in kgNO. OF BOXES
+ code; ?> + + description; ?> + + weight, 3); ?> + + box_count; ?> +
+ No items available +
+ TOTAL QUANTITY + + +
+ + MANUFACTURERS +                  + + MADE IN INDIA +               + + *Under License + +
+ C.R.I. PUMPS PRIVATE LIMITED +
+ + (Unit of {{ $plantName }}) +
+ + {{ $plantAddress }} +
+ + India Regd.Office : + 7/46-1, Keeranatham Road, + Saravanampatti, + Coimbatore- 641 035 +
+ + For Feedback/Complaint: + C.R.I. Customer care cell + Toll-Free: 1800 121 1243 + +
+ +
+ +@endforeach + + + \ No newline at end of file -- 2.49.1