x++ code to get Purchase order Voucher transactions either PO is cancelled or not Cancelled.


    static void  Job(Args _args)
{
    GeneralJournalEntry                     genJourEntry;
    GeneralJournalAccountEntry        genJourAccEntry;
    container                                        conGeneralJourAccEntry;
    //PO_receipt_1985 is the PackingSlipId
 
    while select  DocumentNumber,RecId,JournalNumber,SubledgerVoucher from  genJourEntry
        where genJourEntry.DocumentNumber == 'PO_receipt_1985'
           join GeneralJournalEntry,PostingType,IsCorrection from genJourAccEntry
        where  genJourAccEntry.GeneralJournalEntry  == genJourEntry.RecId
            && genJourAccEntry.PostingType          ==   LedgerPostingType::PurchStdCostPurchasePriceVariance//PurchasePriceVariance
            && (genJourAccEntry.IsCorrection        == NoYes::Yes
            ||  genJourAccEntry.IsCorrection        ==  NoYes::No)
             
    {
        info(strFmt("AccountingCurrencyAmount :%",genJourAccEntry.AccountingCurrencyAmount));
     
 conGeneralJourAccEntry + = GeneralJournalAccountEntry::findRelated(genJourAccEntry.RecId);
  genJourEntry = conpeek(conGeneralJourAccEntry,3);    
     
       info(strFmt("Recid :%1 PackingSlipId: %2 JournalNumber :%3 Voucher:%4",           genJourEntry.RecId,genJourEntry.DocumentNumber,genJourEntry.JournalNumber
  ,genJourEntry.SubledgerVoucher));

    conGeneralJourAccEntry = conNull();
    }
}

Thank you.

Comments

Popular posts from this blog

x++ code to add hyperlink to a field in D365FO

x++ code to get Vendor Email Address based on Purpose in Dynamics 365 for Operations

x++ code to get Customer Address based on purpose in ax 2012