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
0
Comments
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...