|
|
|
@ -0,0 +1,164 @@ |
|
|
|
using BWP.B3Frameworks; |
|
|
|
using BWP.B3Frameworks.BO.NamedValueTemplate; |
|
|
|
using BWP.Web.Layout; |
|
|
|
using BWP.Web.Utils; |
|
|
|
using BWP.Web.WebControls; |
|
|
|
using Forks.EnterpriseServices.DataForm; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
|
using Forks.EnterpriseServices.SqlDoms; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using TSingSoft.WebControls2; |
|
|
|
using BWP.B3Butchery.BO; |
|
|
|
using BWP.B3ProduceUnitedInfos; |
|
|
|
using BWP.B3UnitedInfos; |
|
|
|
using BWP.B3UnitedInfos.BO; |
|
|
|
using BWP.B3Sale.Utils; |
|
|
|
using BWP.B3Sale.BO; |
|
|
|
|
|
|
|
namespace BWP.Web.Pages.B3YunKen.Reports |
|
|
|
{ |
|
|
|
class DynamicPriceReport : DFBrowseGridReportPage<ProduceFinish> |
|
|
|
{ |
|
|
|
protected override string Caption |
|
|
|
{ |
|
|
|
get { return "变价关系表"; } |
|
|
|
} |
|
|
|
|
|
|
|
protected override string QueryOptionsTabName |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
return "显示字段"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override string AccessRoleName |
|
|
|
{ |
|
|
|
get { return "B3_YunKen.报表分析.变价关系表"; } |
|
|
|
} |
|
|
|
|
|
|
|
readonly DFInfo _detailInfo = DFInfo.Get(typeof(ProduceFinish_Detail)); |
|
|
|
readonly Dictionary<string, DFInfo> _fileInfo = new Dictionary<string, DFInfo>(); |
|
|
|
readonly List<string> _sumCol = new List<string>(); |
|
|
|
|
|
|
|
protected override void AddQueryControls(VLayoutPanel vPanel) |
|
|
|
{ |
|
|
|
var layout = new LayoutManager("Main", mDFInfo, mQueryContainer); |
|
|
|
|
|
|
|
//layout.Add("ID", mQueryContainer.Add(new DFTextBox(mDFInfo.Fields["ID"]), "ID"));
|
|
|
|
//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("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["Goods_ID"].NotAutoAddToContainer = true; |
|
|
|
|
|
|
|
//layout.Add("Date", new SimpleLabel("生产日期"), QueryCreator.TimeRange(mDFInfo.Fields["Date"], mQueryContainer, "MinDate", "MaxDate"));
|
|
|
|
//layout["Date"].NotAutoAddToContainer = true;
|
|
|
|
//var state = mQueryContainer.Add(B3ButcheryCustomInputCreator.一般单据状态(mDFInfo.Fields["BillState"], true, false, true, true), "BillState");
|
|
|
|
//((ChoiceBox)state).Value = 单据状态.已审核.Value.ToString() + "|";
|
|
|
|
//state.DisplayValue = "已审核;";
|
|
|
|
//state.EnableInputArgument = true;
|
|
|
|
//layout.Add("BillState", state);
|
|
|
|
//layout["BillState"].NotAutoAddToContainer = true;
|
|
|
|
var config = new AutoLayoutConfig { Cols = 2 }; |
|
|
|
config.Add("AccountingUnit_ID"); |
|
|
|
//config.Add("GoodsProperty_ID");
|
|
|
|
//config.Add("BrandItem_ID");
|
|
|
|
config.Add("ProductLine_ID"); |
|
|
|
config.Add("StandardGoods_ID"); |
|
|
|
config.Add("Goods_ID"); |
|
|
|
//config.Add("Date");
|
|
|
|
//config.Add("BillState");
|
|
|
|
|
|
|
|
layout.Config = config; |
|
|
|
|
|
|
|
vPanel.Add(layout.CreateLayout()); |
|
|
|
} |
|
|
|
|
|
|
|
ReportDisplayOptionHelper mDisplayHelper = new ReportDisplayOptionHelper(); |
|
|
|
protected override void AddQueryOptions(VLayoutPanel vPanel) |
|
|
|
{ |
|
|
|
//mDisplayHelper.AddOptionItem("会计单位", "bill", "AccountingUnit_Name", false);
|
|
|
|
//mDisplayHelper.AddOptionItem("部门", "bill", "Department_Name", false);
|
|
|
|
//mDisplayHelper.AddOptionItem("经办人", "bill", "Employee_Name", false);
|
|
|
|
//mDisplayHelper.AddOptionItem("客户", "bill", "Customer_Name", false);
|
|
|
|
mDisplayHelper.AddOptionItem("存货属性", "detail", "GoodsProperty_Name", false); |
|
|
|
//mDisplayHelper.AddOptionItem("品牌项", "detail", "BrandItem_Name", false);
|
|
|
|
mDisplayHelper.AddOptionItem("产品线", "goods", "ProductLine_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货编号", "detail", "Goods_Code", false); |
|
|
|
mDisplayHelper.AddOptionItem("存货名称", "detail", "Goods_Name", false); |
|
|
|
mDisplayHelper.AddOptionItem("规格", "detail", "Goods_Spec", false); |
|
|
|
mDisplayHelper.AddOptionItem("报价单位", "detail", "Unit", false); |
|
|
|
mDisplayHelper.AddOptionItem("单价", "detail", "Price", false); |
|
|
|
mDisplayHelper.AddOptionItem("非标准件", "convert", "Goods_Name", 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); |
|
|
|
AddQueryOption("选项", mDisplayHelper.GetAllDisplayNames(), mDisplayHelper.GetDefaultSelelectedDisplayNames()); |
|
|
|
base.AddQueryOptions(vPanel); |
|
|
|
} |
|
|
|
|
|
|
|
private DQueryDom GetMaxPriceBillID() |
|
|
|
{ |
|
|
|
var query = new DQueryDom(new JoinAlias(typeof(PriceBill))); |
|
|
|
query.Columns.Add(DQSelectColumn.Max("ID")); |
|
|
|
query.Where.Conditions.Add(DQCondition.EQ("BillState",单据状态.已审核)); |
|
|
|
return query; |
|
|
|
} |
|
|
|
|
|
|
|
class PriceBillID |
|
|
|
{ |
|
|
|
public long? AccountingUnit_ID { get; set; } |
|
|
|
public long ID { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
protected override DQueryDom GetQueryDom() |
|
|
|
{ |
|
|
|
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)); |
|
|
|
mDisplayHelper.AddAlias("detail", JoinAlias.Create("detail")); |
|
|
|
mDisplayHelper.AddAlias("convert", JoinAlias.Create("convert")); |
|
|
|
mDisplayHelper.AddAlias("goods", JoinAlias.Create("goods")); |
|
|
|
dom.RegisterQueryTable(typeof(PriceBillID), new string[] { "ID" }, GetMaxPriceBillID()); |
|
|
|
dom.From.AddJoin(JoinType.Inner, new DQDmoSource(priceBillID), DQCondition.EQ(bill, "ID", priceBillID, "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(detail, "SaleGoods_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())); |
|
|
|
} |
|
|
|
if (!goodsChb.IsEmpty) { |
|
|
|
dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field(convert, "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")); |
|
|
|
mDisplayHelper.AddSelectColumns(dom, (name) => OptionIsSelected("选项", name), SumColumnIndexs); |
|
|
|
return dom; |
|
|
|
} |
|
|
|
} |
|
|
|
} |