|
|
|
@ -19,6 +19,7 @@ using BWP.B3UnitedInfos.BO; |
|
|
|
using BWP.B3Sale.Utils; |
|
|
|
using BWP.B3Sale.BO; |
|
|
|
using BWP.B3Frameworks.BO; |
|
|
|
using Forks.Utils; |
|
|
|
|
|
|
|
namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
{ |
|
|
|
@ -54,15 +55,15 @@ namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
//layout["ID"].NotAutoAddToContainer = true;
|
|
|
|
layout.Add("AccountingUnit_ID", new SimpleLabel("会计单位"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["AccountingUnit_ID"], mQueryContainer, "AccountingUnit_ID", B3FrameworksConsts.DataSources.授权会计单位全部)); |
|
|
|
layout["AccountingUnit_ID"].NotAutoAddToContainer = true; |
|
|
|
layout.Add("StandardGoods_ID", new SimpleLabel("标准件"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "StandardGoods_ID", B3SaleDataSources.标准件)); |
|
|
|
layout["StandardGoods_ID"].NotAutoAddToContainer = true; |
|
|
|
//layout.Add("StandardGoods_ID", new SimpleLabel("标准件"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "StandardGoods_ID", B3SaleDataSources.标准件));
|
|
|
|
//layout["StandardGoods_ID"].NotAutoAddToContainer = true;
|
|
|
|
//layout.Add("GoodsProperty_ID", new SimpleLabel("存货属性"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "GoodsProperty_ID", B3UnitedInfosConsts.DataSources.存货属性全部));
|
|
|
|
//layout["GoodsProperty_ID"].NotAutoAddToContainer = true;
|
|
|
|
//layout.Add("BrandItem_ID", new SimpleLabel("品牌项"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "BrandItem_ID", B3UnitedInfosConsts.DataSources.品牌项));
|
|
|
|
//layout["BrandItem_ID"].NotAutoAddToContainer = true;
|
|
|
|
layout.Add("ProductLine_ID", new SimpleLabel("产品线"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "ProductLine_ID", B3UnitedInfosConsts.DataSources.产品线全部)); |
|
|
|
layout["ProductLine_ID"].NotAutoAddToContainer = true; |
|
|
|
layout.Add("Goods_ID", new SimpleLabel("非标准件"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "Goods_ID", B3UnitedInfosConsts.DataSources.存货)); |
|
|
|
layout.Add("Goods_ID", new SimpleLabel("存货"), QueryCreator.DFChoiceBoxEnableMultiSelection(mDFInfo.Fields["ID"], mQueryContainer, "Goods_ID", B3UnitedInfosConsts.DataSources.存货)); |
|
|
|
layout["Goods_ID"].NotAutoAddToContainer = true; |
|
|
|
|
|
|
|
//layout.Add("Date", new SimpleLabel("生产日期"), QueryCreator.TimeRange(mDFInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate"));
|
|
|
|
@ -78,7 +79,7 @@ namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
//config.Add("GoodsProperty_ID");
|
|
|
|
//config.Add("BrandItem_ID");
|
|
|
|
config.Add("ProductLine_ID"); |
|
|
|
config.Add("StandardGoods_ID"); |
|
|
|
//config.Add("StandardGoods_ID");
|
|
|
|
config.Add("Goods_ID"); |
|
|
|
//config.Add("Date");
|
|
|
|
//config.Add("BillState");
|
|
|
|
@ -95,17 +96,14 @@ namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
//mDisplayHelper.AddOptionItem("部门", "bill", "Department_Name", false);
|
|
|
|
//mDisplayHelper.AddOptionItem("经办人", "bill", "Employee_Name", false);
|
|
|
|
//mDisplayHelper.AddOptionItem("客户", "bill", "Customer_Name", false);
|
|
|
|
mDisplayHelper.AddOptionItem("存货属性", "convert", "GoodsProperty_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货属性", "goods", "GoodsProperty_Name", false); |
|
|
|
//mDisplayHelper.AddOptionItem("品牌项", "detail", "BrandItem_Name", false);
|
|
|
|
mDisplayHelper.AddOptionItem("产品线", "goods", "ProductLine_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货编号", "convert", "Goods_Code", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货名称", "convert", "Goods_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("主单位", "convert", "Goods_MainUnit", false); |
|
|
|
mDisplayHelper.AddOptionItem("单价", () => { |
|
|
|
return DQExpression.Add(DQExpression.Multiply(DQExpression.Field(JoinAlias.Create("detail"), "Price"), DQExpression.IfNull(DQExpression.Field(JoinAlias.Create("convert"), "Multiplier"), DQExpression.Value(1))), DQExpression.IfNull(DQExpression.Field(JoinAlias.Create("convert"), "Diff"), DQExpression.Value(0))); |
|
|
|
}, true); |
|
|
|
mDisplayHelper.AddOptionItem("标准件", "detail", "Goods_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("标准单价", "detail", "Price", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货编号", "goods", "Code", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货名称", "goods", "Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("主单位", "goods", "MainUnit", false); |
|
|
|
mDisplayHelper.AddOptionItem("标准件", "detail", "StandardName", false); |
|
|
|
mDisplayHelper.AddOptionItem("单价", "detail", "Price", false); |
|
|
|
AddQueryOption("选项", mDisplayHelper.GetAllDisplayNames(), mDisplayHelper.GetDefaultSelelectedDisplayNames()); |
|
|
|
base.AddQueryOptions(vPanel); |
|
|
|
} |
|
|
|
@ -128,42 +126,85 @@ namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
public long ID { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
protected override DQueryDom GetQueryDom() |
|
|
|
private DQueryDom GetPriceBillPrice() |
|
|
|
{ |
|
|
|
var dom = base.GetQueryDom(); |
|
|
|
var bill = dom.From.RootSource.Alias; |
|
|
|
mDisplayHelper.AddAlias("bill", JoinAlias.Create("bill")); |
|
|
|
var detail = new JoinAlias("detail", typeof(PriceBill_Detail)); |
|
|
|
var convert = new JoinAlias("convert", typeof(StandardConvert)); |
|
|
|
var goods = new JoinAlias("goods", typeof(SaleGoods)); |
|
|
|
var priceBillID = new JoinAlias("priceBillID", typeof(PriceBillID)); |
|
|
|
var accountingUnit = new JoinAlias("accountingUnit", typeof(AccountingUnit)); |
|
|
|
mDisplayHelper.AddAlias("detail", JoinAlias.Create("detail")); |
|
|
|
mDisplayHelper.AddAlias("convert", JoinAlias.Create("convert")); |
|
|
|
mDisplayHelper.AddAlias("goods", JoinAlias.Create("goods")); |
|
|
|
mDisplayHelper.AddAlias("accountingUnit", JoinAlias.Create("accountingUnit")); |
|
|
|
dom.RegisterQueryTable(typeof(PriceBillID), new string[] { "AccountingUnit_ID","ID" }, GetMaxPriceBillID()); |
|
|
|
var bill = new JoinAlias("a",typeof(PriceBill)); |
|
|
|
var detail = new JoinAlias("b",typeof(PriceBill_Detail)); |
|
|
|
var priceBillID = new JoinAlias("c", typeof(PriceBillID)); |
|
|
|
var query = new DQueryDom(bill); |
|
|
|
query.From.AddJoin(JoinType.Inner, new DQDmoSource(priceBillID), DQCondition.EQ(bill, "ID", priceBillID, "ID")); |
|
|
|
query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "PriceBill_ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", priceBillID)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("SaleGoods_ID",detail)); |
|
|
|
query.Columns.Add(DQSelectColumn.Create(DQExpression.Value("标准件"), "StandardName")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Price",detail)); |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
class PriceBillID2 |
|
|
|
{ |
|
|
|
public long? AccountingUnit_ID { get; set; } |
|
|
|
public long ID { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
private DQueryDom GetPriceBillChildPrice() |
|
|
|
{ |
|
|
|
var detail = new JoinAlias("d",typeof(PriceBill_Detail)); |
|
|
|
var convert = new JoinAlias("e",typeof(StandardConvert)); |
|
|
|
var priceBillID = new JoinAlias("f",typeof(PriceBillID2)); |
|
|
|
var bill = new JoinAlias("g",typeof(PriceBill)); |
|
|
|
var dom = new DQueryDom(bill); |
|
|
|
dom.From.AddJoin(JoinType.Inner, new DQDmoSource(priceBillID), DQCondition.EQ(bill, "ID", priceBillID, "ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(accountingUnit), DQCondition.EQ(priceBillID, "AccountingUnit_ID", accountingUnit, "ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(bill, "ID", detail, "PriceBill_ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(convert), DQCondition.EQ(detail, "SaleGoods_ID", convert, "StandardGoods_ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(convert, "Goods_ID", goods, "ID")); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_ID", priceBillID)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("Goods_ID", convert)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Field("StandardGoods_Name", convert)); |
|
|
|
dom.Columns.Add(DQSelectColumn.Create(DQExpression.Add(DQExpression.Multiply(DQExpression.Field(detail, "Price"), DQExpression.IfNull(DQExpression.Field(convert, "Multiplier"), DQExpression.Value(1))), DQExpression.IfNull(DQExpression.Field(convert, "Diff"), DQExpression.Value(0))),"GoodsPrice")); |
|
|
|
dom.Where.Conditions.Add(DQCondition.IsNotNull(DQExpression.Field(convert, "Goods_ID"))); |
|
|
|
return dom; |
|
|
|
} |
|
|
|
|
|
|
|
class PriceBillData |
|
|
|
{ |
|
|
|
public long? AccountingUnit_ID { get; set; } |
|
|
|
public long? Goods_ID { get; set; } |
|
|
|
public string StandardName { get; set; } |
|
|
|
public Money<decimal>? Price { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
protected override DQueryDom GetQueryDom() |
|
|
|
{ |
|
|
|
var query1 = GetPriceBillChildPrice(); |
|
|
|
query1.UnionNext.Select = GetPriceBillPrice(); |
|
|
|
query1.UnionNext.Type = UnionType.All; |
|
|
|
var detail = new JoinAlias("detail", typeof(PriceBillData)); |
|
|
|
mDisplayHelper.AddAlias("detail", JoinAlias.Create("detail")); |
|
|
|
var accountingUnit = new JoinAlias("accountingUnit", typeof(AccountingUnit)); |
|
|
|
mDisplayHelper.AddAlias("accountingUnit", JoinAlias.Create("accountingUnit")); |
|
|
|
var goods = new JoinAlias("goods", typeof(SaleGoods)); |
|
|
|
mDisplayHelper.AddAlias("goods", JoinAlias.Create("goods")); |
|
|
|
var dom = new DQueryDom(detail); |
|
|
|
dom.RegisterQueryTable(typeof(PriceBillID), new string[] { "AccountingUnit_ID", "ID" }, GetMaxPriceBillID()); |
|
|
|
dom.RegisterQueryTable(typeof(PriceBillID2), new string[] { "AccountingUnit_ID", "ID" }, GetMaxPriceBillID()); |
|
|
|
dom.RegisterQueryTable(typeof(PriceBillData), new string[] { "AccountingUnit_ID", "Goods_ID","StandardName", "Price" }, query1); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(accountingUnit), DQCondition.EQ(detail, "AccountingUnit_ID", accountingUnit, "ID")); |
|
|
|
dom.From.AddJoin(JoinType.Left, new DQDmoSource(goods), DQCondition.EQ(detail, "Goods_ID", goods, "ID")); |
|
|
|
|
|
|
|
var goodsChb = mQueryContainer.GetControl<DFChoiceBox>("Goods_ID"); |
|
|
|
var standChb = mQueryContainer.GetControl<DFChoiceBox>("StandardGoods_ID"); |
|
|
|
var lineChb = mQueryContainer.GetControl<DFChoiceBox>("ProductLine_ID"); |
|
|
|
if (!standChb.IsEmpty) { |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "SaleGoods_ID"), standChb.GetValues().Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
} |
|
|
|
var accountingUnitChb = mQueryContainer.GetControl<DFChoiceBox>("AccountingUnit_ID"); |
|
|
|
if (!goodsChb.IsEmpty) { |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(convert, "Goods_ID"), goodsChb.GetValues().Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "Goods_ID"), goodsChb.GetValues().Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
} |
|
|
|
|
|
|
|
if (!lineChb.IsEmpty) { |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(goods, "ProductLine_ID"), lineChb.GetValues().Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
} |
|
|
|
dom.Where.Conditions.Add(DQCondition.EQ(goods, "IsStandard",true)); |
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(convert, "Multiplier")); |
|
|
|
dom.GroupBy.Expressions.Add(DQExpression.Field(convert, "Diff")); |
|
|
|
|
|
|
|
if (!accountingUnitChb.IsEmpty) { |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(detail, "AccountingUnit_ID"), accountingUnitChb.GetValues().Select(x => DQExpression.Value(x)).ToArray())); |
|
|
|
} |
|
|
|
mDisplayHelper.AddSelectColumns(dom, (name) => OptionIsSelected("选项", name), SumColumnIndexs); |
|
|
|
return dom; |
|
|
|
} |
|
|
|
|