static void purchlinePosting(Args _args)
{
PurchFormLetter purchLetterConfirm, purchLetterPS;
PurchTable purchTable;
PurchLine purchLine;
Query query;
QueryRun queryRun;
while select PurchId from purchLine
where purchLine.PurchId == "" &&
purchLine.PurchStatus == PurchStatus::Backorder
&& purchLine.PurchaseType == PurchaseType::Purch
&& purchLine.PurchReceivedNow != 0
{
select firstonly purchTable
where purchTable.PurchId == purchLine.PurchId
&& purchTable.DocumentState != VersioningDocumentState::Confirmed;
if (purchTable)
{
//Post the confirmation for purchase order
purchLetterConfirm = PurchFormLetter::construct(DocumentStatus::PurchaseOrder, '', '',
SysOperationExecutionMode::Synchronous);
purchLetterConfirm.getLast();
purchLetterConfirm.update(purchTable, purchTable.PurchId, systemDateGet(), PurchUpdate::All, AccountOrder::None,
false, false, false, false);
}
if (purchLine)
{
//Post the product receipt for purchase order
query = new Query(QueryStr(PurchUpdatePackingSlip));
query.dataSourceTable(tableNum(PurchLine)).addRange(fieldNum(PurchTable,PurchId)).value("");
query.dataSourceTable(tableNum(PurchLine)).addRange(fieldNum(PurchLine,recid)).value(int642str(purchLine.RecId));
queryRun = new QueryRun(query);
purchLetterPS = PurchFormLetter::construct(DocumentStatus::PackingSlip, '', '',
SysOperationExecutionMode::
Synchronous);
purchLetterPS.chooseLinesQuery(queryRun);
purchLetterPS.update(purchTable, purchTable.PurchId, systemDateGet(), PurchUpdate::ReceiveNow, AccountOrder::None,
false, false, false, false);
}
}
info("Done");
}
H@ppy D@xing
Posting the purchase order Invoice by purchline wise in ax 2012
Hola,
Here is the code for posting the purchase order invoice for line wise by using the the custom conditions.
please modify according to your requirement.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment