Adding account vat on payment 7

Moved from https://code.launchpad.net/~domsense/account-payment/adding_account_vat_on_payment_7/+merge/196914
It's hard to tell what is being done in that block (which of itself is a problem due to the monolith of a function).

I suggest looking at that block, seeing what you're trying to do and what objects are being affected and what should be returned. Move that block to a function, pass what you need (`invoice_browse.vat_on_payment`, `line_tup[2]`, etc) and return `line_tup` or raise an exception.

The problem is that it's taking me way too long just to understand the data being manipulated. Imagine what it would be like for a new dev to try and maintain this part. It should be immediately apparent what the code is doing with regards to variable names and function names, not even with comments.