@foreach ($products as $product) @php $total_stock = $product->stocks->sum('productStock'); $firstStock = $product->stocks->first(); $total_value = $product->stocks->sum(function ($stock) { return $stock->productPurchasePrice * $stock->productStock; }); @endphp @usercan('stocks.price') @endusercan @endforeach
{{ __('SL') }}. {{ __('Product') }} {{ __('Code') }} {{ __('Category') }} {{ __('Cost') }} {{ __('Qty') }} {{ __('Sale') }} {{ __('Stock Value') }}
{{ $loop->index + 1 }} {{ $product->productName }} {{ $product->productCode }} {{ $product->category->categoryName ?? '' }} {{ currency_format(optional($firstStock)->productPurchasePrice, currency: business_currency()) }} {{ $total_stock }} {{ currency_format(optional($firstStock)->productSalePrice, currency: business_currency()) }} {{ currency_format($total_value, currency: business_currency()) }}