PHP · Track 7 · Tutorial 4 of 5
Drill into an account, and read the cash flow
Go a level deeper: open a statement section into its accounts, and read the cash flow line by line.
You will needThe statements script from Read the profit and loss and the balance sheet.
By the endAccount-level figures for any section, and the cash flow as your reports show it.
1Open a section
Add detail=1 and a section to a statement read, and it answers that section's accounts instead of the sections. Each account carries one figure per month asked for.
2Read revenue by account, and the cash flow
Create account-detail.php:
account-detail.php
<?php
// account-detail.php - opens the REVENUE section account by account, then reads the cash flow.
require __DIR__ . '/brizo.php';
$detail = call('GET', "/organisations/$companyId/statements/profit-loss?period=2026-09&number_of_months=3&detail=1§ion=REVENUE")['body'];
echo 'Revenue by account, ' . implode(', ', $detail['months']) . ":\n";
foreach ($detail['data'] as $account) {
echo " {$account['code']} {$account['name']}: " . implode(' / ', array_map(fn ($v) => number_format($v, 2), $account['movement'])) . "\n";
}
$cash = call('GET', "/organisations/$companyId/statements/cash-flow?period=2026-09&is_ytd=1")['body'];
echo "\nCash flow, {$cash['period']} ({$cash['basis']}):\n";
foreach ($cash['lines'] as $line) {
echo ' ' . str_pad($line['title'], 40) . number_format((float) $line['value'], 2) . "\n";
}
3Run it
php account-detail.phpCheck
First the revenue accounts with a figure for each of the three months, then the cash flow's lines for the year to date. basis says whether you asked for the month or the year to date.
4Good to know
- The section has to be one of the statement's own: ask the balance sheet for
REVENUEand the answer lists the sections it does have. - The cash flow's lines and their order come from the group's own cash flow report, so they match what the screen shows.
Want more detail? See the documentation