Calculating affiliate commisions excluding taxes

I sell the products including the taxes. But I want affiliate commisions to be calculated excluding taxes. (after the all of the tax is excluded.)

So, suppose that the product price including taxes is $100 and an affiliate sold that product. In this way, I want the affiliate commision to be calculated after excluding taxes. Suppose that the affiliate commision is %10. In this way, the commision should be calculated based on excluding taxes. Suppose that tax is %18. Then, the commision shloud be calculated after the tax excludes. So, 100 - 18 = $82

Affiliate commision is: 82 * 10 / 100 = $8,2

I hop I could tell my request. I need help.

Any idea?