static void ExampleLedgerJournal(Args _args)
{
LedgerJournalName LedgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberseq;
LedgerJournalNameId LedgerJournalNameId = 'GenJrn';
BankAccountID BankAccountID = 'CITI';
ledgerAccount offsetAccount = '100000';
amountCur amountCur = 102;
;
ttsbegin;
// Find a ledgerJournalName record
select firstonly LedgerJournalName
where LedgerJournalName.JournalName ==LedgerJournalNameId;
//Created the ledgerJournalTable
ledgerJournalTable.JournalName =LedgerJournalName.JournalName;
ledgerJournalTable.initFromLedgerJournalName();
ledgerJournalTable.Name = 'Hotel';
ledgerJournalTable.insert();
numberseq =NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherSeries);
ledgerJournalTrans.Voucher = numberseq.voucher();
//Generate the transaction line
ledgerJournalTrans.JournalNum =ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = 'EUR';
ledgerJournalTrans.ExchRate =Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = BankAccountID;
ledgerJournalTrans.AccountType =LedgerJournalACType::Bank;
ledgerJournalTrans.AmountCurCredit = amountCur;
//Pass the Date . You can also use str2Date('08/08/2008') if period is not defined.
ledgerJournalTrans.TransDate = today();
ledgerJournalTrans.Txt = 'Room Stay';
ledgerJournalTrans.OffsetAccount = offsetAccount;
ledgerJournalTrans.OffsetAccountType =LedgerJournalACType::Ledger;
ledgerJournalTrans.insert();
info(strfmt('Journal Id:%1',ledgerJournalTable.JournalNum));
//Post the Journal
// ledgerJournalCheckPost= ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes);
// ledgerJournalCheckPost.run();
ttscommit;
}
static void enterPostLedgerJournal(Args _args)
{
LedgerJournalName ledgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberSeq;
;
ttsbegin;
ledgerJournalName = LedgerJournalName::find("GenJrn");
ledgerJournalTable.initFromLedgerJournalName(ledgerJournalName.JournalName);
ledgerJournalTable.insert();
numberSeq = NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherSeries);
ledgerJournalTrans.voucher = numberSeq.voucher();
ledgerJournalTrans.JournalNum = ledgerJournalTable.JournalNum;
ledgerJournalTrans.currencyCode = 'USD';
ledgerJournalTrans.ExchRate =Currency::exchRate(ledgerJournalTrans.currencyCode);
ledgerJournalTrans.AccountNum = '140550';
ledgerJournalTrans.AccountType = ledgerJournalACType::Ledger;
ledgerJournalTrans.AmountCurDebit = 1220.00;
ledgerJournalTrans.TransDate = systemdateget();
ledgerJournalTrans.Txt = 'Projector sold';
ledgerJournalTrans.OffsetAccount = '401140';
// Insert to records into the ledgerJournalTrans table
ledgerJournalTrans.insert();
// Use the LedgerJournalCheckPost class to
// post the journal
ledgerJournalCheckPost =LedgerJournalCheckPost::construct(LedgerJournalType::Daily);
// Set the JournalId, tableId of the journalTable
// and specify to post the journal (not only check it).
ledgerJournalCheckPost.parmJournalNum(ledgerJournalTable.JournalNum);
ledgerJournalCheckPost.parmPost(NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
}
{
LedgerJournalName LedgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberseq;
LedgerJournalNameId LedgerJournalNameId = 'GenJrn';
BankAccountID BankAccountID = 'CITI';
ledgerAccount offsetAccount = '100000';
amountCur amountCur = 102;
;
ttsbegin;
// Find a ledgerJournalName record
select firstonly LedgerJournalName
where LedgerJournalName.JournalName ==LedgerJournalNameId;
//Created the ledgerJournalTable
ledgerJournalTable.JournalName =LedgerJournalName.JournalName;
ledgerJournalTable.initFromLedgerJournalName();
ledgerJournalTable.Name = 'Hotel';
ledgerJournalTable.insert();
numberseq =NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherSeries);
ledgerJournalTrans.Voucher = numberseq.voucher();
//Generate the transaction line
ledgerJournalTrans.JournalNum =ledgerJournalTable.JournalNum;
ledgerJournalTrans.CurrencyCode = 'EUR';
ledgerJournalTrans.ExchRate =Currency::exchRate(ledgerJournalTrans.CurrencyCode);
ledgerJournalTrans.AccountNum = BankAccountID;
ledgerJournalTrans.AccountType =LedgerJournalACType::Bank;
ledgerJournalTrans.AmountCurCredit = amountCur;
//Pass the Date . You can also use str2Date('08/08/2008') if period is not defined.
ledgerJournalTrans.TransDate = today();
ledgerJournalTrans.Txt = 'Room Stay';
ledgerJournalTrans.OffsetAccount = offsetAccount;
ledgerJournalTrans.OffsetAccountType =LedgerJournalACType::Ledger;
ledgerJournalTrans.insert();
info(strfmt('Journal Id:%1',ledgerJournalTable.JournalNum));
//Post the Journal
// ledgerJournalCheckPost= ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable,NoYes::Yes);
// ledgerJournalCheckPost.run();
ttscommit;
}
static void enterPostLedgerJournal(Args _args)
{
LedgerJournalName ledgerJournalName;
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans ledgerJournalTrans;
LedgerJournalCheckPost ledgerJournalCheckPost;
NumberSeq numberSeq;
;
ttsbegin;
ledgerJournalName = LedgerJournalName::find("GenJrn");
ledgerJournalTable.initFromLedgerJournalName(ledgerJournalName.JournalName);
ledgerJournalTable.insert();
numberSeq = NumberSeq::newGetVoucherFromCode(ledgerJournalName.VoucherSeries);
ledgerJournalTrans.voucher = numberSeq.voucher();
ledgerJournalTrans.JournalNum = ledgerJournalTable.JournalNum;
ledgerJournalTrans.currencyCode = 'USD';
ledgerJournalTrans.ExchRate =Currency::exchRate(ledgerJournalTrans.currencyCode);
ledgerJournalTrans.AccountNum = '140550';
ledgerJournalTrans.AccountType = ledgerJournalACType::Ledger;
ledgerJournalTrans.AmountCurDebit = 1220.00;
ledgerJournalTrans.TransDate = systemdateget();
ledgerJournalTrans.Txt = 'Projector sold';
ledgerJournalTrans.OffsetAccount = '401140';
// Insert to records into the ledgerJournalTrans table
ledgerJournalTrans.insert();
// Use the LedgerJournalCheckPost class to
// post the journal
ledgerJournalCheckPost =LedgerJournalCheckPost::construct(LedgerJournalType::Daily);
// Set the JournalId, tableId of the journalTable
// and specify to post the journal (not only check it).
ledgerJournalCheckPost.parmJournalNum(ledgerJournalTable.JournalNum);
ledgerJournalCheckPost.parmPost(NoYes::Yes);
ledgerJournalCheckPost.run();
ttscommit;
}
Nice. Thanks
ReplyDelete