| Agent ID |
Agent Name |
Total Collection |
Total Commission |
';
$grandTotalCommission = 0;
$grandTotalCollection = 0;
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$collection = $row["total_amount"];
$commission = ($collection * $row["comi_rate"]) / 100;
$grandTotalCollection += $collection;
$grandTotalCommission += $commission;
echo "
| ".$row["user_id"]." |
".$row["user_name"]." |
".number_format($collection,2)." |
".number_format($commission,2)." |
";
}
} else {
echo "| No agents found |
";
}
echo '
';
// ---- if admin/bm then show grand total ----
if ($loginType !== 'agent') {
echo '
Grand Total Collection : '.number_format($grandTotalCollection,2).'
Grand Total Commission : '.number_format($grandTotalCommission,2).'
';
}
echo '