payment-report and accrual-report query to find the last date a series of postings had a non/zero balance. This method is a good building block for that.