@php $transactionsPerPage = 21; $transactionPages = !$onlySummary ? ceil(count($payments) / $transactionsPerPage) : 0; // Add the number of fixed pages (summary, payment methods, ventilation) $fixedPages = $onlySummary ? 1 : 2; // Reduced to 2 since we'll combine sections // Calculate total pages $totalPages = $transactionPages + $fixedPages; $currentPage = 1; @endphp @if(!$onlySummary)
Edition du {{ $edition }}

{{ $title }}

Période du {{ $period['start'] }} au {{ $period['end'] }}

Page : {{ $currentPage }} / {{ $totalPages }}
@php $progressiveBalance = 0; $transactionCount = 0; @endphp @foreach($payments as $payment) @php $progressiveBalance += $payment['amount_ttc']; $transactionCount++; // Start new page if we've exceeded transactions per page (but not on first iteration) if ($transactionCount > $transactionsPerPage && $loop->iteration > 1) { echo '
Date N° Client Dénomination N° Paiement Montant HT Montant TVA Montant TTC Solde TTC progressif
'; $currentPage++; echo '
Edition du '.$edition.'

'.$title.'

Période du '. $period['start'] .' au '. $period['end'] .'

Page : '.$currentPage.' / '.$totalPages.'
'; $transactionCount = 1; } @endphp @endforeach
Date N° Client Dénomination N° Paiement Montant HT Montant TVA Montant TTC Solde TTC progressif
{{ $payment['date'] }} {{ $payment['client_id'] }} {{ $payment['denomination'] }} {{ $payment['payment_id'] }} {{ number_format($payment['amount_ht'], 2, ',', ' ') }} {{ number_format($payment['amount_solde_ttc'], 2, ',', ' ') }} {{ number_format($payment['amount_ttc'], 2, ',', ' ') }} {{ number_format($progressiveBalance, 2, ',', ' ') }}
@php $currentPage++; @endphp @endif
Edition du {{ $edition }}

{{ $title }}

Période du {{ $period['start'] }} au {{ $period['end'] }}

Page : {{ $onlySummary ? 1 : $currentPage }} / {{ $totalPages }}
@if(!$onlySummary)
Récapitulatif
Solde TTC progressif Montant HT Montant TVA Montant TTC
Montant total {{ number_format($totals['ht'], 2, ',', ' ') }} {{ number_format($totals['solde_ttc'], 2, ',', ' ') }} {{ number_format($totals['ttc'], 2, ',', ' ') }}
Totaux {{ number_format($totals['ht'], 2, ',', ' ') }} {{ number_format($totals['solde_ttc'], 2, ',', ' ') }} {{ number_format($totals['ttc'], 2, ',', ' ') }}
@endif
Détail par modes de règlement
@foreach($payment_methods as $method => $data) @endforeach
Mode de règlement Montant HT Montant TVA Montant TTC
{{ $method }} {{ number_format($data['total_ht'], 2, ',', ' ') }} {{ number_format($data['total_solde_ttc'], 2, ',', ' ') }} {{ number_format($data['total_ttc'], 2, ',', ' ') }}
Ventilation des factures et avoirs
Ventilation des factures
Taux TVA Montant HT Montant TVA Montant TTC
20.00% {{ number_format($ventilation['factures']['20.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['20.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['20.00%']['ttc'], 2, ',', ' ') }}
0.00% {{ number_format($ventilation['factures']['0.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['0.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['0.00%']['ttc'], 2, ',', ' ') }}
Totaux {{ number_format($ventilation['factures']['totaux']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['totaux']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['factures']['totaux']['ttc'], 2, ',', ' ') }}
Ventilation des avoirs
Taux TVA Montant HT Montant TVA Montant TTC
20.00% {{ number_format($ventilation['avoirs']['20.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['20.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['20.00%']['ttc'], 2, ',', ' ') }}
0.00% {{ number_format($ventilation['avoirs']['0.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['0.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['0.00%']['ttc'], 2, ',', ' ') }}
Totaux {{ number_format($ventilation['avoirs']['totaux']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['totaux']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['avoirs']['totaux']['ttc'], 2, ',', ' ') }}
Ventilation nette globale — {{ $ventilation['facture_count'] }} factures - {{ $ventilation['avoir_count'] }} avoirs
Taux TVA Montant HT Montant TVA Montant TTC
20.00% {{ number_format($ventilation['nette']['20.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['20.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['20.00%']['ttc'], 2, ',', ' ') }}
0.00% {{ number_format($ventilation['nette']['0.00%']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['0.00%']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['0.00%']['ttc'], 2, ',', ' ') }}
Totaux {{ number_format($ventilation['nette']['totaux']['ht'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['totaux']['solde_ttc'], 2, ',', ' ') }} {{ number_format($ventilation['nette']['totaux']['ttc'], 2, ',', ' ') }}