diff --git a/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs b/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs index 3e51b4c..71f96a1 100644 --- a/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs +++ b/BWP.B3_YunKen.Web/Pages/B3YunKen/Dialogs/SelectBillDialog.cs @@ -20,6 +20,7 @@ using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using TSingSoft.WebControls2; using TSingSoft.WebPluginFramework; +using BWP.B3_YunKen; namespace BWP.Web.Pages.B3YunKen.Dialogs { @@ -163,24 +164,66 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs var ids = Ids.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(long.Parse).ToList(); var nextID = VerificationUtil.GetNextID(context); - - foreach (var id in ids) - { - var gathering = new Gathering(); + var onlineConfig = new B3YunKenOnlineConfiguration(); + if (onlineConfig.UseOneGathering && ids.Count == 1) { + var id = ids[0]; var gatheringMoney = InnerBLUtil.GetDmoPropertyByID?>(context.Session, "GatheringMoney", id); var verificationMoney = InnerBLUtil.GetDmoPropertyByID?>(context.Session, "VerificationMoney", id); var tMoney = (gatheringMoney ?? 0) - (verificationMoney ?? 0); - if (tMoney <= 0) - continue; - if (money <= 0) - continue; - if (money < tMoney) - { - tMoney = money; - } - money -= tMoney; + var gathering = new Gathering(); gathering.ID = id; - VerificationUtil.Insert(context, gathering, tMoney, nextID); + foreach (var item in selectItems) { + var billMoney = ((decimal?)item["本次核销金额"]) ?? 0; + + if (tMoney <= 0) + continue; + if (billMoney <= 0) + continue; + if (billMoney <= tMoney) { + + tMoney -= billMoney; + var billType = item["单据类型"] == null ? "销售出库单" : item["单据类型"].ToString(); + short billTypeId; + if (billType == "销售发票") { + billTypeId = DmoTypeIDAttribute.GetID(typeof(Invoice)); + } else if (billType == "客户验收单") { + billTypeId = DmoTypeIDAttribute.GetID(typeof(CustomerAccept)); + } else if (billType == "其他应收款") { + billTypeId = DmoTypeIDAttribute.GetID(typeof(OtherReceivables)); + } else { + billTypeId = DmoTypeIDAttribute.GetID(typeof(SaleOutStore)); + } + var billId = (long)item["ID"]; + var customer_Detail = new InvoiceInfo(); + customer_Detail.Gathering_ID = gathering.ID; + customer_Detail.BillID = billId; + customer_Detail.BillMoney = (Money<金额>?)item["金额"]; + customer_Detail.DmoTypeID = billTypeId; + customer_Detail.Date = (DateTime?)item["单据日期"]; + customer_Detail.AlreadyMoney = (Money<金额>?)item["VerificationMoney"]; + customer_Detail.Customer_ID = CustomerID; + customer_Detail.Money = billMoney; + context.Session.Insert(customer_Detail); + } + } + VerificationUtil.Insert(context, gathering, money, nextID); + } else { + foreach (var id in ids) { + var gathering = new Gathering(); + var gatheringMoney = InnerBLUtil.GetDmoPropertyByID?>(context.Session, "GatheringMoney", id); + var verificationMoney = InnerBLUtil.GetDmoPropertyByID?>(context.Session, "VerificationMoney", id); + var tMoney = (gatheringMoney ?? 0) - (verificationMoney ?? 0); + if (tMoney <= 0) + continue; + if (money <= 0) + continue; + if (money < tMoney) { + tMoney = money; + } + money -= tMoney; + gathering.ID = id; + VerificationUtil.Insert(context, gathering, tMoney, nextID); + } } foreach (var row in _browseGrid.GetSelectedItems()) @@ -245,6 +288,16 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs hPanel.Add(_selectMoneyLabel); } + //private bool IsExistInvoiceInfo(TransactionContext context,short billTypeId,long billId,long gatheringId) + //{ + // var query = new DQueryDom(new JoinAlias(typeof(InvoiceInfo))); + // query.Columns.Add(DQSelectColumn.Field("ID")); + // query.Where.Conditions.Add(DQCondition.EQ("DmoTypeID",billTypeId)); + // query.Where.Conditions.Add(DQCondition.EQ("BillID", billId)); + // query.Where.Conditions.Add(DQCondition.EQ("Gathering_ID", gatheringId)); + // return query.EExecuteScalar(context.Session) != null?true:false; + //} + private void CreateQueryGrid(TitlePanelZone zone) { var result = new TitlePanel(B3FrameworksConsts.PageLayouts.QueryResult, B3FrameworksConsts.PageLayouts.QueryResult_DisplayName); @@ -388,6 +441,7 @@ namespace BWP.Web.Pages.B3YunKen.Dialogs dom.Columns.Add(DQSelectColumn.Field("ID")); dom.Columns.Add(DQSelectColumn.Field("AccountingUnit_Name")); dom.Columns.Add(DQSelectColumn.Field("VerificationMoney")); + dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field("AccountCustomer_ID"), "AccountCustomer_ID")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(customerNameField), "结账客户")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField), "金额")); dom.Columns.Add(DQSelectColumn.Create(DQExpression.Field(moneyField).ESubtract(DQExpression.Field("VerificationMoney")), "本次核销金额")); diff --git a/BWP.B3_YunKen.Web/Pages/B3YunKen/Overlays/VerificationPage_Ext.cs b/BWP.B3_YunKen.Web/Pages/B3YunKen/Overlays/VerificationPage_Ext.cs index c218e2b..84e5303 100644 --- a/BWP.B3_YunKen.Web/Pages/B3YunKen/Overlays/VerificationPage_Ext.cs +++ b/BWP.B3_YunKen.Web/Pages/B3YunKen/Overlays/VerificationPage_Ext.cs @@ -3,11 +3,22 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using TSingSoft.WebControls2; +using BWP.B3_YunKen; +using System.Web.UI.HtmlControls; +using Forks.EnterpriseServices.DataForm; +using Forks.Utils; +using BWP.B3Frameworks.BO.MoneyTemplate; +using System.Web.UI.WebControls; +using TSingSoft.WebPluginFramework; +using Forks.Utils.Collections; +using BWP.Web.WebControls; namespace BWP.Web.Pages.B3YunKen.Overlays { class VerificationPage_Ext: VerificationPage { + B3YunKenOnlineConfiguration config = new B3YunKenOnlineConfiguration(); protected override string BaseLogUrl { @@ -17,5 +28,37 @@ namespace BWP.Web.Pages.B3YunKen.Overlays return "~/B3YunKen/Dialogs/SelectBillDialog.aspx"; } } + + protected override void StartQuery() + { + base.StartQuery(); + if (config.UseOneGathering.Value) { + _verificationBt.Visible = false; + } + } + + protected override void SetGrid(TSingSoft.WebControls2.DFBrowseGrid grid) + { + base.SetGrid(grid); + + if (config.UseOneGathering.Value) { + grid.MultiSelectionEnabled = false; + } + grid.Columns.EAdd(new DFGridCustomExtColumn((obj, cell, dataSourceIndex) => { + var row = (DFDataRow)obj; + var btn = new DialogButton(); + btn.Text = "核销"; + var url = AspUtil.AddParamToUrl(BaseLogUrl, + "ids", "" + (long)row["ID"]); + url = AspUtil.AddParamToUrl(url, "cusID", "'+ __QueryContainer.getValue('AccountCustomer_ID')+'"); + btn.Url = url; + btn.Click += delegate { + StartQuery(); + }; + cell.Controls.Add(btn); + } + )).HeaderText = "操作"; + } + } } diff --git a/BWP.B3_YunKen.Web/PluginClass.cs b/BWP.B3_YunKen.Web/PluginClass.cs index fbe93f0..b9230ff 100644 --- a/BWP.B3_YunKen.Web/PluginClass.cs +++ b/BWP.B3_YunKen.Web/PluginClass.cs @@ -51,6 +51,7 @@ namespace BWP.B3_YunKen.Web GlobalFlags.On(B3SaleConsts.Flags.SetPriceByBrandItem); GlobalFlags.On(B3UnitedInfosConsts.GlobalFlags.QucklyAddGoodsByBrandItem); GlobalFlags.On(B3SaleConsts.Flags.ManySaleOutStoreToOneCustomerAccept); + GlobalFlags.On(B3SaleConsts.Flags.GatheringVerificationByDetails); WpfPageFactory.RegisterPageOverlay(typeof(OrderEdit).FullName, typeof(OrderEdit_Ext).FullName); WpfPageFactory.RegisterPageOverlay(typeof(SaleOutStoreEdit).FullName, typeof(SaleOutStoreEdit_Ext).FullName); WpfPageFactory.RegisterPageOverlay(typeof(SaleForecastEdit).FullName, typeof(SaleForecastEdit_Ext).FullName); diff --git a/BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs b/BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs index 1a96ca6..d52db9c 100644 --- a/BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs +++ b/BWP.B3_YunKen/B3YunKenOnlineConfiguration.cs @@ -90,5 +90,16 @@ namespace BWP.B3_YunKen get { return _AutoStoppedCustomerDays; } set { _AutoStoppedCustomerDays = value; } } + + private BoolConfigRef _UseOneGathering = new BoolConfigRef(false); + [LogicName("核销操作能且只能选到一张付款单")] + [ConfigurationItemGroup("耘垦模块")] + [ConfigurationItemDescription("核销操作能且只能选到一张付款单")] + [DomainConfigurationItem] + public BoolConfigRef UseOneGathering + { + get { return _UseOneGathering; } + set { _UseOneGathering = value; } + } } }