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
Post a Comment