Stats Produits

@isset($commerciaux)
@endisset
@foreach($statsProduits as $famille => $produits) @php $t1 = $t2 = 0; @endphp @foreach($produits as $slug => $p) @php $caVendeur = ($commercial === "" ? $p['ca_total'] : $p['ca_vendeur']); $t1 += $caVendeur; $t2 += $p['ca_total']; @endphp @endforeach @endforeach @php $t1 = collect($statsProduits) ->flatten(1) ->sum(function($p) use ($commercial) { return $commercial === "" ? $p['ca_total'] : $p['ca_vendeur']; }); @endphp
Produit CA Vente CA Total % CA Total
{{ $p['label'] }} {{ number_format($caVendeur, 0, ',', ' ') }} € {{ number_format($p['ca_total'], 0, ',', ' ') }} € @if($caTotal) {{ number_format($caVendeur / $caTotal * 100, 0, ',', ' ') }} % @endif
{{ $famille }} {{ number_format($t1, 0, ',', ' ') }} € {{ number_format($t2, 0, ',', ' ') }} € {{ $caTotal > 0 ? number_format($t1 / $caTotal * 100, 0, ',', ' ') : 0 }} %
Total {{ number_format($t1, 0, ',', ' ') }} € {{ number_format($caTotal, 0, ',', ' ') }} € {{ $caTotal > 0 ? number_format(($p['ca_vendeur'] / $caTotal * 100)+($t1 / $caTotal * 100), 0, ',', ' ') : 0 }} %