Trial Balance Report

Trial Balance reports can be generated by passing a Report message to the ReportController with the report name and effective date:

{
  "name": "trialBalance",
  "toDate": "2001-02-28"
}

The returned result has the form:

{
  "report": {
    "request": {
      "currency": "CAD",
      "domain": {
        "code": "CORP",
        "uuid": "dc93f99f-49b4-4e6b-87d2-1e3c3941d6ff"
      },
      "name": "trialBalance",
      "options": {
        "language": [
          "en"
        ]
      },
      "toDate": "2001-02-28T18:27:47.000000Z"
    },
    "accounts": [
      {
        "balance": "0.00",
        "category": true,
        "code": "1000",
        "credit": false,
        "creditBalance": "",
        "currency": "CAD",
        "debit": true,
        "depth": 1,
        "debitBalance": "0.00",
        "ledgerUuid": "e8a09512-8a31-423c-a65d-c1de25871cd1",
        "name": "Assets",
        "parent": "",
        "total": "3263.59"
      }
    ],
    "domain": {
      "code": "CORP",
      "uuid": "dc93f99f-49b4-4e6b-87d2-1e3c3941d6ff",
      "name": "Your Enterprise Name Here Inc."
    }
  },
  "time": "2001-03-01T18:27:48.631273Z"
}

The creditBalance and debitBalance strings can be formatted for display purposes using options on the report request.

Report requests can also specify the ledger domain and currency to override defaults:

{
  "name": "trialBalance",
  "currency": "USD",
  "domain": "MYDOMAIN",
  "toDate": "2001-02-28"
}

Report API options

The application can limit the level of detail in the report by setting the maximum nesting depth in the ledger configuration:

// in config/ledger.php
'reportApiOptions' => [
    'trialBalance' => [
        'maxDepth' => 3,
    ],
],

Balances for accounts that are nested more deeply than the maximum are rolled up into the parent account's total attribute.

Report request options

Report options are passed via the options property:

Name Type Description
decimal string The separator between the whole and fractional part of amounts (default is ",")
depth int The maximum depth of nested ledger accounts to report on. This value is limited by the maxDepth report API option.
format string If set to "raw", then account information is returned unformatted and without account names
negative string How to display negative numbers, either "-" or "(". If "(" negative numbers will be enclosed in parentheses. Default is "-".
language string or array The language to use when returning account names. If an array is passed then language matches are performed in the order passed. If absent, then the domain's default language is used.
thousands string The separator between thousands in the whole part of amounts (default is "")

Sample request with options:

{
  "name": "trialBalance",
  "currency": "USD",
  "options": {
    "depth": 4,
    "language": ["en-CA", "en"]
  },
  "toDate": "2001-02-28"
}