static void RecoverDeletedPurchasOrder(Args _args)
{
PurchTableDelete purchTableDelete;
PurchLineDelete purchLineDelete;
PurchTable purchTable;
PurchLine purchLine;
;
purchTableDelete = PurchTableDelete::find('', true);
ttsbegin;
switch (purchTableDelete.Cancelled)
{
case Voided::Voided :
purchTable = conpeek(purchTableDelete.PurchTable, 1);
purchTable.insert();
while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.insert();
}
purchTableDelete.delete();
break;
case Voided::linesVoided :
while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.insert();
purchLineDelete.delete();
}
purchTableDelete.delete();
break;
}
ttscommit;
}
{
PurchTableDelete purchTableDelete;
PurchLineDelete purchLineDelete;
PurchTable purchTable;
PurchLine purchLine;
;
purchTableDelete = PurchTableDelete::find('', true);
ttsbegin;
switch (purchTableDelete.Cancelled)
{
case Voided::Voided :
purchTable = conpeek(purchTableDelete.PurchTable, 1);
purchTable.insert();
while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.insert();
}
purchTableDelete.delete();
break;
case Voided::linesVoided :
while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
{
purchLine = conpeek(purchLineDelete.PurchLine, 1);
purchLine.insert();
purchLineDelete.delete();
}
purchTableDelete.delete();
break;
}
ttscommit;
}
No comments:
Post a Comment