class NEC_RetailPeriodicDiscountFormEventHandler
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine, DiscountPercentOrValue), FormDataFieldEventType::Validating)]
public static void DiscountPercentOrValue_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
//RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormRun formRun = sender.datasource().formRun();
FormDataSource RetailDiscountLineMixAndMatch_ds = FormRun.dataSource(formDataSourceStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineMixAndMatch));
RetailDiscountLineMixAndMatch RetailDiscountLineMixAndMatch = RetailDiscountLineMixAndMatch_ds.cursor();
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormDataSource formDataSource = sender.datasource();
RetailPeriodicDiscountLine retailPeriodicDiscountLine = formDataSource.cursor();
FormReferenceGroupControl RetailGroupMemberLine_Product = formRun.design(0).controlName('RetailGroupMemberLine_Product');
if(RetailDiscountLineMixAndMatch.discountType == retaildealpricediscountpctbase::dealprice)
{
select inventTableModule
exists join inventTable
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join EcoResProduct
where inventTable.Product == RetailGroupMemberLine_Product.value();
if (inventTableModule.ItemId && inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue)
{
boolean doCancel =!checkFailed("Deal price cannot exceeds the base sale price");
args.cancel(doCancel);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, discAmount), FormDataFieldEventType::Validating)]
public static void discAmount_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
RetailPeriodicDiscountLine retailPeriodicDiscountLine;
RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormRun formRun = sender.datasource().formRun();
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
FormReferenceGroupControl RetailGroupMemberLine_Product = formRun.design(0).controlName('RetailGroupMemberLine_Product');
if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
{
select inventTableModule
exists join inventTable
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join EcoResProduct
where inventTable.Product == RetailGroupMemberLine_Product.value();
if (inventTableModule.ItemId && inventTableModule.Price < retailDiscountLineOffer.discAmount)
{
boolean doCancel =!checkFailed("Cash discount Amount cannot exceeds the base sale price");
args.cancel(doCancel);
}
}
}
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine, DiscountPercentOrValue), FormDataFieldEventType::Validating)]
public static void DiscountPercentOrValue_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
//RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormRun formRun = sender.datasource().formRun();
FormDataSource RetailDiscountLineMixAndMatch_ds = FormRun.dataSource(formDataSourceStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineMixAndMatch));
RetailDiscountLineMixAndMatch RetailDiscountLineMixAndMatch = RetailDiscountLineMixAndMatch_ds.cursor();
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormDataSource formDataSource = sender.datasource();
RetailPeriodicDiscountLine retailPeriodicDiscountLine = formDataSource.cursor();
FormReferenceGroupControl RetailGroupMemberLine_Product = formRun.design(0).controlName('RetailGroupMemberLine_Product');
if(RetailDiscountLineMixAndMatch.discountType == retaildealpricediscountpctbase::dealprice)
{
select inventTableModule
exists join inventTable
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join EcoResProduct
where inventTable.Product == RetailGroupMemberLine_Product.value();
if (inventTableModule.ItemId && inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue)
{
boolean doCancel =!checkFailed("Deal price cannot exceeds the base sale price");
args.cancel(doCancel);
}
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, discAmount), FormDataFieldEventType::Validating)]
public static void discAmount_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
RetailPeriodicDiscountLine retailPeriodicDiscountLine;
RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormRun formRun = sender.datasource().formRun();
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
FormReferenceGroupControl RetailGroupMemberLine_Product = formRun.design(0).controlName('RetailGroupMemberLine_Product');
if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
{
select inventTableModule
exists join inventTable
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join EcoResProduct
where inventTable.Product == RetailGroupMemberLine_Product.value();
if (inventTableModule.ItemId && inventTableModule.Price < retailDiscountLineOffer.discAmount)
{
boolean doCancel =!checkFailed("Cash discount Amount cannot exceeds the base sale price");
args.cancel(doCancel);
}
}
}
No comments:
Post a Comment