Create and post GL journal - single line voucher

Hi,
The below job is used to create General journal (single line voucher -> both debit and credit in the same line) and post it. 


static void CreateGLJournalPost(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();

journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);

journalTrans.parmTransDate(systemDateGet());

journalTrans.parmCurrencyCode("AED");

journalTrans.parmAmountCurDebit(1200);


journalTrans.parmAccountType(LedgerJournalACType::Ledger);

acctPattern = ["1101001-Disp","1101001", 2, "Department","00000062","ProjectContract", "AACL-000007"];


journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(acctPattern));

offSetAcctPattern = ["1131001-Disp","1131001", 3, "Department","00000062","ProjectContract", "AACL-000007", "Project", "AACL-000006"];


journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern));

journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );

journalTrans.save();


ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);

ledgerJournalCheckPost.run();

info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));


}


Comments

Popular posts from this blog

x++ code to Generate cheque for vendor payment journal

Import Procurement Hierarchy / Categories with out code in ax 2012

Copy favorites From one user to another user - Ax 2012