<?php
ob_start();
require __DIR__.'/../../../../api/reports/customer_aging.php';
$response = ob_get_clean();

$data = json_decode($response,true);
$rows = $data['data'];
?>

<h2>Customer Aging</h2>

<table border="1" cellpadding="8">
<tr>
<th>Customer</th>
<th>Account</th>
<th>Total Outstanding</th>
</tr>

<?php foreach($rows as $r): ?>
<tr>
<td><?= $r['customer'] ?></td>
<td><?= $r['account'] ?></td>
<td>R <?= number_format($r['total'],2) ?></td>
</tr>
<?php endforeach; ?>

</table>