代码过账LedgerJournalTable
static void ExampleLedgerJournal(Args _args)
{
LedgerJournalName ledgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberSeq;
;
ttsbegin;
// Find a LedgerJournalName Record
select firstOnly ledgerJournalName
where ledgerJournalName.JournalType ==
LedgerJournalType::Daily;
// Create the LedgerJournlTable
LedgerJournalTable.JournalName =
ledgerJournalName.JournalName;
LedgerJournalTable.initFromLedgerJournalName();
LedgerJournalTable.Name = "Daily Trans";
ledgerJournalTable.insert();
numberSeq = NumberSeq::newGetVoucherFromCode(
ledgerJournalName.VoucherSeries);
ledgerJournalTrans.Voucher = numberSeq.voucher();
// Create Transaction line
ledgerJournalTrans.JournalNum =
ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = "EUR";
ledgerJournalTrans.ExchRate = Currency::exchRate(
ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = "57210";
ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger;
ledgerJournalTrans.AmountCurDebit = 102.00;
ledgerJournalTrans.TransDate = today();
ledgerJournalTrans.Txt = "Room stay";
ledgerJournalTrans.OffsetAccount = "18110";
ledgerJournalTrans.insert();
info(strfmt("Journal ID: %1",ledgerJournalTable.JournalNum ));
//Post the Journal
ledgerJournalCheckPost =
LedgerJournalCheckPost::newLedgerJournalTable(
ledgerJournalTable,NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
}