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()
            var
                Rec_Items: Record Item;
            begin
                Rec_Items.Get(Rec."No.");
                rec."Profit Percentage" := ((rec.Amount - (Rec.Quantity * "Cost B")) / (rec.Quantity * "Cost B") ) * 100
            end;
        }

Best Answer

Answers

Sign In or Register to comment.