web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

AX 2012 Solved issue: DMF Opening Balance import – cash discounts are not calculated

Galyna Fedorova Profile Picture Galyna Fedorova 3,566

Recently I have bumped into the standard AX issue.

Description:

When you import vendor/customer open transaction with cash discount information (cash discount code, cash discount amount and cash discount date) though DIEF (LedgerOpenBalance entity) and then you post that journal, cash discount information is not created in the VendTransCashDisc table or CustTransCashDisc table. Path to that table from UI is below:

  • Accounts payable > Vendors > All vendors > Invoice tab > Settle open transaction button > Cash discount tab
  • Accounts receivable > Customers > All customers > Collection tab > Settle open transaction button > Cash discount tab

When you manually create absolutely the same record through the General Journal (the same as you imported), cash discount information is created.

In our case (when we have simple setup of cash discount code), AX logic of cash discount information creation is the following:

  1. At the time of general journal line creation, 2 lines in the VendTransCashDisc (or CustTransCashDisc in case of customers) are created with the following data:

Line#1:

CashDiscAmount: Cash discount amount from the journal line

CashDiscCode: Cash discount code from the journal line

CashDiscDate: Cash discount date from the journal line

CashDiscDue: CashDiscount

RefRecId: RecId of the journal line

RefTableId: 212 (Id of the LedgerJournalTrans)

Line#2:

CashDiscAmount: 0.00

CashDiscCode: blank

CashDiscDate: document date from the journal line

CashDiscDue: Due

RefRecId: RecId of the journal line

RefTableId: 212 (Id of the LedgerJournalTrans)

  1. At the time of general journal line posting, 2 lines (created in step 1) are copied and new records are created in the same VendTransCashDisc table (or CustTransCashDisc in case of customers) but with the new RefRecId and RefTableId

Line#1:

CashDiscAmount: Cash discount amount from step 1

CashDiscCode: Cash discount code from step 1

CashDiscDate: Cash discount date from step 1

CashDiscDue: CashDiscount from step 1

RefRecId: RecId of the VendTransOpen (RecId of the CustTransOpen in case of customers)

RefTableId: 866 – Id of the VendTransOpen table (865 – Id of the CustTransOpen table in case of customers)

Line#2:

CashDiscAmount: 0.00 from step 1

CashDiscCode: blank from step 1

CashDiscDate: document date from step 1

CashDiscDue: Due from step 1

RefRecId: RecId of the VendTransOpen (RecId of the CustTransOpen in case of customers)

RefTableId: 866 – Id of the VendTransOpen table (865 – Id of the CustTransOpen table in case of customers)

Cash disc flow

As the result, if at the time of posting you have nothing in the VendTransCashDisc/CustTransCashDisc table, then nothing will be copied.

The root cause of our issue is the following:

  1. when we create record manually in the general journal, data in the VendTransCashDisc/CustTransCashDisc table is created.
  2. when we create record in the general journal through the import, data in the VendTransCashDisc/CustTransCashDisc table is Not created.

I think this is because when we create record manually, AX can identify RecId of the journal line. But when we import the line, AX cannot identify RecId of the journal line because it’s not created yet.

Solution:

In the DMFLedgerBalanceEntityClass class, somewhere in the post target execution, the following code might be added:

LedgerJournalEngine_Server::calcCashDisc(ledgderJournalTrans,                                               TaxUncommitted::getActualTaxAmountForSourceLine(tableNum(ledgerJournalTrans), ledgderJournalTrans.RecId, true, true),true);

That’s all!


This was originally posted here.

Comments

*This post is locked for comments