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?