1.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;
}
}
22. Open the LedgerJournalStatic class, and replace its newJournalTransData() method with the
following code:
JournalTransData
newJournalTransData(
JournalTransMap _journalTrans,
JournalTableData
_journalTableData)
{
return new
LedgerJournalTransData(
_journalTrans,
_journalTableData);
}
33. 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));
}
Hello,
ReplyDeleteCan you please put the code for point#33 as well ?
Thanks,
Nitin