Recap des commandes

Prévendeur: {{ $prevendeur }}

Date: {{$date}}

@php $currentFamille = null; $familleTotalCA = 0; // To accumulate CA for each famille $familleTotalQTE = 0; // To accumulate QTE for each famille $grandTotalCA = 0; // To accumulate grand total CA $grandTotalQTE = 0; // To accumulate grand total QTE $productCount = 0; // Counter for product numeration $familleCount = 0; // Counter for famille numeration @endphp @foreach($collection as $row) @if($row->famille !== $currentFamille) @if($currentFamille !== null) @php // Accumulate to grand totals $grandTotalCA += $familleTotalCA; $grandTotalQTE += $familleTotalQTE; @endphp @endif @php $currentFamille = $row->famille; $familleTotalCA = 0; // Reset totals for the new famille $familleTotalQTE = 0; $productCount = 0; // Reset product counter $familleCount++; // Increment famille counter @endphp @endif @php // Accumulate totals for the famille $familleTotalCA += $row->CA; $familleTotalQTE += $row->QTE; @endphp @endforeach @if($currentFamille !== null) @php // Accumulate to grand totals $grandTotalCA += $familleTotalCA; $grandTotalQTE += $familleTotalQTE; @endphp @endif
Produit CA QTE
Total {{ $currentFamille }}: {{ number_format($familleTotalCA, 0, ' ', ' ') }} {{ $familleTotalQTE }}
{{ $familleCount }}. {{ $currentFamille }}
{{ ++$productCount }} {{ $row->produit }} {{ number_format($row->CA, 0, ' ', ' ') }} {{ $row->QTE }}
Total {{ $currentFamille }}: {{ number_format($familleTotalCA, 0, ' ', ' ') }} {{ $familleTotalQTE }}
Total Final : {{ number_format($grandTotalCA, 0, ' ', ' ') }} {{ $grandTotalQTE }}

Imprimé le {{ now()->format('d/m/Y H:i:s') }}