How is the Profit % calculated?

mysamzamysamza Member Posts: 66
On the Sales Order Subform, I have included 2 new field. Cost B and Profit Percentage.
If for Item Bicycle I have added a Cost B to be 75 (LCY) then the profit percentage would be P% = Selling Price - Cost Price / Cost Price * 100
However, this only works if quantity = 1.
How do I factor in the scenario where Quantity > 1.
Here is the code I have written;
modify("Unit Price")
            trigger OnAfterValidate()
                Rec_Items: Record Item;
                rec."Profit Percentage" := ((rec.Amount - (Rec.Quantity * "Cost B")) / (rec.Quantity * "Cost B") ) * 100

Best Answer


Sign In or Register to comment.