@extends('layouts.print') @section('title', 'Voucher '.$voucher->voucher_no) @section('doc_title', 'JOURNAL VOUCHER') @section('doc_no', $voucher->voucher_no.' · '.$voucher->voucher_date->format('d M Y')) @php $debit = (float) $voucher->entries->sum('debit'); $credit = (float) $voucher->entries->sum('credit'); $balanced = abs($debit - $credit) < 0.005; $currency = $voucher->entries->first()?->currency ?: 'BDT'; $money = fn ($v) => number_format((float) $v, 2); @endphp @section('doc_badge') {{ $voucher->status ?: 'draft' }} @endsection @section('document')
Voucher date
{{ $voucher->voucher_date->format('d M Y') }}
Source
{{ $voucher->source_type ? ucfirst(str_replace('_', ' ', $voucher->source_type)).($voucher->source_id ? ' #'.$voucher->source_id : '') : 'Manual entry' }}
Prepared by
{{ $voucher->preparedBy?->name ?? '—' }}
Posted
{{ $voucher->posted_at?->format('d M Y, H:i') ?? 'Not posted' }}
@if ($voucher->narration)
Narration
{{ $voucher->narration }}
@endif

Entries {{ $voucher->entries->count() }} {{ Str::plural('line', $voucher->entries->count()) }} · {{ $currency }}

@foreach ($voucher->entries as $i => $e) @endforeach
# Account Memo Debit Credit
{{ $e->line_no ?: $i + 1 }} {{ $e->account?->account_name ?? '—' }} @if ($e->account?->account_code)
{{ $e->account->account_code }}@if ($e->account->account_type) · {{ ucfirst($e->account->account_type) }}@endif
@endif
{{ $e->memo ?: '—' }} {{ (float) $e->debit > 0 ? $money($e->debit) : '' }} {{ (float) $e->credit > 0 ? $money($e->credit) : '' }}
Total {{ $money($debit) }} {{ $money($credit) }}
@unless ($balanced)

Debits and credits differ by {{ $currency }} {{ $money(abs($debit - $credit)) }}. This voucher is not balanced.

@endunless
{{-- Signature block for the paper file --}}
@foreach (['Prepared by' => $voucher->preparedBy?->name, 'Checked by' => null, 'Approved by' => $voucher->approvedBy?->name] as $label => $name)
{{ $label }}
{{ $name ?? ' ' }}
@endforeach
@endsection @section('doc_footer') Accounting record · {{ $voucher->voucher_no }} @endsection