I currently have the below Business Rule activated on Opportunity Product, which is intended to apply the discount correctly to all items in the line, then calculate and update the Tax field for that Opportunity Product based on the final price of the line. It doesn't show in the screenshot, but the Scope of the rule is Entity.
The final price on the line before tax is (Price Per Unit - Manual Discount) * Quantity, and Tax is 10% of that amount.
The intention of this is to automatically calculate the Tax on a line item when input via the in-line editable view in Opportunity.
It generally works correctly and as intended, apart from two issues.
1. The Extended Amount on any line is wrong: http://prnt.sc/cai2j2
On the first line the Tax amount is calculated to be $22.50, which appears to be removed from the total for the Extended Amount instead of added to it. Same again on the second line, the tax of $200 per quantity is removed from the total to make the Extended Amount. This only messes up the Extended Amount though, the final calculations for the Total Tax and Total Amount at the bottom of the Products area is correct.
2. The Business Rule doesn't run correctly when Manual Discount is edited, only Quantity: http://prntscr.com/cai4j5
The first line I entered the manual discount only. The second line I entered the discount, then changed the Quantity to 2 then back to 1. It appears as though the Business Rule doesn't run at all, as the Extended Amount is just the Amount - Discount. I can't confirm this though, as opening the record causes the Business Rule to run properly and update the values.
Has anyone had similar problems before or might know what I'm doing wrong?