GL Consistency error

aniruddha_majumdaraniruddha_majumdar Member Posts: 57
edited 2005-12-08 in Navision Attain
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
Thanks & Regards,
Aniruddha

Comments

  • fbfb Member Posts: 246
    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...
Sign In or Register to comment.