@php $paidSum = $invoice->payments()->sum('amount'); $totalDue = max(0, ($invoice->total - $invoice->discount)); $remainingDue = max(0, $totalDue - $paidSum); @endphp

Montant payé: {{ number_format($paidSum, 0, '', ' ') }} {!! htmlentities(auth()->user()->company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
Reste à payer: {{ number_format($remainingDue, 0, '', ' ') }} {!! htmlentities(auth()->user()->company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!}
@if(isset($payments) && $payments->count()) @foreach($payments as $payment) @endforeach
Date Montant Méthode
{{ \Carbon\Carbon::parse($payment->payment_date)->format('d/m/Y') }} {{ number_format($payment->amount, 0, '', ' ') }} {!! htmlentities(auth()->user()->company->currency_symbol, ENT_NOQUOTES, 'UTF-8') !!} {{ ucfirst($payment->payment_method_fr) }}
@else

Aucun paiement enregistré pour cette facture.
@endif