@extends('layouts.portal') @section('title', 'Clients Report') @section('page_title', 'Clients Report') @section('page_subtitle', 'Detailed client information with will status and payment details') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'reports-master']) @endsection @section('content')
Total Clients: {{ $clients->total() }}
| Client Name | Phone | IC Number | Address | Created By | Will Type | Status | Versions | Last Version Date | Changed By | Subtotal | Discount | Tax | Total Invoice | Paid | Payment Status | Paid Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{ $client['name'] }} | {{ $client['email'] }} | {{ $client['phone'] ?? 'N/A' }} | {{ $client['ic_number'] ?? 'N/A' }} | {{ $client['address'] }} | {{ $client['created_by'] }} ({{ $client['created_by_role'] }}) | @endif{{ $will['type'] }} | @if($will['status'] === 'completed') {{ ucfirst($will['status']) }} @elseif($will['status'] === 'approved') {{ ucfirst($will['status']) }} @elseif($will['status'] === 'pending') {{ ucfirst($will['status']) }} @else {{ ucfirst($will['status']) }} @endif | {{ $will['versions_count'] }} | @if($will['last_version_date']){{ $will['last_version_date']->format('d M Y H:i') }}@else—@endif | {{ $will['last_version_by'] }} | RM {{ number_format($will['subtotal'] ?? 0, 2) }} | -RM {{ number_format($will['discount_amount'] ?? 0, 2) }} | +RM {{ number_format($will['tax_amount'] ?? 0, 2) }} | RM {{ number_format($will['total_invoiced'], 2) }} | RM {{ number_format($will['total_paid'], 2) }} | @if($will['total_invoiced'] === 0) No Invoice @elseif($will['is_paid']) ✓ Paid @else Pending @endif | @if($will['paid_date']){{ $will['paid_date']->format('d M Y H:i') }}@else—@endif |
| {{ $client['name'] }} | {{ $client['email'] }} | {{ $client['phone'] ?? 'N/A' }} | {{ $client['ic_number'] ?? 'N/A' }} | {{ $client['address'] }} | {{ $client['created_by'] }} ({{ $client['created_by_role'] }}) | No wills created | |||||||||||
| No clients found | |||||||||||||||||
Total Clients
{{ $clients->total() }}
Total Wills
{{ $clients->sum('wills_count') }}
Total Subtotal
RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('subtotal')), 0) }}
Total Discount
-RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('discount_amount')), 0) }}
Total Tax
+RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('tax_amount')), 0) }}
Total Invoiced
RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('total_invoiced')), 0) }}
Total Paid
RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('total_paid')), 0) }}
Pending
RM {{ number_format($clients->sum(fn($c) => $c['wills']->sum('total_invoiced') - $c['wills']->sum('total_paid')), 0) }}