{{-- Header Section --}}
{{-- Filter Section --}}
{{-- Stat Cards --}}
{{-- Order Breakdown Table --}}
@if(!$orders->isEmpty())
Sales Analytics
Monitor your sales, profit, and order performance.
{{ \Carbon\Carbon::parse($startDate)->format('d M') }} — {{ \Carbon\Carbon::parse($endDate)->format('d M, Y') }}
{{-- Total Sales --}}
{{-- Online Paid --}}
{{-- Net Sales --}}
{{-- Net Profit --}}
{{-- ✅ DYNAMIC: All Status Cards --}}
Total Sales
৳{{ number_format($totalSales, 0) }}
Online Paid
৳{{ number_format($totalOnlinePaid, 0) }}
Net Sales
৳{{ number_format($netSales, 0) }}
Net Profit
৳{{ number_format($grossProfit, 0) }}
@if(isset($orderStatuses))
@foreach($orderStatuses as $key => $label)
@php
$count = $orders->filter(fn($q) => strtolower($q->status) == strtolower($key))->count();
$colorClass = 'bg-soft-dark'; // Default
$k = strtolower($key);
if (in_array($k, ['pending'])) {
$colorClass = 'bg-soft-warning';
} elseif (in_array($k, ['processing', 'confirmed', 'on_hold'])) {
$colorClass = 'bg-soft-info';
} elseif (in_array($k, ['shipped', 'courier'])) {
$colorClass = 'bg-soft-primary';
} elseif (in_array($k, ['complete', 'delivered', 'courier_complete'])) {
$colorClass = 'bg-soft-success';
} elseif (in_array($k, ['return', 'returned', 'return received', 'return missing', 'canceled', 'cancelled', 'returning'])) {
$colorClass = 'bg-soft-danger';
}
@endphp
@endforeach
@endif
{{ $label }}
{{ $count }}
{{-- Left Side Stats --}}
@php
$margin = $netSales > 0 ? ($grossProfit / $netSales) * 100 : 0;
@endphp
{{-- Chart --}}
{{-- ✅ TOP SOLD PRODUCTS TABLE --}}
৳{{ number_format($totalDelivery, 0) }}
Delivery Cost{{ $totalOrders }}
Total Orders{{ number_format($margin, 1) }}%
Net Profit MarginRevenue Trend
🔥 Top Selling Products
| Product Name | Sold Qty | Total Amount |
|---|---|---|
|
@if(optional($item->product)->image)
|
{{ $item->total_qty }} | ৳{{ number_format($item->total_amount, 0) }} |
| No data available. | ||
Order List
| Inv. | Customer | Date | Status | Payment | Qty | Total | Profit |
|---|---|---|---|---|---|---|---|
| #{{ $order->invoice_no }} |
{{ strtoupper(substr($order->first_name, 0, 1)) }}
{{ $order->first_name }}
{{ $order->mobile }}
|
{{ $order->created_at->format('d M') }} {{ $order->created_at->format('h:i A') }} | @php $statusMap = [ 'pending' => ['bg-soft-warning', 'text-warning', 'Pending'], 'processing' => ['bg-soft-info', 'text-info', 'Process'], 'courier' => ['bg-soft-primary', 'text-primary', 'Courier'], 'complete' => ['bg-soft-success', 'text-success', 'Done'], 'delivered' => ['bg-soft-success', 'text-success', 'Done'], 'courier_complete' => ['bg-soft-success', 'text-success', 'Done'], 'return' => ['bg-soft-danger', 'text-danger', 'Return'], 'returned' => ['bg-soft-danger', 'text-danger', 'Return'], 'canceled' => ['bg-soft-dark', 'text-dark', 'Cancel'], 'cancelled' => ['bg-soft-dark', 'text-dark', 'Cancel'], 'return missing' => ['bg-soft-danger', 'text-danger', 'Missing'], 'return received' => ['bg-soft-danger', 'text-danger', 'Return'], ]; $currStatus = strtolower($order->status); $badge = $statusMap[$currStatus] ?? ['bg-soft-dark', 'text-dark', substr($order->status, 0, 6)]; @endphp {{ strtoupper($badge[2]) }} |
@if($isOnline)
SSL
{{ $order->transaction_id }}
@else
COD
@endif
|
{{ $order->details->sum('quantity') }} | ৳{{ number_format($order->final_amount, 0) }} | @if($orderProfit >= 0) {{ number_format($orderProfit, 0) }} @else {{ number_format($orderProfit, 0) }} @endif |
No orders found. |
|||||||
Showing {{ $orders->count() }} records
@endif