Create and Post GL Journal - mulit line voucher
Hi,
The below job is used to create General journal (multiline voucher -> debit and credit in different line) and post it.
static void CreateGLJournalPost_multiLine(Args _args)
{
AxLedgerJournalTable journalTable; // class
AxLedgerJournalTrans journalTrans; // class
container acctPattern;
container offSetAcctPattern;
LedgerJournalTable ledgerJournalTable; // table
ledgerJournalCheckPost ledgerJournalCheckPost;// table
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
//Debit line
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurDebit(1200);
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
acctPattern = ["1101001-Disp","1101001", 1, "Worker","000005"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
//if LeadgerJournalACType::Vend - use below code
/*
journalTrans.parmAccountType(LedgerJournalACType::Vend);
journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount(_vendAccount,LedgerJournalACType::Vend));*/
journalTrans.save();
//credit line 1
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurCredit(700);
journalTrans.parmAccountType(LedgerJournalACType:: Ledger ); acctPattern = ["1121002-Disp","1121002", 1, "Worker","000038"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
journalTrans.save();
//credit line 2
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurCredit(500);
journalTrans.parmAccountType(LedgerJournalACType:: Ledger ); acctPattern = ["1121002-Disp","1121002", 1, "Worker","11234"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
journalTrans.save();
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}
The below job is used to create General journal (multiline voucher -> debit and credit in different line) and post it.
static void CreateGLJournalPost_multiLine(Args _args)
{
AxLedgerJournalTable journalTable; // class
AxLedgerJournalTrans journalTrans; // class
container acctPattern;
container offSetAcctPattern;
LedgerJournalTable ledgerJournalTable; // table
ledgerJournalCheckPost ledgerJournalCheckPost;// table
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
//Debit line
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurDebit(1200);
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
acctPattern = ["1101001-Disp","1101001", 1, "Worker","000005"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
//if LeadgerJournalACType::Vend - use below code
/*
journalTrans.parmAccountType(LedgerJournalACType::Vend);
journalTrans.parmLedgerDimension(DimensionStorage::getDynamicAccount(_vendAccount,LedgerJournalACType::Vend));*/
journalTrans.save();
//credit line 1
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurCredit(700);
journalTrans.parmAccountType(LedgerJournalACType:: Ledger ); acctPattern = ["1121002-Disp","1121002", 1, "Worker","000038"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
journalTrans.save();
//credit line 2
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum); journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode("AED");
journalTrans.parmAmountCurCredit(500);
journalTrans.parmAccountType(LedgerJournalACType:: Ledger ); acctPattern = ["1121002-Disp","1121002", 1, "Worker","11234"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));
journalTrans.save();
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}
Comments
Post a Comment