Tuesday, July 6, 2010

Post Journal - Illustrate the structure of LedgerJournalcheckPost\postJournal. It is called by most journals.

Object:  Classes\LedgerJournalCheckPost\postJournal

Invoke Scenario:

Most of the journals (including “General ledger”, “Payment journal”, “Invoice journal”, “Invoice register”, “Invoice approval journal”, etc.) will call this method to deal with the posting staff.

Operation Instance:


General ledger -> Journals -> General journal -> Create a new line -> Click Line -> add lines for journal -> Click button post -> post.


Explanation of codes:


while select ledgerJournalTrans order by Voucher, AccountType, RecId //line 99

where ledgerJournalTrans.JournalNum == ledgerJournalTable.JournalNum

{

……

while (ledgerJournalTrans.AccountNum

ledgerJournalTrans.AmountCurDebit

// line 316
ledgerJournalTrans.AmountCurCredite

{

if (!this.postTrans(……))

……

ledgerJournalTrans = this.ledgerJournalTransOffset(ledgerJournalTrans, // line357

swappedAcToPostTaxedFirst);

……

}

……

}

……

if (interCompanyCompanies.elements() > 0) //line 400

{

interCompanyCompaniesEnumerator = interCompanyCompanies.getEnumerator();

while (interCompanyCompaniesEnumerator.moveNext())
{
if (interCompanyJournalIds.exists(interCompanyCompaniesEnumerator.current()))
{
ok = this.postJournalInterCompany(……);
……
}
}
}
Instance: (General journal Form)

GL -> Journals -> General journals -> lines
Add two lines as following:
Account Debit Credit Offset account

11010 1000 12060(intercompany)

21125 200 40112

Line 99: The while loop contains all the lines created in the journal form. In this instance, the while loop will be execute twice. One is for “11010, Offset 12060”, another is for “21125, Offset 40112”.

Line 316: This while loop will be execute twice at most. One is for the Current line account, another is for the offset account. In the end of this loop line357, the ledgerJournalTrans will be changed to its offset account.

Line 400: The codes within the ‘if’ condition is used to post the legertrans for intercompany. In this instance, the while loop inside the ‘if’ condition will be executed once. Because there is only one intercompany record 12060.
Post a Comment