@extends('garage.layouts.app') @section('title', 'View Voucher') @section('content') @php $typeColors = [ 'journal' => 'primary', 'receipt' => 'success', 'payment' => 'danger', 'contra' => 'info' ]; $typeColor = $typeColors[$voucher->voucher_type] ?? 'secondary'; $statusColors = [ 'draft' => 'warning', 'posted' => 'success', 'cancelled' => 'danger' ]; $statusColor = $statusColors[$voucher->status] ?? 'secondary'; $totalDebit = 0; $totalCredit = 0; @endphp
| # | Ledger | Type | Amount | Narration |
|---|---|---|---|---|
| {{ $index + 1 }} |
@if(!empty($transaction->garage_ledger_id))
{{ $transaction->ledger_name }}
@else
{{ $transaction->ledger_name }}
@endif
@if(!empty($transaction->sub_ledger_code) || !empty($transaction->sub_ledger_title))
/
@if(!empty($transaction->garage_sub_ledger_id))
{{ trim(($transaction->sub_ledger_code ?? '').' '.($transaction->sub_ledger_title ?? '')) }}
@else
{{ trim(($transaction->sub_ledger_code ?? '').' '.($transaction->sub_ledger_title ?? '')) }}
@endif
@endif
@if($transaction->ledger_code)
Code: {{ $transaction->ledger_code }}
@endif
|
@if($transaction->transaction_type === 'debit') Dr @else Cr @endif | PKR {{ number_format($transaction->amount, 2) }} | {{ $transaction->narration ?? '—' }} |
| Debit | PKR {{ number_format($totalDebit, 2) }} | |||
| Credit | PKR {{ number_format($totalCredit, 2) }} | |||
| Balance | PKR {{ number_format(abs($totalDebit - $totalCredit), 2) }} {{ abs($totalDebit - $totalCredit) < 0.01 ? '(Balanced)' : '(Unbalanced)' }} | |||