Monday, May 22, 2023

How to Copy Pending Vendor Invoice Description to Vendor Transaction Descriptions in d365 using x++

 My requirement is to copy the  Pending Vendor Invoice Description to Vendor Transaction Descriptions in d365 using x++.

[ExtensionOf(classStr(PurchFormLetter_Invoice))]

internal final class DaxPurchFormLetter_Invoice_Extension

{

    protected void afterOperationEnd()

    {

        FormletterOutputContract purchFormLetterOutputContract;

        VendInvoiceJour vendInvoiceJournal;

        VendTrans updateVendTrans;

        VendInvoiceInfoTable vendInvoiceInfoTable;

          next afterOperationEnd();

          purchFormLetterOutputContract = this.getOutputContract();

        vendInvoiceJournal = purchFormLetterOutputContract.parmJournal() as VendInvoiceJour;

        if (purchFormLetterOutputContract.parmNumberOfOrdersPosted() > 0)

        {

            select vendInvoiceInfoTable where vendInvoiceInfoTable.ParmId==vendInvoiceJournal.ParmId

                    && vendInvoiceInfoTable.PurchId==vendInvoiceJournal.PurchId;

            select forupdate updateVendTrans

                 where updateVendTrans.Voucher==vendInvoiceJournal.LedgerVoucher

                && updateVendTrans.TransDate == vendInvoiceJournal.InvoiceDate

                && updateVendTrans.AccountNum == vendInvoiceJournal.InvoiceAccount;

            if (updateVendTrans.RecId)

            {

                ttsbegin;

                updateVendTrans.Txt=vendInvoiceInfoTable.Description;

                updateVendTrans.doUpdate();

                ttscommit;

            }

        }

    }

}

Account Payable à Invoice à Pending Vendor Invoice à Header à Invoice Description

Account Payable à Vendors à All Vendors à Transactions à Description





No comments:

Post a Comment