@extends('garage.layouts.app') @section('title', 'Sub-ledger statement') @section('content') @php $bal = 0.0; $totalDr = 0.0; $totalCr = 0.0; $name = trim(($sub->sub_code ? $sub->sub_code.' · ' : '').($sub->title ?? 'Sub-ledger')); $parent = trim(($sub->customer_ledger_code ? $sub->customer_ledger_code.' · ' : '').($sub->customer_ledger_name ?? '')); $print = request()->boolean('print'); foreach ($rows as $rr) { $d = $rr->transaction_type === 'debit' ? (float) $rr->amount : 0.0; $c = $rr->transaction_type === 'credit' ? (float) $rr->amount : 0.0; $totalDr += $d; $totalCr += $c; $bal += ($d - $c); } $closingAbs = abs($bal); $closingSide = $bal >= 0 ? 'Dr' : 'Cr'; $runBal = 0.0; @endphp
| Date | Voucher | Type | Ledger | Ref | Dr | Cr | Balance | Narration |
|---|---|---|---|---|---|---|---|---|
| {{ $r->voucher_date }} | {{ $r->voucher_no }} | {{ $r->voucher_type }} | {{ $ledgerLine !== '' ? $ledgerLine : '—' }} | @include('garage.reports.partials.statement-reference-cell', ['row' => $r]) | {{ $dr ? number_format($dr, 2) : '—' }} | {{ $cr ? number_format($cr, 2) : '—' }} | {{ number_format(abs($runBal), 2) }} {{ $runBal >= 0 ? 'Dr' : 'Cr' }} | {{ $r->narration ?: '—' }} |
| No transactions. | ||||||||
| Totals | {{ number_format($totalDr, 2) }} | {{ number_format($totalCr, 2) }} | {{ number_format($closingAbs, 2) }} {{ $closingSide }} | Closing balance | ||||