@php $isCreate = $voucher === null; $editable = $isCreate || ($voucher->isDraft() && auth()->user()->can('vouchers.edit')); $simple = in_array($type, ['receipt', 'payment', 'contra', 'transfer'], true); $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); $title = $isCreate ? __('app.accounts.vouchers.form.create_title') : ($voucher->voucher_no ?? __('app.accounts.vouchers.form.edit_title')); @endphp
{{ __('app.accounts.vouchers.form.back_to_register') }}

{{ $title }}

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

@if (! $isCreate)
{{ $voucher->type->label() }} @if ($voucher->isDraft()) {{ $voucher->status->label() }} @elseif ($voucher->isPosted()) {{ $voucher->status->label() }} @else {{ $voucher->status->label() }} @endif @if ($voucher->reversal_of_id !== null) {{ __('app.accounts.vouchers.form.reversal_badge') }} @endif
@endif
@if ($notice) {{ $notice }} @endif @if ($errors->any())
    @foreach ($errors->all() as $message)
  • {{ $message }}
  • @endforeach
@endif @if ($editable)
@foreach ($types as $voucherType) @endforeach @if (in_array($type, ['receipt', 'payment'], true)) @foreach ($categoryOptions as $option) @endforeach @endif @if ($type === 'receipt') @foreach ($campaigns as $campaign) @endforeach @endif
@if ($simple)

@if ($type === 'receipt') {{ __('app.accounts.vouchers.form.receipt_hint') }} @elseif ($type === 'payment') {{ __('app.accounts.vouchers.form.payment_hint') }} @elseif ($type === 'contra') {{ __('app.accounts.vouchers.form.contra_hint') }} @else {{ __('app.accounts.vouchers.form.transfer_hint') }} @endif

@if ($type === 'receipt' || $type === 'payment') @foreach ($liquidAccounts as $account) @endforeach @foreach ($counterAccounts as $account) @endforeach @else @foreach ($liquidAccounts as $account) @endforeach @foreach ($liquidAccounts as $account) @endforeach @endif
@else

{{ __('app.accounts.vouchers.form.journal_hint') }}

@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.vouchers.form.add_line') }}
{{ __('app.accounts.fields.total_debit') }}: {{ number_format($debitTotal, 2) }} {{ __('app.accounts.fields.total_credit') }}: {{ number_format($creditTotal, 2) }} @if ($difference === 0.0 && $debitTotal > 0) {{ __('app.accounts.vouchers.form.balanced') }} @else {{ __('app.accounts.vouchers.form.unbalanced', ['difference' => number_format(abs($difference), 2)]) }} @endif
@endif
@if (! $isCreate && $voucher->isDraft()) @can('vouchers.delete') {{ __('app.accounts.vouchers.form.delete_draft') }} @endcan @endif {{ __('app.actions.cancel') }} {{ $isCreate ? __('app.accounts.vouchers.form.save_draft') : __('app.accounts.vouchers.form.save_changes') }} @can('vouchers.post') {{ __('app.accounts.vouchers.form.post_voucher') }} @endcan
@else
{{ __('app.accounts.fields.voucher_date') }} {{ $voucher->voucher_date->translatedFormat('d M Y') }}
{{ __('app.accounts.fields.financial_year') }} {{ $voucher->financialYear?->code ?? '—' }}
{{ __('app.accounts.fields.category') }} {{ $voucher->category?->label() ?? '—' }}
{{ __('app.accounts.fields.reference') }} {{ $voucher->reference_no ?: '—' }}
{{ __('app.accounts.fields.party_name') }} {{ $voucher->party_name ?: '—' }} @if ($voucher->party_contact) {{ $voucher->party_contact }} @endif
{{ __('app.accounts.fields.campaign') }} {{ $voucher->campaign ? $voucher->campaign->code.' — '.$voucher->campaign->localizedTitle() : '—' }}
{{ __('app.accounts.fields.narration') }} {{ $voucher->narration ?: '—' }}
{{ __('app.accounts.vouchers.form.created_by') }} {{ $voucher->creator?->name ?? '—' }}
{{ __('app.accounts.vouchers.form.posted_by') }} {{ $voucher->poster?->name ?? '—' }} @if ($voucher->posted_at) {{ $voucher->posted_at->translatedFormat('d M Y, h:i A') }} @endif
@if ($voucher->reverser)
{{ __('app.accounts.vouchers.form.reversed_by') }} {{ $voucher->reverser->name }} @if ($voucher->reversed_at) {{ $voucher->reversed_at->translatedFormat('d M Y, h:i A') }} @endif
@endif
@if ($voucher->voucher_no === null)

{{ __('app.accounts.vouchers.form.read_only_hint') }}

@endif
@foreach ($voucher->lines as $line) @endforeach
{{ __('app.accounts.vouchers.form.line_no') }} {{ __('app.accounts.fields.account') }} {{ __('app.accounts.fields.memo') }} {{ __('app.accounts.fields.debit') }} {{ __('app.accounts.fields.credit') }}
{{ $line->line_no }} {{ $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) $voucher->lines->sum('debit'), 2) }} {{ number_format((float) $voucher->lines->sum('credit'), 2) }}
@if ($voucher->reversal)
{{ __('app.accounts.vouchers.form.reversed_hint') }} {{ $voucher->reversal->voucher_no }}
@endif @if ($voucher->reversalOf)
{{ __('app.accounts.vouchers.form.reversal_of') }}: {{ $voucher->reversalOf->voucher_no }}
@endif
{{ __('app.accounts.vouchers.form.back_to_register') }} @if ($voucher->isDraft()) @can('vouchers.post') {{ __('app.accounts.vouchers.form.post_voucher') }} @endcan @endif @if ($voucher->isPosted() && $voucher->reversal === null) @can('vouchers.reverse') {{ __('app.accounts.vouchers.actions.reverse') }} @endcan @endif @can('vouchers.print') {{ __('app.accounts.vouchers.actions.print') }} @endcan
@endif @if ($reversingId !== null)

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

{{ __('app.accounts.vouchers.reversal.cancel') }} {{ __('app.accounts.vouchers.reversal.submit') }}
@endif