From cb2fc709d4e2aec6bbea3e6f4e8ccc24f3d27756 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期日, 06 十月 2024 17:27:08 +0800
Subject: [PATCH] 工艺路线工价

---
 WebTM/views/销售管理/销售合同/Add_Edit_Xs_ContractBillList.html |   67 ++++++++++++++++++++++++++++++---
 1 files changed, 61 insertions(+), 6 deletions(-)

diff --git "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\345\220\210\345\220\214/Add_Edit_Xs_ContractBillList.html" "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\345\220\210\345\220\214/Add_Edit_Xs_ContractBillList.html"
index fcac126..2db280f 100644
--- "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\345\220\210\345\220\214/Add_Edit_Xs_ContractBillList.html"
+++ "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\345\220\210\345\220\214/Add_Edit_Xs_ContractBillList.html"
@@ -613,6 +613,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));
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -649,6 +650,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));
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -686,6 +688,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));
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -1026,6 +1029,8 @@
                                     //    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++) {
@@ -1049,7 +1054,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);
                                     }
@@ -1063,7 +1068,11 @@
                                 end: function () {
                                     //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
                                     var HSupID = $("#HCusID").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_Customer/xg",
                                             //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1080,6 +1089,14 @@
                                                 var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                                                 var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //绋庨=閲戦*绋庣巼
                                                 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爜
@@ -1096,7 +1113,7 @@
                                                 })
                                             }
                                         });
-                                    } else {
+                                    } else if (typeof (OptionData.HItemID) != "undefined") {
                                         obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                             "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                             , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1209,6 +1226,8 @@
                                 //    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++) {
@@ -1232,7 +1251,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);
                                 }
@@ -1246,7 +1265,11 @@
                             end: function () {
                                 //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
                                 var HSupID = $("#HCusID").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_Customer/xg",
                                         //url: "http://localhost:12761/Gy_Supplier/xg",
@@ -1263,6 +1286,14 @@
                                             var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                                             var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //绋庨=閲戦*绋庣巼
                                             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爜
@@ -1279,7 +1310,7 @@
                                             })
                                         }
                                     });
-                                } else {
+                                } else if (typeof (OptionData.HItemID) != "undefined"){
                                     obj.update({ //鏇存柊琛ㄦ牸鏁版嵁
                                         "HMaterID": OptionData.HItemID             //璁剧疆HItemID鐨勫�间负鈥淗BillNo鈥濆瓧娈电殑鍊糎ItemID`鐨勫��
                                         , "鐗╂枡浠g爜": OptionData.鐗╂枡浠g爜
@@ -1539,6 +1570,30 @@
             }
             //#endregion
 
+            //#region 閫氳繃瀹㈡埛id鑾峰彇绋庣巼
+            function getHTaxRateByHSupID() {
+                var HTaxRate;
+                //閫氳繃渚涘簲鍟唅d鑾峰彇绋庣巼
+                var HSupID = $("#HCusID").val();
+                if (HSupID != 0) {
+                    $.ajax({
+                        url: GetWEBURL() + "/Gy_Customer/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_Xs_POInStockBillList.html?OperationType=4&linterid=' + linterid + '&HSouceBillType=');

--
Gitblit v1.9.1