This is not an easy problem. The board of full of partners, or you can buy some time as a professional service and we can help you fix that. It will require a deep understanding of SQL to make that happen.
All that said, which is the path of least resistance, and if I understand the issue. The items total on an invoice comes from the Detail query source and uses this:
formatMoney(round((invcitem_billed * invcitem_qty_invuomratio) * (invcitem_price / COALESCE(invcitem_price_invuomratio,1)),2))
The group footer uses a summary function for the tax( in the default, not sure if yours has been changed?), you will need something like public.calculatetaxdetailline.
This would require some digging and testing to see what exactly would work for your form.
I would think if this was normal, a partner that has done VAT would be jumping in, so I am not sure I fully understand the issues.