@php $debitTotal = round(collect($lines)->sum(fn ($line) => (float) ($line['debit'] ?? 0)), 2); $creditTotal = round(collect($lines)->sum(fn ($line) => (float) ($line['credit'] ?? 0)), 2); $difference = round($debitTotal - $creditTotal, 2); @endphp

{{ __('app.accounts.opening.title') }}

{{ __('app.accounts.opening.desc') }}

@if ($notice) {{ $notice }} @endif @if ($errors->any())
    @foreach ($errors->all() as $message)
  • {{ $message }}
  • @endforeach
@endif @if ($years->isEmpty()) @can('financial_years.create') {{ __('app.accounts.years.create') }} @endcan @else
@foreach ($years as $option) @endforeach
{{ $year->starts_on->translatedFormat('d M Y') }} — {{ $year->ends_on->translatedFormat('d M Y') }} @if ($year->is_closed) {{ __('app.accounts.years.closed_hint') }} @else {{ __('app.accounts.opening.hint') }} @endif
@if ($opening)
{{ __('app.accounts.vouchers.columns.voucher_no') }} {{ $opening->voucher_no }}
{{ __('app.accounts.fields.voucher_date') }} {{ $opening->voucher_date->translatedFormat('d M Y') }}
{{ __('app.accounts.fields.amount') }} {{ number_format((float) $opening->amount, 2) }}
{{ __('app.accounts.fields.status') }} {{ $opening->status->label() }}
{{ __('app.accounts.vouchers.form.created_by') }} {{ $opening->creator?->name ?? '—' }}
{{ __('app.accounts.vouchers.form.posted_by') }} {{ $opening->poster?->name ?? '—' }} @if ($opening->posted_at) {{ $opening->posted_at->translatedFormat('d M Y, h:i A') }} @endif
@if ($opening->narration)
{{ __('app.accounts.fields.narration') }} {{ $opening->narration }}
@endif
@foreach ($opening->lines as $line) @endforeach
{{ __('app.accounts.fields.account') }} {{ __('app.accounts.fields.memo') }} {{ __('app.accounts.fields.debit') }} {{ __('app.accounts.fields.credit') }}
{{ $line->account?->code }} {{ $line->account?->localizedName() }} {{ $line->memo ?: '—' }} {{ (float) $line->debit > 0 ? number_format((float) $line->debit, 2) : '—' }} {{ (float) $line->credit > 0 ? number_format((float) $line->credit, 2) : '—' }}
{{ __('app.accounts.vouchers.form.totals') }} {{ number_format((float) $opening->lines->sum('debit'), 2) }} {{ number_format((float) $opening->lines->sum('credit'), 2) }}
@can('opening_balances.post') @unless ($showReversal) {{ __('app.accounts.opening.reverse') }} @endunless @endcan @can('vouchers.print') {{ __('app.accounts.vouchers.actions.print') }} @endcan
@if ($showReversal)

{{ __('app.accounts.vouchers.reversal.title') }}

{{ __('app.accounts.vouchers.reversal.desc') }}

{{ __('app.accounts.vouchers.reversal.cancel') }} {{ __('app.accounts.opening.reverse') }}
@endif
@elseif ($year->isOpen()) @can('opening_balances.post')
@foreach ($lines as $index => $line) @endforeach
{{ __('app.accounts.vouchers.form.line_no') }} {{ __('app.accounts.fields.account') }} {{ __('app.accounts.fields.memo') }} {{ __('app.accounts.fields.debit') }} {{ __('app.accounts.fields.credit') }}
{{ $index + 1 }}
{{ __('app.accounts.opening.add_line') }}
{{ __('app.accounts.opening.totals') }}: {{ number_format($debitTotal, 2) }} / {{ number_format($creditTotal, 2) }} @if (abs($difference) < 0.01) {{ __('app.accounts.opening.balances') }} @else {{ __('app.accounts.opening.difference') }}: {{ number_format(abs($difference), 2) }} @endif

{{ __('app.accounts.opening.equity_hint') }}

{{ __('app.accounts.opening.post') }}
@endcan @else @endif @endif