From 44178ad4def665fe10f64dbdd557b970ea0a7e77 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期二, 13 八月 2024 14:22:13 +0800
Subject: [PATCH] 采购销售双击小数点后位数bug修复

---
 WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html |  106 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 99 insertions(+), 7 deletions(-)

diff --git "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html" "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
index b282454..15c042c 100644
--- "a/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
+++ "b/WebTM/views/\351\224\200\345\224\256\347\256\241\347\220\206/\351\224\200\345\224\256\350\256\242\345\215\225/Add_Edit_Xs_SeOrderBillList.html"
@@ -2574,13 +2574,17 @@
                                     var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
                                     var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                    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"];  //閲戦绮惧害
                                     for (var i = 0; i < checkStatus.data.length; i++) {
                                         if (rowIndex + i >= option.data.length) {
                                             var NewRow = {
                                                 "HMaterID": "0", "鐗╂枡浠g爜": "", "鐗╂枡鍚嶇О": "", "瑙勬牸鍨嬪彿": "", "HUnitID": "0", "璁¢噺鍗曚綅": "", "HQty": "0", "HPrice": "0", "HTaxPrice": "0"
                                                 , "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0"
                                                 , "HDate": Format(new Date(), 'yyyy-MM-dd'), "HOutStockQty": "0", "HInvoiceQty": "0", "HRemark": "", "HCusMaterNumber": "",
-                                                "HCusModel": "","HCusMaterName": ""
+                                                "HCusModel": "", "HCusMaterName": ""
                                             }
                                             btnAddLine(NewRow);
                                         }
@@ -2603,8 +2607,8 @@
                                         }
 
                                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                        var HQty = option.data[rowIndex + i].HQty;                  //鏁伴噺
-                                        var HPrice = option.data[rowIndex + i].HPrice;              //鍗曚环
+                                        var HQty = option.data[rowIndex + i].HQty * 1;                  //鏁伴噺
+                                        var HPrice = option.data[rowIndex + i].HPrice * 1;              //鍗曚环
                                         var HTaxRate = value * 0.01;                                //绋庣巼
                                         /*var HDiscountRate = obj.data.HDiscountRate * 1;           //鎶樻墸鐜�*/
                                         var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
@@ -2613,7 +2617,13 @@
                                         var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
                                         var HTaxMoney = 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));
+                                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
 
                                         option.data[rowIndex + i].HMaterID = resultData.HItemID;
                                         option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.鐗╂枡浠g爜;
@@ -2643,6 +2653,42 @@
                                 }
                                 , end: function () {
                                     if (typeof (HDataEmp.HItemID) != "undefined") {
+                                        var value = subHTaxRate;
+                                        //鏁板�兼牸寮忔牎楠屽伐鍏�
+                                        var ref = /^\d+(\.\d+)?$/;
+                                        //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                        temp = value + "";
+                                        if (ref.test(temp)) {
+                                            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"];  //閲戦绮惧害
+                                            //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                            var HQty = obj.data.HQty * 1;                           //鏁伴噺
+                                            var HPrice = obj.data.HPrice * 1;               //鍗曚环
+                                            var HTaxRate = value * 0.01;           //绋庣巼
+                                            var HTaxPrice = HPrice * (1 + HTaxRate);        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                            var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                                            var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                            var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+
+                                            //鏁板瓧绮惧害
+                                            HQty = Number(HQty.toFixed(HQtyDec));
+                                            HPrice = Number(HPrice.toFixed(HPriceDec));
+                                            HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                            HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                            HTaxPrice = Number(HPrice.toFixed(HPriceDec));
+
+                                            //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                                            obj.update({
+                                                HQty: HQty
+                                                , HPrice: HPrice
+                                                , HTaxRate: HTaxRate * 100
+                                                , HTaxPrice: HTaxPrice
+                                                , HMoney: HMoney
+                                                , HlineTotal: HlineTotal
+                                            });
+                                        }
                                         //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                         obj.update({
                                             "HMaterID": HDataEmp.HItemID
@@ -3165,6 +3211,10 @@
                             var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
                             var rowIndex = $(obj.tr).attr("data-index") * 1;
+                            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"];  //閲戦绮惧害
                             for (var i = 0; i < checkStatus.data.length; i++) {
                                 if (rowIndex + i >= option.data.length) {
                                     var NewRow = {
@@ -3194,8 +3244,8 @@
                                 }
 
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                var HQty = option.data[rowIndex + i].HQty;                  //鏁伴噺
-                                var HPrice = option.data[rowIndex + i].HPrice;              //鍗曚环
+                                var HQty = option.data[rowIndex + i].HQty * 1;                  //鏁伴噺
+                                var HPrice = option.data[rowIndex + i].HPrice * 1;              //鍗曚环
                                 var HTaxRate = value * 0.01;                                //绋庣巼
                                 /*var HDiscountRate = obj.data.HDiscountRate * 1;           //鎶樻墸鐜�*/
                                 var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
@@ -3204,7 +3254,13 @@
                                 var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
                                 var HTaxMoney = 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));
+                                HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
 
                                 option.data[rowIndex + i].HMaterID = resultData.HItemID;
                                 option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.鐗╂枡浠g爜;
@@ -3234,6 +3290,42 @@
                         }
                         , end: function () {
                             if (typeof (HDataEmp.HItemID) != "undefined") {
+                                var value = subHTaxRate;
+                                //鏁板�兼牸寮忔牎楠屽伐鍏�
+                                var ref = /^\d+(\.\d+)?$/;
+                                //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                temp = value + "";
+                                if (ref.test(temp)) {
+                                    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"];  //閲戦绮惧害
+                                    //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                    var HQty = obj.data.HQty * 1;                           //鏁伴噺
+                                    var HPrice = obj.data.HPrice * 1;               //鍗曚环
+                                    var HTaxRate = value * 0.01;           //绋庣巼
+                                    var HTaxPrice = HPrice * (1 + HTaxRate);        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                    var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                                    var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                    var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+
+                                    //鏁板瓧绮惧害
+                                    HQty = Number(HQty.toFixed(HQtyDec));
+                                    HPrice = Number(HPrice.toFixed(HPriceDec));
+                                    HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                    HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                    HTaxPrice = Number(HPrice.toFixed(HPriceDec));
+
+                                    //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
+                                    obj.update({
+                                        HQty: HQty
+                                        , HPrice: HPrice
+                                        , HTaxRate: HTaxRate * 100
+                                        , HTaxPrice: HTaxPrice
+                                        , HMoney: HMoney
+                                        , HlineTotal: HlineTotal
+                                    });
+                                }
                                 //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
                                 obj.update({
                                     "HMaterID": HDataEmp.HItemID

--
Gitblit v1.9.1