Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Getting Ledger transactions based on Main Account and Employee Dimension in Ax 2012

$
0
0

Hii,

I have a requirement to make a report that will get the data as following based on two filters, Main Account and Employee ID i.e. when we run the report from GL the parameter window should ask MainAccount and Employee Id and show the results as following.

In the above image Ledger Account (11503005-HQ-D02-10336). MainAccount = 11503005 Employee Id = 10336. Employee is dimension.

Following is my job code in AOT. It shows correct and required information, but for all employees in this range.

Please guide how I can see results by selected employee id . 

    MainAccount                         mainAccount;
    GeneralJournalEntry                 generalJournalEntry;
    GeneralJournalAccountEntry          generalJournalAccountEntry;
    SubledgerJournalEntry               subLedgerJournalEntry;
    SubledgerJournalAccountEntry        subLedgerJournalAccountEntry;
    P_EmplTable                         emplTable; // Out employees table
    DimensionAttributeValueCombination  dimAttrValueComb; ccounts and dimensions

    MainAccountNum mainAcId;
    P_EmplId empId;
    FromDate fromDate;
    ToDate toDate;
    fromDate = str2date('01/01/2016',123);
    toDate = str2date('01/01/2016',123);
    mainAcId = '11503005';
    empId = '10336';

    while select AccountingCurrencyAmount, TransactionCurrencyAmount,  TransactionCurrencyCode, LedgerAccount
         from generalJournalAccountEntry
            join dimAttrValueComb
                where dimAttrValueComb.RecId == generalJournalAccountEntry.LedgerDimension
            join AccountingDate, JournalNumber from generalJournalEntry
                where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
                   && generalJournalEntry.AccountingDate >= fromDate&& generalJournalEntry.AccountingDate <= toDate&& generalJournalEntry.Ledger == Ledger::current()
                join MainAccountId, Name from mainAccount
                    where mainAccount.RecId == dimAttrValueComb.MainAccount&& mainAccount.MainAccountId == mainAcId // Main Account
        {
            info(strFmt("%1-%2, %3, %4, %5, %6, %7, %8, %9", mainAccount.MainAccountId, mainAccount.Name,
                        generalJournalEntry.AccountingDate, subLedgerJournalEntry.Voucher,
                        generalJournalAccountEntry.TransactionCurrencyCode, generalJournalAccountEntry.TransactionCurrencyAmount,
                        generalJournalAccountEntry.AccountingCurrencyAmount,
                        generalJournalEntry.JournalNumber, generalJournalAccountEntry.LedgerAccount));
        }





Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>