@section('title', 'Reports') @section('top-menu-items') @endsection @section('sub-menu-items') @endsection
Transaction Date:
@if ($this->date)

Daily Sales Report - {{ $this->date }}

@endif
@php $totalTotalPrice = 0; $totalPaidAmount = 0; $totalRemaining = 0; @endphp @forelse($orders ?? [] as $order) @php $totalTotalPrice += ($order['total_price'] ?? 0) + ($order['taxes'] ?? 0) + ($order['discount'] ?? 0); $nonOnAccountPayments = collect($order['payments'])->filter(fn($p) => strtolower($p['name']) !== 'on account'); $paid = $nonOnAccountPayments->sum(fn($p) => $p['pivot']['amount'] ?? 0); $totalPaidAmount += $paid; $balance = round($order['total_price'] + $order['taxes'] + $order['discount'] - $order['paid'], 2); if (abs($balance) < 0.05) $balance=0; // treat -0.01, 0.01, 0.02 as zero $totalRemaining +=$balance; @endphp @php $balance = $order['total_price'] + $order['taxes'] + $order['discount'] - $order['paid']; if (abs($balance) < 0.5) $balance=0; // treat very small values as zero @endphp @empty @endforelse {{-- Sum Row --}}
Company Name Order # Wp Order Id Order Total Payment Types Payment Amounts Order Balance
{{ $order->orderable?->partner?->organization_name ?? 'Cash Customer' }} {{ $order['id'] }} {{ $order->wp_order_id}} {{ number_format(($order->total_price ?? 0) + ($order->taxes ?? 0) + ($order->discount ?? 0), 2) }} {{ !empty($order['payments']) ? collect($order['payments'])->pluck('name')->implode(', ') : 'N/A' }} @if (!empty($order['payments'])) {!! collect($order['payments'])->map(fn($payment) => number_format($payment['pivot']['amount'] ?? 0, 2))->implode('
') !!} @else N/A @endif
{{ number_format($balance, 2) }}
No Orders found.
Total: $ {{ number_format($totalTotalPrice, 2) }} $ {{ number_format($totalPaidAmount, 2) }} $ {{ number_format(abs($totalRemaining) <= 0.50 ? 0 : $totalRemaining, 2) }}
@if (!empty($paymentSummary)) @php $totalPayments = 0; $totalAmount = 0; @endphp @foreach ($paymentSummary as $payment) @php $totalPayments += $payment['no_of_payments']; $totalAmount += $payment['gross_amount']; @endphp @endforeach @else @endif
Payment Type # of Payments Gross Amount
{{ $payment['name'] }} {{ $payment['no_of_payments'] }} {{ $payment['gross_amount'] }}
Total {{ $totalPayments }} {{ $totalAmount }}
No Orders found.
@push('scripts') @endpush