static void VendPaymJournalCreate(Args _args)
{
LedgerJournalTable jourTable;
LedgerJournalTrans jourTrans;
LedgerJournalTableData jourTableData;
LedgerJournalTransData jourTransData;
LedgerJournalStatic jourStatic;
DimensionDynamicAccount ledgerDim;
DimensionDynamicAccount offsetLedgerDim;
ttsBegin;
ledgerDim = DimensionStorage::getDynamicAccount(
'1001',
LedgerJournalACType::Vend);
offsetLedgerDim = DimensionStorage::getDynamicAccount(
'USA OPER',
LedgerJournalACType::Bank);
jourTableData = JournalTableData::newTable(jourTable);
jourTable.JournalNum = jourTableData.nextJournalId();
jourTable.JournalType = LedgerJournalType::Payment;
jourTable.JournalName = 'APPay';
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.AccountType = LedgerJournalACType::Vend;
jourTrans.LedgerDimension = ledgerDim;
jourTrans.Txt = 'Vendor payment journal demo';
jourTrans.OffsetAccountType = LedgerJournalACType::Bank;
jourTrans.OffsetLedgerDimension = offsetLedgerDim;
jourTrans.AmountCurDebit = 1000;
jourTransData.create();
jourTable.insert();
ttsCommit;
info(strFmt(
"Journal '%1' has been created", jourTable.JournalNum));
}
Now, the newly created
journal can be found in Accounts payable |
Journals | Payments | Payment journal:
Hello,
ReplyDeleteLedgerJournalTransData object you have used. where is this objects in AOT ?