Each product has a discount. I defined its variables as follows:

discount1, discount2, discount3

But there is a different tax for each product when the discount equals 100% (for example) as follows:

tax1, tax2, tax3

I wrote this code and it works well:

Expand|Select|Wrap|Line Numbers

- if discount1 = 100 and discount2 = 100 and discount3 = 100 then
- total_price = price - tax1 - tax2 - tax3
- elseif discount2 = 100 and discount3 = 100 then
- total_price = price - tax2 - tax3
- elseif discount1 = 100 and discount3 = 100 then
- total_price = price - tax1 - tax3
- elseif discount1 = 100 and discount2 = 100 then
- total_price = price - tax1 - tax2
- elseif discount1 = 100 then
- total_price = price - tax1
- elseif discount2 = 100 then
- total_price = price - tax2
- elseif discount3 = 100 then
- total_price = price - tax3
- else
- total_price = price
- end if