How to calculate retention Tax, based on Total Tax
I'm just trying to figure it out how to calculate this Tax, not really sure how to do it, so please let me explain what we need with an example.
When we send an invoice it happens the following:
- Lets say we charge $100 to a customer for a service (subtotal)
- Then we add the 12% Sales Tax, this will be $12
- The Total to charge would be $112. (no issues until here)
- But we have customers, that retain 10% of the tax. ($1.2)
- If we add a "10% Retain Tax" to our taxes (as -0.10), it will calculate the 10% of the subtotal ($10), but we need it to calculate the 10% only of the invoice tax total ($1.2)!
How can we manage this?, I tried with the Tax Type: Python Code, where shows me to calculate as "result = price_unit * 0.10", but I'm not able to find the "tax_subtotal" code or correct formula. Based on the technical guide, I even tried with this:
result = (amount_total - price_subtotal_incl) * 0.10
No luck so far, any idea on how to do it?