Hi Everybody,
I have a question about the following code in Codeunit 12, InsertGLEntry Trigger:
IF GLEntry."Posting Date" = NORMALDATE(GLEntry."Posting Date") THEN BEGIN
BalanceCheckAmount :=
BalanceCheckAmount + GLEntry.Amount * ((GLEntry."Posting Date" - 01010000D) MOD 99 + 1);
BalanceCheckAmount2 :=
BalanceCheckAmount2 + GLEntry.Amount * ((GLEntry."Posting Date" - 01010000D) MOD 98 + 1);
END ELSE BEGIN
BalanceCheckAmount :=
BalanceCheckAmount + GLEntry.Amount * ((NORMALDATE(GLEntry."Posting Date") - 01010000D + 50) MOD 99 + 1);
BalanceCheckAmount2 :=
BalanceCheckAmount2 + GLEntry.Amount * ((NORMALDATE(GLEntry."Posting Date") - 01010000D + 50) MOD 98 + 1);
END;
Can anybody tell me what this code does? My colleague and me are struggling with it. ](*,)
Thanks in advance
KYDutchie
Fostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.
0
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Here it is an answer i got from a Microsoft support case:
"The code is there to ensure that entries balance on a specific date. If you are wondering why there is a MOD 99 and a MOD 98 it's because you could otherwise post two entries on 2 dates with (if only 99 was used) 99 days in between and the system would still believe this would balanced. When we are using 99 and 98 there is 99*98 dates between the same numbers are used for multiplying - which is more then 25 years."
Hope you find it interesting.
Thanks.