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