Browse Source

修改。结算单 应付金额=现有的应付金额-人工费-运费。

master
yibo 7 years ago
parent
commit
4ae181340d
2 changed files with 35 additions and 9 deletions
  1. +11
    -8
      B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs
  2. +24
    -1
      B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs

+ 11
- 8
B3QingDaoWanFu.Web/Pages/B3QingDaoWanFu/Bills/CostRecord_/CostRecordEdit.cs View File

@ -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();


+ 24
- 1
B3QingDaoWanFu/TypeIOCs/StatPayBLTypeIoc.cs View File

@ -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<>?, Money<>?>(session);
if (result == null)
return 0;
return (result.Item1 ?? 0) + (result.Item2 ?? 0);
}
}
}

Loading…
Cancel
Save