@php
use SimpleSoftwareIO\QrCode\Facades\QrCode;
if (!function_exists('getDetailedQr')) {
function getDetailedQr($refNo, $products) {
try {
// Build a structured text summary for the scanner app
$summary = "REF: " . $refNo . "\n";
$summary .= "--- PRODUCTS ---\n";
foreach ($products as $pId => $group) {
$name = $group->first()->product->name ?? $group->first()->name ?? 'N/A';
$qty = $group->sum('qty') ?: $group->sum('planned_quantity') ?: 0;
$summary .= "• " . $name . ": " . number_format($qty, 0) . "\n";
}
$qrCode = QrCode::format('svg')
->size(150)
->margin(0)
->encoding('UTF-8')
->generate($summary);
return '';
} catch (\Exception $e) {
return 'Error';
}
}
}
@endphp
|
@php
$jobRef = \Modules\POSM\Models\PosmDepletionJob::where('job_no', $job_no)->first();
$jobId = $jobRef ? $jobRef->id : $ref->depletion_job_id;
$products = \Modules\POSM\Models\PosmDepletionJobDetailsProduct::where('depletion_job_id', $jobId)
->where('distribution_center_id', $ref->distribution_center_id)
->when($ref->supplier_id, function($q) use ($ref) {
$q->where('supplier_id', $ref->supplier_id);
})
->with('product')
->get()
->groupBy('product_id');
@endphp
{!! getDetailedQr($ref->ref_no, $products) !!}
{{ $ref->distributionCenter->name ?? 'N/A' }}
{{ $ref->ref_no }}
|
@endforeach
@for($i = $row->count(); $i < 3; $i++)
@endfor |
|
@php
$items = isset($shipment->items) ? $shipment->items : collect([$shipment]);
$groupedItems = collect($items)->groupBy('product_id');
@endphp
{!! getDetailedQr($shipment->shipment_number ?: $shipment->qr_code ?: $shipment->ref_no, $groupedItems) !!}
{{ $shipment->distributionPoint->name ?? 'N/A' }}
{{ $shipment->shipment_number ?: $shipment->ref_no }}
|
@endforeach
@for($i = $row->count(); $i < 3; $i++)
@endfor |