web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Modify Price/Profit Calculation field on Item Card

(2) ShareShare
ReportReport
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?

I have the same question (0)
  • Gerardo Rentería García Profile Picture
    25,225 Most Valuable Professional on at
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,917

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,161 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,025 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans