class NEC_InventJournalLossProfitFormEventHandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(InventJournalLossProfit, InventJournalTrans, Qty), FormDataFieldEventType::Validated)]
public static void Qty_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource inventJournalTrans_ds = sender.datasource();
InventJournalTrans inventJournalTrans = inventJournalTrans_ds.cursor();
if(InventJournalName::find(inventJournalTrans.inventJournalTable().JournalNameId).NEC_NegativeQtyOnly == NoYes::Yes && inventJournalTrans.Qty > 0)
{
FormDataFieldCancelEventArgs ce = e as FormDataFieldCancelEventArgs;
ce.cancel(!checkFailed("Quantity cannot be positive"));
}
}
}
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(InventJournalLossProfit, InventJournalTrans, Qty), FormDataFieldEventType::Validated)]
public static void Qty_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource inventJournalTrans_ds = sender.datasource();
InventJournalTrans inventJournalTrans = inventJournalTrans_ds.cursor();
if(InventJournalName::find(inventJournalTrans.inventJournalTable().JournalNameId).NEC_NegativeQtyOnly == NoYes::Yes && inventJournalTrans.Qty > 0)
{
FormDataFieldCancelEventArgs ce = e as FormDataFieldCancelEventArgs;
ce.cancel(!checkFailed("Quantity cannot be positive"));
}
}
}
No comments:
Post a Comment