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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.01.2011, 20:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
Shekhar: Dynamics AX 2009 – Import fixed asset journal lines for posting accumulated depreciation
Источник: http://shekhardiptiman.spaces.live.c...B978!349.entry
==============

During the implementation for importing the fixed asset transaction we need to post the acquisition journals and their accumulated depreciation  as of the cut-off date. This is done by creating a Fixed asset journal and then importing the data in the journal lines for that journal.

In AX 2009, the structure of the fixed asset journal transaction has been made a little complex than the earlier versions of the product and hence the data import through standard excel import using the definition groups.

The following way may be followed to import the fixed asset journal lines in an efficient way.

Step 1 . Create the import job in your AOT. I am copying the job code as below for use by the AX consultants. Copy it and paste it in jobs in your AOT.

static void TEC_FixedAssetJournal_Insert(Args _args)
{
     #define.ioComma(",")
     #define.ioEndLine("\r\n")
     #define.ioRead("r")


     AsciiIo io ;
     str jourName;
     str jourNum;
     str lineNum;
     str accountType;
     str accountNum;
     str amount;
     str currencyCode;
     str offsetAcType;
     str transdate;
     str offAc;
     str valMod;
     str assetype;  // this is the transaction type
     str transtxt;


     int linecount;

     LedgerJournalTrans        ledgerJournalTrans;
     LedgerJournalTrans_Asset  ledgerJournalTrans_asset;
     LedgerJournalACType       ledgerJournalACType;


     NumberSeq                   numSeq;
     int                         n = 1,idx =1;
     SysOperationProgress        lprogress;
     #AviFiles


    ;
     io = new AsciiIo("\\\\AX-SRv-01\\DynamicsVM\\FileAccess\\CSVFile.txt", #ioRead);  // This is the network path where the data file will be read from
    if(!io)
      error ("File cannot be open");


    lprogress = new SysOperationProgress();
    lprogress.setCaption("Insert Fixed asset trans ");
    lprogress.setAnimation(#AviUpdate);


    if (io)
    {
        io.inFieldDelimiter(#ioComma);
        io.inRecordDelimiter(#ioEndLine);
       [jourName, jourNum, transdate, accountNum, amount ,currencyCode, offsetAcType, offAc, transtxt, assetype, valMod] = io.read();


        while (io.status() == IO_Status::Ok)
            {
                    if (io.status() != IO_Status::Ok)
                    {
                        error("File not found");
                    }
                lprogress.setCount(n,Idx);
                lprogress.setText("Inserting trans");
                n++;
                Idx++;
                numSeq                       = NumberSeq::newGetVoucherFromCode(LedgerJournalName::find(jourName).VoucherSeries, true );
                if(!numSeq)
                 error(strfmt("Number sequence set up does not exists for journal %1",jourName));
                ledgerJournalTrans.Voucher   =  numSeq.voucher();
                ledgerJournalTrans.TransDate =  mkdate( str2int( substr( transdate, 1, 2 ) ), str2int( substr( transdate, 3, 2 ) ), str2int( substr( transdate, 5, 4 ) ) );
                ledgerJournalTrans.JournalNum = jourNum;
                ledgerJournalTrans.LineNum    = str2num(lineNum);
                ledgerJournalTrans.Company    = curext();
                ledgerJournalTrans.txt        = transtxt;
                ledgerJournalTrans.AccountType = LedgerJournalACType::FixedAssets;


                ledgerJournalTrans.AccountNum = accountNum;

                if(str2num(amount) > 0)
                  ledgerJournalTrans.AmountCurDebit = str2num(amount);
                else
                 ledgerJournalTrans.AmountCurCredit = str2num(amount);


                ledgerJournalTrans.currencyCode = currencyCode;
                ledgerJournalTrans.ExchRate  = Currency::exchRate(ledgerJournalTrans.currencyCode);


                switch (offsetAcType)
                {
                                case "L" :
                                              ledgerJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger;
                                                break;
                               case "B" :
                                           ledgerJournalTrans.OffsetAccountType =  LedgerJournalACType::Bank;
                                               break;
                                case "C" :
                                           ledgerJournalTrans.OffsetAccountType =  LedgerJournalACType::Cust;
                                               break;
                                case "V" :
                                           ledgerJournalTrans.OffsetAccountType =  LedgerJournalACType::Vend;
                                               break;
                                case "F" :
                                           ledgerJournalTrans.OffsetAccountType =  LedgerJournalACType::FixedAssets;
                                               break;
                               default:
                                           ledgerJournalTrans.AccountType =  LedgerJournalACType::Ledger;
                                               break;


                }

                ledgerJournalTrans.OffsetAccount = offAc;
                ledgerJournalTrans.insert();


                if(ledgerJournalTrans.RecId)
                {
                   ledgerJournalTrans_asset.RefRecId = ledgerJournalTrans.RecId;
                   ledgerJournalTrans_asset.AssetId  = ledgerJournalTrans.getAssetId();
                   ledgerJournalTrans_Asset.Company  = ledgerJournalTrans.getAssetCompany();
                   ledgerJournalTrans_asset.BookId   = valMod;
                   if(assetype == "A")
                       ledgerJournalTrans_asset.TransType = AssetTransTypeJournal::Acquisition;
                   else
                       ledgerJournalTrans_asset.TransType = AssetTransTypeJournal::Depreciation;
                   ledgerJournalTrans_asset.insert();
                }


              [jourName, jourNum, transdate, accountNum, amount ,currencyCode, offsetAcType, offAc, transtxt, assetype, valMod] = io.read();
            }
     }
}


 

Step 2 : Now create a network folder which has been mentioned in the job in step 1 and give the full access to the windows user account which is using the job. For making it simple you may give the full access to ‘Everyone’.

see the example structure below :



See the properties set for the file CSVFile.txt in the screenshot below .



Also enabling the sharing  the folder containing the file.



 

See the sharing and security properties for the folder ‘FileAccess’ as shown below.



 

Step 3 ; Open a MS Excel file and populate the journal lines data in the columns in the following format :



Save the file as .csv file e.g. CSVFile.csv. The highlighted row is for your information and understanding only . After the data is maintained in excel , pls delete the highlighted row #1.

Step 4. Open the .csv file in the note pad.



Save it at the same location as a flat file with .txt extension . e.g. CSVFile.txt

 

Step 5 : All is done . now go back to AX and run the job.



 

Step 6 : verify that the data is imported and visible in the journal lines . Recheck the amounts and post



If you like this post or need any more information then leave your comments .

enjoy















Источник: http://shekhardiptiman.spaces.live.c...B978!349.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
semanticax: Dynamics AX 2009 Installation - Application Blog bot DAX Blogs 0 22.12.2010 08:11
emeadaxsupport: List of fixes that improve performance of certain features in Dynamics AX 2009 Blog bot DAX Blogs 0 13.10.2009 19:06
gatesasbait: Dynamics AX 2009 SSRS and SSAS Integration Tips Blog bot DAX Blogs 3 09.07.2009 13:07
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 20:07.