@foreach ($stock_reports as $stock_report) @php $total_stock = $stock_report->stocks->sum('productStock'); $firstStock = $stock_report->stocks->first(); $total_value = $stock_report->stocks->sum(function ($stock) { return $stock->productPurchasePrice * $stock->productStock; }); @endphp @endforeach @if ($stock_reports->count() > 0) @endif
{{ __('SL') }}. {{ __('Product') }} {{ __('Cost') }} {{ __('Qty') }} {{ __('Sale') }} {{ __('Stock Value') }}
{{ ($stock_reports->currentPage() - 1) * $stock_reports->perPage() + $loop->iteration }} {{ $stock_report->productName }} {{ 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()) }}
{{ $stock_reports->links('vendor.pagination.bootstrap-5') }}