How is the Profit % calculated?

mysamza
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;
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; }
0
Best Answer
-
No know what exactly "Cost B" mean, but seems it's like "Cost for one Unit"
Error In Your formula
You try (LineAmount - LineCost)/LineCost
usually Profit mean ProfitAmount/LineAmount
and when Quantity and/or "Cost B" will be zero then You will get a DivisionByZero error
in this case take a look how this "Profit %" is calculated in Item table for example
And be sure that Your rec.Amount also contain quantity factor5
Answers
-
No know what exactly "Cost B" mean, but seems it's like "Cost for one Unit"
Error In Your formula
You try (LineAmount - LineCost)/LineCost
usually Profit mean ProfitAmount/LineAmount
and when Quantity and/or "Cost B" will be zero then You will get a DivisionByZero error
in this case take a look how this "Profit %" is calculated in Item table for example
And be sure that Your rec.Amount also contain quantity factor5
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions