Posted on May 9, 2015by srinathsundaresan
Problem:Post a partial product receipt for a purchase order
Solution: We need to post partial product receipt for a purchase order. The lines to post are determined by the line number range You can add range on any field in purch line. The receive now quantity will specify the quantity to receive against each line.
purchTable = PurchTable::find(“PO1002228”);
update_recordSet purchLine
setting purchReceivedNow = 1 , Inventreceivednow = 1
where purchLine.PurchId == purchTable.PurchId &&
purchLine.LineNumber == 1;
query = new Query(queryStr(PurchUpdate));//Query for the filter criteria
query.dataSourceTable(tableNum(PurchTable)).addRange(fieldnum (PurchTable,PurchId)).value(queryValue(purchTable.PurchId));
query.dataSourceTable(tableNum(PurchLine)).addRange(fieldNum(PurchLine,LineNumber)).value(queryValue(1));
chooseLinesQuery = new SysQueryRun(query);
purchFormLetter = PurchFormLetter_PackingSlip::newPackingSlipFromChooseLineQuery(chooseLinesQuery,purchTable); //pass in _purchid,
purchFormLetter.update( purchTable,
“PA0093”,//product receipt number
systemDateGet(),//trans date
PurchUpdate::ReceiveNow,//Receive now
AccountOrder::None,
false,
false);