{{-- ✅ Filters --}}
{{-- ✅ KPI --}}
Opening Balance
{{ number_format($openingBalance, 2) }}
Debit (Sale)
{{ number_format($periodDebit, 2) }}
Credit (Received/Return/Advance/Other)
{{ number_format($periodCredit, 2) }}
Closing Balance
{{ number_format($closingBalance, 2) }}
{{-- ✅ Ledger Table --}}
| # |
Date |
Customer |
CUR |
Type |
Ref |
Debit |
Credit |
Running |
Action |
{{-- ✅ Opening row --}}
| Opening Balance |
{{ number_format($openingBalance, 2) }} |
|
@php $running = (float)$openingBalance; @endphp
@forelse($rows as $k => $r)
@php
$debit = (float) ($r->bill_total ?? 0);
$credit = (float) ($r->amount ?? 0);
$running = $running + $debit - $credit;
$type = $trxTitles[$r->transaction_id] ?? ('TID-'.$r->transaction_id);
// ✅ route mapping (safe by Route::has)
$link = null;
if ((int)$r->transaction_id === 1 && Route::has('customer_bill.show')) {
$link = route('customer_bill.show', $r->module_rid);
}
elseif ((int)$r->transaction_id === 2 && Route::has('customer_recieved.show')) {
$link = route('customer_recieved.show', $r->module_rid);
}
// elseif ((int)$r->transaction_id === 3 && Route::has('customer_return_bill.show')) {
// $link = route('customer_return_bill.show', $r->module_rid);
// }
elseif ((int)$r->transaction_id === 4) {
if (Route::has('customer_advance.show')) {
$link = route('customer_advance.show', $r->module_rid);
} elseif (Route::has('customer_advance.edit')) {
$link = route('customer_advance.edit', $r->module_rid);
}
}
@endphp
|
{{-- for paginator --}}
{{ method_exists($rows,'firstItem') ? ($rows->firstItem() + $k) : ($k+1) }}
|
{{ $r->date }} |
{{ $r->customer->name ?? '-' }} |
{{ $r->currency->title_en ?? '-' }} |
@if((int)$r->transaction_id === 1)
{{ $type }}
@elseif((int)$r->transaction_id === 2)
{{ $type }}
@elseif((int)$r->transaction_id === 3)
{{ $type }}
@elseif((int)$r->transaction_id === 4)
{{ $type }}
@else
{{ $type }}
@endif
|
{{ $r->module_rid }} |
{{ number_format($debit, 2) }} |
{{ number_format($credit, 2) }} |
{{ number_format($running, 2) }} |
@if($link)
View
@else
-
@endif
|
@empty
| No data found |
@endforelse
{{-- Pagination --}}
{{ $rows->links('pagination::bootstrap-4') }}
{{-- ✅ Print Footer Branding --}}