@foreach($rows as $op)
@php
$date = $op->date_execution ? \Carbon\Carbon::parse($op->date_execution)->format('d/m/Y') : ($op->annee ?? '—');
$border = $op->est_fini ? '#28a745' : '#ffc107';
$lignes = $op->lignes ?? collect();
$single = $lignes->count() === 1;
$opRec = 0; $opDep = 0; $opVol = 0.0;
foreach ($lignes as $l) {
if ($l->est_recette) { $opRec += (float)($l->montant_ht ?? 0); }
else { $opDep += (float)($l->montant_ht ?? 0); }
$opVol += (float)($l->volume ?? 0);
}
@endphp
@if($lignes->isEmpty())
| {{ $date }} |
{{ $op->libelle }} |
{{ $op->nom_parcelle ?? '—' }} |
{{ $op->recette_ht ? number_format($op->recette_ht, 2, ',', ' ') . ' €' : '—' }} |
{{ $op->depense_ht ? number_format($op->depense_ht, 2, ',', ' ') . ' €' : '—' }} |
{{ $op->volume ? number_format($op->volume, 2, ',', ' ') : '—' }} |
@elseif($single)
| {{ $date }} |
{{ $op->libelle }}{{ $lignes[0]->prestataire ? ' ('.$lignes[0]->prestataire.')' : '' }} |
{{ $op->nom_parcelle ?? '—' }} |
{{ $lignes[0]->est_recette ? number_format($opRec, 2, ',', ' ') . ' €' : '—' }} |
{{ !$lignes[0]->est_recette ? number_format($opDep, 2, ',', ' ') . ' €' : '—' }} |
{{ $opVol > 0 ? number_format($opVol, 2, ',', ' ') : '—' }} |
@else
| {{ $date }} |
{{ $op->libelle }} |
{{ $op->nom_parcelle ?? '—' }} |
{{ number_format($opRec, 2, ',', ' ') . ' €' }} |
{{ number_format($opDep, 2, ',', ' ') . ' €' }} |
{{ number_format($opVol, 2, ',', ' ') }} |
@foreach($lignes as $l)
|
— {{ $l->libelle ?? '—' }}{{ $l->prestataire ? ' ('.$l->prestataire.')' : '' }} |
|
{{ $l->est_recette ? number_format((float)($l->montant_ht ?? 0), 2, ',', ' ') . ' €' : '' }} |
{{ !$l->est_recette ? number_format((float)($l->montant_ht ?? 0), 2, ',', ' ') . ' €' : '' }} |
{{ $l->volume ? number_format((float)$l->volume, 2, ',', ' ') : '—' }} |
@endforeach
@endif
@endforeach