Skip to main content

Posts

Showing posts with the label inventtrans

Force delete inventtrans

Below is sample job to force delete inventtrans, which will take care of invent on hand update. static void DeleteInventTrans(Args _args) { Dialog dlg = new Dialog("Delete inventtrans ?"); DialogField dlgFld; InventMovement inventMovement; PurchLine purchLine; PurchLineRefRecId recId; ; dlgFld = dlg.addField(typeid(PurchLineRefRecId)); if(dlg.run()) { recId = dlgFld.value(); purchLine = PurchLine::findRecId(recId); if(purchLine) { InventMovement = InventMovement::construct(purchLine); InventUpd_DeleteMovement::newMovement( inventMovement,true).updateNow(); info("done"); } } }

how to remove reserv

// Code is added to InventJournalTable methods void removeAllJournalLinesReservation() { InventUpd_Reservation res; InventMovement inventmovement; Inventtrans inventtrans; InventJournalTrans inventJournalTrans ; if(this.Posted) return; while select inventJournalTrans index hint LineIdx where inventJournalTrans.JournalId == this.JournalId { while select inventTrans index hint TransIdIdx where inventTrans.InventTransId == inventJournalTrans.InventTransId && (inventTrans.StatusIssue == statusIssue::ReservOrdered || inventTrans.StatusIssue == statusIssue::ReservPhysical) { inventmovement = inventTrans.inventmovement(true); res = InventUpd_Reservation::newInventDim(inventmovement,inventTrans.inventDim(),abs(inventTrans.Qty),true); res.updatenow(); } } }