Sunday 22 October 2006

Dynamics AX V4 Bug Tax allocation in journals

Precondition, change V4 setup in demo database to work with not including Tax amounts.

That is in GL Parameters Tab Tax remove including tax tick and do the same for the journal.

When you create a Daily journal in the GL with only ledger accounts, and set 2 or more lines with VAT with one setoff line the verification process finds no errors but posting tells you that you have a difference.

The problem is in the changed (from V3) TaxVoucherService it now stores the VAT in a MAP using the linenumber of the Journal as a link.

Now if you have f'ex

Line 1 account 1000 Amt 100 Tax 25
Line 2 account 1010 Amt 100 Tax 25
Line 3 Account 2000 Amt -200

The system should generate a Tax surcharge on line 3 of +50thus making the posting 250 on that account.

However in the Map Calculated by the TaxVoucherService class the amount for line 3 is empty.

I have as a work around introduced a new Method in the TaxVoucherService class which returns the sum of the TaxAmountToPostMap

// Changed on 20 Jul 2006 at 17:44:45 by SJO
AmountCur Sev_TaxAmountTotal()
{
LineNum _LineNum;
AmountCur total;
MapIterator iterator;
;
iterator = new MapIterator(taxAmountToPostMap);
while (iterator.more())
{
total = total + iterator.value();
iterator.next();
}
return total;
}

And in the UpdateNow method of LedgerJournalTransUpdate I now call my new Method instead of the standard code

if (taxVoucherService)
{
if (taxVoucherService.ledgerFallbackAccount() == _ledgerJournalTrans.AccountNum)
{
// Changed on 20 Jul 2006 at 17:44:45 by SJO
// This should be all the tax not the tax on the line
taxAmount = TaxVoucherService.Sev_TaxAmountTotal();
// taxAmount = taxVoucherService.taxAmountToPost(_ledgerJournalTrans.LineNum); // Changed on 20 Jul 2006 at 17:44:45 by SJO
}
}

This seems to resolve the issue for my particular case however I am not dealing with the case of several different fallback accounts / Offset accounts.

Basically the function no longer works as in V3 due to the changes made and my change may not be compatible with V3 functionality however it at least correctly posts the amounts.

The issue should be resolved in Dynamics Ax 4.01 or SP1 depending upon the title given to this release which is due out soon.

/Sven

No comments: