Closing Balance and the Statement Agree
The vendor’s balance was computed as the total of the aging buckets. That answers what is open and how old is it, not what is this vendor’s balance, and the two agree only while the ledger holds nothing the buckets cannot see: an opening balance is not a transaction, an invoice with no due date is skipped outright, an unallocated payment or advance has no bucket at all, and a posted adjustment note that reduced the payable in the general ledger was invisible in the balance.
Separately, the statement’s running balance left TDS out, so the card and the last row of the grid disagreed by exactly the tax withheld.
Both now accumulate opening plus credits less debits less TDS, so the card and the bottom of the statement are the same figure by construction. The buckets stay what they always were: an aging of what is still open.
A negative closing balance is now possible and correct — it is a vendor sitting in advance, which a bucket total could not express. The KPI row reconciles too: TDS, debit-note and credit-note cards appear when non-zero, and Total Payment counts payments and advances rather than every debit.
Administrators: rebuild_vendor_ledger_balances recomputes the stored values per tenant, reporting by default. On one tenant it corrected 53 closing balances, 33 of which revealed vendor advances nobody could see.
Finance
Global