ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request]Report 6031 'Update Service Contract Prices" - OnBeforeCalcAnnualAmt

Open JellebBE opened this issue 2 years ago • 1 comments

Describe the request

We want to be able to influence the "Number of Periods" used to calculate the Annual Amount.

Original Code:

 NumberOfPeriods := ReturnNoOfPer(ServContract."Invoice Period");
 if NumberOfPeriods = 0 then
    ServContract."Amount per Period" := 0
  else
  ServContract."Amount per Period" :=
                            Round(ServContract."Annual Amount" / NumberOfPeriods, Currency."Amount Rounding Precision");

Change:

IsHandled := false;
OnBeforeCalcAnnualAmt(ServContract, IsHandled);
if not IsHandled then begin
 NumberOfPeriods := ReturnNoOfPer("Invoice Period");
   if NumberOfPeriods = 0 then
      ServContract."Amount per Period" := 0
    else
      ServContract."Amount per Period" :=
             Round(ServContract."Annual Amount" / NumberOfPeriods, Currency."Amount Rounding Precision");
end;
[IntegrationEvent(false, false)]
local procedure OnBeforeCalcAnnualAmt(var ServiceContractHeader: Record "Service Contract Header"; var IsHandled: Boolean)
begin
end;

Additional context

When you have Extended the Enum "Invoice Period" Which is used in the Service Contract Header, to a value larger then the Yearly value(For example "2 Years", "3 Years", the report is not able to update the "amounts per period". As You want to invoice once for a 2 year period. So the Number of Periods will be Lower then 1 (Therefor the Integer cannot be used) So in order to work around this issue we came up with the suggestion above. Internal work item: AB#535528

JellebBE avatar May 14 '24 12:05 JellebBE

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 19932.

JesperSchulz avatar May 23 '24 20:05 JesperSchulz