No brother, you are simply redistributing the proportion of what is item price and what is tax, but this will give you nonsense numbers.

We are not doing math for number’s sake, the numbers actually stand for something.

If you take the example from before:

-price: 100 euro

-discount: 10 euro discount

-taxes: 19% taxes

You’ll never be able to obtain the numbers you gave from the actual data:

In my price book, this item minus the discount should be 90 (100-10), but in the result I get 91,60 euro. What is 91,60? What does it stand for?

In my price book, this item should be sold for 100, but I’m selling it for 101,60 if I remove the discount… What is 101,60?

The result is different from the sum of the parts.

In the current Italian e-invoice XML, I have to specify the tax base, and if I put the number that IP gives me it will be wrong.

For reasons like this, like @ComputingFroggy said, in most countries, you cannot discount after-tax, period.

If you do solve both ways, it’s clear that with this system you are taxing the wrong amount, look:

Step 1:

Before tax: ((100 - 10) + ((100 - 10) / 100 * 19)) = 107.1 euro

After tax: ((100 + (100 / 100 * 19)) - 10) = 109 euro

Step 2:

Before tax: (90 + (90 / 100 * 19)) = 107.1 euro

After tax: (90 + (100 / 100 * 19)) = 109 euro

The tax bases are both 90, but you are taxing in the second case the full amount and not the discounted amount.

The difference between the two prices is the 1.9 euro in excess you are adding, look:

Difference: ((100 - 90) / 100 * 19) = 1.9 euro