@php $totalQuantity = $products->sum('quantity'); $totalValue = $products->sum(fn ($p) => ($p->price ?? 0) * ($p->quantity ?? 0)); $outOfStock = $products->filter(fn ($p) => (int) $p->quantity === 0); $lowStock = $products->filter(fn ($p) => (int) $p->quantity > 0 && (int) $p->quantity <= 5); $categoryName = !empty($filters['category_id']) ? optional(\App\Models\Category::find($filters['category_id']))->name : null; @endphp

RAPPORT DE STOCK — {{ $magasin->name ?? 'Magasin' }}

Date d'impression : {{ now()->format('d/m/Y H:i') }}

Nombre de produits : {{ $products->count() }}

@if($categoryName)

Catégorie : {{ $categoryName }}

@endif @if(!empty($filters['type']))

Type : {{ $filters['type'] }}

@endif @if(!empty($filters['query']))

Recherche : {{ $filters['query'] }}

@endif

Quantité totale en stock : {{ $totalQuantity }} unités

Valeur totale du stock : {{ number_format($totalValue, 0, ' ', ' ') }} FCFA

@forelse($products as $product) @empty @endforelse
Produit Catégorie Type Prix unitaire Quantité Valeur totale
{{ $product->name }} {{ optional($product->category)->name ?? '-' }} {{ $product->type ?? '-' }} {{ number_format($product->price ?? 0, 0, ' ', ' ') }} FCFA {{ $product->quantity ?? 0 }} {{ number_format(($product->price ?? 0) * ($product->quantity ?? 0), 0, ' ', ' ') }} FCFA
Aucun produit trouvé

RÉSUMÉ DU STOCK

• Magasin : {{ $magasin->name ?? '-' }}

• Nombre total de produits différents : {{ $products->count() }}

• Quantité totale en stock : {{ $totalQuantity }} unités

• Valeur totale du stock : {{ number_format($totalValue, 0, ' ', ' ') }} FCFA

@if($outOfStock->count() > 0)

• Produits en rupture de stock : {{ $outOfStock->count() }}

@endif @if($lowStock->count() > 0)

• Produits en stock faible (≤ 5) : {{ $lowStock->count() }}

@endif