zoukankan      html  css  js  c++  java
  • How to getting ledger transactions in AX 2012

    In Dynamics AX 2009, it was pretty simple as you had to just loop through LedgerTrans table, AX 2012 it has changed a bit.
    Lets take an example and see how we can achieve this. Say you want to display following information in a report (for example purpose we will use infolog).

    Main account number – Main account name, Transaction date, voucher number, amount in base currency, amount in transaction currency and currency code.

    To fetch transactions, now there are two tables that we need to use:
    GeneralJournalEntry, GeneralJournalAccountEntry (There are more tables with GeneralJournalPrefix, I have not found there use yet but will update this post once I find more use of them).
    static void THK_findLedgerTransactions(Args _args)
    {
        MainAccount mainAccount;
        GeneralJournalEntry generalJournalEntry;
        GeneralJournalAccountEntry generalJournalAccountEntry;
        DimensionAttributeValueCombination dimAttrValueComb;
        SubledgerVoucherGeneralJournalEntry subledgerVoucherGeneralJournalEntry;
        ledgerEntry ledgerEntry;
        ledgerEntryJournal ledgerEntryJournal;
        ledgerEntryJournalizing ledgerEntryJournalizing;

        while select AccountingCurrencyAmount, TransactionCurrencyAmount, TransactionCurrencyCode
                from generalJournalAccountEntry
            join dimAttrValueComb
                where dimAttrValueComb.RecId == generalJournalAccountEntry.LedgerDimension
            join AccountingDate, JournalNumber from generalJournalEntry
                where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId
                && generalJournalEntry.AccountingDate <= today() //str2Date("12012012",123)
                && generalJournalEntry.PostingLayer == OperationsTax::Current
                && generalJournalEntry.Ledger == Ledger::current()
            join MainAccountId, Name from mainAccount
                where mainAccount.RecId == dimAttrValueComb.MainAccount && 
                mainAccount.MainAccountId == "1105"
            join subledgerVoucherGeneralJournalEntry
                where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == GeneralJournalEntry.RecId
            outer join RecId from ledgerEntry
                where ledgerEntry.GeneralJournalAccountEntry == generalJournalAccountEntry.RecId
            outer join RecId from ledgerEntryJournal
                where ledgerEntryJournal.RecId == generalJournalEntry.LedgerEntryJournal
            outer join RecId from ledgerEntryJournalizing
                where ledgerEntryJournalizing.GeneralJournalAccountEntry == generalJournalAccountEntry.RecId
        {
            info(strFmt("%1-%2, %3, %4, %5, %6, %7, %8", mainAccount.MainAccountId, mainAccount.Name,
                        generalJournalEntry.AccountingDate, subledgerVoucherGeneralJournalEntry.Voucher,
                        generalJournalAccountEntry.TransactionCurrencyCode, generalJournalAccountEntry.TransactionCurrencyAmount,
                        generalJournalAccountEntry.AccountingCurrencyAmount,
                        generalJournalEntry.JournalNumber));
        }

  • 相关阅读:
    TimesTen的安装和连接
    推荐10款免费而优秀的图表插件
    做了一个jquery插件,使表格的标题列可左右拉伸
    基于SSM实现的简易员工管理系统(基于阿里云的网站上线篇)
    基于SSM实现的简易员工管理系统
    基于局域网的超简易即时通讯软件(二)
    基于局域网的超简易即时通讯软件(一)
    我的Vim常用快捷键
    php最新面试题
    2017php经典面试题
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2779405.html
Copyright © 2011-2022 走看看