@extends('layouts.admin') @section('content')

Inventory Reports

Total Products

{{ number_format($products->count()) }}

Low Stock

{{ number_format($lowStockProducts->count()) }}

Out of Stock

{{ number_format($outOfStockProducts->count()) }}

Stock Value

Rs.{{ number_format($totalStockValue, 2) }}

@if($reportType == 'stock_levels')

Current Stock Levels

@foreach($products as $product)

{{ $product->product_name }}

{{ $product->product_code }} • {{ $product->product_type }}

@if($product->quantity_in_stock <= 0) Out @elseif($product->isLowStock()) Low @else OK @endif
Current: {{ number_format($product->quantity_in_stock) }} {{ $product->unit }}
Threshold: {{ number_format($product->low_stock_threshold) }} {{ $product->unit }}
Stock Value: Rs.{{ number_format($product->quantity_in_stock * $product->cost, 2) }}
@endforeach
@endif @if($reportType == 'low_stock')

Low Stock Alerts

Products that need immediate attention

@foreach($reorderProducts as $product)

{{ $product->product_name }}

Needs Restocking

Restock
Current: {{ number_format($product->quantity_in_stock) }} {{ $product->unit }}
Threshold: {{ number_format($product->low_stock_threshold) }} {{ $product->unit }}
Shortfall: {{ number_format(max(0, $product->low_stock_threshold - $product->quantity_in_stock)) }} {{ $product->unit }}
Last Sold: @php $lastSale = $product->sales->sortByDesc('created_at')->first(); @endphp @if($lastSale) {{ $lastSale->created_at->diffForHumans() }} @else Never @endif
@endforeach
@endif @if($reportType == 'best_sellers')

Best Selling Products (Last 30 Days)

@foreach($bestSellingProducts as $product)

{{ $product->product_name }}

{{ $product->product_code }}

{{ number_format($product->total_sold) }} sold

Rs.{{ number_format(($product->sales_sum_total_price ?? 0), 2) }} revenue

@endforeach

Highest Stock Value

@foreach($products->sortByDesc(fn($p) => $p->quantity_in_stock * $p->cost)->take(10) as $product)

{{ $product->product_name }}

{{ number_format($product->quantity_in_stock) }} in stock

Rs.{{ number_format($product->quantity_in_stock * $product->cost, 2) }}

Cost: Rs.{{ number_format($product->cost, 2) }}

@endforeach
@endif
@endsection