@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')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Carburant & Énergie {{ $meta['code'] }} Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} · {{ $meta['total_vehicles'] }} véhicules thermiques · Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}

Indicateurs clés

Volume total
{{ $fmtNum($k['total_volume']['value']) }}{{ $k['total_volume']['unit'] }}
{{ $k['total_volume']['delta_label'] }}
Consommation moyenne
{{ $fmtNum($k['avg_consumption']['value']) }}{{ $k['avg_consumption']['unit'] }}
{{ $k['avg_consumption']['delta_label'] }}
Coût total carburant
{{ $fmtNum($k['total_cost']['value']) }}{{ $k['total_cost']['unit'] }}
{{ $k['total_cost']['delta_label'] }}
Coût moyen / véhicule
{{ $fmtNum($k['avg_cost_per_vehicle']['value']) }}{{ $k['avg_cost_per_vehicle']['unit'] }}
{{ $k['avg_cost_per_vehicle']['delta_label'] }}

Consommation par mois (6 mois)

@if (!empty($points)) @foreach ($points as $p) {{ $p['label'] }} {{ number_format($p['value'], 0, ',', ' ') }} L @endforeach @else

Pas de données carburant pour la période.

@endif

Top consommateurs thermiques

@if (!empty($top)) @foreach ($top as $r) @endforeach
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, ',', ' ') : '—' }}
@else

Aucune entrée carburant sur la période.

@endif @endsection