@extends('layouts.app') @section('title', 'Sales Report') @section('breadcrumb') @endsection @section('content') {{-- Date Filter --}}
{{-- Summary Stats --}}
Rs. {{ number_format($summary['total_sales'] ?? 0, 0) }}
Total Sales
{{ $summary['total_orders'] ?? 0 }}
Total Orders
Rs. {{ number_format($summary['gross_profit'] ?? 0, 0) }}
Gross Profit
Rs. {{ number_format($summary['avg_order_value'] ?? 0, 0) }}
Avg. Order Value
{{-- Top Products --}}
Top Selling Products
@forelse($topProducts as $index => $product)
{{ $index + 1 }}
{{ $product->product_name }}
{{ $product->total_qty }} units sold
Rs. {{ number_format($product->total_revenue, 0) }}
@empty

No sales data

@endforelse
{{-- Sales by Category --}}
Sales by Category
@php $totalCategorySales = $salesByCategory->sum('total'); @endphp @forelse($salesByCategory as $cat)
{{ $cat->category ?? 'Uncategorized' }} Rs. {{ number_format($cat->total, 0) }}
@empty
No category data
@endforelse
{{-- Sales by Cashier --}}
Sales by Cashier
@forelse($salesByUser as $user) @empty @endforelse
Cashier Orders Total Sales
{{ $user['user'] }} {{ $user['orders'] }} Rs. {{ number_format($user['total'], 2) }}
No data
{{-- Daily Sales Chart --}}
Daily Sales Trend
@php $maxDaily = collect($dailyChart)->max('sales') ?: 1; @endphp @foreach(array_slice($dailyChart, -14) as $day)
{{ \Carbon\Carbon::parse($day['date'])->format('d') }}
@endforeach
@push('styles') @endpush @endsection