class NEC_Alldiscountvalidations
{
//// <summary>
//// </summary>
//// <param name="sender"></param>
//// <param name="e"></param>
//[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine, DiscountPercentOrValue), FormDataFieldEventType::Validated)]
//public static void DiscountPercentOrValue_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
//{
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// RetailDiscountLineMixAndMatch retailDiscountLineMixAndMatch;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailPeriodicDiscountLine_ds = sender.datasource();
// RetailPeriodicDiscountLine retailPeriodicDiscountLine = RetailPeriodicDiscountLine_ds.cursor();
// FieldId amount = retailPeriodicDiscountLine.DiscountPercentOrValue;
// select retailDiscountLineMixAndMatch
// where retailDiscountLineMixAndMatch.RecId == retailPeriodicDiscountLine.RecId;
// if(retailDiscountLineMixAndMatch.discountType == RetailDealPriceDiscountPctBase::DealPrice)
// {
// select retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId )
// {
// if(inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue )
// {
// boolean doCancel =!checkFailed("Deal price cannot exceeds the base sale price");
// args.cancel(doCancel);
// // throw warning("Deal price cannot exceeds the base sale price");
// }
// }
// }
//}
//// <summary>
// //</summary>
// //<param name="sender"></param>
//// <param name="e"></param>
//[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, offerPrice), FormDataFieldEventType::Validated)]
//public static void offerPrice_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
//{
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailPeriodicDiscountLine retailPeriodicDiscountLine;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
// RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.offerPrice;
// if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price)
// {
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId)
// {
// if(inventTableModule.Price < retailDiscountLineOffer.offerPrice )
// {
// boolean doCancel =!checkFailed("Discount Price cannot exceeds the base sale price");
// args.cancel(doCancel);
// // throw warning("Discount Price cannot exceeds the base sale price");
// }
// }
// }
//}
//// <summary>
//// </summary>
// // <param name="sender"></param>
// // <param name="e"></param>
// [FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, discAmount), FormDataFieldEventType::Validated)]
// public static void discAmount_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
// {
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailPeriodicDiscountLine retailPeriodicDiscountLine;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
// RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.discAmount;
// if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
// {
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId )
// {
// if(inventTableModule.Price < retailDiscountLineOffer.discAmount )
// {
// boolean doCancel =!checkFailed("Cash discount Amount cannot exceeds the base sale price");
// args.cancel(doCancel);
// //throw warning("Cash discount Amount cannot exceeds the base sale price");
// }
// }
// }
// }
/// <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 retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select /*inventTableModule
where inventTableModule.ItemId == EcoResProduct.DisplayProductNumber
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join */
inventTable
join EcoResProduct
where inventTable.Product == ecoResProduct.RecId
&& ecoResProduct.RecId == RetailGroupMemberLine_Product.value();
//join retailGroupMemberLineilPeriodicDiscountLine.RetailGroupMemberLine;
// //join retailDiscountLineMixAndMatch
// where retailDiscountLineMixAndMatch.RecId == retailPeriodicDiscountLine.RecId
// && retailDiscountLineMixAndMatch.discountType == RetailDealPriceDiscountPctBase::DealPrice;
info(strFmt("%1... %2 .. %3", inventTable.ItemId, inventTableModule.Price, retailPeriodicDiscountLine.DiscountPercentOrValue));
if (inventTableModule.ItemId && inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue)
{
info(strFmt("%1..%2", 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;
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.discAmount;
//if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
//{
//select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select inventTableModule
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join inventTable
where inventTable.Product == ecoResProduct.RecId
exists join ecoResProduct
where ecoResProduct.RecId == retailGroupMemberLine.Product
exists join retailGroupMemberLine
where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
exists join retailPeriodicDiscountLine
where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
&& retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff;
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_RetailDiscountLineOffer, offerPrice), FormDataFieldEventType::Validating)]
public static void offerPrice_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
RetailPeriodicDiscountLine retailPeriodicDiscountLine;
RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
//FieldId amount = retailDiscountLineOffer.offerPrice;
//if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price)
//{
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select inventTableModule
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join inventTable
where inventTable.Product == ecoResProduct.RecId
exists join ecoResProduct
where ecoResProduct.RecId == retailGroupMemberLine.Product
exists join retailGroupMemberLine
where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
exists join retailPeriodicDiscountLine
where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
&& retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price;
if (inventTableModule.ItemId && inventTableModule.Price < retailDiscountLineOffer.offerPrice )
{
boolean doCancel =!checkFailed("Discount Price 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::Validated)]
//public static void DiscountPercentOrValue_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
//{
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// RetailDiscountLineMixAndMatch retailDiscountLineMixAndMatch;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailPeriodicDiscountLine_ds = sender.datasource();
// RetailPeriodicDiscountLine retailPeriodicDiscountLine = RetailPeriodicDiscountLine_ds.cursor();
// FieldId amount = retailPeriodicDiscountLine.DiscountPercentOrValue;
// select retailDiscountLineMixAndMatch
// where retailDiscountLineMixAndMatch.RecId == retailPeriodicDiscountLine.RecId;
// if(retailDiscountLineMixAndMatch.discountType == RetailDealPriceDiscountPctBase::DealPrice)
// {
// select retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId )
// {
// if(inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue )
// {
// boolean doCancel =!checkFailed("Deal price cannot exceeds the base sale price");
// args.cancel(doCancel);
// // throw warning("Deal price cannot exceeds the base sale price");
// }
// }
// }
//}
//// <summary>
// //</summary>
// //<param name="sender"></param>
//// <param name="e"></param>
//[FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, offerPrice), FormDataFieldEventType::Validated)]
//public static void offerPrice_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
//{
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailPeriodicDiscountLine retailPeriodicDiscountLine;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
// RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.offerPrice;
// if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price)
// {
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId)
// {
// if(inventTableModule.Price < retailDiscountLineOffer.offerPrice )
// {
// boolean doCancel =!checkFailed("Discount Price cannot exceeds the base sale price");
// args.cancel(doCancel);
// // throw warning("Discount Price cannot exceeds the base sale price");
// }
// }
// }
//}
//// <summary>
//// </summary>
// // <param name="sender"></param>
// // <param name="e"></param>
// [FormDataFieldEventHandler(formDataFieldStr(RetailPeriodicDiscount, RetailPeriodicDiscountLine_RetailDiscountLineOffer, discAmount), FormDataFieldEventType::Validated)]
// public static void discAmount_OnValidated(FormDataObject sender, FormDataFieldEventArgs e)
// {
// InventTable inventTable;
// InventTableModule inventTableModule;
// RetailPeriodicDiscountLine retailPeriodicDiscountLine;
// RetailGroupMemberLine retailGroupMemberLine;
// EcoResProduct ecoResProduct;
// FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
// FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
// RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.discAmount;
// if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
// {
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
// if (inventTableModule.ItemId )
// {
// if(inventTableModule.Price < retailDiscountLineOffer.discAmount )
// {
// boolean doCancel =!checkFailed("Cash discount Amount cannot exceeds the base sale price");
// args.cancel(doCancel);
// //throw warning("Cash discount Amount cannot exceeds the base sale price");
// }
// }
// }
// }
/// <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 retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select /*inventTableModule
where inventTableModule.ItemId == EcoResProduct.DisplayProductNumber
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join */
inventTable
join EcoResProduct
where inventTable.Product == ecoResProduct.RecId
&& ecoResProduct.RecId == RetailGroupMemberLine_Product.value();
//join retailGroupMemberLineilPeriodicDiscountLine.RetailGroupMemberLine;
// //join retailDiscountLineMixAndMatch
// where retailDiscountLineMixAndMatch.RecId == retailPeriodicDiscountLine.RecId
// && retailDiscountLineMixAndMatch.discountType == RetailDealPriceDiscountPctBase::DealPrice;
info(strFmt("%1... %2 .. %3", inventTable.ItemId, inventTableModule.Price, retailPeriodicDiscountLine.DiscountPercentOrValue));
if (inventTableModule.ItemId && inventTableModule.Price < retailPeriodicDiscountLine.DiscountPercentOrValue)
{
info(strFmt("%1..%2", 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;
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
// FieldId amount = retailDiscountLineOffer.discAmount;
//if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff)
//{
//select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select inventTableModule
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join inventTable
where inventTable.Product == ecoResProduct.RecId
exists join ecoResProduct
where ecoResProduct.RecId == retailGroupMemberLine.Product
exists join retailGroupMemberLine
where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
exists join retailPeriodicDiscountLine
where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
&& retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::AmountOff;
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_RetailDiscountLineOffer, offerPrice), FormDataFieldEventType::Validating)]
public static void offerPrice_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
{
InventTable inventTable;
InventTableModule inventTableModule;
RetailPeriodicDiscountLine retailPeriodicDiscountLine;
RetailGroupMemberLine retailGroupMemberLine;
EcoResProduct ecoResProduct;
FormDataFieldCancelEventArgs args = e as FormDataFieldCancelEventArgs;
FormDataSource RetailDiscountlineoffer_ds = sender.datasource();
RetailDiscountLineOffer retailDiscountLineOffer = RetailDiscountlineoffer_ds.cursor();
//FieldId amount = retailDiscountLineOffer.offerPrice;
//if(retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price)
//{
// select retailPeriodicDiscountLine
// where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
// join retailGroupMemberLine
// where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
// join ecoResProduct
// where ecoResProduct.RecId == retailGroupMemberLine.Product
// join inventTable
// where inventTable.Product == ecoResProduct.RecId
// join inventTableModule
// where inventTableModule.ItemId == inventTable.ItemId
// && inventTableModule.ModuleType == ModuleInventPurchSales::Sales;
select inventTableModule
where inventTableModule.ItemId == inventTable.ItemId
&& inventTableModule.ModuleType == ModuleInventPurchSales::Sales
exists join inventTable
where inventTable.Product == ecoResProduct.RecId
exists join ecoResProduct
where ecoResProduct.RecId == retailGroupMemberLine.Product
exists join retailGroupMemberLine
where retailGroupMemberLine.RecId == retailPeriodicDiscountLine.RetailGroupMemberLine
exists join retailPeriodicDiscountLine
where retailPeriodicDiscountLine.RecId == retailDiscountLineOffer.RecId
&& retailDiscountLineOffer.discountMethod == RetailDiscountOfferLineDiscMethodBase::Price;
if (inventTableModule.ItemId && inventTableModule.Price < retailDiscountLineOffer.offerPrice )
{
boolean doCancel =!checkFailed("Discount Price cannot exceeds the base sale price");
args.cancel(doCancel);
}
}
}
No comments:
Post a Comment