From b63e4e9f97aba58867a01b85e7d128b6eb738a0a Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 09 十月 2025 09:48:50 +0800
Subject: [PATCH] 请示类别要增加  维修申请   维修付款申请

---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs |   94 +++++++++++++++++++++++++++++++++++++---------
 1 files changed, 75 insertions(+), 19 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
index 0a99c4f..920ce6e 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
@@ -96,11 +96,17 @@
                 }
                 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.txtMolingMoney.Value = fukuanshenqing.Molingmoney.HasValue ? fukuanshenqing.Molingmoney.Value.ToString("0.00") : "0";
 
-                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"));
+
+                if (fukuanshenqing.Molingmoney.HasValue)
+                {
+                    this.txtReciveMoney.Value = (ReceiveMoney.Value - fukuanshenqing.Molingmoney.Value).ToString("0.00");
+                }
             }
                
 
@@ -119,14 +125,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 +150,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 && molingmoney.Value > 0)
+                        //{
+                        //    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,
@@ -164,22 +191,36 @@
                         {
                             try
                             {
+                                var sss = fukuanshenqing.Molingmoney.HasValue ? fukuanshenqing.Molingmoney.Value : 0;
+
                                 var yishoumoney = fukuanshenqing.Yishoumoney.HasValue ? fukuanshenqing.Yishoumoney.Value : 0;
-                                if (money >= (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
+                                if (money >= (fukuanshenqing.Fukuanmoney + sss - fukuanshenqing.Yishoumoney))
                                 {
                                     fukuanshenqing.FukuanStatus = 2;
+                                }
+                                if (molingmoney.HasValue && molingmoney.Value > 0)
+                                {
+                                    if ((money + molingmoney.Value) >= (fukuanshenqing.Fukuanmoney + sss - 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 && molingmoney.Value > 0)
+                                    {
+                                        molingmoneyvalue = molingmoney.Value;
+                                    }
                                     foreach (var item in Keys)
                                     {
                                         OA_Procurement m_OA_Procurement = bll_OA_ProcurementBLL.SelectSingleModel(item);
@@ -193,10 +234,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,14 +263,15 @@
                                             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;
@@ -265,7 +321,7 @@
                                                 var oA_Staff = staffBLL.SelectListByFirmId(CurrentUser.MemberId, false, false).Where(x => x.Name == oA_Baozhengjin.MemberName).FirstOrDefault();
                                                 oA_Baozhengjin.MemberId = oA_Staff.Keyid;
 
-                                                var sss = oA_BaozhengjinBLL.InsertModel(oA_Baozhengjin);
+                                                var aaaaa = oA_BaozhengjinBLL.InsertModel(oA_Baozhengjin);
 
                                             }
                                         }

--
Gitblit v1.9.1