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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.11.2012, 15:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
Malaysia: Creating a general journal
Источник: http://axmas.blogspot.com/2012/11/cr...l-journal.html
==============


1. In the AOT, create a new class named LedgerJournalTransData with the
following code:

class LedgerJournalTransData extends JournalTransData
{
}

public void create(boolean _doInsert = false, boolean _initVoucherList = true)
{
lastLineNum++;
journalTrans.LineNum = lastLineNum;
if (journalTableData.journalVoucherNum())
{
this.initVoucher(lastVoucher, false, _initVoucherList);
}

this.addTotal(false, false);
if (_doInsert)
{
journalTrans.doInsert();
}
else
{
journalTrans.insert();
}

if (journalTableData.journalVoucherNum())
{
lastVoucher = journalTrans.Voucher;
}
}


2. Open the LedgerJournalStatic class, and replace its
newJournalTransData() method with the following code:

JournalTransData newJournalTransData(JournalTransMap _journalTrans,
JournalTableData _journalTableData)
{
return new LedgerJournalTransData(_journalTrans, _journalTableData);
}

3. Double check that the getLedgerDimension() method exists on the
DimensionAttributeValueCombination table. If not, create it as described in the first
recipe in this chapter.

4. Create a new job named LedgerJournalCreate, with the following code:
static void LedgerJournalCreate(Args _args)
{
LedgerJournalTable jourTable;
LedgerJournalTrans jourTrans;
LedgerJournalTableData jourTableData;
LedgerJournalTransData jourTransData;
LedgerJournalStatic jourStatic;
DimensionDynamicAccount ledgerDim;
DimensionDynamicAccount offsetLedgerDim;
ttsBegin;
ledgerDim = DimensionAttributeValueCombination::getLedgerDimension(
'110180', ['Department', 'CostCenter', 'ExpensePurpose'], ['OU_2311', 'OU_3568', 'Training']);
offsetLedgerDim = DimensionAttributeValueCombination::getLedgerDimension(
'170150', ['Department', 'CostCenter', 'ExpensePurpose'], ['OU_2311', 'OU_3568', 'Training']);
jourTableData = JournalTableData::newTable(jourTable);
jourTable.JournalNum = jourTableData.nextJournalId();
jourTable.JournalType = LedgerJournalType::Daily;
jourTable.JournalName = 'GenJrn';
jourTableData.initFromJournalName(LedgerJournalName::find(jourTable.JournalName));
jourStatic = jourTableData.journalStatic();
jourTransData = jourStatic.newJournalTransData(jourTrans, jourTableData);
jourTransData.initFromJournalTable();
jourTrans.CurrencyCode = 'USD';
jourTrans.initValue();
jourTrans.TransDate = systemDateGet();
jourTrans.LedgerDimension = ledgerDim;
jourTrans.Txt = 'General journal demo';
jourTrans.OffsetLedgerDimension = offsetLedgerDim;
jourTrans.AmountCurDebit = 1000;
jourTransData.create();
jourTable.insert();
ttsCommit;
info(strFmt("Journal '%1' has been created", jourTable.JournalNum));
}

5. Run the job and check the results by opening General ledger | Journals |
General journal:


6. Click on the Lines button to open journal lines and notice the newly created line:







Источник: http://axmas.blogspot.com/2012/11/cr...l-journal.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Malaysia: Posting a general journal Blog bot DAX Blogs 0 27.11.2012 15:11
Malaysia: Creating a custom instant search filter Blog bot DAX Blogs 0 14.11.2012 14:11
axaptacorner: How to create General Journal in AX 2012 by X++ code Blog bot DAX Blogs 0 10.09.2012 23:15
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
Dynamics AX Sustained Engineering: Unexpected voucher number proposed when creating a new journal line after sorting the grid in a journal Blog bot DAX Blogs 0 22.07.2010 19:06

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

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

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