|
|
|
@ -10,6 +10,11 @@ using System.Text; |
|
|
|
using System.Web.UI.WebControls; |
|
|
|
using TSingSoft.WebControls2; |
|
|
|
using Forks.Utils.Collections; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2.DQuery; |
|
|
|
using Forks.EnterpriseServices.DomainObjects2; |
|
|
|
using BWP.B3SubstituteKill.Utils; |
|
|
|
using TSingSoft.WebPluginFramework; |
|
|
|
using Forks.EnterpriseServices.BusinessInterfaces; |
|
|
|
|
|
|
|
namespace BWP.Web.Pages.B3SubstituteKill.Bills.StatPay_ |
|
|
|
{ |
|
|
|
@ -101,10 +106,23 @@ __DFContainer.setValue('PriceBill_ID',''); |
|
|
|
DFEditGrid _costDetail; |
|
|
|
private void AddCostDetail(TitlePanel titlePanel) |
|
|
|
{ |
|
|
|
if (CanSave) |
|
|
|
titlePanel.EAdd(new TSButton("载入", delegate |
|
|
|
{ |
|
|
|
GetFromUI(); |
|
|
|
if (Dmo.PriceBill_ID == null) |
|
|
|
throw new Exception("没有定价单号"); |
|
|
|
Dmo.CostDetails.Clear(); |
|
|
|
LoadCostItemDetail(); |
|
|
|
_costDetail.DataBind(); |
|
|
|
})); |
|
|
|
var editor = new DFCollectionEditor<StatPay_CostDetail>(() => Dmo.CostDetails); |
|
|
|
editor.AllowDeletionFunc = () => CanSave; |
|
|
|
editor.CanDeleteFunc = detail => CanSave; |
|
|
|
editor.IsEditableFunc = (field, detail) => false; |
|
|
|
editor.IsEditableFunc = (field, detail) => |
|
|
|
{ |
|
|
|
return CanSave && field.Name == "Number"; |
|
|
|
}; |
|
|
|
_costDetail = titlePanel.EAdd(new DFEditGrid(editor) { Width = Unit.Percentage(100) }); |
|
|
|
_costDetail.Columns.Add(new DFEditGridColumn("SubKillProductLine_Name")); |
|
|
|
_costDetail.Columns.Add(new DFEditGridColumn("GenerationCostItem_Name")); |
|
|
|
@ -120,12 +138,26 @@ __DFContainer.setValue('PriceBill_ID',''); |
|
|
|
DFEditGrid _callbackPayDetail; |
|
|
|
private void AddCallbackPayDetail(TitlePanel titlePanel) |
|
|
|
{ |
|
|
|
if (CanSave) |
|
|
|
titlePanel.EAdd(new TSButton("载入", delegate |
|
|
|
{ |
|
|
|
GetFromUI(); |
|
|
|
if (Dmo.PriceBill_ID == null) |
|
|
|
throw new Exception("没有定价单号"); |
|
|
|
Dmo.CallbackPayDetails.Clear(); |
|
|
|
LoadCallBackDetail(); |
|
|
|
_callbackPayDetail.DataBind(); |
|
|
|
})); |
|
|
|
var editor = new DFCollectionEditor<StatPay_CallbackPayDetail>(() => Dmo.CallbackPayDetails); |
|
|
|
editor.AllowDeletionFunc = () => CanSave; |
|
|
|
editor.CanDeleteFunc = detail => CanSave; |
|
|
|
editor.IsEditableFunc = (field, detail) => false; |
|
|
|
editor.IsEditableFunc = (field, detail) => |
|
|
|
{ |
|
|
|
return CanSave && field.Name == "Number"; |
|
|
|
}; |
|
|
|
_callbackPayDetail = titlePanel.EAdd(new DFEditGrid(editor) { Width = Unit.Percentage(100) }); |
|
|
|
_callbackPayDetail.Columns.Add(new DFEditGridColumn("SubKillCallBack_Name")); |
|
|
|
_callbackPayDetail.Columns.Add(new DFEditGridColumn("Number")); |
|
|
|
_callbackPayDetail.Columns.Add(new DFEditGridColumn("Price")); |
|
|
|
_callbackPayDetail.Columns.EAdd(new DFEditGridColumn("Money")); |
|
|
|
var section = mPageLayoutManager.AddSection("CallbackPayDetail", "回收应付"); |
|
|
|
@ -147,5 +179,74 @@ __DFContainer.setValue('PriceBill_ID',''); |
|
|
|
_costDetail.GetFromUI(); |
|
|
|
_callbackPayDetail.GetFromUI(); |
|
|
|
} |
|
|
|
|
|
|
|
void LoadCallBackDetail() |
|
|
|
{ |
|
|
|
var details = GetDetails(); |
|
|
|
var num = details.Sum(x => x.Item2); |
|
|
|
if (num == 0) |
|
|
|
return; |
|
|
|
var price = BIFactory.Create<ISubKillPriceBillBL>().Load(Dmo.PriceBill_ID.Value); |
|
|
|
if (price == null) |
|
|
|
return; |
|
|
|
foreach (var detail in price.CallBackDetails) |
|
|
|
{ |
|
|
|
var d = new StatPay_CallbackPayDetail(); |
|
|
|
d.Number = num; |
|
|
|
d.SubKillCallBack_ID = detail.SubKillCallBack_ID; |
|
|
|
d.SubKillCallBack_Name = detail.SubKillCallBack_Name; |
|
|
|
d.Price = detail.Price; |
|
|
|
d.Money = d.Price * d.Number; |
|
|
|
Dmo.CallbackPayDetails.Add(d); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void LoadCostItemDetail() |
|
|
|
{ |
|
|
|
var price = BIFactory.Create<ISubKillPriceBillBL>().Load(Dmo.PriceBill_ID.Value); |
|
|
|
if (price == null) |
|
|
|
return; |
|
|
|
var details = GetDetails(); |
|
|
|
foreach (var detail in details) |
|
|
|
{ |
|
|
|
var tags = price.CostItemDetails.Where(x => x.SubKillProductLine_ID == detail.Item1); |
|
|
|
foreach (var t in tags) |
|
|
|
{ |
|
|
|
var d = new StatPay_CostDetail(); |
|
|
|
d.GenerationCostItem_ID = t.GenerationCostItem_ID; |
|
|
|
d.GenerationCostItem_Name = t.GenerationCostItem_Name; |
|
|
|
d.SubKillProductLine_ID = t.SubKillProductLine_ID; |
|
|
|
d.SubKillProductLine_Name = t.SubKillProductLine_Name; |
|
|
|
d.Number = detail.Item2; |
|
|
|
d.Price = t.Price; |
|
|
|
d.Money = d.Price * d.Number; |
|
|
|
Dmo.CostDetails.Add(d); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<Tuple<long, int>> GetDetails() |
|
|
|
{ |
|
|
|
Type t = null; |
|
|
|
string join = string.Empty; |
|
|
|
var config = new B3SubstituteKillOnlineConfig(); |
|
|
|
if (config.ButcherOrderCreateStatPay && Dmo.SourceBillType == DmoTypeIDAttribute.GetID(typeof(SubKillButcherOrder))) |
|
|
|
{ |
|
|
|
t = typeof(SubKillButcherOrder_Detail); |
|
|
|
join = "SubKillButcherOrder_ID"; |
|
|
|
} |
|
|
|
else if (!config.ButcherOrderCreateStatPay && Dmo.SourceBillType == DmoTypeIDAttribute.GetID(typeof(SubKillWeightBill))) |
|
|
|
{ |
|
|
|
t = typeof(SubKillWeightBill_Detail); |
|
|
|
join = "SubKillWeightBill_ID"; |
|
|
|
} |
|
|
|
else |
|
|
|
return new List<Tuple<long, int>>(); |
|
|
|
var query = new DQueryDom(new JoinAlias(t)); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("SubKillProductLine_ID")); |
|
|
|
query.Columns.Add(DQSelectColumn.Field("Number")); |
|
|
|
query.Where.Conditions.Add(DQCondition.And(DQCondition.IsNotNull(DQExpression.Field("Number")), DQCondition.EQ(join, Dmo.SourceBillID))); |
|
|
|
return query.EExecuteList<long, int>(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |