diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs index cc7b256..0535ea4 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs @@ -21,6 +21,7 @@ using Forks.EnterpriseServices.SqlDoms; using TSingSoft.WebControls2; using TSingSoft.WebControls2.DFGrids; using TSingSoft.WebPluginFramework; +using BWP.B3Frameworks; namespace BWP.Web.Pages.B3QingDaoWanFu.Reports { @@ -164,14 +165,17 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports DFNamedValueInput<单据状态> input; layoutManager.Add("BillState", input = QueryCreator.一般单据状态(mDFInfo.Fields["BillState"], true)); input.Value = 单据状态.已审核; - var config = new AutoLayoutConfig() { Cols = 2 }; + var config = new AutoLayoutConfig() { Cols = 4 }; layoutManager.Add("ID", new SimpleLabel("结算单号"), QueryCreator.DFTextBox(mDFInfo.Fields["ID"])); + layoutManager.Add("HotFreshType", new SimpleLabel("热鲜"), QueryCreator.DFNameValueInput<热鲜类型>(mDFInfo.Fields["BillState"])); + config.Add("AccountingUnit_ID"); config.Add("ID"); // config.Add("Weigh_ID"); config.Add("BillState"); + config.Add("HotFreshType"); config.Add("Supplier_ID"); config.Add("SupplierClass_ID"); config.Add("Employee_ID"); @@ -244,8 +248,9 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports var weight = new JoinAlias("mainweight", typeof(WeighBill)); query.From.AddJoin(JoinType.Left, new DQDmoSource(weight), DQCondition.EQ(bill, "Weigh_ID", weight, "ID")); - - + var hotFreshInput = mQueryContainer.GetInput("HotFreshType"); + if (hotFreshInput != null) + ButcherOrderTemp.AddJoinWithCondition(query, weight, hotFreshInput); tempUnionDom.Register(query); var unionAlias = new JoinAlias("tempUnionDom", typeof(tempUnionDom)); query.From.AddJoin(JoinType.Left, new DQDmoSource(unionAlias), DQCondition.EQ(bill, "ID", unionAlias, "StatPay_ID")); @@ -878,5 +883,24 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports } } + + class ButcherOrderTemp + { + public long? Weigh_ID { get; set; } + + public static void AddJoinWithCondition(DQueryDom root, JoinAlias weighBill, object hotFreshType) + { + var main = new JoinAlias(typeof(ButcherOrder)); + var detail = new JoinAlias(typeof(ButcherOrder_Detail)); + var query = new DQueryDom(detail); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(main), DQCondition.EQ(main, "ID", detail, "ButcherOrder_ID")); + query.Columns.Add(DQSelectColumn.Field("WeighBill_ID")); + query.GroupBy.Expressions.Add(DQExpression.Field("WeighBill_ID")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ(main, "Domain_ID", DomainContext.Current.ID), DQCondition.GreaterThanOrEqual(main, "BillState", 单据状态.已审核), DQCondition.EQ("HotFreshType", hotFreshType))); + var alias = new JoinAlias(typeof(ButcherOrderTemp)); + root.RegisterQueryTable(typeof(ButcherOrderTemp), new string[] { "Weigh_ID" }, query); + root.From.AddJoin(JoinType.Inner, new DQDmoSource(alias), DQCondition.EQ(weighBill, "ID", alias, "Weigh_ID")); + } + } } }