Partner Ledger Overview

Request Withdrawal
@php $balances = collect($partnerBalances); $totalPartners = $balances->count(); $totalAllocated = $balances->sum('total_allocated'); $totalWithdrawn = $balances->sum('total_withdrawn'); $totalOutstanding = $balances->sum('closing_balance'); $creditors = $balances->filter(function($balance) { return $balance->closing_balance > 0; })->count(); $debtors = $balances->filter(function($balance) { return $balance->closing_balance < 0; })->count(); $zeroBalance = $balances->filter(function($balance) { return $balance->closing_balance == 0; })->count(); $totalPayable = $balances->where('closing_balance', '>', 0)->sum('closing_balance'); $totalReceivable = $balances->where('closing_balance', '<', 0)->sum('closing_balance'); @endphp
Click on partner name to view detailed ledger
@forelse($partnerBalances as $index => $balance) @php $percentageUsed = $balance->total_allocated > 0 ? ($balance->total_withdrawn / $balance->total_allocated) * 100 : 0; // Determine balance status $balanceClass = 'amount-neutral'; $balanceIcon = ''; $badgeText = ''; if ($balance->closing_balance > 0) { $balanceClass = 'amount-positive'; $badgeText = 'Available'; // $balanceIcon = ''; } elseif ($balance->closing_balance < 0) { $balanceClass = 'amount-negative'; $badgeText = 'Overdrawn'; // $balanceIcon = ''; } else { $badgeText = 'Zero'; } @endphp @empty @endforelse @if(count($partnerBalances) > 0) @php $totalAllocatedSum = collect($partnerBalances)->sum('total_allocated'); $totalWithdrawnSum = collect($partnerBalances)->sum('total_withdrawn'); $totalBalanceSum = collect($partnerBalances)->sum('closing_balance'); @endphp @endif
# Partner Name Total Allocated Total Withdrawn Balance Action
{{ $index + 1 }} {{ $balance->partner->full_name }} @if($balance->partner->partner_code) ({{ $balance->partner->partner_code }}) @endif @if($percentageUsed > 0 && $percentageUsed < 100) @endif KWD {{ number_format($balance->total_allocated, 2) }} KWD {{ number_format($balance->total_withdrawn, 2) }} @if($balance->total_withdrawn > 0) @endif KWD {{ number_format(abs($balance->closing_balance), 2) }} {!! $balanceIcon !!} @if($badgeText) @endif View

No Partner Data Found

There are no partner balances to display at the moment.

Grand Totals: KWD {{ number_format($totalAllocatedSum, 2) }} KWD {{ number_format($totalWithdrawnSum, 2) }} KWD {{ number_format($totalBalanceSum, 2) }}