PurchaseOrderCancel X++ AX 2012
static void Del_PurchaseOrderCancel(Args _args)
{
#File
IO iO;
PurchId PurchId;
FilenameOpen filename;
Container record;
str one;
boolean first = true;
str Delimiter = ",";
int totalRecords;
Dialog dialog;
DialogField dialogFilename;
PurchTable PurchTable;
PurchLine purchLine;
;
dialog = new dialog();
dialog.caption("select a file");
dialogFilename = dialog.addField(extendedTypeStr(FilenameOpen));
dialog.filenameLookupFilter(record);
dialog.run();
if(dialog.closedOk())
{
filename = dialogFilename.value();
iO = new CommaTextIo(filename,#IO_Read);
if (! iO || iO.status() != IO_Status::Ok)
{
throw error("@SYS19358");
}
record = iO.read();
ttsBegin;
while(iO.status() == IO_Status::Ok)
{
record = iO.read();
if(!record)
break;
Purchid = conPeek(record,1);
PurchTable =PurchTable::find(Purchid);
if (PurchTable)
{
while select forUpdate purchLine
where purchLine.PurchId == PurchId
{
purchLine.RemainInventPhysical = 0;
purchLine.RemainPurchPhysical = 0;
purchLine.PurchStatus = PurchStatus::Canceled;
purchLine.update();
InventMovement::bufferSetRemainQty(purchLine);
}
}
}
ttsCommit;
iO.finalize();
}
info("Purchase Order Cancellation completed");
}
*This post is locked for comments