From 31825a295fbb27f75a543891c438fcc277917313 Mon Sep 17 00:00:00 2001 From: luanhui <1029149336@qq.com> Date: Fri, 24 Nov 2017 10:14:15 +0800 Subject: [PATCH] . --- .../Reports/ComprehensiveReport.cs | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs index b53666f..3aae36a 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Reports/ComprehensiveReport.cs @@ -15,6 +15,7 @@ using System.Text; using System.Web.UI.WebControls; using BWP.B3Frameworks.BO.MoneyTemplate; using BWP.B3ProduceUnitedInfos.BO; +using Forks.EnterpriseServices.DataForm; using Forks.EnterpriseServices.SqlDoms; using TSingSoft.WebControls2; using TSingSoft.WebPluginFramework; @@ -44,6 +45,24 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports base.InitBrowseGrid(grid); grid.DataFilter = (table) => { + decimal sum皮肉重量 = 0; + foreach (DFDataRow row in table.Rows) + { + try + { + var 肉重量 = row["皮肉重量"]; + var 皮重 = row["皮重"]; + var 皮肉重量= (Money<金额>?)(objToDecimal(肉重量) + objToDecimal(皮重)); + row["皮肉重量"] = 皮肉重量; + sum皮肉重量 += (皮肉重量??0); + + var 到厂毛重 = objToDecimal(row["到厂毛重"]); + row["皮肉比"] = Math.Round((double)(皮肉重量 / 到厂毛重 * 100), 2); + } + catch{} + + } + try { table.SumRow["毛重单价"] = (Money<金额>?)(objToDecimal(table.SumRow["应付金额"]) / objToDecimal(table.SumRow["到厂毛重"])); @@ -54,19 +73,28 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports table.SumRow["实付单价"] = (Money<金额>?)(objToDecimal(table.SumRow["实付金额"]) / objToDecimal(table.SumRow["到厂毛重"])); } catch {} + + try + { + table.SumRow["实付单价"] = (Money<金额>?)(objToDecimal(table.SumRow["实付金额"]) / objToDecimal(table.SumRow["到厂毛重"])); + } + catch {} + try + { + table.SumRow["皮肉重量"] = sum皮肉重量; + } + catch {} }; } - decimal? objToDecimal(object obj) + decimal objToDecimal(object obj) { if (obj == null) { - return null; + return 0; } var r = Convert.ToDecimal(obj); - if (r == 0) - return null; return r; } @@ -258,8 +286,8 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports GroupSumColumnIndexs.Add(query.Columns.Count - 1); break; case "皮肉比": - var 皮肉比 =DQExpression.Multiply( 皮肉重量.ESafeDivide(榜前重量),DQExpression.Value(100)).ECastType>(); - query.Columns.Add(DQSelectColumn.Create(皮肉比, "皮肉比")); +// var 皮肉比 =DQExpression.Multiply( 皮肉重量.ESafeDivide(榜前重量),DQExpression.Value(100)).ECastType>(); + query.Columns.Add(DQSelectColumn.Create(DQExpression.NULL.ECastType(), "皮肉比")); break; case "一二级比": var 一二级重量= DQExpression.Add( @@ -512,7 +540,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports query.Where.Conditions.Add(DQCondition.EQ(bill, "Date", stat, "Date")); query.Where.Conditions.Add(DQCondition.EQ(statdetail, "Technics",工艺.毛剥)); - query.Where.Conditions.Add(DQCondition.GreaterThan(stat,"BillState",单据状态.已审核)); + query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(stat,"BillState",单据状态.已审核)); query.Columns.Add(DQSelectColumn.Sum(statdetail, "Number")); return query; @@ -526,7 +554,7 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Reports query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ByProduct_ID")); query.Where.Conditions.Add(DQCondition.EQ(bill, "Date", main, "ButcherDate")); - query.Where.Conditions.Add(DQCondition.GreaterThan(main, "BillState", 单据状态.已审核)); + query.Where.Conditions.Add(DQCondition.GreaterThanOrEqual(main, "BillState", 单据状态.已审核)); // query.Where.Conditions.Add(DQCondition.EQ(DQExpression.Snippet("CAST(CONVERT(varchar(10), [bill].[Date], 120 )as smalldatetime)"), DQExpression.Snippet("CAST(CONVERT(varchar(10), [byproduct].[ButcherDate], 120 )as smalldatetime)")));