JavaScript · Track 7 · Tutorial 3 of 5

Read the profit and loss and the balance sheet

Read the statements back the way your reports show them - section by section, the month and the close.

You will needA month sent and recalculated, from the earlier tutorials.
By the endA script that reads both statements for any month, scenario or currency.

1Read the statements

Create statements.mjs. It reads September's profit and loss and balance sheet:

statements.mjs

// statements.mjs - reads September's profit and loss and balance sheet.
import { call, companyId } from './brizo.mjs';

const money = (n) => Number(n).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });

for (const [statement, title] of [['profit-loss', 'Profit and loss'], ['balance-sheet', 'Balance sheet']]) {
    const answer = await call('GET', `/organisations/${companyId}/statements/${statement}?period=2026-09`);
    if (answer.status !== 200) {
        console.log(`Refused (${answer.status}): ${answer.body.message}`);
        process.exit(1);
    }

    console.log(`${title}, September 2026`);
    for (const row of answer.body.data) {
        console.log('  ' + row.section.padEnd(26) + 'month ' + money(row.movement).padStart(12)
            + '   balance ' + money(row.balance).padStart(12));
    }
}
One row per section
A statement answers one row per section: the account types that moved, or that hold a balance.

2Run it

node statements.mjs

Check

One line for each profit and loss section that moved - REVENUE, DIRECT COSTS and EXPENSE for the month you sent - then the balance sheet's sections, ending with CY EARNINGS, the year's earnings so far.

What each row carries
Movement is the month's figure, balance the close - both on the account's own side.

3Which figures these are

A statement answers for the company the address names: your company's own figures. Statements are read after the overnight run, like the trial balance.

4Ask for more

  • number_of_months=12 - the twelve months up to the period.
  • scenario=Budget or Forecast - the plan.
  • currency=USD - presented in another currency the group holds rates for.

Want more detail? See the documentation