@extends('admin.layouts.wholesale-live')
@section('page-title', 'Parties Ledger')
@push('scripts')@endpush
@section('wholesale-actions')
@if($party && auth()->user()->hasPermission('wholesale.payments'))Receive Payment@endif
@if($report)@endif
@endsection
@section('wholesale-content')
@if($report)
{{ $party->name }} · {{ $party->phone }} {{ $from ?? 'Beginning' }} → {{ $to ?? 'All dates' }} Statement page {{ $report['rows']->currentPage() }} of {{ $report['rows']->lastPage() }} Balance carried into this page: BDT {{ number_format(((int) $report['rows']->first()->balance - (int) $report['rows']->first()->debit + (int) $report['rows']->first()->credit) / 100, 2) }}. Range totals above cover all matching pages.{{ $brand['name'] }} · Party statement
@foreach(['opening' => 'Brought forward', 'debit' => 'Range debit', 'credit' => 'Range credit', 'closing' => 'Closing balance due'] as $key => $label)
@if($report['rows']->first())
@forelse($report['rows'] as $row)
Date Reference / Details Debit (BDT) Credit (BDT) Balance due (BDT)
@empty{{ $row->event_date }}
@if($row->kind === 'opening')Opening due
@elseif($row->kind === 'payment')
@if(auth()->user()->hasPermission('wholesale.payments'))RC{{ str_pad((string) $row->event_id, 6, '0', STR_PAD_LEFT) }}@else RC{{ str_pad((string) $row->event_id, 6, '0', STR_PAD_LEFT) }} @endif
Payment received
@else
WH{{ str_pad((string) $row->event_id, 6, '0', STR_PAD_LEFT) }}{{ $row->kind === 'initial' ? 'Payment with invoice' : 'Wholesale invoice' }}
@endif
{{ number_format($row->debit / 100, 2) }} {{ number_format($row->credit / 100, 2) }} {{ number_format($row->balance / 100, 2) }} @endforelse
No transactions in this date range.
Choose a saved Party to view its ledger.
@endif @endsection