{{-- Breadcrumb & Title --}}
{{-- Header Info --}}
{{-- Lines Table --}}
=======
@php
use App\Support\AccountingAmounts;
$totalDebit = round((float) $entry->lines->sum('debit'), 2);
$totalCredit = round((float) $entry->lines->sum('credit'), 2);
$difference = round(abs($totalDebit - $totalCredit), 2);
$isBalanced = $difference < 0.01;
$lineCount = $entry->lines->count();
$debitLines = $entry->lines->filter(fn ($l) => (float) $l->debit > 0)->count();
$creditLines = $entry->lines->filter(fn ($l) => (float) $l->credit > 0)->count();
$scaleTotal = max($totalDebit, $totalCredit, 1);
$debitPct = round(($totalDebit / $scaleTotal) * 100, 1);
$creditPct = round(($totalCredit / $scaleTotal) * 100, 1);
$accountTypeClass = fn (?string $type) => match ($type) {
'asset' => 'chm-acct-type--asset',
'liability' => 'chm-acct-type--liability',
'equity' => 'chm-acct-type--equity',
'income' => 'chm-acct-type--income',
'expense' => 'chm-acct-type--expense',
default => 'chm-acct-type--neutral',
};
$sortedLines = $entry->lines->sortBy([
fn ($l) => $l->account->code ?? '',
fn ($l) => -(float) $l->debit,
])->values();
@endphp
Entry Information
Date
{{ $entry->entry_date->format('Y-m-d') }}
Reference
{{ $entry->reference ?: '—' }}
Description
{{ $entry->description ?: '—' }}
Line Items
| Account | Debit | Credit | Memo |
|---|---|---|---|
| {{ $line->account->full_name }} | {{ number_format($line->debit, 2) }} | {{ number_format($line->credit, 2) }} | {{ $line->memo ?: '—' }} |
| Total | {{ number_format($entry->lines->sum('debit'), 2) }} | {{ number_format($entry->lines->sum('credit'), 2) }} |
Unbalanced entry.
Debits and credits differ by {{ number_format($difference, 2) }}.
Correct this before closing the period.
@can('balance_check.view')
Balance check
@endcan
! $isBalanced])>
$isBalanced, 'is-unbalanced' => ! $isBalanced])>
{{ $isBalanced ? 'Entry is balanced' : 'Entry is out of balance' }}
{{ number_format($lineCount) }} {{ Str::plural('line', $lineCount) }}
· {{ $debitLines }} debit {{ Str::plural('side', $debitLines) }}
· {{ $creditLines }} credit {{ Str::plural('side', $creditLines) }}
Debit {{ number_format($totalDebit, 2) }}
Credit {{ number_format($totalCredit, 2) }}
Entry date
{{ $entry->entry_date->format('d M Y') }}
{{ $entry->entry_date->format('l') }}
Total debit
{{ number_format($totalDebit, 2) }}
UGX
Total credit
{{ number_format($totalCredit, 2) }}
UGX
Reference
{{ $entry->reference ?: '—' }}
Entry #{{ $entry->id }}
Description
{{ $entry->description }}