@php $creditSales = $creditSales ?? collect(); $creditPayments = $creditPayments ?? collect(); $transactions = $transactions ?? collect(); $expensesFormatted = $expensesFormatted ?? []; $paymentMethodsFormatted = $paymentMethodsFormatted ?? []; @endphp

Sales Transactions

@foreach($transactions as $transaction) @endforeach
# Invoice No Location Date Amount Added By
{{ $loop->iteration }} {{ $transaction->invoice_no }} {{ $transaction->location_name }} {{ \Carbon\Carbon::parse($transaction->transaction_date)->format('d/m/Y H:i') }} {{ number_format($transaction->final_total, 2) }} {{ $transaction->added_by }}

{{ __('Credit Payments') }}

@forelse($creditPayments as $cp) @php $rawMethod = $cp->method; $method = ucfirst($rawMethod); if (in_array($method, ['Cash', 'Card', 'Bank Transfer', 'Cheque', 'Other'])) { // Standard method – keep as-is } else { // Custom method: use label from business settings $method = $customLabels[$rawMethod] ?? ucfirst(str_replace('_', ' ', $rawMethod)); } $customer = $cp->customer_name ?? $cp->supplier_business_name ?? '-'; @endphp @empty @endforelse
# {{ __('Invoice No') }} {{ __('Transaction Date') }} {{ __('Customer') }} {{ __('Payment Method') }} {{ __('Amount') }} {{ __('Paid On') }}
{{ $loop->iteration }} {{ $cp->invoice_no }} {{ $cp->sell_date?->format('d/m/Y H:i') ?? '-' }} {{ $customer }} {{ $method }} {{ number_format($cp->amount, 2) }} {{ $cp->paid_on?->format('d/m/Y H:i') ?? '-' }}
{{ __('No credit payments found for the selected filters.') }}
{{ __('Total Credit Payments') }}: {{ number_format($totalCreditAmount, 2) }}

{{ __('Credit Sales (Due/Partial Payments)') }}

@php $creditSales = $creditSales ?? collect(); @endphp @forelse($creditSales as $sale) @php $statusClass = $sale->due_amount > 0 ? 'text-danger' : 'text-success'; $statusText = $sale->due_amount == 0 ? 'Paid' : ($sale->paid_amount > 0 ? 'Partial' : 'Due'); @endphp @empty @endforelse @if($creditSales && $creditSales->count() > 0) @endif
# {{ __('Invoice No') }} {{ __('Location') }} {{ __('Date') }} {{ __('Customer') }} {{ __('Total Amount') }} {{ __('Paid') }} {{ __('Due') }} {{ __('Payment Status') }}
{{ $loop->iteration }} {{ $sale->invoice_no }} {{ $sale->location_name }} {{ \Carbon\Carbon::parse($sale->transaction_date)->format('d/m/Y H:i') }} {{ $sale->customer }} {{ number_format($sale->final_total, 2) }} {{ number_format($sale->paid_amount, 2) }} {{ number_format($sale->due_amount, 2) }} @if($sale->due_amount == 0) Paid @elseif($sale->paid_amount > 0) Partial @else Due @endif
{{ __('No credit sales found for the selected filters.') }}
{{ __('Totals') }}: {{ number_format($totalCreditSalesAmount, 2) }} {{ number_format($totalPaidOnCredit, 2) }} {{ number_format($totalDueAmount, 2) }}

{{ __('Payment Summary') }}

@foreach($paymentMethodsFormatted as $method => $amount) @endforeach
Payment Method Amount
{{ $method }} {{ number_format($amount, 2) }}

{{ __('Expense Summary') }}

@foreach($expensesFormatted as $expense) @endforeach
Expense Category Amount Payment Method
{{ $expense['category_name'] }} {{ number_format($expense['total_expense'], 2) }} {{ $expense['method'] }}

{{ __('Money in Hand') }}

@php $totalAmountInHand = 0; $allPaymentMethods = collect($paymentMethodsFormatted)->keys()->merge(collect($expensesFormatted)->pluck('method'))->unique(); @endphp @foreach($allPaymentMethods as $method) @php $paymentAmount = $paymentMethodsFormatted[$method] ?? 0; $matchingExpenses = collect($expensesFormatted)->filter(function($expense) use ($method) { return $expense['method'] == $method; }); $totalExpense = $matchingExpenses->sum('total_expense'); $remainingAmount = $paymentAmount - $totalExpense; $totalAmountInHand += $remainingAmount; @endphp @endforeach
Payment Method Amount in Hand
{{ $method }} {{ number_format($remainingAmount, 2) }}
{{ __('Total Amount in Hand') }} {{ number_format($totalAmountInHand, 2) }}