{{ __('tenants.collection_report') }}

@if ($startDate && $endDate)
Period: {{ \Carbon\Carbon::parse($startDate)->format('d M Y') }} - {{ \Carbon\Carbon::parse($endDate)->format('d M Y') }}
@endif @foreach ($clients as $client) @php $amountPaid = $client->rentPayments->sum('amount_paid'); $paymentMonths = collect( json_decode($client->rentPayments->pluck('payment_month')->first() ?? '[]'), ); $expectedAmount = $client->amount * $paymentMonths->count(); $balance = $expectedAmount - $amountPaid; @endphp @endforeach
{{ __('tenants.th_name') }} {{ __('tenants.type') }} {{ __('tenants.contact') }} Expected Amount Amount Paid Balance Payment Month Status
{{ $client->name }} {{ ucfirst($client->type) }} {{ $client->contact }} {{ number_format($expectedAmount) }} {{ number_format($amountPaid) }} {{ number_format($balance) }} {{ $paymentMonths->implode(', ') }} {{ $amountPaid >= $expectedAmount ? 'Paid' : 'Pending' }}