@extends('admin.admin_dashboard') @section('admin') <<<<<<< HEAD
{{-- Breadcrumb & Title --}} {{-- Header Info --}}
Entry Information
Date
{{ $entry->entry_date->format('Y-m-d') }}
Reference
{{ $entry->reference ?: '—' }}
Description
{{ $entry->description ?: '—' }}
{{-- Lines Table --}}
Line Items
@foreach($entry->lines as $line) @endforeach
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) }}
======= @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
Home Journal entries Entry #{{ $entry->id }} All entries @can('journals.edit') Edit entry @endcan @if(! $isBalanced)
Unbalanced entry. Debits and credits differ by {{ number_format($difference, 2) }}. Correct this before closing the period.
@can('balance_check.view') Balance check @endcan
@endif
! $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 }}
@if($entry->description)
Description
{{ $entry->description }}
@endif
Line items {{ $lineCount }} {{ Str::plural('account', $lineCount) }} touched
@foreach($sortedLines as $index => $line) @php $account = $line->account; $hasDebit = (float) $line->debit > 0; $hasCredit = (float) $line->credit > 0; @endphp @endforeach
# Account Type Debit Credit Memo
{{ $index + 1 }}
{{ $account->name ?? '—' }}
{{ $account->code ?? '—' }}
@if($account?->type) type)])> {{ ucfirst($account->type) }} @else — @endif @if($hasDebit) {{ AccountingAmounts::formatDebit($line->debit) }} @else @endif @if($hasCredit) {{ AccountingAmounts::formatCredit($line->credit) }} @else @endif {{ $line->memo ?: '—' }}
Totals {{ number_format($totalDebit, 2) }} {{ number_format($totalCredit, 2) }} @if(! $isBalanced) Diff {{ number_format($difference, 2) }} @endif
>>>>>>> origin/main
@endsection