From 879b9eaa07c8f3e5340bfd7cac565780b9d2867c Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 24 七月 2025 09:31:03 +0800
Subject: [PATCH] 采购付款抹零

---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/WaixieExpenses.aspx.cs           |    4 
 CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs        |    6 
 CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx             |   19 ++++
 CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.designer.cs |   56 +++++++++----
 CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx               |    2 
 CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.cs          |   93 ++++++++++++++++++++---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs            |    6 
 7 files changed, 145 insertions(+), 41 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx
index 46444d5..2cf1b30 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx
@@ -143,7 +143,7 @@
                 鏀跺彇閲戦锛�
             </td>
             <td  title="褰撳崟涓粯娆炬椂鍙儴鍒嗕粯娆�">
-                <input  runat="server"  id="txtReciveMoney"  class="req float" maxlength="18" min="0" readonly="readonly" ></input>
+                <input  runat="server"  id="txtReciveMoney"  class="req float" maxlength="18" min="0" readonly="readonly" />
             </td>
         </tr>
         <tr>
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
index ba2e66b..3e95218 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
@@ -165,7 +165,7 @@
                             return;
                         }
 
-                        if (molingmoney.HasValue)
+                        if (molingmoney.HasValue && molingmoney.Value > 0)
                         {
                             if ((money + molingmoney.Value) != (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                             {
@@ -191,7 +191,7 @@
                                 {
                                     fukuanshenqing.FukuanStatus = 2;
                                 }
-                                if (molingmoney.HasValue)
+                                if (molingmoney.HasValue && molingmoney.Value > 0)
                                 {
                                     if ((money + molingmoney.Value) >= (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                                     {
@@ -210,7 +210,7 @@
                                     m_OA_FirmAccountOut.Balance -= money;
                                     m_OA_FirmAccountOut.AllExpenses += money;
                                     decimal molingmoneyvalue = 0;
-                                    if (molingmoney.HasValue)
+                                    if (molingmoney.HasValue && molingmoney.Value > 0)
                                     {
                                         molingmoneyvalue = molingmoney.Value;
                                     }
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
index 0173d4c..4d3c0ca 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
@@ -165,7 +165,7 @@
                 return;
             }
 
-            if (molingmoney.HasValue)
+            if (molingmoney.HasValue && molingmoney.Value > 0)
             {
                 if ((money + molingmoney.Value) != (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                 {
@@ -191,7 +191,7 @@
                     {
                         fukuanshenqing.FukuanStatus = 2;
                     }
-                    if (molingmoney.HasValue)
+                    if (molingmoney.HasValue && molingmoney.Value > 0)
                     {
                         if ((money + molingmoney.Value) >= (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                         {
@@ -206,7 +206,7 @@
                     if(this.txtReciveMoney.Value.ToDecimal2() > 0)
                     {
                         decimal molingmoneyvalue = 0;
-                        if (molingmoney.HasValue)
+                        if (molingmoney.HasValue && molingmoney.Value > 0)
                         {
                             molingmoneyvalue = molingmoney.Value;
                         }
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx
index 479705c..ab811b5 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx
@@ -30,7 +30,13 @@
                 }
             });
         }
-            
+
+
+        function molinya() {
+            var sss = $("#hidReceiveMoney").val() - $("#txtMolingMoney").val()
+            $("#txtReciveMoney").val(sss);
+
+        }
     </script>
     <script type="text/javascript">
         $(function () {
@@ -72,6 +78,7 @@
             </td>
             <td>
                 <span class="moneystyle" id="spanReceiveMoney" runat="server">锟�</span>
+                 <input type="hidden" id="hidReceiveMoney"  runat="server" />
             </td>
         </tr>
         <tr>
@@ -107,9 +114,17 @@
                 鏀跺彇閲戦锛�
             </td>
             <td  title="褰撳崟涓粯娆炬椂鍙儴鍒嗕粯娆�">
-                <asp:TextBox TextMode="SingleLine"  id="txtReciveMoney" runat="server" class="req float" min="0"></asp:TextBox>
+               <input  runat="server"  id="txtReciveMoney"  class="req float" maxlength="18" min="0"  />
             </td>
         </tr>
+         <tr>
+                <td class="ali03 ">
+                    鎶归浂閲戦锛�
+                </td>
+                <td>
+                    <input runat="server" id="txtMolingMoney" type="text" class=" float" maxlength="18" min="0" onchange="molinya();" />(鍏�)
+                </td>
+            </tr>
         <tr>
             <td class="ali03">
             </td>
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.cs
index a9f6faa..c1de724 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.cs
@@ -81,10 +81,11 @@
             {
                 this.spanAllMoney.InnerHtml = "锟�" + (AllMoney ?? 0).ToString("0.00");
                 this.spanReceiveMoney.InnerHtml = "锟�" + (ReceiveMoney ?? 0).ToString("0.00");
+                this.hidReceiveMoney.Value = (ReceiveMoney ?? 0).ToString("0.0000");
                 this.spanCountRe.InnerHtml = "1 鍗�";
 
-                this.txtReciveMoney.Enabled = true;
-                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"));
 
             }
@@ -92,10 +93,11 @@
             {
                 this.spanAllMoney.InnerHtml = "锟�" + (AllMoney ?? 0).ToString("0.00");
                 this.spanReceiveMoney.InnerHtml = "锟�" + ReceiveMoney.Value.ToString("0.00");
+                this.hidReceiveMoney.Value = (ReceiveMoney ?? 0).ToString("0.0000");
                 this.spanCountRe.InnerHtml = Keys.Count().ToString2() + " 鍗�";
 
-                this.txtReciveMoney.Enabled = false;
-                this.txtReciveMoney.Text = (ReceiveMoney ?? 0).ToString("0.00");
+                this.txtReciveMoney.Attributes["readonly"] = "readonly";
+                this.txtReciveMoney.Value = (ReceiveMoney ?? 0).ToString("0.00");
                 this.txtReciveMoney.Attributes.Add("max", (ReceiveMoney ?? 0).ToString("0.00"));
             }
         }
@@ -106,7 +108,26 @@
             try
             {
 
+
                 string[] Keys = Request["Keyid"].ToString2().Trim('|').Split('|');
+                var molingmoney = this.txtMolingMoney.Value.ToDecimal2();
+                decimal molingmoneyvalue = 0;
+                if (molingmoney.HasValue && molingmoney.Value > 0)
+                {
+                    molingmoneyvalue = molingmoney.Value;
+                }
+                var remoney = this.txtReciveMoney.Value.ToDecimal2();
+                var hidremoney = this.hidReceiveMoney.Value.ToDecimal2(); 
+
+                if (molingmoney.HasValue && molingmoney.Value > 0)
+                {
+                    if ((remoney + molingmoney.Value) != hidremoney )
+                    {
+                        JavaScript.MessageBox("鎿嶄綔閲戦鍔犳姽闆堕噾棰濆繀椤荤瓑浜庡墿浣欏簲浠橀噾棰濓紒", this);
+                        return;
+                    }
+                }
+
                 foreach (var item in Keys)
                 {
                     if (!string.IsNullOrEmpty(item))
@@ -121,11 +142,15 @@
                 }
 
                 int? SubjectId = this.selSubject.Value.ToInt32();
-
+               
                 decimal? money = ReceiveMoney;
                 if (Request["amount"].ToString2() == "one")
                 {
-                    money = this.txtReciveMoney.Text.ToDecimal2();
+                    money = this.txtReciveMoney.Value.ToDecimal2();
+                }
+                if (molingmoney.HasValue && molingmoney.Value > 0)
+                {
+                    money = money - molingmoney.Value;
                 }
 
                 int? AccountIdOut = Request["selAccountNameOut"].ToInt32();
@@ -153,13 +178,14 @@
                             OA_Procurement m_OA_Procurement = bll_OA_ProcurementBLL.SelectSingleModel(item);
                             if (m_OA_Procurement != null)
                             {
-                                if (Request["amount"].ToString2() == "one")
-                                    m_OA_Procurement.ReceiveMoney += money;
-                                else
-                                    m_OA_Procurement.ReceiveMoney = m_OA_Procurement.AllMoney;
+                                //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, "缁撹处鐘舵��");
+                              
 
                                 m_OA_Procurement.Operator = CurrentUser.ShortName;
                                 m_OA_Procurement.LastUpdateTime = DateTime.Now;
@@ -171,9 +197,52 @@
                                 m_OA_FirmAccountRecordOut.RecordTypeId = 2;//鏀嚭
 
                                 if (Request["amount"].ToString2() == "one")
+                                {
+                                    m_OA_Procurement.ReceiveMoney += money;
                                     m_OA_FirmAccountRecordOut.Money = money;
+                                }
                                 else
+                                {
                                     m_OA_FirmAccountRecordOut.Money = (m_OA_Procurement.AllMoney - m_OA_Procurement.ReceiveMoney);
+                                    m_OA_Procurement.ReceiveMoney = m_OA_Procurement.AllMoney;
+                                  
+
+                                    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;
+                                        }
+
+                                    }
+                                }
+                                if (Request["amount"].ToString2() == "one")
+                                {
+                                    if (molingmoney.HasValue && molingmoney.Value > 0)
+                                    {
+                                            m_OA_Procurement.ClearingStatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "缁撹处鐘舵��");
+                                    }
+                                    else
+                                    {
+                                        if (m_OA_Procurement.ReceiveMoney == m_OA_Procurement.AllMoney)
+                                            m_OA_Procurement.ClearingStatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "缁撹处鐘舵��");
+                                    }
+                                   
+                                }
+                                else
+                                {
+                                    m_OA_Procurement.ClearingStatusId = bll_Sys_DictionaryBLL.GetKeyIdByKeyid(1, "缁撹处鐘舵��");
+                                }
+                                   
+
 
                                 m_OA_FirmAccountRecordOut.SubjectId = m_OA_SubjectSet.Keyid;
                                 m_OA_FirmAccountRecordOut.OperationalMatters = "閲囪喘浠樻";
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.designer.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.designer.cs
index dfd1aa8..1935c12 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.designer.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/PurchasePayEdit.aspx.designer.cs
@@ -2,16 +2,18 @@
 // <鑷姩鐢熸垚>
 //     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
 //
-//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
-//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便�� 
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳藉鑷翠笉姝g‘鐨勮涓猴紝濡傛灉
+//     閲嶆柊鐢熸垚浠g爜锛屽垯鎵�鍋氭洿鏀瑰皢涓㈠け銆�
 // </鑷姩鐢熸垚>
 //------------------------------------------------------------------------------
 
-namespace CY.WebForm.Pages.financial {
-    
-    
-    public partial class PurchasePayEdit {
-        
+namespace CY.WebForm.Pages.financial
+{
+
+
+    public partial class PurchasePayEdit
+    {
+
         /// <summary>
         /// Head1 鎺т欢銆�
         /// </summary>
@@ -20,7 +22,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlHead Head1;
-        
+
         /// <summary>
         /// CMSHead1 鎺т欢銆�
         /// </summary>
@@ -29,7 +31,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::CY.WebForm.Pages.common.CMSHead CMSHead1;
-        
+
         /// <summary>
         /// form1 鎺т欢銆�
         /// </summary>
@@ -38,7 +40,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlForm form1;
-        
+
         /// <summary>
         /// spanCountRe 鎺т欢銆�
         /// </summary>
@@ -47,7 +49,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanCountRe;
-        
+
         /// <summary>
         /// spanAllMoney 鎺т欢銆�
         /// </summary>
@@ -56,7 +58,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanAllMoney;
-        
+
         /// <summary>
         /// spanReceiveMoney 鎺т欢銆�
         /// </summary>
@@ -65,7 +67,16 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanReceiveMoney;
-        
+
+        /// <summary>
+        /// hidReceiveMoney 鎺т欢銆�
+        /// </summary>
+        /// <remarks>
+        /// 鑷姩鐢熸垚鐨勫瓧娈点��
+        /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
+        /// </remarks>
+        protected global::System.Web.UI.HtmlControls.HtmlInputHidden hidReceiveMoney;
+
         /// <summary>
         /// selAcoountTypeOut 鎺т欢銆�
         /// </summary>
@@ -74,7 +85,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlSelect selAcoountTypeOut;
-        
+
         /// <summary>
         /// selAccountNameOut 鎺т欢銆�
         /// </summary>
@@ -83,7 +94,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlSelect selAccountNameOut;
-        
+
         /// <summary>
         /// selSubject 鎺т欢銆�
         /// </summary>
@@ -92,7 +103,7 @@
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
         protected global::System.Web.UI.HtmlControls.HtmlSelect selSubject;
-        
+
         /// <summary>
         /// txtReciveMoney 鎺т欢銆�
         /// </summary>
@@ -100,8 +111,17 @@
         /// 鑷姩鐢熸垚鐨勫瓧娈点��
         /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
         /// </remarks>
-        protected global::System.Web.UI.WebControls.TextBox txtReciveMoney;
-        
+        protected global::System.Web.UI.HtmlControls.HtmlInputText txtReciveMoney;
+
+        /// <summary>
+        /// txtMolingMoney 鎺т欢銆�
+        /// </summary>
+        /// <remarks>
+        /// 鑷姩鐢熸垚鐨勫瓧娈点��
+        /// 鑻ヨ杩涜淇敼锛岃灏嗗瓧娈靛0鏄庝粠璁捐鍣ㄦ枃浠剁Щ鍒颁唬鐮侀殣钘忔枃浠躲��
+        /// </remarks>
+        protected global::System.Web.UI.HtmlControls.HtmlInputText txtMolingMoney;
+
         /// <summary>
         /// btn_Submit 鎺т欢銆�
         /// </summary>
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/WaixieExpenses.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/WaixieExpenses.aspx.cs
index 58a86b2..abfbcc7 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/WaixieExpenses.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/WaixieExpenses.aspx.cs
@@ -139,7 +139,7 @@
             }
 
 
-            if (molingmoney.HasValue)
+            if (molingmoney.HasValue && molingmoney.Value > 0)
             {
                 if((money + molingmoney.Value ) != (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                 {
@@ -171,7 +171,7 @@
                         fukuanshenqing.FukuanStatus = 2;
                     }
 
-                    if (molingmoney.HasValue)
+                    if (molingmoney.HasValue && molingmoney.Value > 0)
                     {
                         if ((money + molingmoney.Value) >= (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
                         {

--
Gitblit v1.9.1