AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.12.2011, 22:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
sumitsaxfactor: Getting Ledger transactions in Ax 2012
Источник: http://sumitsaxfactor.wordpress.com/...ns-in-ax-2012/
==============

Continuing with my blogs on Chart of accounts, in this blog, I will help you find the ledger transactions between a particular period.

In 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, I will cover reports in other blog entries).

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).

staticvoid findLedgerTransactions(Args _args)

{

    MainAccount                         mainAccount; //Holds the main accounts

    GeneralJournalEntry                 generalJournalEntry; //Used to hold Ledger transactions

    GeneralJournalAccountEntry          generalJournalAccountEntry; //Used to hold Ledger transactions

    SubledgerJournalEntry               subLedgerJournalEntry; //Used to hold sub Ledger transactions (Like sales/purch invoice etc.)

    SubledgerJournalAccountEntry        subLedgerJournalAccountEntry;  //Used to hold sub Ledger transactions (Like sales/purch invoice etc.)

    DimensionAttributeValueCombination  dimAttrValueComb; //Used to store the combination of main accounts and dimensions

 

    whileselect AccountingCurrencyAmount, TransactionCurrencyAmount,  TransactionCurrencyCode

            from generalJournalAccountEntry

            join dimAttrValueComb

                where dimAttrValueComb.RecId == generalJournalAccountEntry.LedgerDimension

            join AccountingDate, JournalNumber from generalJournalEntry

                where generalJournalAccountEntry.GeneralJournalEntry == generalJournalEntry.RecId

                   && generalJournalEntry.AccountingDate == 017\2010

                   && generalJournalEntry.PostingLayer == OperationsTax::Current

                   && generalJournalEntry.Ledger == Ledger::current()

                join MainAccountId, Name from mainAccount

                    where mainAccount.RecId == dimAttrValueComb.MainAccount

                        && mainAccount.MainAccountId == ’130100′

            join subLedgerJournalAccountEntry

                where subLedgerJournalAccountEntry.GeneralJournalAccountEntry == generalJournalAccountEntry.RecId

                   && subLedgerJournalAccountEntry.LedgerDimension == generalJournalAccountEntry.LedgerDimension

                join Voucher from subLedgerJournalEntry

                    where subLedgerJournalAccountEntry.SubledgerJournalEntry == subLedgerJournalEntry.RecId

                       //&& subLedgerJournalEntry.Ledger == Ledger::current()

 

    {

        info(strFmt("%1-%2, %3, %4, %5, %6, %7, %8", mainAccount.MainAccountId, mainAccount.Name,

                    generalJournalEntry.AccountingDate, subLedgerJournalEntry.Voucher,

                    generalJournalAccountEntry.TransactionCurrencyCode, generalJournalAccountEntry.TransactionCurrencyAmount,

                    generalJournalAccountEntry.AccountingCurrencyAmount,

                    generalJournalEntry.JournalNumber));

    }

}

 



The output is as follows:








Источник: http://sumitsaxfactor.wordpress.com/...ns-in-ax-2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Jose Lorenzo: Change transactions date utility upgrade for Dynamics AX 2012 Beta VM Blog bot DAX Blogs 0 03.08.2011 09:11
dynamics-ax: Interview with Microsoft's Lachlan Cash on his new role, AX 2012 and more Blog bot DAX Blogs 6 22.04.2011 14:55
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:06.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.