From 4f4a5a073bed3688ddead42557829fc8610db86b Mon Sep 17 00:00:00 2001
From: pzy <2829717936@qq.com>
Date: 星期二, 13 八月 2024 16:00:34 +0800
Subject: [PATCH] 1

---
 WebTM/views/采购管理/采购合同/Add_Edit_Cg_ContractBillList.html |   67 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 9 deletions(-)

diff --git "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\345\220\210\345\220\214/Add_Edit_Cg_ContractBillList.html" "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\345\220\210\345\220\214/Add_Edit_Cg_ContractBillList.html"
index 56c7066..d78a18c 100644
--- "a/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\345\220\210\345\220\214/Add_Edit_Cg_ContractBillList.html"
+++ "b/WebTM/views/\351\207\207\350\264\255\347\256\241\347\220\206/\351\207\207\350\264\255\345\220\210\345\220\214/Add_Edit_Cg_ContractBillList.html"
@@ -609,13 +609,14 @@
                         var HPrice = obj.data.HPrice * 1;               //鍗曚环
                         var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                         var HTaxRate = obj.data.HTaxRate * 0.01;           //绋庣巼
-                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //绋庨=閲戦*绋庣巼
+                        var HTaxMoney = Number((HMoney * HTaxRate));         //绋庨=閲戦*绋庣巼
                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
                         var HExRate = $("#HExRate").val();                      //姹囩巼
                         //鏁板瓧绮惧害
                         HQty = Number(HQty.toFixed(HQtyDec));
                         HPrice = Number(HPrice.toFixed(HPriceDec));
                         HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                         HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({             //鏇存柊琛ㄦ牸鏁版嵁                鏂规硶鏄瀵硅薄鎻愪緵鐨勪竴涓柟娉曪紝鐢ㄤ簬鏇存柊鍏跺唴閮ㄧ姸鎬佹垨涓庝箣鍏宠仈鐨勬暟鎹簮
@@ -652,6 +653,7 @@
                         HQty = Number(HQty.toFixed(HQtyDec));
                         HPrice = Number(HPrice.toFixed(HPriceDec));
                         HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                         HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
@@ -691,6 +693,7 @@
                         HQty = Number(HQty.toFixed(HQtyDec));
                         HPrice = Number(HPrice.toFixed(HPriceDec));
                         HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
                         HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
@@ -1110,6 +1113,7 @@
                                     //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
                                     //}
                                     OptionData = checkStatus.data[0];
+                                    var TaxRate = getHTaxRateByHSupID();
                                     if (checkStatus.data.length > 1) {
                                         var rowIndex = $(obj.tr).attr("data-index") * 1;
                                         for (var i = 0; i < checkStatus.data.length; i++) {
@@ -1133,7 +1137,7 @@
                                             option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
                                             option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                             option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
-
+                                            option.data[rowIndex + i].HTaxRate = TaxRate;
                                         }
                                         table.render(option);
                                     }
@@ -1147,7 +1151,11 @@
                                 end: function () {
                                     //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
                                     var HSupID = $("#HSupID").val();
-                                    if (HSupID != 0) {
+                                    if (HSupID != 0 && typeof (OptionData.HItemID) != "undefined") {
+                                        var Dec = getDecByMaterID(obj.data.HMaterID) //鑾峰彇绮惧害
+                                        var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //鏁伴噺绮惧害
+                                        var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //鍗曚环绮惧害
+                                        var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //閲戦绮惧害
                                         $.ajax({
                                             url: GetWEBURL() + "/Gy_Supplier/xg",
                                             //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1161,8 +1169,14 @@
                                                 var HQty = obj.data.HQty * 1;                           //鏁伴噺
                                                 var HPrice = obj.data.HPrice * 1;               //鍗曚环
                                                 var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                                                var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //绋庨=閲戦*绋庣巼
+                                                var HTaxMoney = Number((HMoney * HTaxRate));         //绋庨=閲戦*绋庣巼
                                                 var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                                                //鏁板瓧绮惧害
+                                                HQty = Number(HQty.toFixed(HQtyDec));
+                                                HPrice = Number(HPrice.toFixed(HPriceDec));
+                                                HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                                                 obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                                     "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                                     , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1179,7 +1193,7 @@
                                                 })
                                             }
                                         });
-                                    } else {
+                                    } else if (typeof (OptionData.HItemID) != "undefined") {
                                         obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                             "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                             , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1289,6 +1303,7 @@
                             //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
                             //}
                             OptionData = checkStatus.data[0];
+                            var TaxRate = getHTaxRateByHSupID();
                             if (checkStatus.data.length > 1) {
                                 var rowIndex = $(obj.tr).attr("data-index") * 1;
                                 for (var i = 0; i < checkStatus.data.length; i++) {
@@ -1312,7 +1327,7 @@
                                     option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.HMaterModel;
                                     option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                     option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.HUnitName;
-
+                                    option.data[rowIndex + i].HTaxRate = TaxRate;
                                 }
                                 table.render(option);
                             }
@@ -1326,7 +1341,11 @@
                         end: function () {
                             //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
                             var HSupID = $("#HSupID").val();
-                            if (HSupID != 0) {
+                            if (HSupID != 0 && typeof (OptionData.HItemID) != "undefined") {
+                                var Dec = getDecByMaterID(obj.data.HMaterID) //鑾峰彇绮惧害
+                                var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //鏁伴噺绮惧害
+                                var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //鍗曚环绮惧害
+                                var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //閲戦绮惧害
                                 $.ajax({
                                     url: GetWEBURL() + "/Gy_Supplier/xg",
                                     //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1340,8 +1359,14 @@
                                         var HQty = obj.data.HQty * 1;                           //鏁伴噺
                                         var HPrice = obj.data.HPrice * 1;               //鍗曚环
                                         var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                                        var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //绋庨=閲戦*绋庣巼
+                                        var HTaxMoney = Number((HMoney * HTaxRate));         //绋庨=閲戦*绋庣巼
                                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                                        //鏁板瓧绮惧害
+                                        HQty = Number(HQty.toFixed(HQtyDec));
+                                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                                         obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                             "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                             , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1358,7 +1383,7 @@
                                         })
                                     }
                                 });
-                            } else {
+                            } else if (typeof (OptionData.HItemID) != "undefined") {
                                 obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                     "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                     , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1573,6 +1598,30 @@
             }
             //#endregion
 
+            //#region 閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
+            function getHTaxRateByHSupID() {
+                var HTaxRate;
+                //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
+                var HSupID = $("#HSupID").val();
+                if (HSupID != 0) {
+                    $.ajax({
+                        url: GetWEBURL() + "/Gy_Supplier/xg",
+                        type: "GET",
+                        async: false,
+                        data: {
+                            "HInterID": HSupID
+                        },
+                        success: function (d) {
+                            HTaxRate = parseInt(d.data[0].澧炲�肩◣鐜�);
+                        }
+                    });
+                } else {
+                    HTaxRate = 0;
+                }
+                return HTaxRate;
+            }
+            //#endregion
+
             //#region 淇濆瓨鍚庢祻瑙堟柟娉�
             function ReRoadBillMain() {
                 location.replace('Add_Edit_Cg_POInStockBillList.html?OperationType=4&linterid=' + linterid + '&HSouceBillType=');

--
Gitblit v1.9.1