diff --git a/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs b/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs index ffdf786..3e51b4c 100644 --- a/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs +++ b/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs @@ -7,6 +7,7 @@ using BWP.Web.Layout; using BWP.Web.Utils; using BWP.Web.WebControls; using Forks.EnterpriseServices.BusinessInterfaces; +using Forks.EnterpriseServices.DataForm; using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; using Forks.Utils; @@ -74,6 +75,19 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs set { ViewState["thisMoney"] = value; } } + + // 选中核销的金额 + decimal SelectMoney + { + get + { + if (ViewState["SelectMoney"] != null) + return (decimal)ViewState["SelectMoney"]; + return 0; + } + set { ViewState["SelectMoney"] = value; } + } + private readonly B3SaleOnlineConfiguration _config = new B3SaleOnlineConfiguration(); protected override void InitForm(HtmlForm form) @@ -258,6 +272,40 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs e.Control.Attributes["onchange"] = str + "_SumMoney();"; }; _browseGrid.Columns.Add(col); + _browseGrid.OnDetailDataBound = (row, obj, index) => + { + if (!IsPostBack) + { + var dataRow = obj as DFDataRow; + if (dataRow == null) + { + return; + } + + var 缺少 = ThisMoney - SelectMoney; + if (缺少 > 0) + { + var item = row.Cells[0]; + var re = item.Controls[0] as HtmlInputCheckBox; + re.Checked = true; + var 本次核销金额 = Convert.ToDecimal(dataRow["本次核销金额"]); + var 差值 = 缺少 - 本次核销金额; + if (差值 > 0) + { + SelectMoney += 本次核销金额; + } + else + { + var 应核销 = 本次核销金额 + 差值; + SelectMoney += 应核销; + dataRow["本次核销金额"] = 应核销; + + } + } + + _selectMoneyLabel.Text = (SelectMoney).ToString(); + } + }; var hbox = new HLayoutPanel(); hbox.CssClass += " LeftPaddingWrapper"; @@ -355,7 +403,7 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs { dom.Where.Conditions.Add(DQCondition.LessThanOrEqual(dateField, _maxInput.Value)); } - + dom.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID",false)); dom.Where.Conditions.Add(DQCondition.Or(DQCondition.And(DQCondition.LessThan(moneyField, 0), DQCondition.LessThan(DQExpression.Field(moneyField), DQExpression.IfNull(DQExpression.Field("VerificationMoney"), DQExpression.ConstValue(0)))), DQCondition.GreaterThan(DQExpression.Field(moneyField), DQExpression.IfNull(DQExpression.Field("VerificationMoney"), DQExpression.ConstValue(0))))); return dom; }