@if(isset($data->bannerUrl) && $data->bannerUrl != "") @endif
Cost Of Inventory Report
@php $totalStockSum = 0; $totalListPriceSum = 0; $totalDiscountPriceSum = 0; $totalInvoicePriceSum = 0; // Merge rows: same productSku + warehouseName + productName $merged = []; foreach ($data->reportData as $row) { $r = is_object($row) ? (array) $row : (array) $row; if (($r['stockQuantity'] ?? 0) <= 0) { continue; } $productSku = $r['productSku'] ?? 'N/A'; $warehouseName = $r['warehouseName'] ?? 'N/A'; $productName = $r['name'] ?? 'N/A'; $key = $productSku . '||' . $warehouseName . '||' . $productName; if (isset($merged[$key])) { $merged[$key]['stockQuantity'] += $r['stockQuantity'] ?? 0; $merged[$key]['totalListPrice'] += $r['totalListPrice'] ?? 0; $merged[$key]['totalDiscountPrice'] += $r['totalDiscountPrice'] ?? 0; $merged[$key]['totalInvoicePrice'] += $r['totalInvoicePrice'] ?? 0; } else { $merged[$key] = [ 'productSku' => $productSku, 'warehouseName' => $warehouseName, 'productName' => $productName, 'stockQuantity' => $r['stockQuantity'] ?? 0, 'listPrice' => $r['listPrice'] ?? 0, 'totalListPrice' => $r['totalListPrice'] ?? 0, 'totalDiscountPrice' => $r['totalDiscountPrice'] ?? 0, 'totalInvoicePrice' => $r['totalInvoicePrice'] ?? 0, ]; } } @endphp @foreach($merged as $index => $req) @php $totalStockSum += $req['stockQuantity']; $totalListPriceSum += $req['totalListPrice']; $totalDiscountPriceSum += $req['totalDiscountPrice']; $totalInvoicePriceSum += $req['totalInvoicePrice']; @endphp @endforeach
SL Product SKU Warehouse Product Name Stock Qty List Price Total List Price Total Sell Price Total Buying Price
{{ $loop->iteration }} {{ $req['productSku'] }} {{ $req['warehouseName'] }} {{ $req['productName'] }} {{ $req['stockQuantity'] }} {{ number_format($req['listPrice'], 2) }} {{ number_format($req['totalListPrice'], 2) }} {{ number_format($req['totalDiscountPrice'], 2) }} {{ number_format($req['totalInvoicePrice'], 2) }}
Total = {{ $totalStockSum }} {{ number_format($totalListPriceSum, 2) }} {{ number_format($totalDiscountPriceSum, 2) }} {{ number_format($totalInvoicePriceSum, 2) }}