@extends('layouts.app') @section('title', $voucher->voucher_number ?? 'Voucher') @section('breadcrumb') @endsection @push('styles') @endpush @section('content') @php [$sbg,$sfg] = $voucher->getStatusColor(); $user = auth()->user(); $totalDebit = $voucher->lines->where('dr_cr','dr')->sum('line_total'); $totalCredit = $voucher->lines->where('dr_cr','cr')->sum('line_total'); $isBalanced = abs($totalDebit - $totalCredit) < 0.01; $extraData = $voucher->extra_data ?? []; $chequeNo = $extraData['cheque_no'] ?? ''; $chequeDate = $extraData['cheque_date'] ?? ''; $paymentMethodLabel = \App\Support\VoucherPaymentMethods::label($extraData['payment_method'] ?? null); $partyName = $partyName ?? null; $partyLabel = $partyLabel ?? null; $company = $company ?? auth()->user()->company; $settings = $settings ?? array_merge(\App\Models\Setting::defaults(), \App\Models\Setting::where('company_id', auth()->user()->company_id)->get()->pluck('value','key')->toArray()); // Signatories from settings $sig1 = $settings['signatory_prepared_by'] ?? 'Prepared By'; $sig2 = $settings['signatory_checked_by'] ?? 'Checked By'; $sig3 = $settings['signatory_custom1'] ?? ''; $sig4 = $settings['signatory_custom2'] ?? ''; $sig5 = $settings['signatory_approved_by'] ?? 'Approved By'; // Currency-aware Amount in Words $grandTotal = (float) ($voucher->grand_total ?? max($totalDebit, $totalCredit)); $amountInWords = \App\Helpers\NumberHelper::amountInWordsForCompany($grandTotal, auth()->user()->company_id); // Voucher title — always append "Voucher" $printTitle = $label . ' Voucher'; // Party label on screen $screenPartyLabel = match($voucherType) { 'cash_payment','bank_payment' => 'Paid To', 'cash_receipt','bank_receipt' => 'Received From', default => null, }; @endphp {{-- ════════════════════════════════════════════════════════════ --}} {{-- SCREEN VIEW --}} {{-- ════════════════════════════════════════════════════════════ --}}
Voucher Details
Voucher No
{{ $voucher->voucher_number }}
Date
{{ $voucher->voucher_date->format('d M Y') }}
@if($chequeNo)
Cheque No
{{ $chequeNo }}
@endif @if($chequeDate)
Cheque Date
{{ \Carbon\Carbon::parse($chequeDate)->format('d M Y') }}
@endif @if($paymentMethodLabel)
Payment Method
{{ $paymentMethodLabel }}
@endif @if($partyName && $screenPartyLabel)
{{ $screenPartyLabel }}
{{ $partyName }}
{{ ucfirst(str_replace('_',' ',$voucher->party_type??'')) }}
@endif @if($voucher->reference)
Reference
{{ $voucher->reference }}
@endif @if($voucher->narration)
Narration
{{ $voucher->narration }}
@endif
Account Lines
@foreach($voucher->lines as $i => $line) @endforeach
# Account Description Debit Credit
{{ $i+1 }}
{{ $line->account->name ?? '—' }}
@if($line->account->code ?? false)
{{ $line->account->code }}
@endif
{{ $line->description ?? '' }} {{ $line->dr_cr==='dr' ? number_format($line->line_total,2) : '' }} {{ $line->dr_cr==='cr' ? number_format($line->line_total,2) : '' }}
Total {{ number_format($totalDebit,2) }} {{ number_format($totalCredit,2) }}
Workflow
@if($voucher->createdBy)@endif @if($voucher->approvedBy)@endif @if($voucher->posted_at)@endif
Status{{ ucfirst($voucher->status) }}
Created By{{ $voucher->createdBy->name }}
Approved By{{ $voucher->approvedBy->name }}
Posted At{{ $voucher->posted_at->format('d M Y H:i') }}
{{-- end screen-only --}} {{-- ════════════════════════════════════════════════════════════ --}} {{-- PRINT AREA --}} {{-- ════════════════════════════════════════════════════════════ --}}
{{-- Status stamp --}} @if($voucher->isCancelled())
CANCELLED
@elseif($isReversed)
REVERSED
@endif {{-- Company Header --}}
@php $printLogoPath = app(\App\Support\BrandLogoManager::class)->localCompanyLogoPath($company); @endphp @if($printLogoPath && is_file($printLogoPath)) @endif

{{ $company->name }}

@if($company->address)

{{ $company->address }}

@endif
@if($company->phone)
Tel: {{ $company->phone }}
@endif @if($company->email)
{{ $company->email }}
@endif @if($company->website)
{{ $company->website }}
@endif
{{-- Title: e.g. "Bank Payment Voucher" --}}
{{ $printTitle }}
{{-- Meta grid --}}
@if($chequeNo)
Check No: {{ $chequeNo }}
@endif @if($paymentMethodLabel ?? null)
Payment Method: {{ $paymentMethodLabel }}
@endif
Voucher No: {{ $voucher->voucher_number }}
@if($chequeDate)
Check Date: {{ \Carbon\Carbon::parse($chequeDate)->format('d-M-y') }}
@endif
Voucher Date: {{ $voucher->voucher_date->format('d-M-y') }}
@if($partyName && $partyLabel)
{{ $partyLabel }}: {{ $partyName }}
@endif @if($voucher->reference)
Reference: {{ $voucher->reference }}
@endif @if($voucher->narration)
Narration: {{ $voucher->narration }}
@endif
{{-- Lines --}} @foreach($voucher->lines as $line) @endforeach
Account Name & Code Memo Debit Credit
{{ $line->account->name ?? '—' }}{{ ($line->account->code ?? false) ? ' '.$line->account->code : '' }} {{ $line->description ?? '' }} {{ $line->dr_cr==='dr' ? number_format($line->line_total,2) : '' }} {{ $line->dr_cr==='cr' ? number_format($line->line_total,2) : '' }}
Total {{ number_format($totalDebit,2) }} {{ number_format($totalCredit,2) }}
{{-- Amount in Words --}}
Amount in word : {{ $amountInWords }}
{{-- Signatories --}}
{{ $sig1 ?: 'Prepared By' }}
{{ $sig2 ?: 'Checked By' }}
@if($sig3)
{{ $sig3 }}
@endif @if($sig4)
{{ $sig4 }}
@endif
{{ $sig5 ?: 'Approved By' }}
{{-- end print --}} {{-- Modals --}} @endsection