@extends('layouts.app') @section('content')
Back to {{ $partyType==='Customer'?'Customers':'Suppliers' }} @if($partyType==='Customer')Invoice Summary@endif
To: {{ $party->name }}
{{ $party->address }}
{{ implode(' | ',array_filter([$party->phone,$party->email])) }}
@if($missingPostings)

{{ $missingPostings }} invoice(s) have no accounting posting in the selected scope. This ledger includes recorded accounting entries only; review those invoices against the invoice summary before relying on the balance.

@endif @if($ownOnly)

Your role limits this ledger to your own invoices and their related payments. This is not the full account ledger.

@endif
@foreach(['opening'=>'Opening Balance','debit'=>'Total Debit','credit'=>'Total Credit','closing'=>'Closing Balance'] as $key=>$label)
{{ $label }}{{ \App\Models\SystemSetting::formatMoney(abs($summary[$key])) }}@if(in_array($key,['opening','closing'])) {{ $summary[$key]>0?'DR':($summary[$key]<0?'CR':'') }}@endif
@endforeach @if($partyType==='Customer')
Available Advance (Current){{ \App\Models\SystemSetting::formatMoney($summary['advance']) }}
@endif
@foreach($rows as $row) @if($row['items'])@endif @endforeach
DateReferenceTypeBranchPayment StatusDebitCreditBalancePayment MethodDetails
{{ \Carbon\Carbon::parse($filters['from_date'])->format('d/m/Y h:i a') }}Opening balance brought forward{{ \App\Models\SystemSetting::formatMoney(abs($summary['opening'])) }} {{ $summary['opening']>0?'DR':($summary['opening']<0?'CR':'') }}
{{ $row['date']->format('d/m/Y h:i a') }}{{ $row['reference'] }}
{{ $row['entry_no'] }}
{{ $row['type'] }}{{ $row['branch'] }}{{ ucfirst($row['status']) }}{{ \App\Models\SystemSetting::formatMoney($row['debit']) }}{{ \App\Models\SystemSetting::formatMoney($row['credit']) }}{{ \App\Models\SystemSetting::formatMoney(abs($row['balance'])) }} {{ $row['balance']>0?'DR':($row['balance']<0?'CR':'') }}{{ $row['method'] ?: '-' }}{{ $row['note'] }}
Current invoice items@foreach($row['items'] as $item)@endforeach
ProductQtyUnit PriceTotal
{{ $item['name'] }}{{ $item['quantity'] }}{{ \App\Models\SystemSetting::formatMoney($item['price']) }}{{ \App\Models\SystemSetting::formatMoney($item['total']) }}
Period Totals / Closing Balance{{ \App\Models\SystemSetting::formatMoney($summary['debit']) }}{{ \App\Models\SystemSetting::formatMoney($summary['credit']) }}{{ \App\Models\SystemSetting::formatMoney(abs($summary['closing'])) }} {{ $summary['closing']>0?'DR':($summary['closing']<0?'CR':'') }}

DR: debit balance. CR: credit balance. A customer debit is owed to the business; a supplier credit is owed to the supplier. Available advances are shown separately and enter this receivable ledger when applied.

@endsection