GL Consistency error

aniruddha_majumdar
Member Posts: 57
Dear friends,
In Codeunit 12 u can see that there is a code related to GL consistency.
Actually the consistent function doesnot allow us to post if the we pass "false" as boolean parameter and this happens only all the parameters (balanceCheckAmount,balanceCheckAmount2,balanceCheckAddCurrAmount,balanceCheckAddCurrAmount2)it is passing in zero.
But my problem is I could not follow how the calculation procedure for BalanceCheckAmount it is following.
BalanceCheckAmount :=
BalanceCheckAmount + GLEntry.Amount * ((GLEntry."Posting Date" - 01010000D) MOD 99 + 1);
Can anyone plz xplain the code
Thanks
Aniruddha
In Codeunit 12 u can see that there is a code related to GL consistency.
Actually the consistent function doesnot allow us to post if the we pass "false" as boolean parameter and this happens only all the parameters (balanceCheckAmount,balanceCheckAmount2,balanceCheckAddCurrAmount,balanceCheckAddCurrAmount2)it is passing in zero.
But my problem is I could not follow how the calculation procedure for BalanceCheckAmount it is following.
BalanceCheckAmount :=
BalanceCheckAmount + GLEntry.Amount * ((GLEntry."Posting Date" - 01010000D) MOD 99 + 1);
Can anyone plz xplain the code
Thanks
Aniruddha
Thanks & Regards,
Aniruddha
Aniruddha
0
Comments
-
The purpose of the G/L Consistency check in cu12 is as follows: Do not allow any set of g/l entries to commit unless the entries balance by date (that is, sum to zero for each posting date). So, it is not enough just to track the sum of the Amounts, the codeunit must track the sum of the Amounts for each posting date seen.
The expression you refer to is a trick that effectively creates 99 'date buckets' to track balances, all wrapped up into a single expression. This single expression works fine except for the case where you happen to use dates that are exactly 99 days apart. Say you debit an account some amount on Day1, then credit an account the same amount, but on Day100. The (Date Difference) MOD 99 + 1 expression will project the debit and credit into the same 'date bucket, and BalanceCheckAmount will become zero.
To avoid this problem, cu12 also calculates BalanceCheckAmount2 using a modulus 98 instead of 99. Now it becomes much harder to 'trick' the expression with dates that are different -- I haven't figured it out yet -- something like the dates must be 98 * 99 days different... Perhaps you'll experiment and report back the results...
Hope this helps...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions