From 4ae181340da79834e85fad11650b76acb7b9a1a0 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Fri, 13 Apr 2018 16:22:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=8D=95=20=E5=BA=94=E4=BB=98=E9=87=91=E9=A2=9D=3D=E7=8E=B0?= =?UTF-8?q?=E6=9C=89=E7=9A=84=E5=BA=94=E4=BB=98=E9=87=91=E9=A2=9D-?= =?UTF-8?q?=E4=BA=BA=E5=B7=A5=E8=B4=B9-=E8=BF=90=E8=B4=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bills/CostRecord_/CostRecordEdit.cs | 19 ++++++++------ B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs | 25 ++++++++++++++++++- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs index a8b5dad..41204c6 100644 --- a/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs +++ b/B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs @@ -85,15 +85,18 @@ namespace BWP.Web.Pages.B3QingDaoWanFu.Bills.CostRecord_ { using (var reader = session.ExecuteReader(query)) { - var detail = new CostRecord_Detail() + while (reader.Read()) { - WeightBill_ID = (long)reader[0], - Supplier_Name = (string)reader[1], - Employee_Name = (string)reader[2], - Car_Name = (string)reader[3], - BuyNum = (int?)reader[4] - }; - Dmo.Details.Add(detail); + var detail = new CostRecord_Detail() + { + WeightBill_ID = (long)reader[0], + Supplier_Name = (string)reader[1], + Employee_Name = (string)reader[2], + Car_Name = (string)reader[3], + BuyNum = (int?)reader[4] + }; + Dmo.Details.Add(detail); + } } } _detailGrid.DataBind(); diff --git a/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs b/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs index 1b92a0a..9fbdbff 100644 --- a/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs +++ b/B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs @@ -10,6 +10,12 @@ using BWP.B3Frameworks; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.Utils; using TSingSoft.WebPluginFramework; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.EnterpriseServices.DomainObjects2; +using BWP.B3QingDaoWanFu.BO; +using Forks.EnterpriseServices.SqlDoms; +using BWP.B3Frameworks.BO.NamedValueTemplate; +using BWP.B3Frameworks.BO.MoneyTemplate; namespace BWP.B3QingDaoWanFu.TypeIOCs { @@ -19,7 +25,7 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs //{ // public void Invoke(IDmoContext context, StatPay dmo) // { - + // } //} @@ -51,7 +57,24 @@ namespace BWP.B3QingDaoWanFu.TypeIOCs dmo.ActualPrice = decimal.Round(dmo.ActualMoney.EToDecimal() ?? 0, 2) / we; if (dmo.ActualPrice.HasValue) dmo.ActualPrice = decimal.Round(dmo.ActualPrice.Value.Value, 2); + if (dmo.Weigh_ID.HasValue) + dmo.Money = dmo.Money - GetCostRecordMoney(dmo.Weigh_ID.Value, context.Session); } } + + decimal GetCostRecordMoney(long weightID, IDmoSession session) + { + var main = new JoinAlias("_Main",typeof(CostRecord)); + var detail = new JoinAlias(typeof(CostRecord_Detail)); + var query = new DQueryDom(main); + query.From.AddJoin(JoinType.Left, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "CostRecord_ID")); + query.Columns.Add(DQSelectColumn.Sum(detail, "JingJiFee")); + query.Columns.Add(DQSelectColumn.Sum(detail, "TransferFee")); + query.Where.Conditions.Add(DQCondition.And(DQCondition.GreaterThanOrEqual("BillState", 单据状态.已审核), DQCondition.EQ(detail, "WeightBill_ID", weightID))); + var result = query.EExecuteScalar?, Money<金额>?>(session); + if (result == null) + return 0; + return (result.Item1 ?? 0) + (result.Item2 ?? 0); + } } }