The tax is calculated based on the individual invoice lines.
The amount of all invoice lines with the same tax code are consolidated, and based on this amount the tax amount is calculated.
The tax amount for internal invoices, Invoicing and Accounts Payable is calculated by tax code or by line.