@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $k = $data['kpis']; $series = $data['monthly_series']; $top = $data['top_consumers']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, ((float) $v) == (int) $v ? 0 : 1, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Line chart geometry — liters per month. $chartW = 480; $chartH = 140; $padX = 30; $padY = 18; $values = array_map(fn ($r) => (float) $r['liters'], $series); $minV = !empty($values) ? min($values) : 0; $maxV = !empty($values) ? max($values) : 1; if ($minV === $maxV) { $maxV = $minV + 1; } $stepX = count($series) > 1 ? ($chartW - 2 * $padX) / (count($series) - 1) : 0; $points = []; foreach ($series as $i => $r) { $x = $padX + $i * $stepX; $y = $chartH - $padY - (((float) $r['liters'] - $minV) / ($maxV - $minV)) * ($chartH - 2 * $padY); $points[] = ['x' => $x, 'y' => $y, 'label' => $r['label'], 'value' => (float) $r['liters']]; } $polyline = implode(' ', array_map(fn ($p) => "{$p['x']},{$p['y']}", $points)); @endphp @section('content')
Pas de données carburant pour la période.
@endif| Immatriculation | Marque / Modèle | Énergie | Volume (L) | Coût (€) | Km parcourus | L/100km |
|---|---|---|---|---|---|---|
| {{ $r['plate'] ?? '—' }} | {{ $r['model'] }} | {{ $r['motor'] }} | {{ number_format($r['liters'], 1, ',', ' ') }} | {{ number_format($r['cost'], 2, ',', ' ') }} | {{ $r['km'] !== null ? number_format($r['km'], 0, ',', ' ') : '—' }} | {{ $r['consumption'] !== null ? number_format($r['consumption'], 2, ',', ' ') : '—' }} |
Aucune entrée carburant sur la période.
@endif @endsection