x++ code to Generate cheque for vendor payment journal

Hi,
X++ code to generate check (cheque) from Vendor payment journal (generate payments).

Note: In the Method of payment field, select a method of payment that uses the Check export file format.

//***********************************
/*To print check
    1) PaymMode - must be filled in LedgerJournalTrans (in paymMode = export format to be check)
    2) OffsetAccountType = Bank in LedgerJournalTrans
    3) Generate Payment dialog, bank account = Offset Bank account in LedgerJournalTrans*/
//*************************************

static void GenerateCheque_VendorPayment(Args _args)
{
    LedgerJournalTrans      LedgerJournalTrans = LedgerJournalTrans::findRecId(5637186584, true);
    VendSumForPaym          vendSumForPaym;
    boolean                 runDialog;
    LedgerJournalCheckPostResults       postingResults_Client;
    LedgerPostingMessage                logTxt;
    ;

    vendSumForPaym = CustVendSumForPaym::newLedgerJournalTrans(LedgerJournalTrans);
    runDialog = vendSumForPaym.validateTransactions();
    if(!runDialog)
        throw error("@SYS319214");

    vendSumForPaym.parmPaymMode(LedgerJournalTrans.PaymMode);
    //vendSumForPaym.parmPaymFormat();
    vendSumForPaym.parmBankAccountID('ADIB-01');
    vendSumForPaym.parmMCRRunFormatPrompt(false);

    if (vendSumForPaym.validate())
    {
        vendSumForPaym.run();
        if (ledgerJournalTrans.parmLedgerDimension())
        {
            postingResults_Client = LedgerJournalCheckPostResults::construct();
            logTxt = postingResults_Client.errorLogJournalLine(tableNumLedgerJournalTrans),  LedgerJournalTrans.RecId);
            if (logTxt)
            {
                throw error(strFmt('%1',logTxt));
            }
            else
            {
                CustVendPDCManager::updatePostDatedCheckNum(LedgerJournalTrans.journalNum);
            }
        }
    }
}

Thanks,
Vijaykarthik

Comments

Popular posts from this blog

Import Procurement Hierarchy / Categories with out code in ax 2012

Copy favorites From one user to another user - Ax 2012