diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/Bill.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/Bill.cs
index e95d271..37dccb9 100644
--- a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/Bill.cs
+++ b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/Bill.cs
@@ -27,6 +27,23 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice
SetBillContral(limitCustomer == 1);
}
+ public override void BeforeF7Select(BeforeF7SelectEventArgs e)
+ {
+ base.BeforeF7Select(e);
+ }
+ ///
+ /// 下拉框根据编号取值前事件
+ ///
+ ///
+ public override void BeforeSetItemValueByNumber(BeforeSetItemValueByNumberArgs e)
+ {
+ base.BeforeSetItemValueByNumber(e);
+ }
+
+ ///
+ /// 值更新事件
+ ///
+ ///
public override void DataChanged(DataChangedEventArgs e)
{
base.DataChanged(e);
@@ -36,28 +53,6 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice
SetBillContral(val == 1);
}
- if (e.Field.Key.EqualsIgnoreCase("FCustID"))
- {
- var custId_Id = e.NewValue.Long2Int();
- if (custId_Id > 0)
- {
- var custId = this.View.Model.GetValue("FCustID", e.Row) as DynamicObject;
- //KHXYFL013
- var creditClassificationId = custId["F_CreditClassification_Id"];
- if (!creditClassificationId.IsNullOrEmptyOrWhiteSpace())
- {
- var creditClassification = custId["F_CreditClassification"] as DynamicObject;
- var number = creditClassification["Number"].ToString();
-
- this.View.Model.SetValue("FIsBigCust", number.EqualsIgnoreCase("KHXYFL013"), e.Row);
- }
- }
- else
- {
- this.View.Model.SetValue("FIsBigCust", false, e.Row);
- }
- }
-
if (e.Field.Key.EqualsIgnoreCase("FMaterialId"))
{
var materialId_Id = e.NewValue.Long2Int();
@@ -85,6 +80,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice
this.View.GetControl("F_MaterialModelGroup").Visible = !visible;
this.View.GetControl("F_BigCustSettlePrice").Visible = !visible;
+ this.View.GetControl("F_BigCustDiscRate").Visible = !visible;
this.View.GetControl("FMaterialId").Visible = visible;
this.View.GetControl("FMaterialName").Visible = visible;
diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/Save.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/Save.cs
index cc06739..620bf43 100644
--- a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/Save.cs
+++ b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/Save.cs
@@ -19,6 +19,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
base.OnPreparePropertys(e);
//添加需要加载的字段:
e.FieldKeys.Add("FLimitCustomer");
+ //产品类型
e.FieldKeys.Add("F_MaterialModelGroup");
e.FieldKeys.Add("FMaterialId");
e.FieldKeys.Add("FSeq");
@@ -29,6 +30,8 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
e.FieldKeys.Add("F_AgreePrice");
e.FieldKeys.Add("FCustID");
+ e.FieldKeys.Add("FEntryEffectiveDate");//生效日期
+ e.FieldKeys.Add("FEntryExpiryDate");//失效日期
}
public override void OnAddValidators(AddValidatorsEventArgs e)
diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/SaveValidator.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/SaveValidator.cs
index 993345a..607d655 100644
--- a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/SaveValidator.cs
+++ b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/BD_CustPrice/ServicePlugIn/SaveValidator.cs
@@ -1,4 +1,5 @@
-using Kingdee.BOS;
+using Gatedge.K3.Pilot.PlugIn.Models.Validate;
+using Kingdee.BOS;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.Validation;
using Kingdee.BOS.Orm.DataEntity;
@@ -9,6 +10,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Xml.Linq;
namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
{
@@ -20,16 +22,28 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
{
var limitCustomer = data.DataEntity["LimitCustomer"].Long2Int();
var entrys = data.DataEntity["BD_CustPriceEntry"] as DynamicObjectCollection;
+ //var idx = 0;
+ var periodValidityList = new List();
foreach (var entry in entrys)
{
- var idx = entry["Seq"].Long2Int() - 1;
+ var pvData = new PeriodValidity
+ {
+ Seq = entry["Seq"].Long2Int(),
+ MaterialModelGroup = entry["MaterialModelGroup"]?.ToString(),
+ MaterialId = entry["MaterialId_Id"].Long2Int(),
+ EffectiveDate = entry["EffectiveDate"] is DateTime ed ? ed : DateTime.MinValue,
+ ExpirationDate = entry["ExpiryDate"] is DateTime exd ? exd : DateTime.MinValue
+ };
+
+ var seq = entry["Seq"].Long2Int();
//大客户
if (limitCustomer == 1)
{
- if (entry["MaterialModelGroup"].IsNullOrEmptyOrWhiteSpace())
+ var materialModelGroup = entry["MaterialModelGroup"]?.ToString();
+ if (materialModelGroup.IsNullOrEmptyOrWhiteSpace())
{
var title = "物料规格类型必填!";
- var msg = $"限定客户类型为大客户时,{title}";
+ var msg = $"客户类型为大客户时,{title}";
var displayToFieldKey = "F_MaterialModelGroup";
validateContext.AddError(data
@@ -37,7 +51,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
displayToFieldKey// 出错的字段Key,可以空
, data.DataEntity["Id"].ToString() // 数据包内码,必填,后续操作会据此内码避开此数据包
, data.DataEntityIndex // 出错的数据包在全部数据包中的顺序
- , idx// 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
+ , seq// 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
, "REF"// 错误编码,可以任意设定一个字符,主要用于追查错误来源
, msg // 错误的详细提示信息
, title// 错误的简明提示信息
@@ -49,7 +63,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
if (entry["BigCustSettlePrice"].Convert() == 0M)
{
var title = "大客户底价必填!";
- var msg = $"限定客户类型为大客户时,{title}";
+ var msg = $"客户类型为大客户时,{title}";
var displayToFieldKey = "F_BigCustSettlePrice";
validateContext.AddError(data
@@ -57,7 +71,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
displayToFieldKey// 出错的字段Key,可以空
, data.DataEntity["Id"].ToString() // 数据包内码,必填,后续操作会据此内码避开此数据包
, data.DataEntityIndex // 出错的数据包在全部数据包中的顺序
- , idx// 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
+ , seq// 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
, "REF"// 错误编码,可以任意设定一个字符,主要用于追查错误来源
, msg // 错误的详细提示信息
, title// 错误的简明提示信息
@@ -65,8 +79,15 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
)
);
}
+
+ //设置分组Id
+ var first = periodValidityList.FirstOrDefault(w => w.MaterialModelGroup.Contains(pvData.MaterialModelGroup) || pvData.MaterialModelGroup.Contains(w.MaterialModelGroup));
+
+ pvData.GroupId = first == null ? pvData.Seq : first.GroupId;
}
+ periodValidityList.Add(pvData);
+
//协议客户
if (limitCustomer == 2)
{
@@ -81,7 +102,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
displayToFieldKey// 出错的字段Key,可以空
, data.DataEntity["Id"].ToString() // 数据包内码,必填,后续操作会据此内码避开此数据包
, data.DataEntityIndex // 出错的数据包在全部数据包中的顺序
- , idx // 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
+ , seq // 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
, "REF"// 错误编码,可以任意设定一个字符,主要用于追查错误来源
, msg // 错误的详细提示信息
, title// 错误的简明提示信息
@@ -101,7 +122,7 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
displayToFieldKey// 出错的字段Key,可以空
, data.DataEntity["Id"].ToString() // 数据包内码,必填,后续操作会据此内码避开此数据包
, data.DataEntityIndex // 出错的数据包在全部数据包中的顺序
- , idx // 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
+ , seq // 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
, "REF"// 错误编码,可以任意设定一个字符,主要用于追查错误来源
, msg // 错误的详细提示信息
, title// 错误的简明提示信息
@@ -109,12 +130,14 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
)
);
}
+ //设置分组Id
+ pvData.GroupId = pvData.MaterialId;
}
if (limitCustomer == 0)
{
- var title = "限定客户必填!";
- var msg = $"限定客户不能为空";
+ var title = "客户类型必填!";
+ var msg = $"客户类型不能为空";
var displayToFieldKey = "FMaterialId";
validateContext.AddError(data
@@ -133,6 +156,56 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.BD_CustPrice.ServicePlugIn
}
+ if (limitCustomer != 0 && periodValidityList.Count > 1)
+ {
+ //筛选出需要校验的数据
+ //大客户:产品类型不为空的
+ //协议客户:物料Id不为0的
+ var selList = periodValidityList.Where(w =>
+ (limitCustomer == 1 && !w.MaterialModelGroup.IsNullOrEmptyOrWhiteSpace())
+ || (limitCustomer == 2 && !(w.MaterialId == 0))
+ ).ToList();
+
+ if (selList.Any())
+ {
+ var groupList = selList.GroupBy(g => g.GroupId).Where(wg => wg.Count() > 1).ToList();
+
+ foreach (var group in groupList)
+ {
+ var items = group.ToList().OrderBy(o => o.EffectiveDate).ToList();
+ for (int i = 0; i < items.Count - 1; i++)
+ {
+ var currentItem = items[i];
+ var currSeq = currentItem.Seq;
+ for (int j = i + 1; j < items.Count; j++)
+ {
+ var compareItem = items[j];
+ if (currentItem.ExpirationDate >= compareItem.EffectiveDate)
+ {
+ var seq = compareItem.Seq;
+ var title = "同物料、产品类型,效期不能重叠!";
+ var msg = $"第【{seq}】行与第【{currSeq}】行效期重叠!";
+ var displayToFieldKey = "FEntryEffectiveDate";
+
+ validateContext.AddError(data
+ , new ValidationErrorInfo(
+ displayToFieldKey// 出错的字段Key,可以空
+ , data.DataEntity["Id"].ToString() // 数据包内码,必填,后续操作会据此内码避开此数据包
+ , data.DataEntityIndex // 出错的数据包在全部数据包中的顺序
+ , seq// 出错的数据行在全部数据行中的顺序,如果校验基于单据头,此为0
+ , "REF"// 错误编码,可以任意设定一个字符,主要用于追查错误来源
+ , msg // 错误的详细提示信息
+ , title// 错误的简明提示信息
+ , ErrorLevel.Error // 错误级别:警告、错误...
+ )
+ );
+ }
+ }
+ }
+ }
+ }
+ }
+
var entrys2 = data.DataEntity["BD_CustPriceCustEntry"] as DynamicObjectCollection;
if (limitCustomer != 1 && (entrys2 == null || entrys2.Count == 0))
diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/CUST_PAYMENT_PERIOD/List.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/CUST_PAYMENT_PERIOD/List.cs
new file mode 100644
index 0000000..5869f1d
--- /dev/null
+++ b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/CUST_PAYMENT_PERIOD/List.cs
@@ -0,0 +1,43 @@
+using Kingdee.BOS;
+using Kingdee.BOS.Core.List.PlugIn;
+using Kingdee.BOS.Core.List.PlugIn.Args;
+using Kingdee.BOS.Util;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.CUST_PAYMENT_PERIOD
+{
+ [Description("【客户账期_列表插件】列表动态创建列"), HotUpdate]
+ public class List : AbstractListPlugIn
+ {
+ public override void CreateListHeader(CreateListHeaderEventArgs e)
+ {
+ base.CreateListHeader(e);
+ // 创建动态列1
+ var header = e.ListHeader.AddChild();// 将动态列放在列表的最后面
+ //var header = e.ListHeader.AddChild(0);// 将动态列放在列表的指定位置
+ header.Caption = new LocaleValue("账期情况");
+ header.Key = "FDynamicColumn1";
+ header.FieldName = "FDynamicColumn1";
+ header.ColType = SqlStorageType.Sqlnvarchar;
+ header.Width = 200;
+ header.Visible = true;
+ header.ColIndex = e.ListHeader.GetChilds().Max(o => o.ColIndex) + 1;// 注意:列的显示顺序不是ColIndex决定的,而是由该列在ListHeader的childs集合中的位置决定的。
+
+ }
+
+ public override void FormatCellValue(FormatCellValueArgs args)
+ {
+ base.FormatCellValue(args);
+ if (args.Header.Key.Equals("FDynamicColumn1", StringComparison.OrdinalIgnoreCase))
+ {
+ args.FormateValue = string.Format("{0}=>{1}", args.Header.Caption, DateTime.Now);
+ }
+ }
+
+ }
+}
diff --git a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/Sal_Order/Bill.cs b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/Sal_Order/Bill.cs
index 62ee971..87b2fa6 100644
--- a/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/Sal_Order/Bill.cs
+++ b/Gatedge.K3.Pilot.PlugIn/BOSPlugIn/Sal_Order/Bill.cs
@@ -22,6 +22,9 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.Sal_Order
//物料
if (e.Field.Key.EqualsIgnoreCase("FMaterialId"))
{
+ this.Model.SetValue("F_AGREEPRICE", 0, e.Row);
+ this.Model.SetValue("F_BIGCUSTSETTLEPRICE", 0, e.Row);
+
var materialId_Id = e.NewValue.Long2Int();
if (materialId_Id == 0)
return;
@@ -41,20 +44,20 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.Sal_Order
var F_AGREEPRICE = data["F_AGREEPRICE"].Convert();
this.Model.SetValue("F_AGREEPRICE", F_AGREEPRICE, e.Row);
- var custId = this.View.Model.GetValue("FCustID") as DynamicObject;
- var creditClassificationId = custId["F_CreditClassification_Id"];
- if (!creditClassificationId.IsNullOrEmptyOrWhiteSpace())
- {
- var creditClassification = custId["F_CreditClassification"] as DynamicObject;
- var number = creditClassification["Number"].ToString();
+ // 大客户结算价
+ var F_BIGCUSTSETTLEPRICE = data["F_BIGCUSTSETTLEPRICE"].Convert();
+ this.Model.SetValue("F_BIGCUSTSETTLEPRICE", F_BIGCUSTSETTLEPRICE, e.Row);
- if (number.EqualsIgnoreCase("KHXYFL013"))
- {
- // 大客户结算价
- var F_BIGCUSTSETTLEPRICE = data["F_BIGCUSTSETTLEPRICE"].Convert();
- this.Model.SetValue("F_BIGCUSTSETTLEPRICE", F_BIGCUSTSETTLEPRICE, e.Row);
- }
- }
+ //大客户折扣率
+ var F_BigCustDiscRate = data["F_BIGCUSTDISCRATE"].Convert();
+ this.Model.SetValue("F_BigCustDiscRate", F_BigCustDiscRate, e.Row);
+
+ }
+ else
+ {
+ this.Model.SetValue("F_AGREEPRICE", 0, e.Row);
+ this.Model.SetValue("F_BIGCUSTSETTLEPRICE", 0, e.Row);
+ this.Model.SetValue("F_BigCustDiscRate", 0, e.Row);
}
}
@@ -62,8 +65,6 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.Sal_Order
if (e.Field.Key.EqualsIgnoreCase("FCustID"))
{
var custId_Id = e.NewValue.Long2Int();
- if (custId_Id == 0)
- return;
var dal = new BDCustPriceDAL(this.Context);
var dateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
@@ -76,34 +77,36 @@ namespace Gatedge.K3.Pilot.PlugIn.BOSPlugIn.Sal_Order
var rowIndex = this.View.Model.GetRowIndex(details, entry);
var materialId_Id = entry["MaterialId_Id"].Long2Int();
- if (materialId_Id == 0)
- continue;
- var resData = dal.GetMaterialPrice(materialId_Id, custId_Id, dateTime);
+ this.Model.SetValue("F_AGREEPRICE", 0, rowIndex);
+ this.Model.SetValue("F_BIGCUSTSETTLEPRICE", 0, rowIndex);
+ this.Model.SetValue("F_BigCustDiscRate", 0, rowIndex);
- if (resData != null && resData.Count > 0)
+ if (materialId_Id > 0 && custId_Id > 0)
{
- var data = resData[0];
+ var resData = dal.GetMaterialPrice(materialId_Id, custId_Id, dateTime);
- // 协议价
- var F_AGREEPRICE = data["F_AGREEPRICE"].Convert();
- this.Model.SetValue("F_AGREEPRICE", F_AGREEPRICE, rowIndex);
-
- var custId = this.View.Model.GetValue("FCustID") as DynamicObject;
- var creditClassificationId = custId["F_CreditClassification_Id"]?.ToString();
- if (!creditClassificationId.IsNullOrEmptyOrWhiteSpace())
+ if (resData != null && resData.Count > 0)
{
- var creditClassification = custId["F_CreditClassification"] as DynamicObject;
- var number = creditClassification["Number"].ToString();
+ var data = resData[0];
+
+ // 协议价
+ var F_AGREEPRICE = data["F_AGREEPRICE"].Convert();
+ this.Model.SetValue("F_AGREEPRICE", F_AGREEPRICE, rowIndex);
+
+ // 大客户结算价
+ var F_BIGCUSTSETTLEPRICE = data["F_BIGCUSTSETTLEPRICE"].Convert();
+ this.Model.SetValue("F_BIGCUSTSETTLEPRICE", F_BIGCUSTSETTLEPRICE, rowIndex);
+
+ //大客户折扣率
+ var F_BigCustDiscRate = data["F_BIGCUSTDISCRATE"].Convert();
+ this.Model.SetValue("F_BigCustDiscRate", F_BigCustDiscRate, rowIndex);
- if (number.EqualsIgnoreCase("KHXYFL013"))
- {
- // 大客户结算价
- var F_BIGCUSTSETTLEPRICE = data["F_BIGCUSTSETTLEPRICE"].Convert();
- this.Model.SetValue("F_BIGCUSTSETTLEPRICE", F_BIGCUSTSETTLEPRICE, rowIndex);
- }
}
+
}
+
+ this.View.InvokeFieldUpdateService("FMaterialId", rowIndex);
}
}
diff --git a/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj b/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
index 27e28c3..04e95dd 100644
--- a/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
+++ b/Gatedge.K3.Pilot.PlugIn/Gatedge.K3.Pilot.PlugIn.csproj
@@ -92,14 +92,14 @@
+
+
-
-
-
+
copy $(TargetPath) "E:\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin"
diff --git a/Gatedge.K3.Pilot.PlugIn/Models/Validate/PeriodValidity.cs b/Gatedge.K3.Pilot.PlugIn/Models/Validate/PeriodValidity.cs
new file mode 100644
index 0000000..b7b74a5
--- /dev/null
+++ b/Gatedge.K3.Pilot.PlugIn/Models/Validate/PeriodValidity.cs
@@ -0,0 +1,43 @@
+using Kingdee.BOS.Core.Metadata.EntityElement;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Gatedge.K3.Pilot.PlugIn.Models.Validate
+{
+ ///
+ ///
+ ///
+ public class PeriodValidity
+ {
+
+ public int Seq { get; set; }
+
+ ///
+ /// 产品类型
+ ///
+ public string MaterialModelGroup { get; set; }
+
+ ///
+ /// 物料内码
+ ///
+ public int MaterialId { get; set; }
+
+ ///
+ /// 生效日期
+ ///
+ public DateTime EffectiveDate { get; set; }
+
+ ///
+ /// 失效日期
+ ///
+ public DateTime ExpirationDate { get; set; }
+
+ ///
+ /// 分组ID
+ ///
+ public int GroupId { get; set; }
+ }
+}
diff --git a/Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs b/Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs
index af94b63..7ad04b3 100644
--- a/Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs
+++ b/Gatedge.K3.Pilot.PlugIn/Services/DBService/BDCustPriceDAL.cs
@@ -30,7 +30,9 @@ SET @custId = {custId}
SET @FMaterialID = {materialId}
SET @dateTime = '{dateTime}'
SELECT t0.FMATERIALID,t0.FNUMBER,t0.FUSEORGID
- ,t0_l.FNAME,t0_l.FSPECIFICATION,ISNULL(t1.F_AGREEPRICE,0) AS F_AGREEPRICE,ISNULL(t2.F_BIGCUSTSETTLEPRICE,0) AS F_BIGCUSTSETTLEPRICE
+ ,t0_l.FNAME,t0_l.FSPECIFICATION,ISNULL(t1.F_AGREEPRICE,0) AS F_AGREEPRICE
+ ,ISNULL(t2.F_BIGCUSTSETTLEPRICE,0) AS F_BIGCUSTSETTLEPRICE
+ ,ISNULL(t2.F_BIGCUSTDISCRATE,0) AS F_BIGCUSTDISCRATE
FROM T_BD_MATERIAL t0
INNER JOIN T_BD_MATERIAL_L t0_l on t0_l.FMATERIALID = t0.FMATERIALID AND t0_l.FLOCALEID = 2052
OUTER APPLY (
@@ -42,7 +44,7 @@ FROM T_BD_MATERIAL t0
WHERE t1.FLIMITCUSTOMER = '2'
AND t1.FDOCUMENTSTATUS = 'C'
AND t1.FFORBIDSTATUS = 'A'
- AND t1e.FROWAUDITSTATUS = 'A'
+ --AND t1e.FROWAUDITSTATUS = 'A'
AND t1e.FFORBIDSTATUS = 'A'
AND @dateTime BETWEEN t1e.FEFFECTIVEDATE AND t1e.FEXPRIYDATE
AND t1.FUSEORGID = t0.FUSEORGID
@@ -51,12 +53,13 @@ FROM T_BD_MATERIAL t0
) t1
OUTER APPLY (
SELECT TOP 1 t2e.F_BIGCUSTSETTLEPRICE
+ ,t2e.F_BIGCUSTDISCRATE
FROM T_BD_CustPrice t2
INNER JOIN T_BD_CustPriceEntry t2e on t2.FID = t2e.FID
WHERE t2.FLIMITCUSTOMER = '1'
AND t2.FDOCUMENTSTATUS = 'C'
AND t2.FFORBIDSTATUS = 'A'
- AND t2e.FROWAUDITSTATUS = 'A'
+ --AND t2e.FROWAUDITSTATUS = 'A'
AND t2e.FFORBIDSTATUS = 'A'
AND @dateTime BETWEEN t2e.FEFFECTIVEDATE AND t2e.FEXPRIYDATE
AND t2.FUSEORGID = t0.FUSEORGID