This is a continuation of the blog entry ‘What does the Maximum penny difference parameter do’
On the above blog it was described how the Maximum penny difference works. However, it might be surprising why the parameter does not work for a more simple scenario where there is a penny difference entered into a journal directly. This blog will explain why this is the case and how the penny difference parameter works in this scenario.
In this example the Maximum penny difference has been set to 0.02
A general journal is entered where there is a difference of 1 penny between the debit and credits
However when trying to either validate or post it, the following imbalance error is thrown, despite the 1 penny difference falling within the threshold of 2 pennies specified in the Maximum penny difference parameter.
The reason for this is due to the validation found on Classes\LedgerVoucherObject\CheckBalance
Here the variable ‘TransactionCurrencyBalance’ is being validated. This variable contains the sum of the journal lines
eg. in this example -99.99 + 100 which gives a difference rather than balances at 0.0 and hence the voucher is not valid and we get the imbalance error.
What the system hence is doing is checking on the entries that are directly entered in the journal lines and if these do not balance then there is an imbalance as it is not desirable to have an imbalance here. The penny difference parameter is not applied in the code here
Note how this differs from the scenario described on the previous blog in that the scenario described in this blog the validation occurs for the ‘amount that will be posted’ to the ledger and this amount is the sum of a rounding rather than what is entered in the journal. In this case the penny difference parameter threshold check is implemented into the code
This principle can be seen in the method checkBalanceAccountingCurrency on the LedgerVoucherObject class
In this case, the system is checking whether the amount in the accountingCurrencyBalance variable is bigger than in the penny difference parameter.
Here it would not be the case as 0.01 is less than 0.02, but what has to be kept in mind is that the validation has already failed on the check for the ‘transactionCurrencyBalance’ variable which stored the sum of the amounts entered in the journal line and where the penny difference parameter is not implemented in the code. Furthermore, what needs to be kept in mind is that the penny difference parameter is implemented when the sum of the amounts due to a rounding do not equal to zero as detailed in the original blog
We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!