@php $coatPath = public_path('assets/images/emblem.jpeg'); $coatBase64 = file_exists($coatPath) ? base64_encode(file_get_contents($coatPath)) : ''; $coatSrc = $coatBase64 ? 'data:image/jpeg;base64,' . $coatBase64 : ''; $wmaPath = public_path('assets/images/wmalogo.png'); $wmaBase64 = file_exists($wmaPath) ? base64_encode(file_get_contents($wmaPath)) : ''; $wmaSrc = $wmaBase64 ? 'data:image/png;base64,' . $wmaBase64 : ''; $sortedCharts = $charts ?? []; uksort($sortedCharts, 'strnatcmp'); // Names print in capitals, whatever case they were captured in. $customerName = isset($customerName) && $customerName !== null ? mb_strtoupper($customerName) : null; $inspectorName = isset($inspectorName) && $inspectorName !== null ? mb_strtoupper($inspectorName) : null; $managerName = !empty($managerName) ? mb_strtoupper($managerName) : null; // Capacity is the sum of each compartment's last reading, when the caller did not supply it. if (empty($capacity) && !empty($sortedCharts)) { $chartedTotal = 0; foreach ($sortedCharts as $chartData) { $chartReadings = array_values($chartData['readings'] ?? []); if (!empty($chartReadings)) { $lastLitre = str_replace(',', '', (string) ($chartReadings[count($chartReadings) - 1]['litre'] ?? '')); $chartedTotal += is_numeric($lastLitre) ? (float) $lastLitre : 0; } } $capacity = $chartedTotal > 0 ? number_format($chartedTotal) . ' LITRE' : null; } $totalComps = count($sortedCharts); $boxWidth = $totalComps > 0 ? floor(100 / $totalComps) . '%' : '100%'; @endphp
@if($coatSrc) Coat of Arms @endif

THE UNITED REPUBLIC OF TANZANIA

MINISTRY OF INDUSTRY AND TRADE

WEIGHTS AND MEASURES AGENCY

Wma Headquarters (HQ)

Mob: +255 (022) 2928158 Tel: 0800 110097 Fax: 0800 110097 Address: P.O BOX 313, Dar es Salaam, Email: info@wma.go.tz

@if($wmaSrc) WMA Logo @endif
{{-- Blank unless the chart is valid: all compartments charted and a control number issued --}}
VERIFICATION CHART NO{{ $chartNumber ?: '' }} @if(!empty($qrCodeImage)) @endif
FOR: TANK/TR TANK/TR NO {{ $plateNumber ?? 'N/A' }}
FOR: {{ $customerName ?? 'N/A' }}
CAPACITY: {{ $capacity ?? 'N/A' }}
@foreach($sortedCharts as $compKey => $data) @endforeach
@if($isGasTank ?? false)
COMPARTMENT {{ strtoupper(str_replace('compartment', '', $compKey)) }}
@php $readings = $data['readings'] ?? []; $half = ceil(count($readings) / 2); $firstHalf = array_slice($readings, 0, $half); $secondHalf = array_slice($readings, $half); $usePercentage = $data['usePercentage'] ?? false; $dialLabel = $usePercentage ? 'Dial Indicator(%)' : 'Dial Indicator'; @endphp
@foreach($firstHalf as $reading) @endforeach
Volume {{ $dialLabel }}
{{ $reading['litre'] ?? '' }} {{ $reading['mm'] ?? '' }}
@foreach($secondHalf as $reading) @endforeach
Volume {{ $dialLabel }}
{{ $reading['litre'] ?? '' }} {{ $reading['mm'] ?? '' }}
@else
T.T {{ $data['tankTop'] ?? 'N/A' }} mm
@foreach(($data['readings'] ?? []) as $reading) @endforeach
Volume(l) Height(mm)
{{ $reading['litre'] ?? '' }} {{ $reading['mm'] ?? '' }}
@endif
The dipstick(s) was | were marked @if(!empty($chartNumber)){{ $chartNumber }}
@endif {{ $customerName ?? 'N/A' }}
TANK/TR NO {{ $plateNumber ?? 'N/A' }}
@foreach($sortedCharts as $compKey => $data) @php $cleanCompNo = str_replace('compartment', '', $compKey); $maxLitre = count($data['readings'] ?? []) > 0 ? end($data['readings'])['litre'] : '0'; @endphp @endforeach
COMPT NO. {{ $cleanCompNo }}
{{ $maxLitre }} LITRE
STAMP: {{ $data['stampNumber'] ?? 'N/A' }}
The tank was verified  1. On a level plane  2 . against approved measure
@if($isGasTank ?? false) @if($isPercentageUsed ?? false) NOTE (a) The Tank is attached with Percentage Dial marked {{ $percentageMarks ?? '1,2,5,10,15,20,30,40,50,60,70,80,85,90,95,100' }}
@else NOTE (a) The Tank is attached with Dial indicator
@endif @else NOTE (a) the compartments should be filled in the order {{ $fillOrder ?? 'N/A' }} and emptied in the order {{ $emptyOrder ?? 'N/A' }}
@endif @php $expDateObj = !empty($expiryDate) ? \Carbon\Carbon::parse($expiryDate) : null; $expDateStr = $expDateObj ? $expDateObj->format('d M Y') : 'N/A'; $genDateObj = !empty($generatedDate) ? \Carbon\Carbon::parse($generatedDate) : null; $genDateStr = $genDateObj ? $genDateObj->format('d M Y') : 'N/A'; @endphp (b) THIS TANK SHALL BE VERIFIED AGAIN IF SUSPECTED OF GIVING INCORRECT MEASUREMENTS BUT IN ANY CASE NOT LATER THAN {{ $expDateStr }}