@extends('backEnd.layouts.master') @section('title', 'Order Report') {{-- CSS Section --}} @section('css') @endsection @section('content')
{{-- HEADER --}}

Order Reports

Analysis for: {{ $label }}

{{-- FILTERS --}}
{{-- Report Type --}}
{{-- Dynamic Inputs --}} {{-- Actions --}}
{{-- SUMMARY STATS --}}
{{-- Total Orders --}}
Total Orders

{{ $totalOrders }}

{{-- Total Amount --}}
৳
Revenue

{{ number_format($totalAmount, 2) }}

{{-- Total Discount --}}
Discount Given

{{ number_format($totalDiscount, 2) }}

{{-- Shipping --}}
Shipping Cost

{{ number_format($totalShipping, 2) }}

{{-- ORDER TABLE --}}
Detailed Order List
@forelse($orders as $order) @php $rowTotal = $order->amount ?? $order->total ?? $order->total_amount ?? $order->grand_total ?? $order->subtotal ?? 0; $rowDiscount = $order->discount ?? $order->discount_amount ?? $order->coupon_discount ?? 0; $rowShipping = $order->shipping_amount ?? $order->shipping_charge ?? $order->shipping_cost ?? $order->shipping ?? 0; // Status Badge Logic $statusName = is_object($order->status) ? $order->status->name : ($order->order_status ?? $order->status ?? '-'); $badgeClass = 'bg-secondary'; if(stripos($statusName, 'complete') !== false || stripos($statusName, 'delivered') !== false) $badgeClass = 'bg-success'; elseif(stripos($statusName, 'pending') !== false) $badgeClass = 'bg-warning text-dark'; elseif(stripos($statusName, 'cancel') !== false) $badgeClass = 'bg-danger'; elseif(stripos($statusName, 'process') !== false) $badgeClass = 'bg-info'; @endphp @empty @endforelse
# Invoice Customer Total Amount Discount Shipping Status Date
{{ $loop->iteration + ($orders->currentPage() - 1) * $orders->perPage() }} #{{ $order->invoice_id ?? $order->id }}
{{ substr($order->customer_name ?? ($order->customer->name ?? 'G'), 0, 1) }}
{{ $order->customer_name ?? ($order->customer->name ?? 'Guest') }}
৳{{ number_format($rowTotal, 2) }} {{ $rowDiscount > 0 ? '৳'.number_format($rowDiscount, 2) : '-' }} {{ $rowShipping > 0 ? '৳'.number_format($rowShipping, 2) : 'Free' }} {{ $statusName }} {{ optional($order->created_at)->format('d M, Y') }}
{{ optional($order->created_at)->format('h:i A') }}

No orders found

Try changing the filter parameters.
{{-- Pagination --}}
Showing {{ $orders->firstItem() }} to {{ $orders->lastItem() }} of {{ $orders->total() }} results
{{ $orders->links('pagination::bootstrap-4') }}
@endsection @push('scripts') {{-- Changed from section('script') to push('scripts') to fix error --}} @endpush