Offset sales to and purchases from one party

This sounds a little bit like dunning.
I’ve already done such customization of the invoice template (display customer payable/receivable) but I dislike it because then we store temporary data in the invoice archive. But probably a module that append the customer balance as a next page to the invoice report like Account Invoice Watermark Module will be great.