@foreach($creances as $c) @php $vente = $c->vente; $client = $c->client; $produit = $vente?->produit; $magasin = $vente?->magasin; $montant = (float) ($vente?->montant ?? 0); $reste = (float) ($c->montant_restant ?? 0); $paye = max(0, $montant - $reste); @endphp @endforeach
Référence Client Produit Magasin Montant total Montant payé Montant restant Date
{{ $vente?->reference ?? ('CR-' . $c->id) }} {{ $client?->nom ?? '—' }} {{ $produit?->designation ?? '—' }} {{ $magasin?->nom ?? '—' }} {{ $montant }} {{ $paye }} {{ $reste }} {{ optional($vente?->date_vente)->format('Y-m-d') }}