Question about some code in CodeUnit 12
KYDutchie
Member Posts: 345
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
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
-
It makes sure your GL is consistent and your debits equal credits.0
-
Hello.
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.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
