username@email.com
18 小时以前 529d8cb61421eb65d86559d3d2636ad405b87b41
CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
@@ -96,10 +96,11 @@
                }
                this.spanAllMoney.InnerHtml = "¥" + (AllMoney ?? 0).ToString("0.00");
                this.spanReceiveMoney.InnerHtml = "¥" + ReceiveMoney.Value.ToString("0.00");
                this.hidReceiveMoney.Value =  ReceiveMoney.Value.ToString();
                this.spanCountRe.InnerHtml = Keys.Count().ToString2() + " 单";
                this.txtReciveMoney.Enabled = false;
                this.txtReciveMoney.Text = (ReceiveMoney ?? 0).ToString("0.00");
                this.txtReciveMoney.Value = (ReceiveMoney ?? 0).ToString("0.00");
                this.txtReciveMoney.Attributes.Add("max", (ReceiveMoney ?? 0).ToString("0.00"));
            }
               
@@ -119,14 +120,12 @@
                    JavaScript.MessageBox("请选择账户", this);
                    return;
                }
                ReceiveMoney = this.txtReciveMoney.Text.ToDecimal2();
                var werwerwerwerwe = Request["txtReciveMoney"];
                ReceiveMoney = this.txtReciveMoney.Value.ToDecimal2();
                int? SubjectId = this.selSubject.Value.ToInt32();
                var molingmoney = this.txtMolingMoney.Value.ToDecimal2();
                decimal? money = ReceiveMoney;
                if (Request["amount"].ToString2() == "one")
                {
                    money = this.txtReciveMoney.Text.ToDecimal2();
                }
                int? AccountIdOut = Request["selAccountNameOut"].ToInt32();
@@ -146,12 +145,35 @@
                    {
                        var id = this.Keyid.Value.ToInt32().Value;
                        var fukuanshenqing = _fukuanshenqingBLL.GetModelByKeyid(id);
                        if (fukuanshenqing.FukuanStatus == 2 && money>0)
                        {
                            JavaScript.MessageBox("该申请已经付款结束!", this);
                            return;
                        }
                        if (money > (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                        {
                            JavaScript.MessageBox("操作金额大于剩余应付金额!", this);
                            return;
                        }
                        var Youwufapiao = Request["rdoReceiveQuannbu"];
                        if (fukuanshenqing.Youwufapiao == 2 && Youwufapiao == "1")
                        {
                            JavaScript.MessageBox("已经保存为有发票,无法修改为无发票!", this);
                            return;
                        }
                        if (molingmoney.HasValue)
                        {
                            if ((money + molingmoney.Value) != (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                            {
                                JavaScript.MessageBox("操作金额加抹零金额必须等于剩余应付金额!", this);
                                return;
                            }
                        }
                        string[] Keys = fukuanshenqing.DindanId.Trim(',').Split(',');
                        var ssss = false;
                        using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
@@ -169,17 +191,29 @@
                                {
                                    fukuanshenqing.FukuanStatus = 2;
                                }
                                if (molingmoney.HasValue)
                                {
                                    if ((money + molingmoney.Value) >= (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                                    {
                                        fukuanshenqing.FukuanStatus = 2;
                                    }
                                }
                                fukuanshenqing.Yishoumoney = yishoumoney + money;
                                fukuanshenqing.Updater = CurrentUser.ShortName;
                                fukuanshenqing.LastUpdateTime = DateTime.Now;
                                fukuanshenqing.Youwufapiao = Youwufapiao.ToInt32();
                                ssss = _fukuanshenqingBLL.UpdateModel(fukuanshenqing);
                                if (this.txtReciveMoney.Text.ToDecimal2() > 0)
                                if (this.txtReciveMoney.Value.ToDecimal2() > 0)
                                {
                                    List<OA_Procurement> m_OA_ProcurementList = new List<OA_Procurement>();
                                    List<OA_FirmAccountRecord> m_OA_FirmAccountRecordList = new List<OA_FirmAccountRecord>();
                                    m_OA_FirmAccountOut.Balance -= money;
                                    m_OA_FirmAccountOut.AllExpenses += money;
                                    decimal molingmoneyvalue = 0;
                                    if (molingmoney.HasValue)
                                    {
                                        molingmoneyvalue = molingmoney.Value;
                                    }
                                    foreach (var item in Keys)
                                    {
                                        OA_Procurement m_OA_Procurement = bll_OA_ProcurementBLL.SelectSingleModel(item);
@@ -193,10 +227,24 @@
                                            m_OA_FirmAccountRecordOut.AccountId = m_OA_FirmAccountOut.Keyid;
                                            m_OA_FirmAccountRecordOut.RecordTypeId = 2;//支出
                                            if (Request["amount"].ToString2() == "one")
                                                m_OA_FirmAccountRecordOut.Money = money;
                                            else
                                                m_OA_FirmAccountRecordOut.Money = (m_OA_Procurement.AllMoney - m_OA_Procurement.ReceiveMoney);
                                            m_OA_FirmAccountRecordOut.Money = m_OA_Procurement.AllMoney.Value;
                                            m_OA_Procurement.ReceiveMoney = m_OA_Procurement.AllMoney.Value ;
                                            if (molingmoneyvalue > 0)
                                            {
                                                if (m_OA_Procurement.AllMoney.Value >= molingmoneyvalue)
                                                {
                                                    m_OA_Procurement.ReceiveMoney = m_OA_Procurement.AllMoney.Value  - molingmoneyvalue;
                                                    m_OA_FirmAccountRecordOut.Money = m_OA_Procurement.AllMoney.Value  - molingmoneyvalue;
                                                    molingmoneyvalue = 0;
                                                }
                                                else
                                                {
                                                    m_OA_Procurement.ReceiveMoney = 0;
                                                    m_OA_FirmAccountRecordOut.Money = 0;
                                                    molingmoneyvalue = molingmoneyvalue - m_OA_Procurement.AllMoney.Value;
                                                }
                                            }
                                            m_OA_FirmAccountRecordOut.SubjectId = m_OA_SubjectSet.Keyid;
                                            m_OA_FirmAccountRecordOut.OperationalMatters = "采购付款";
@@ -208,16 +256,17 @@
                                            m_OA_FirmAccountRecordList.Add(m_OA_FirmAccountRecordOut);
                                            m_OA_ProcurementList.Add(m_OA_Procurement);
                                            if (Request["amount"].ToString2() == "one")
                                                m_OA_Procurement.ReceiveMoney += money;
                                            else
                                                m_OA_Procurement.ReceiveMoney = m_OA_Procurement.AllMoney;
                                            if (m_OA_Procurement.ReceiveMoney == m_OA_Procurement.AllMoney)
                                                m_OA_Procurement.ClearingStatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "结账状态");
                                            if (fukuanshenqing.FukuanStatus == 2)
                                                m_OA_Procurement.ClearingStatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "结账状态");
                                            m_OA_Procurement.Operator = CurrentUser.ShortName;
                                            m_OA_Procurement.LastUpdateTime = DateTime.Now;