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

{{ $partner->partner_code ?? 'No Code' }} @if(isset($partner->status)) | Status: {{ ucfirst($partner->status) }} @endif
Reset

Total Allocated

KWD {{ number_format($totalAllocated, 2) }}

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

Total Withdrawn

KWD {{ number_format($totalWithdrawn, 2) }}

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

Closing Balance

KWD {{ number_format($closingBalance, 2) }}

@if($closingBalance < 0) Overdrawn by KWD {{ number_format(abs($closingBalance), 2) }} @elseif($closingBalance > 0) Available: KWD {{ number_format($closingBalance, 2) }} @else Zero Balance @endif
@if(!empty($branchDetails))

Branch-wise Summary

@foreach($branchDetails as $branchId => $branch)
{{ $branch['branch_name'] }}
Allocations

KWD {{ number_format($branch['allocations'], 2) }}

({{ $branch['allocation_count'] ?? 0 }} transactions)
Withdrawals

KWD {{ number_format($branch['withdrawals'], 2) }}

({{ $branch['withdrawal_count'] ?? 0 }} transactions)

Balance: KWD {{ number_format($branch['balance'], 2) }} @if($branch['balance'] > 0) @elseif($branch['balance'] < 0) @endif {{ $branch['balance'] > 0 ? 'Available' : ($branch['balance'] < 0 ? 'Overdrawn' : 'Zero') }}
@endforeach
@endif

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 $isAllocation = $transaction->transaction_type == 'Allocation'; $isWithdrawal = $transaction->transaction_type == 'Withdrawal'; // Calculate running balance if ($isAllocation) { $runningBalance += $transaction->credit_amount; } elseif ($isWithdrawal) { $runningBalance -= $transaction->debit_amount; } $rowClass = $isAllocation ? 'allocation-row' : ($isWithdrawal ? 'withdrawal-row' : ''); @endphp @empty @endforelse @if($transactions->count() > 0) @endif
# Date Branch Transaction Type Allocation Withdrawal
{{ $counter++ }} {{ date('d-m-Y', strtotime($transaction->transaction_date)) }} {{ $transaction->branch_name ?? 'N/A' }} @if($isAllocation) Allocation @if(isset($transaction->is_management) && $transaction->is_management == 1) @endif @elseif($isWithdrawal) Withdrawal @else {{ $transaction->transaction_type }} @endif @if($isAllocation) KWD {{ number_format($transaction->credit_amount, 2) }} @else - @endif @if($isWithdrawal) KWD {{ number_format($transaction->debit_amount, 2) }} @else - @endif

No transactions found for the selected period.

Total: KWD {{ number_format($totalAllocated, 2) }} KWD {{ number_format($totalWithdrawn, 2) }}
Closing Balance: KWD {{ number_format($closingBalance, 2) }}
(Allocation − Withdrawal)

Transaction Summary

Total Transactions

{{ $transactions->count() }}

Allocations

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

Withdrawals

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

Branches

{{ count($branchDetails) }}