Dynamics AX

Welcome to my Dynamics AX playground!

Home     Articles     Dynamics AX - Trivia     Dynamics AX Search     Mohammed Rasheed     Contact Me     My Dynamics Ax Blog      
Guide to Setup SSRS with
Add Fields to a Table Using Code
Code to view Ledger Transaction Details
AX Mobile - Installation and Configuration
Forecasting in Dynamics AX 2009
Multi Threaded Programming in DAX
OLAP - Installation and Configuration
Send Text Messages (SMS) from DAX
Sending Emails from DAX without Outlook.
Using Data Definition Groups
A View Thing..
All About Maps..
COM Class Wrapper
Create a Role Centre
Create and Post Counting
Outlook 07 Integration
Alerts to Multiple Users
Counting Lines of Code
 
 

Code to View Ledger Transaction Details in Dynamics AX

 

use this code to find the vendor and the item that was purchased..

 

static void listVendItemfromVoucher(Args _args)

{

    LedgerTrans             ledgerTrans;

    LedgerTransModule       ledgerTransModule;

    TmpLedgerBase           tmpLedgerBase;

    ;

   

    while select Voucher,TransDate from ledgertrans where

ledgertrans.TransType == ledgertransType::Purch

    {

       

        ledgerTransModule = new LedgerTransModule(ledgerTrans.Voucher,ledgertrans.TransDate);

        ledgerTransModule.createTransModule();

       

        tmpLedgerBase.setTmpData(ledgerTransModule.transModule());

       

        while select tmpLedgerBase where tmpLedgerBase.Module ==

SysModule::Purch // change the Where section to what suits you

                                      || tmpLedgerBase.Module ==

SysModule::Invent

                                      || tmpLedgerBase.OriginalDocument ==

OriginalDocument::PurchaseInvoice

        {

          

            info(strfmt("Amoount = %1, id = %2, IdName = %3, Module = %4,

OrgDocument = %5, voucher %6",

                        tmpLedgerBase.Amount,

                        tmpLedgerBase.id,

                        tmpLedgerBase.IdName,

                        tmpLedgerBase.Module,

                        tmpLedgerBase.OriginalDocument,

                        tmpLedgerBase.Voucher));

        }

       

        break;

    }

}