{{ __('Cheques') }}

@include('accounting.partials.nav') @php $activeTab = $tab ?? request('tab', 'summary'); if (!in_array($activeTab, ['summary', 'create', 'cleared', 'returned'], true)) { $activeTab = 'summary'; } $tabBase = url('/accounting/cheques'); $viewMode = (string) request('view', 'list'); if (!in_array($viewMode, ['list', 'card'], true)) { $viewMode = 'list'; } // Bank logo map for previews (create + lists) $pvBankLogosAll = [ 'BOC' => asset('image/bank/bank_of_ceylon.png'), 'Commercial' => asset('image/bank/commercial_bank.png'), 'DFCC' => asset('image/bank/dfcc_bank.png'), 'HNB' => asset('image/bank/hatton_national_bank.png'), 'NSB' => asset('image/bank/national_savings_bank.png'), 'NDB' => asset('image/bank/ndb_bank.png'), "People's" => asset("image/bank/people's_bank.png"), 'Sampath' => asset('image/bank/sampath_bank.png'), 'Seylan' => asset('image/bank/seylan_bank.png'), 'Union' => asset('image/bank/union_bank.png'), ]; @endphp @if($activeTab === 'create')

{{ isset($editCheque) && $editCheque ? 'Edit Cheque' : 'Create Cheque' }}

@php $isEdit = isset($editCheque) && $editCheque; $hasLinkedParty = $isEdit && ((int) ($editCheque->customer_id ?? 0) > 0 || (int) ($editCheque->supplier_id ?? 0) > 0 || (int) ($editCheque->person_account_id ?? 0) > 0); $editRecipientLabel = ''; if ($isEdit) { if (($editCheque->direction ?? 'issue') === 'issue') { if ((int) ($editCheque->supplier_id ?? 0) > 0) { $editRecipientLabel = 'Supplier: '.($editCheque->supplier?->supplier_name ?? $editCheque->payee ?? '').' (#'.(int) $editCheque->supplier_id.')'; } elseif ((int) ($editCheque->person_account_id ?? 0) > 0) { $editRecipientLabel = 'Counterparty: '.($editCheque->personAccount?->name ?? $editCheque->payee ?? '').' (Account #'.(int) $editCheque->person_account_id.')'; } } else { if ((int) ($editCheque->customer_id ?? 0) > 0) { $editRecipientLabel = 'Customer: '.($editCheque->customer?->name ?? $editCheque->payee ?? '').' (#'.(int) $editCheque->customer_id.')'; } elseif ((int) ($editCheque->person_account_id ?? 0) > 0) { $editRecipientLabel = 'Counterparty: '.($editCheque->personAccount?->name ?? $editCheque->payee ?? '').' (Account #'.(int) $editCheque->person_account_id.')'; } } $editRecipientLabel = trim($editRecipientLabel); } @endphp @if (session('status'))
{{ session('status') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @if ($errors->any())
Please fix the following:
    @foreach ($errors->all() as $err)
  • {{ $err }}
  • @endforeach
@endif
@csrf @if($isEdit) @method('PUT') @endif
@php $ct = old('cheque_type', $isEdit ? (string) ($editCheque->cheque_type ?? 'crossed') : 'crossed'); @endphp
@foreach(($suppliers ?? []) as $s) @php $due = (float) (($supplierDue ?? [])[(int) $s->supplier_id] ?? 0); $label = trim((string) ($s->supplier_name ?? '')); $mobile = $s->supplier_mobile ? ('0'.(string)$s->supplier_mobile) : ''; @endphp @endforeach @foreach(($personAccounts ?? []) as $p) @php $bal = (float) (($personBalances ?? [])[(int) $p->id] ?? 0); @endphp @endforeach @foreach(($customers ?? []) as $c) @php $due = (float) ($c->credit_balance ?? 0); @endphp @endforeach @foreach(($personAccounts ?? []) as $p) @php $bal = (float) (($personBalances ?? [])[(int) $p->id] ?? 0); @endphp @endforeach
Select Supplier/Customer/Counterparty (optional).
@php $recvBankOptions = ['BOC', 'Commercial', 'DFCC', 'HNB', 'NSB', 'NDB', "People's", 'Sampath', 'Seylan', 'Union', 'Other']; $recvBankCurrent = (string) old('received_bank_name', $isEdit ? (string) ($editCheque->received_bank_name ?? '') : ''); $recvKnown = in_array($recvBankCurrent, $recvBankOptions, true) && $recvBankCurrent !== 'Other'; $recvSelect = (string) old('received_bank_select', $recvKnown ? $recvBankCurrent : ($recvBankCurrent !== '' ? 'Other' : 'BOC')); $recvOther = (string) old('received_bank_other', $recvKnown ? '' : $recvBankCurrent); @endphp
@error('received_bank_select')
{{ $message }}
@enderror
@error('received_bank_other')
{{ $message }}
@enderror
@if(isset($editCheque) && $editCheque) Cancel @endif
Cheque Preview
Live preview for entertainment (not an actual printable cheque).
Cheque
Date
Pay
Cash
Rupees
 
Cheque No
 
@php $pvLocationLogoUrl = ''; if (isset($currentLocation) && $currentLocation && !empty($currentLocation->logo)) { $pvLocationLogoUrl = asset('storage/' . $currentLocation->logo); } @endphp @if($pvLocationLogoUrl) Signature @else   @endif
@endif @if($activeTab === 'summary' || $activeTab === 'cleared' || $activeTab === 'returned')

@if($activeTab === 'cleared') Cleared Cheques @elseif($activeTab === 'returned') Returned Cheques @else Upcoming Cheques @endif

Clear
@php $q = request()->query(); $q['tab'] = $activeTab; $qList = $q; $qList['view'] = 'list'; $qCard = $q; $qCard['view'] = 'card'; @endphp
@if($activeTab === 'summary') @php $issue = $pendingPreview['issue'] ?? null; $recv = $pendingPreview['receive'] ?? null; $issueAmt = $issue ? (float) $issue->total_amount : 0; $recvAmt = $recv ? (float) $recv->total_amount : 0; $issueCnt = $issue ? (int) $issue->total_count : 0; $recvCnt = $recv ? (int) $recv->total_count : 0; @endphp
Pending Issue Amount
{{ number_format($issueAmt, 2) }}
{{ $issueCnt }} cheques
Pending Receive Amount
{{ number_format($recvAmt, 2) }}
{{ $recvCnt }} cheques
@endif @if(($viewMode ?? 'list') === 'card')
@forelse($cheques ?? [] as $cheque)
@include('accounting.partials.cheque_preview', ['cheque' => $cheque, 'activeTab' => $activeTab, 'pvBankLogosAll' => $pvBankLogosAll, 'currentLocation' => $currentLocation ?? null, 'mode' => 'card'])
@empty
No cheques found.
@endforelse
@else
@forelse($cheques ?? [] as $cheque) @php $party = ''; if (($cheque->direction ?? 'issue') === 'issue') { $party = $cheque->supplier?->supplier_name ?: ($cheque->personAccount?->name ?: ($cheque->payee ?? '')); } else { $party = $cheque->customer?->name ?: ($cheque->personAccount?->name ?: ($cheque->payee ?? '')); } $releaseDate = (string) ($cheque->clear_date ?? ''); $defaultClearAt = $releaseDate !== '' ? $releaseDate : now()->toDateString(); @endphp @empty @endforelse
Actions Cheque No. Bank Account Party Amount Status
@if($activeTab === 'summary') @elseif($activeTab === 'returned') @else @endif {{ $cheque->cheque_no ?? 'N/A' }} {{ $cheque->account->name ?? $cheque->bank_name }} {{ $party }} {{ number_format($cheque->amount, 2) }} @if($cheque->direction === 'issue') Issue @elseif($cheque->direction === 'receive') Receive @endif
No cheques found.
@endif @if($activeTab === 'summary' || $activeTab === 'returned' || $activeTab === 'cleared') @if($activeTab === 'summary') @endif @endif @if(isset($cheques))
{{ $cheques->links() }}
@endif
@endif