Product Report

Generated on: {{ $generated_at }}

Generated by: {{ auth()->user()->first_name }} {{ auth()->user()->last_name }}

@if(!empty($filters))
Applied Filters: @php $filterText = []; foreach($filters as $key => $value) { if(!empty($value) && $key != '_token' && $key != 'export_type') { if($key == 'vendor') { $vendor = \App\Models\VendorModel::find($value); $value = $vendor ? ($vendor->store_name ?? $vendor->first_name . ' ' . $vendor->last_name) : $value; } elseif($key == 'category' || $key == 'sub_category') { $cat = \App\Models\Categories::find($value); $value = $cat ? $cat->name : $value; } $filterText[] = ucfirst(str_replace('_', ' ', $key)) . ': ' . $value; } } echo implode(' | ', $filterText); @endphp
@endif @if(count($data) > 0) @php $totalStock = 0; $totalSold = 0; $totalRemaining = 0; @endphp @foreach($data as $row) @php $totalStock += $row['Total Stock']; $totalSold += $row['Sold Quantity']; $totalRemaining += $row['Remaining Stock']; @endphp @endforeach
# Product Name Category Sub Category Supplier/Vendor Type Total Stock Sold Remaining Created Date
{{ $row['#'] }} {{ $row['Product Name'] }} {{ $row['Category'] }} {{ $row['Sub Category'] }} {{ $row['Supplier/Vendor'] }} @if($row['Product Type'] == 'Simple') Simple @else Variant @endif {{ number_format($row['Total Stock']) }} {{ number_format($row['Sold Quantity']) }} @if($row['Remaining Stock'] > 50) {{ number_format($row['Remaining Stock']) }} @elseif($row['Remaining Stock'] > 10) {{ number_format($row['Remaining Stock']) }} @else {{ number_format($row['Remaining Stock']) }} @endif {{ $row['Created Date'] }}
Totals: {{ number_format($totalStock) }} {{ number_format($totalSold) }} {{ number_format($totalRemaining) }}
Total Products: {{ count($data) }} Average Stock: {{ number_format($totalStock / count($data), 2) }} Average Sold: {{ number_format($totalSold / count($data), 2) }} Stock Turnover: {{ number_format(($totalSold / $totalStock) * 100, 2) }}%
@else

No data found for the selected filters.

@endif