Withheld tax in payments module

Hello everyone!

I need to be able to add a line item in the payments entry window for withheld tax and then subtract that amount from the total invoice amount and reflect the result as the amount paid. Which file and how do I achieve this?

Thanks for the help!!

You can find all the used code in /appplication/modules/payments/