Java · 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.java. It reads September's profit and loss and balance sheet:
Statements.java
// Statements.java - reads September's profit and loss and balance sheet.
import com.fasterxml.jackson.databind.JsonNode;
import java.util.LinkedHashMap;
import java.util.Map;
public class Statements {
public static void main(String[] args) throws Exception {
Map<String, String> statements = new LinkedHashMap<>();
statements.put("profit-loss", "Profit and loss");
statements.put("balance-sheet", "Balance sheet");
for (Map.Entry<String, String> statement : statements.entrySet()) {
Brizo.Answer answer = Brizo.call("GET", "/organisations/" + Brizo.COMPANY_ID + "/statements/" + statement.getKey() + "?period=2026-09");
if (answer.status() != 200) {
System.out.println("Refused (" + answer.status() + "): " + answer.body().path("message").asText());
return;
}
System.out.println(statement.getValue() + ", September 2026");
for (JsonNode row : answer.body().path("data")) {
System.out.println(String.format(" %-26smonth %12s balance %12s", row.path("section").asText(),
Brizo.money(row.path("movement")), Brizo.money(row.path("balance"))));
}
}
}
}2Run it
gradle -q run -Pmain=StatementsCheck
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.
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=BudgetorForecast- the plan.currency=USD- presented in another currency the group holds rates for.
Want more detail? See the documentation