Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Event Request] Codeunit 5611 Calculate Normal Depreciation - OnBeforeExitCalcSLAmountByDeprYears #2473

Closed
muratkarabek opened this issue May 16, 2019 · 0 comments
Labels
event-request Request for adding an event ships-in-future-update Fix ships in a future update

Comments

@muratkarabek
Copy link

Hi,

We need an event to manipulate exit value for depreciation years in CalcSLAmount method of codeunit 5611 as described below:

LOCAL [IntegrationEvent] OnBeforeExitCalcSLAmountByDeprYears(FA : Record "Fixed Asset";FADeprBook : Record "FA Depreciation Book";UntilDate : Date;BookValue : Decimal;DeprBasis : Decimal;DeprYears : Decimal;NumberOfDays : Integer;DaysInFiscalYear : Integer

LOCAL CalcSLAmount() : Decimal
...
...
IF DeprYears > 0 THEN BEGIN
  RemainingLife :=
    (DeprYears * DaysInFiscalYear) -
    DepreciationCalc.DeprDays(
      DeprStartingDate,DepreciationCalc.Yesterday(FirstDeprDate,Year365Days),Year365Days);
  IF RemainingLife < 1 THEN
    EXIT(-BookValue);

  // ***** publisher call begins here *****
  IsHandled := FALSE; 
  OnBeforeExitCalcSLAmountByDeprYears(FA,FADeprBook,UntilDate,BookValue,DeprBasis,DeprYears,NumberOfDays,DaysInFiscalYear,ExitValue,IsHandled);
  IF IsHandled THEN
    EXIT(ExitValue);
  // ***** publisher call ends here *****

  EXIT(-(BookValue + SalvageValue - MinusBookValue) * NumberOfDays / RemainingLife);
END;
EXIT(0);

Thanks in advance!

@AlexanderYakunin AlexanderYakunin added the event-request Request for adding an event label May 17, 2019
@jobulsin jobulsin added the ships-in-future-update Fix ships in a future update label Jun 3, 2019
@jobulsin jobulsin closed this as completed Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-request Request for adding an event ships-in-future-update Fix ships in a future update
Projects
None yet
Development

No branches or pull requests

3 participants