public final class DaxCancellButton
{
public static SalesTable salesTable;
public static SalesLine salesLine;
public static void main(Args _args)
{
//FormRun formRun = this.formRun() as formRun;
salesTable = _args.record();
DaxCancellButton ss = new DaxCancellButton();
if(salesTable)
{
while select forupdate salesLine where salesTable.SalesId == salesLine.SalesId
{
ttsbegin;
salesLine.remainSalesPhysical = 0;
salesLine.remainInventPhysical = 0;
ss.closeOk();
ttscommit;
}
}
}
public void closeOk()
{
// SalesLine callerSalesLine;
FormDataSource callerDataSource;
// SalesTable salestable;
MCRSalesOrderCancellation mcrSalesOrderCancellation;
if (isConfigurationkeyEnabled(configurationKeyNum(MCRCallCenter)))
{
mcrSalesOrderCancellation = new MCRSalesOrderCancellation();
mcrSalesOrderCancellation.preCancel(SalesTable::find(salesLine.SalesId));
}
try
{
SalesUpdateRemain salesUpdateRemain = SalesUpdateRemain::construct();
boolean updated = salesUpdateRemain.updateDeliverRemainder(salesLine,0,0);
if (updated)
{
if (isConfigurationkeyEnabled(configurationKeyNum(MCRCallCenter)))
{
salesTable = SalesTable::find(salesLine.SalesId, true);
// If sales order is paid by loyalty create the refund loyalty lines and post them as part of this process
if (salesTable.SalesStatus != SalesStatus::Canceled)
{
mcrSalesOrderCancellation.RefundLoyaltyPointsForSalesLine(salesTable, salesLine);
} mcrSalesOrderCancellation.postCancelAdjPayment(salesTable);
}
Object salesLineDataSource = callerDataSource;
//if (formDataSourceHasMethod(salesLineDataSource, identifierStr(salesTable_ds)))
//{
// FormDataSource salesTableDataSource = salesLineDataSource.salesTable_ds();
// salesTableDataSource.reread();
// salesTableDataSource.refresh();
//}
//salesLineDataSource.reread();
//salesLineDataSource.refresh();
//salesLineDataSource.research(true);
}
//super();
}
catch
{
//salesLine.reread();
}
}
}
No comments:
Post a Comment