{{-- LOGO --}}

LAPORAN KESELURUHAN BULANAN PER KENDARAAN DALAM PERIODE TAHUN {{ $year }}

RSUD dr. SOERATNO GEMOLONG


{{-- TABEL DATA --}} @php $grandTotalLiter = 0; $grandTotalBiaya = 0; @endphp @foreach($data as $index => $row) @php $grandTotalLiter += $row['total_liters']; $grandTotalBiaya += $row['total_cost']; @endphp @endforeach
No Kendaraan / Penanggung Jawab Jenis BBM Total Liter Total Biaya
{{ $loop->iteration }} {{ $row['identity'] }} {{ $row['fuel_type'] }} {{ number_format($row['total_liters'], 2) }} L Rp {{ number_format($row['total_cost'], 0, ',', '.') }}
TOTAL KESELURUHAN {{ number_format($grandTotalLiter, 2) }} L Rp {{ number_format($grandTotalBiaya, 0, ',', '.') }}
{{-- ========================================================= --}} {{-- GRAFIK 1: LITER --}} {{-- ========================================================= --}} @if($data->count() > 0 && $maxLiters > 0)
Perbandingan Konsumsi BBM (Liter)
{{-- BAGIAN 1: BATANG --}}
@foreach($data as $row) @php $maxGraphHeightPx = 100; $heightPx = 0; if($maxLiters > 0 && $row['total_liters'] > 0) { $heightPx = ($row['total_liters'] / $maxLiters) * $maxGraphHeightPx; if($heightPx < 2) $heightPx = 2; } @endphp
@if($row['total_liters'] > 0)
{{ round($row['total_liters']) }}
@else
@endif
@endforeach
{{-- BAGIAN 2: LABEL --}}
@foreach($data as $row) @php $fullLabel = $row['identity']; // Logic pemendekan label tetap dipakai if(strpos($fullLabel, ' - ') !== false) { $parts = explode(' - ', $fullLabel); $label = $parts[0]; } elseif(strpos($fullLabel, ' (') !== false) { $parts = explode(' (', $fullLabel); $label = $parts[0]; } else { $label = substr($fullLabel, 0, 15); } @endphp
{{ $row['chart_label'] }}
@endforeach
@endif {{-- ========================================================= --}} {{-- GRAFIK 2: BIAYA --}} {{-- ========================================================= --}} @if($data->count() > 0 && $maxCost > 0)
Perbandingan Total Biaya (Rupiah)
{{-- BAGIAN 1: BATANG --}}
@foreach($data as $row) @php $maxGraphHeightPx = 100; $heightPx = 0; if($maxCost > 0 && $row['total_cost'] > 0) { $heightPx = ($row['total_cost'] / $maxCost) * $maxGraphHeightPx; if($heightPx < 2) $heightPx = 2; } $costLabel = number_format($row['total_cost'], 0, ',', '.'); @endphp
@if($row['total_cost'] > 0)
{{ $costLabel }}
@else
@endif
@endforeach
{{-- BAGIAN 2: LABEL --}}
@foreach($data as $row) @php $fullLabel = $row['identity']; if(strpos($fullLabel, ' - ') !== false) { $parts = explode(' - ', $fullLabel); $label = $parts[0]; } elseif(strpos($fullLabel, ' (') !== false) { $parts = explode(' (', $fullLabel); $label = $parts[0]; } else { $label = substr($fullLabel, 0, 15); } @endphp
{{ $row['chart_label'] }}
@endforeach
@endif