Ledger Details: {{ $partner->full_name }}

Opening Balance

{{ $transactions->isNotEmpty() ? number_format($openingBalance, 2) : number_format(0, 2) }}

Total Allocated (Credit)

{{ number_format($transactions->sum('credit_amount'), 2) }}

Total Withdrawn (Debit)

{{ number_format($transactions->sum('debit_amount'), 2) }}

Closing Balance

{{ $transactions->isNotEmpty() ? number_format($transactions->last()->running_balance ?? 0, 2) : number_format(0, 2) }}

Transaction Details

Period: {{ date('d-m-Y', strtotime($startDate)) }} to {{ date('d-m-Y', strtotime($endDate)) }}
@php $runningBalance = 0; $counter = 1; @endphp @forelse($transactions as $transaction) @php // Calculate running balance properly if ($loop->first) { // For first transaction, opening balance is running_balance - (credit - debit) $openingBalance = $transaction->running_balance - ($transaction->credit_amount - $transaction->debit_amount); $runningBalance = $openingBalance; } // Add current transaction effect $runningBalance = $runningBalance + $transaction->credit_amount - $transaction->debit_amount; @endphp @empty @endforelse
# Date Transaction Type Description Debit (Withdrawal) Credit (Allocation) Running Balance
{{ $counter++ }} {{ date('d-m-Y', strtotime($transaction->transaction_date)) }} @if($transaction->transaction_type == 'Allocation') Allocation @elseif($transaction->transaction_type == 'Withdrawal') Withdrawal @elseif($transaction->transaction_type == 'Adjustment') Adjustment @else {{ $transaction->transaction_type }} @endif {{ $transaction->description ?? '-' }} @if($transaction->debit_amount > 0) {{ number_format($transaction->debit_amount, 2) }} @else - @endif @if($transaction->credit_amount > 0) {{ number_format($transaction->credit_amount, 2) }} @else - @endif {{ number_format($runningBalance, 2) }}
No transactions found for the selected period.
Totals: {{ number_format($transactions->sum('debit_amount'), 2) }} {{ number_format($transactions->sum('credit_amount'), 2) }} {{ number_format($runningBalance, 2) }}

Transaction Summary

Total Transactions

{{ $transactions->count() }}

Allocations

{{ $transactions->where('transaction_type', 'Allocation')->count() }}

Withdrawals

{{ $transactions->where('transaction_type', 'Withdrawal')->count() }}

Adjustments

{{ $transactions->where('transaction_type', 'Adjustment')->count() }}