Billing reports
A billing report calculates the fees of your firm's accounts and households for one billing period. The console shows billing reports on the Billing Reports tab of the Billing page.
After you create a billing report, AdviceCloud calculates its fees in the background. The billing report starts with the status pending, and changes to complete when its figures are ready, or to failed. The console shows a complete billing report as a draft. To check it, call Get a billing report.
When the figures of a draft are final, call Finalize a billing report. A finalized billing report cannot be deleted or changed back to a draft. Finalizing starts the finalize workflow, which runs its steps in order in the background: snapshot_values stores the billing figures of each household, and publish_to_slant publishes them, with a note, to the household's Slant record. To follow the finalize workflow, call Get the finalize workflow of a billing report. To start again at the step that did not succeed, call Re-run the finalize workflow of a billing report.
List billing reports
Returns your firm's billing reports in the order they were created, without the ones whose status is `failed` or `canceled`. Each billing report in the list has `households` as `[]`: to see the households and accounts of a billing report, call **Get a billing report**.
Create a billing report
Creates a billing report for the billing period from `startDate` to `endDate`, and calculates its fees in the background, as Run Billing does in the console. Send `periodType` `standard` for a standard billing cycle, as Firm-Wide Billing does, or `custom` for a custom dated billing cycle, as One-Off Billing does. Send `householdIds` to bill only those households; leave it out to bill every household and account that has a fee structure. Returns the billing report with the status `pending` and `households` as `[]`. To see its fees, call **Get a billing report** until its status is `complete`.
Get a billing report
Returns the billing report with the given ID, with its households and the accounts of each household. `households` is `[]` until AdviceCloud has calculated the fees. If your firm has no billing report with that ID, the response is `404`.
Delete a billing report
Deletes the billing report with the given ID, with its households, accounts, billing splits and invoices. Returns `200` with `deleted: true`. A finalized billing report cannot be deleted; nothing is deleted. If your firm has no billing report with that ID, the response is `404`.
Finalize a billing report
Finalizes the billing report with the given ID: its figures become final, and AdviceCloud starts its finalize workflow in the background. Only a billing report with the status `complete` can be finalized; for any other status, including `finalized`, nothing changes. A finalized billing report cannot be deleted or changed back to a draft. If `workflowStarted` is `false`, call **Re-run the finalize workflow of a billing report** to start the finalize workflow. If your firm has no billing report with that ID, the response is `404`.
Get the finalize workflow of a billing report
Returns the steps of the finalize workflow of the billing report with the given ID, in the order they run, each with every attempt at it. The `publish_to_slant` step also has `counts`, its progress in households; `counts` is `null` on every other step. `stepToRerun` is the step that **Re-run the finalize workflow of a billing report** starts. A billing report that is not finalized has no attempts. If your firm has no billing report with that ID, the response is `404`.
Re-run the finalize workflow of a billing report
Starts a new attempt at the first step of the finalize workflow of the billing report with the given ID whose latest attempt did not succeed, and returns that step as `restartedStep`. The step runs in the background. Each attempt that is still `running` is marked `abandoned` first, so call this operation only when an attempt has failed, or when a `running` attempt has stopped: its `updatedTime` no longer changes. When every step has succeeded, nothing starts and `restartedStep` is `null`. The billing report must have the status `finalized`; for any other status, nothing changes. If your firm has no billing report with that ID, the response is `404`.