{{ __('Borrow / Lend / Settle') }}

@include('accounting.partials.nav')
Rule: Person account balance > 0 means person owes you; balance < 0 means you owe the person.
Borrow
@csrf
Lend
@csrf
Settle
@csrf
Outstanding Balances
@php $peopleOweYou = 0; $youOwePeople = 0; $outstandingAccounts = []; foreach ($personAccounts as $p) { $bal = (float) ($personBalances[$p->id] ?? 0); if (abs($bal) >= 0.01) { $outstandingAccounts[] = ['name' => $p->name, 'balance' => $bal]; if ($bal > 0) { $peopleOweYou += $bal; } else { $youOwePeople += abs($bal); } } } @endphp @if (empty($outstandingAccounts))

No outstanding balances.

@else
@foreach ($outstandingAccounts as $item) @endforeach
Person Balance
{{ $item['name'] }} {{ number_format($item['balance'], 2) }}
People owe you {{ number_format($peopleOweYou, 2) }}
You owe people {{ number_format($youOwePeople, 2) }}
Net Position {{ number_format($peopleOweYou - $youOwePeople, 2) }}
@endif