I've struggled mightily with the Historical Aged Trial Balance report for years.
The technique is to take all the invoices from the beginning of time, subtract all the payments from the beginning of time, and then display the data.
But, I've yet to find a GP install where all the documents where there. There's always a missing payment, or invoice, or apply record. Always. Then I have to explain to the client why my report doesn't match GPs.
I give up.
Here's the script that GP uses to run this report. That's what I'm using from now on.