From abdd1a1d8802a93ad9307b0b42020beae9147f62 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期四, 30 十月 2025 08:44:30 +0800
Subject: [PATCH] 把这个放到开票管理中,就是财务管理的付款未票啊,付款未开票啊,把它放到开票管理中,同时在后面加一个开票说明,这个就有。经办人自己填,就是这个好久开开不开得到那个个进度。

---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs |  128 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 120 insertions(+), 8 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
index 8f308a6..62fc632 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/NewWaixieExpenses.aspx.cs
@@ -28,6 +28,10 @@
         OA_FirmAccount firmAccount = null;
         OA_FukuanshenqingBLL _fukuanshenqingBLL = null;
         string orderNo = string.Empty;
+        OA_SubjectSetBLL _OA_SubjectSetBLL = null;
+        Sys_DictionaryBLL _Sys_DictionaryBLL = null;
+        OA_StaffBLL staffBLL = null;
+        OA_BaozhengjinBLL oA_BaozhengjinBLL = null;
 
         decimal? AllMoney = 0;
         decimal? ReceiveMoney = 0;
@@ -42,6 +46,10 @@
             firmAccountRecord = new OA_FirmAccountRecord();
             _OA_FirmAccountRecordBLL = new OA_FirmAccountRecordBLL();
             _fukuanshenqingBLL = new OA_FukuanshenqingBLL();
+            _Sys_DictionaryBLL = new Sys_DictionaryBLL();
+            staffBLL = new OA_StaffBLL();
+            oA_BaozhengjinBLL = new OA_BaozhengjinBLL();
+            _OA_SubjectSetBLL = new OA_SubjectSetBLL();
         }
 
         /// <summary>
@@ -125,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;
@@ -136,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
@@ -153,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))
@@ -176,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;
@@ -183,13 +245,15 @@
                                     firmAccountRecord.RecordTypeId = 2;//鏀嚭
                                     firmAccountRecord.Remark = this.txtRemark.Value;
                                     firmAccountRecord.SubjectId = this.selSubject.Value.ToInt32();
-                                    firmAccountRecord.ResidualAmount = firmAccount.Balance - orderBasic.UnPayedMoney; ;
+                                    firmAccountRecord.ResidualAmount = firmAccount.Balance - firmAccountRecord.Money; ;
 
-                                    firmAccount.AllExpenses = orderBasic.UnPayedMoney + firmAccount.AllExpenses;
-                                    firmAccount.Balance = firmAccount.Balance - orderBasic.UnPayedMoney;
+                                    firmAccount.AllExpenses = firmAccountRecord.Money + firmAccount.AllExpenses;
+                                    firmAccount.Balance = firmAccount.Balance - firmAccountRecord.Money;
                                     ssss = _OA_FirmAccountRecordBLL.AddModel(firmAccountRecord, firmAccount);
                                     if (ssss)
                                     {
+                                      
+
                                         UsePrepare(orderBasic);
 
 
@@ -202,6 +266,48 @@
 
                                 }
 
+                            }
+
+                            if (!string.IsNullOrEmpty(this.selSubject.Value))
+                            {
+                                var oA_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(firmAccountRecord.SubjectId);
+                                if (oA_SubjectSet.SubjectName.IndexOf("鎶曟爣淇濊瘉閲�") >= 0 || oA_SubjectSet.SubjectName.IndexOf("灞ョ害淇濊瘉閲�") >= 0)
+                                {
+                                    //濡傛灉閫夋嫨绉戠洰鏄繚璇侀噾锛屾彃鍏ヤ互鏉′繚璇侀噾鏁版嵁
+                                    OA_Baozhengjin oA_Baozhengjin = new OA_Baozhengjin();
+                                    oA_Baozhengjin.FirmId = CurrentUser.MemberId;
+                                    oA_Baozhengjin.FukuanTime = DateTime.Now;
+
+                                    oA_Baozhengjin.Zhanghuleixing = this.selAcoountType.Value;
+
+                                    var ss = _Sys_DictionaryBLL.GetDataByType("璐︽埛绫诲瀷").FirstOrDefault(x => x.Name == oA_Baozhengjin.Zhanghuleixing);
+                                    if (ss != null)
+                                    {
+                                        oA_Baozhengjin.ReceiveWay = ss.Keyid;
+                                    }
+
+                                    oA_Baozhengjin.Account = Request["selAccountName"].ToInt32();
+                                    oA_Baozhengjin.Fukuanzhanghu = firmAccount.AccountName + "-" + firmAccount.UserName;
+                                    oA_Baozhengjin.Subject = firmAccountRecord.SubjectId;
+                                    oA_Baozhengjin.Fukuankemu = oA_SubjectSet.SubjectName;
+                                    oA_Baozhengjin.Fukuanmoney = money;
+                                    oA_Baozhengjin.Shoukuandanwei = firmAccountRecord.PaymentUnit;
+                                    oA_Baozhengjin.remark = firmAccountRecord.OperationalMatters;
+                                    oA_Baozhengjin.TuikuanTime = null;
+
+                                    oA_Baozhengjin.TuikuanStatus = 1;
+                                    oA_Baozhengjin.Creater = CurrentUser.ShortName;
+                                    oA_Baozhengjin.CreateTime = oA_Baozhengjin.FukuanTime;
+                                    oA_Baozhengjin.Updater = CurrentUser.ShortName;
+                                    oA_Baozhengjin.LastUpdateTime = oA_Baozhengjin.FukuanTime;
+                                    oA_Baozhengjin.MemberName = fukuanshenqing.Creater;
+
+                                    var oA_Staff = staffBLL.SelectListByFirmId(CurrentUser.MemberId, false, false).Where(x => x.Name == oA_Baozhengjin.MemberName).FirstOrDefault();
+                                    oA_Baozhengjin.MemberId = oA_Staff.Keyid;
+
+                                    var aaaaa = oA_BaozhengjinBLL.InsertModel(oA_Baozhengjin);
+
+                                }
                             }
                         }
                     }
@@ -314,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