From 72b668c965a3f5308d1a388296eb4c3f8fb7be72 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期五, 12 九月 2025 08:46:01 +0800
Subject: [PATCH] 批量入库,操作成功关闭窗口 完成

---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs |   72 +++++++++++++++++++++++++++++++++---
 1 files changed, 66 insertions(+), 6 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
index 1a4679f..3f5f149 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
@@ -133,8 +133,9 @@
                 return;
             }
             firmAccount = _OA_FirmAccountBLL.getSingleSubject(Request["selAccountName"].ToInt32());
-            var money = this.txtReciveMoney.Text.ToDecimal2();
-            if (this.txtReciveMoney.Text.ToDecimal2() > 0 && firmAccount.Balance < this.txtReciveMoney.Text.ToDecimal2())
+            var money = this.txtReciveMoney.Value.ToDecimal2();
+            var molingmoney = this.txtMolingMoney.Value.ToDecimal2();
+            if (this.txtReciveMoney.Value.ToDecimal2() > 0 && firmAccount.Balance < this.txtReciveMoney.Value.ToDecimal2())
             {
                 JavaScript.MessageBox("璐︽埛浣欓涓嶈冻", this);
                 return;
@@ -144,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 && molingmoney.Value > 0)
+            //{
+            //    if ((money + molingmoney.Value) != (fukuanshenqing.Fukuanmoney - fukuanshenqing.Yishoumoney))
+            //    {
+            //        JavaScript.MessageBox("鎿嶄綔閲戦鍔犳姽闆堕噾棰濆繀椤荤瓑浜庡墿浣欏簲浠橀噾棰濓紒", this);
+            //        return;
+            //    }
+            //}
+
             string[] Keys = fukuanshenqing.DindanId.Trim(',').Split(',');
             using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
     new TransactionOptions
@@ -161,19 +185,32 @@
             {
                 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)
                     {
+                        decimal molingmoneyvalue = 0;
+                        if (molingmoney.HasValue && molingmoney.Value > 0)
+                        {
+                            molingmoneyvalue = molingmoney.Value;
+                        }
                         foreach (var item in Keys)
                         {
                             if (!string.IsNullOrEmpty(item))
@@ -184,6 +221,23 @@
                                     firmAccountRecord.AccountId = Request["selAccountName"].ToInt32();
                                     firmAccountRecord.LastUpdateTime = DateTime.Now;
                                     firmAccountRecord.Money = orderBasic.UnPayedMoney;
+                                    var UnPayedMoney = orderBasic.UnPayedMoney;
+                                    if (molingmoneyvalue > 0)
+                                    {
+                                        if (UnPayedMoney >= molingmoneyvalue)
+                                        {
+                                          
+                                            firmAccountRecord.Money = UnPayedMoney - molingmoneyvalue;
+                                            molingmoneyvalue = 0;
+                                        }
+                                        else
+                                        {
+                                            firmAccountRecord.Money = 0;
+                                            molingmoneyvalue = molingmoneyvalue - UnPayedMoney;
+                                           
+                                        }
+
+                                    }
                                     orderNo = orderBasic.SellerOrderId;
                                     firmAccountRecord.OperationalMatters = "澶栧崗浠樻" + "(" + orderNo + ")";
                                     firmAccountRecord.Operator = CurrentUser.ShortName;
@@ -251,7 +305,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);
 
                                 }
                             }
@@ -366,8 +420,14 @@
 
                 this.spanAllMoney.InnerText = "锟�" + AllMoney.Value.ToString("0.00");
                 this.spanReceiveMoney.InnerText = "锟�" + ReceiveMoney.Value.ToString("0.00");
-                this.txtReciveMoney.Text = ReceiveMoney.Value.ToString("0.00");
+                this.hidReceiveMoney.Value =   ReceiveMoney.Value.ToString();
+                this.txtReciveMoney.Value = ReceiveMoney.Value.ToString("0.00");
                 this.spanCountRe.InnerHtml = Keys.Count().ToString2() + " 鍗�";
+                this.txtMolingMoney.Value = fukuanshenqing.Molingmoney.HasValue? fukuanshenqing.Molingmoney.Value.ToString("0.00"):"0";
+                if (fukuanshenqing.Molingmoney.HasValue)
+                {
+                    this.txtReciveMoney.Value = (ReceiveMoney.Value - fukuanshenqing.Molingmoney.Value).ToString("0.00");
+                }
             }
            
 

--
Gitblit v1.9.1