TmpFrmVirtual tmpFrmVirtualVend; PurchFormLetter_Invoice purchFormLetter; VendPackingSlipJour vendPackingSlipJour; SysQueryRun chooseLinesQuery; SysQueryRun chooseLinesPendingInvoiceQuery; container conTmpFrmVirtual; List selectedList = new List(Types::Record); while select TableId, RecId, PurchId from vendPackingSlipJour where vendPackingSlipJour.PurchId == _purchTable.PurchId { tmpFrmVirtualVend.clear(); tmpFrmVirtualVend.TableNum = vendPackingSlipJour.TableId; tmpFrmVirtualVend.RecordNo = vendPackingSlipJour.RecId; tmpFrmVirtualVend.NoYes = NoYes::Yes; tmpFrmVirtualVend.Id = vendPackingSlipJour.PurchId; tmpFrmVirtualVend.insert(); } chooseLinesQuery = new SysQueryRun(queryStr(PurchUpdate)); chooseLinesQuery.query().addDataSource(tableNum(VendInvoiceInfoTable)).enabled(false); //chooseLinesPendingInvoiceQuery needs to be initialized, although it will not be used chooseLinesPendingInvoiceQuery = new SysQueryRun(queryStr(PurchUpdatePendingInvoice)); chooseLinesPendingInvoiceQuery.query().dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable,PurchId)).value(queryValue('')); purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice); purchFormLetter.chooseLinesQuery (chooseLinesQuery); purchFormLetter.parmQueryChooseLinesPendingInvoice(chooseLinesPendingInvoiceQuery); purchFormLetter.purchTable (_purchTable); purchFormLetter.transDate (DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone())); purchFormLetter.parmParmTableNum (invoiceId); purchFormLetter.printFormLetter (NoYes::No); purchFormLetter.sumBy (AccountOrder::Auto); purchFormLetter.specQty (PurchUpdate::All); while select tmpFrmVirtualVend { selectedList.addEnd(tmpFrmVirtualVend); conTmpFrmVirtual = selectedList.pack(); } purchFormLetter.selectFromJournal(conTmpFrmVirtual); VendInvoiceInfoTable vendInvoiceInfoTable; select forupdate vendInvoiceInfoTable where vendInvoiceInfoTable.ParmId == purchFormLetter.parmId() && vendInvoiceInfoTable.PurchId == _purchTable.PurchId; if(vendInvoiceInfoTable) { vendInvoiceInfoTable.DocumentDate = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()); vendInvoiceInfoTable.LastMatchVariance = LastMatchVarianceOptions::OK; vendInvoiceInfoTable.ParmJobStatus = ParmJobStatus::Waiting; vendInvoiceInfoTable.Approved = NoYes::Yes; vendInvoiceInfoTable.Approver = HcmWorkerLookup::currentWorker(); vendInvoiceInfoTable.update(); } purchFormLetter.reArrangeNow(true); purchFormLetter.run();
Friday, December 7, 2018
Post Purchase Invoice with Match product receipts through Code in D365 FO
Subscribe to:
Post Comments (Atom)
Convert Call stack to readable format in D365FO X++
//Input --container _xppCallStack = xSession::xppCallStack(); Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...
-
Restore .bacpac file to Development VM Steps: 1. Take Backup of AxDB database from Development VM 2. Open Command Pr...
-
Posting Vendor invoice based on Product receipt public void postPurchaseInvoiceJournal() { VendPackingSlipJour vendP...
-
Code for reserve and unreserved sales order lines Inputs : SalesLine, InventDim (Combination to reserve), Qty Note : To Reserve -> Pass...
No comments:
Post a Comment