From 529d8cb61421eb65d86559d3d2636ad405b87b41 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 22 七月 2025 08:50:06 +0800
Subject: [PATCH] 专版 四色  八色   自翻印刷的时候   ctp 4张 扣版  8张

---
 CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs |  148 +++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 125 insertions(+), 23 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
index 830e042..ba2e66b 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/financial/CaigouPayEdit.aspx.cs
@@ -29,6 +29,10 @@
         OA_FirmAccountBLL bll_OA_FirmAccountBLL = null;
         OA_SuppliersBLL bll_OA_SuppliersBLL = null;
         OA_FukuanshenqingBLL _fukuanshenqingBLL = null;
+        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;
         //鍒濆鍖�
@@ -43,6 +47,10 @@
             bll_OA_FirmAccountBLL = new OA_FirmAccountBLL();
             bll_OA_SuppliersBLL = new OA_SuppliersBLL();
             _fukuanshenqingBLL = new OA_FukuanshenqingBLL();
+            _Sys_DictionaryBLL = new Sys_DictionaryBLL();
+            staffBLL = new OA_StaffBLL();
+            oA_BaozhengjinBLL = new OA_BaozhengjinBLL();
+            _OA_SubjectSetBLL = new OA_SubjectSetBLL();
         }
 
         //椤甸潰鍔犺浇
@@ -88,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"));
             }
                
@@ -111,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();
 
@@ -138,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,
@@ -161,32 +191,35 @@
                                 {
                                     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);
                                         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 (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;
+                                           
 
 
                                             OA_Suppliers m_OA_Suppliers = bll_OA_SuppliersBLL.getSingleSupplier(m_OA_Procurement.SuppliersId.ToString2());
@@ -194,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,6 +255,21 @@
                                             m_OA_FirmAccountRecordOut.ResidualAmount = m_OA_FirmAccountOut.Balance;
                                             m_OA_FirmAccountRecordList.Add(m_OA_FirmAccountRecordOut);
                                             m_OA_ProcurementList.Add(m_OA_Procurement);
+
+                                            
+
+
+
+
+                                            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;
+
                                         }
                                     }
 
@@ -215,7 +277,47 @@
                                     if (m_OA_ProcurementList.Count > 0)
                                     {
                                         ssss = bll_OA_FirmAccountBLL.PurchasePayList(m_OA_FirmAccountRecordList, m_OA_ProcurementList, m_OA_FirmAccountOut);
+                                        if (!string.IsNullOrEmpty(this.selSubject.Value))
+                                        {
+                                            var oA_SubjectSet = _OA_SubjectSetBLL.getSingleSubject(m_OA_FirmAccountRecordList[0].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.selAcoountTypeOut.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 = m_OA_FirmAccountOut.AccountName + "-" + m_OA_FirmAccountOut.UserName;
+                                                oA_Baozhengjin.Subject = m_OA_FirmAccountRecordList[0].SubjectId;
+                                                oA_Baozhengjin.Fukuankemu = oA_SubjectSet.SubjectName;
+                                                oA_Baozhengjin.Fukuanmoney = money;
+                                                oA_Baozhengjin.Shoukuandanwei = m_OA_FirmAccountRecordList[0].PaymentUnit;
+                                                oA_Baozhengjin.remark = m_OA_FirmAccountRecordList[0].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 sss = oA_BaozhengjinBLL.InsertModel(oA_Baozhengjin);
+
+                                            }
+                                        }
                                     }
                                 }
 

--
Gitblit v1.9.1