Customer payment transaction, mark for settlement against invoice and post

Pre requisite is that you have your CustInvoiceJour table containing the invoice you wanted to receive payment for and settle.


//...
//Create your LedgerJournalTable and LedgerJournalTrans
//ledgerJournalTrans.InvoiceId must be blank to hinder this becoming a free text invoice

ledgerJournalTrans.MarkedInvoice = custInvoiceJour.InvoiceId;
ledgerJournalTrans.MarkedInvoiceCompany = custInvoiceJour.DataAreaId;
ledgerJournalTrans.MarkedInvoiceRecId = CustTransOpen::getFirstDueRecIdByInvoice(ledgerJournalTrans.MarkedInvoice);
ledgerJournalTrans.insert();

//mark the open customer transactions
LedgerJournalEngine_CustPayment::updateMarkedInvoiceSpecTrans(ledgerJournalTrans);

After posting the payment journal, if everything validates, your transactions will be settled.

//Post the journal
LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes).runOperation();

Comments

Popular posts from this blog

Call a simple Logic app from X++

SysOperationFramework with use of Query

Retail Attributes on sales lines