| Serial Number |
KAM Name |
Total Clients |
Active Clients |
@php
use App\Models\Pop;
$sumOfTotalClients = 0;
$sumOfActiveClients = 0;
$total_resellers = 0;
@endphp
@foreach ($users as $user)
@php
$all_resellers_ids = $user->resellers()->count();
$resellers_ids = $user->resellers()
->whereBetween('resellers.created_at', [$start, $end])
->pluck('resellers.id');
$pops = Pop::whereIn('reseller_id', $resellers_ids)->pluck('id');
$total_clients = $clients->whereIn('pop_id', $pops)->count();
$active_clients = $clients->whereIn('pop_id', $pops)->where('clients_status', 'active')->count();
$sumOfTotalClients += $total_clients;
$sumOfActiveClients += $active_clients;
$total_resellers += $all_resellers_ids;
@endphp
| {{ $loop->iteration }} |
{{ $user->name }} ({{$all_resellers_ids}}) |
{{ $total_clients }} |
{{ $active_clients }} |
@endforeach
| Total ({{$total_resellers}}) |
{{ $sumOfTotalClients }} |
{{ $sumOfActiveClients }} |