@extends('layouts.app') @section('title', 'Voucher ' . $item->voucher_number) @push('styles') @endpush @section('content') {{-- ✅ Header Section --}}

Voucher {{ $item->voucher_number }}

View voucher details and journal lines.

@can('viewAny', \App\Models\Voucher::class) Back to list @endcan
@if (session('success')) @endif {{-- ✅ Details Card --}}
{{-- Voucher Number --}}
Voucher Number
{{ $item->voucher_number }}
{{-- Type --}}
Type
{{ $item->voucher_type === 'receipt' ? 'Receive' : $item->voucher_type }}
{{-- Date --}}
Date
{{ \Carbon\Carbon::parse($item->voucher_date)->format('d M, Y') }}
{{-- Status --}}
Status
{{-- Branch --}}
Branch
{{ $item->branch?->name ?? '—' }}
{{-- Payment Mode --}}
Payment Mode
{{ $item->paymentMode?->name ?? '—' }}
{{-- Payee --}}
Payee / Received From
{{ $item->payee ?? '—' }}
{{-- ✅ Totals Row (Debit & Credit Side-by-Side) --}}
{{-- Total Debit --}}
Debit
{{ number_format($item->total_debit, 2) }}
{{-- Total Credit --}}
Credit
{{ number_format($item->total_credit, 2) }}
{{-- Narration --}}
Narration / Notes
{{ $item->narration }}
{{-- Attachment --}} @if ($item->attachment_path) @endif {{-- Reversed By --}} @if ($item->reversal_voucher_id)
Reversed By
View reversal voucher
@endif
{{-- Pending Approval Warning --}} @if ($item->status === 'draft') @endif
{{-- ✅ Journal Lines Card --}}
{{ $item->status === 'draft' ? 'Draft Entries' : 'Journal Lines' }}
@if (!$item->journalEntry) @forelse ($item->draft_lines ?? [] as $line) @php($account = $draftAccounts[$line['account_id'] ?? 0] ?? null) @empty @endforelse @else @forelse ($item->journalEntry->lines ?? [] as $line) @empty @endforelse @endif {{-- Footer for Totals --}} @if (count($item->draft_lines ?? ($item->journalEntry->lines ?? [])) > 0) @endif
Account Narration Debit Credit
{{ $account?->code }} — {{ $account?->name }} {{ $line['narration'] ?? '' }} {{ number_format((float) ($line['debit'] ?? 0), 2) }} {{ number_format((float) ($line['credit'] ?? 0), 2) }}
No draft lines found.
{{ $line->account->code ?? '' }} — {{ $line->account->name ?? '' }} {{ $line->narration }} {{ number_format($line->debit, 2) }} {{ number_format($line->credit, 2) }}
No journal lines found.
Total {{ number_format($item->total_debit, 2) }} {{ number_format($item->total_credit, 2) }}
{{-- ✅ Action Buttons (Draft) --}} @if ($item->status === 'draft')
@can('update', $item) Edit Draft @endcan @can('approve', $item)
@csrf
@endcan @can('reject', $item)
@csrf
@endcan
@endif {{-- ✅ Reverse Voucher (Posted) --}} @if ($item->status === 'posted') @can('reverse', $item)
Reverse this voucher

Posted vouchers cannot be edited or deleted. A reversal creates a mirror-image voucher and marks this one as reversed.

@csrf
Reverse Voucher
@endcan @endif @endsection @push('scripts') {{-- SweetAlert2 CDN --}} @endpush