Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

Modify Price/Profit Calculation field on Item Card

Posted on by 8

Hello!

 

I am currently working with a customer that wants a little change on their Item Card page. Below Costs & Posting, there are these two fields: Standard Cost and Unit Cost. Unit Cost is a field I can edit, while Standard Cost is not editable, which is fine.

 

Below Price & Sales, there is another field called Price/Profit Calculation, where I can choose between a couple of options in a dropdown menu. All of these fields are default Business Central fields. Because of the way my customer uses Business Central, they would like to use the Standard Cost field instead of the Unit Cost field in that Calculation when choosing /Profit=Price-Cost/.

 

I have found the field in the packages, and I can see the calculation. Obviously it is read-only, so I am not able to edit this. Here is the code:

 

 

field(19; /Price/Profit Calculation/; Enum /Item Price Profit Calculation/)

       {

           Caption = 'Price/Profit Calculation';

           trigger OnValidate()

           begin

               case /Price/Profit Calculation/ of

                   /Price/Profit Calculation/::/Profit=Price-Cost/:

                       if /Unit Price/ <> 0 then

                           if /Unit Cost/ = 0 then

                               /Profit %/ := 0

                           else

                               /Profit %/ :=

                                 Round(

                                   100 * (1 - /Unit Cost/ /

                                          (/Unit Price/ / (1 + CalcVAT()))), 0.00001)

                       else

                           /Profit %/ := 0;

                   /Price/Profit Calculation/::/Price=Cost+Profit/:

                       if /Profit %/ < 100 then begin

                           GetGLSetup();

                           /Unit Price/ :=

                             Round(

                               (/Unit Cost/ / (1 - /Profit %/ / 100)) *

                               (1 + CalcVAT()),

                               GLSetup./Unit-Amount Rounding Precision/);

                       end;

               end;

           end;

       }

 

 

Is there any way I can modify this code, and make the calculation the way my customer wants it done, using AL?

Categories:
  • gdrenteria Profile Picture
    gdrenteria 12,183 Most Valuable Professional on at
    Modify Price/Profit Calculation field on Item Card
    Hi
    You could rely on this event to make some changes.
    BR
    GR

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans