lunes, septiembre 17, 2012

AX 2012 Finance Relations


I’m starting with Ax 2012, and there are a lot of changes in the code. Almost all the tables of General Ledger are new in Dynamics AX 2012.  It was difficult to understand how the ledger posts are now inserted and their relations. Below some important relations of GL that might help.

How a Ledger post (GeneralJournalEntry) is related with a General Journal Ledger.
public static LedgerJournalTable findByGeneralJournalEntry( GeneralJournalEntry journalEntry )
{
LedgerJournalTable journalTable;
LedgerEntryJournal journalLink;
;
select firstOnly * from journalLink where journalLink.RecId == journalEntry.LedgerEntryJournal
join journalTable where journalTable.JournalNum == journalLink.JournalNumber;// &&
//journalTable.dataAreaId == journalLink.LedgerJournalTableDataAreaId;
return journalTable;
}
view raw gistfile1.js hosted with ❤ by GitHub


How a General Journal Line is related with a  Ledger post (GeneralJournalEntry)
LedgerJournalTable jourTable, origJornalTable;
LedgerJournalTrans jourTrans, origJournalTrans;
SubledgerVoucherGeneralJournalEntry jourLink;
;
origJornalTable = LedgerJournalTable::findByGeneralJournalEntry(journalEntry);
if(origJornalTable){
select * from origJournalTrans where origJournalTrans.JournalNum == origJornalTable.JournalNum
join jourLink where jourLink.GeneralJournalEntry == journalEntry.RecId && origJournalTrans.Voucher == jourLink.Voucher;
view raw xpo hosted with ❤ by GitHub