@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $byCategory = $data['by_category']; $evolution = $data['evolution']; $anomaly = $data['anomaly']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Line geometry. $lineW = 320; $lineH = 140; $linePadX = 30; $linePadY = 22; $maxLine = 0; foreach ($evolution as $e) { $maxLine = max($maxLine, (float) $e['recoverable'], (float) $e['non_recoverable']); } $maxLine = max($maxLine, 1); $lineSlot = count($evolution) > 1 ? ($lineW - 2 * $linePadX) / (count($evolution) - 1) : 0; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Fiscalité {{ $meta['code'] }} Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} · Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}

Indicateurs clés

TVA récupérable
{{ $fmtNum($kpis['tva_recoverable']['value']) }}{{ $kpis['tva_recoverable']['unit'] }}
{{ $kpis['tva_recoverable']['delta_label'] }}
TVA non récupérable
{{ $fmtNum($kpis['tva_non_recoverable']['value']) }}{{ $kpis['tva_non_recoverable']['unit'] }}
{{ $kpis['tva_non_recoverable']['delta_label'] }}
Taux de récup.
{{ $kpis['recovery_rate']['value'] !== null ? $kpis['recovery_rate']['value'] : '—' }}{{ $kpis['recovery_rate']['unit'] }}
{{ $kpis['recovery_rate']['delta_label'] }}
Gain mensuel
+{{ $fmtNum($kpis['monthly_gain']['value']) }}{{ $kpis['monthly_gain']['unit'] }}
{{ $kpis['monthly_gain']['delta_label'] }}

TVA par catégorie de dépense

@if (!empty($byCategory)) @foreach ($byCategory as $c)
{{ $c['label'] }} — {{ $c['value'] }} ({{ $c['meta'] }})
@endforeach @else

Pas de dépenses sur la période.

@endif

Évolution TVA récupérable vs non récupérable

@php $px1=null;$py1=null;$px2=null;$py2=null; @endphp @foreach ($evolution as $i => $e) @php $x = $linePadX + $i * $lineSlot; $y1 = $lineH - $linePadY - (($e['recoverable'] / $maxLine) * ($lineH - 2 * $linePadY)); $y2 = $lineH - $linePadY - (($e['non_recoverable'] / $maxLine) * ($lineH - 2 * $linePadY)); @endphp @if ($px1 !== null) @endif {{ $e['label'] }} @php $px1=$x;$py1=$y1;$px2=$x;$py2=$y2; @endphp @endforeach
Récupérable Non récupérable
@if ($anomaly)
Anomalie détectée : {{ $anomaly }}
@endif @endsection