I'm building a SaaS tool for SMBs on top of Business Central and I'm trying to compute granular aging metrics. What I'd like to retrieve is:
For a historic date,
For each customer,
For each invoice,
The amount due to that invoice and the number of days overdue, if any, at the time of reference ("historic date").
Or said another way: "How much did each customer on a given date owe, and how out of date are each of those remaining balances?"
What I've tried:
I can get historic data from companies({id})/agedAccountsReceivables, but it's already aggregated by time bucket and grouped by customer.
The AgedAccountsReceivable report in the UI with "Print Detail" turned on gives me a little more detail, with individual invoices, but still time bucketed.
I've read discussion about posting custom API pages, but given my SaaS app will be multi-tenant and connecting via application credentials, I'm wary of any solution that would require each of my users to do this.
Individual invoice records include amount due and due date, but can't be evaluated from a historical view ("How much of this was paid at the end of last month?").
I've looked at computing this manual from customer ledgers, but this approach feels fraught with complexity and I'd much rather rely on Microsoft computing balance.