Update the vendor open trans to mark and update the amount using x++.
VendTransOpen vendTransOpen;
VendTrans vendTrans;
SpecTransManager specTransManager;
boolean check;
SpecTrans specTrans;
;
CustVendOpenTransManager managerLoc = CustVendOpenTransManager::construct(ledgerJournalTrans);
select firstonly vendTrans
where vendTrans.Invoice == ledgerJournalTrans.Invoice
join firstonly vendTransOpen
where vendTransOpen.RefRecId == vendTrans.RecId;
specTransManager = SpecTransManager::construct(ledgerJournalTrans);
check = SpecTrans::existByRef(vendTransOpen.DataAreaID,tableNum(VendTransOpen),vendTransOpen.RecId);
if(!check)
{
managerLoc.updateTransMarked(vendTransOpen,NoYes::Yes);
ttsbegin;
specTrans = SpecTrans::findByRef(vendTransOpen.DataAreaID,tableNum(VendTransOpen),vendTransOpen.RecId,true);
specTrans.Balance01 = -ledgerJournalTrans.AmountCurDebit;
specTrans.update();
ttscommit;
}
else
{
warning(strFmt("%1 Record already marked.",ledgerJournalTrans.Invoice));
}
Keep Daxing!!
No comments:
Post a Comment