From 727ee25aeb5fcaf84e2cf009b2eacd3a86bcb3ca Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 28 十一月 2024 12:55:23 +0800
Subject: [PATCH] 新增 环境检测方案,环境检测单

---
 WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html |  924 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 809 insertions(+), 115 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 96ddd5a..dea00d6 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"
@@ -77,7 +77,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">鍗曟嵁缂栧彿<label style="color:red"> * </label></label>
                                             <div class="layui-input-inline">
-                                                <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;" readonly>
+                                                <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="background-color:#efefef4d;">
                                                 <input type="hidden" name="HInterID" id="HInterID" value="0">
                                                 <input type="hidden" name="HSTOCKORGID" id="HSTOCKORGID" lay-verify="HSTOCKORGID">
                                             </div>
@@ -91,7 +91,7 @@
                                         <div class="layui-inline">
                                             <label class="layui-form-label">閿�鍞憳</label>
                                             <div class="layui-input-inline">
-                                                <input type="text" name="HEmpName" id="HEmpName" " class="layui-input" value="" style="float: left; width: 150px; background-color: #efefef4d;" readonly>
+                                                <input type="text" name="HEmpName" id="HEmpName" class="layui-input" value="" style="float: left; width: 150px;">
                                                 <input type="hidden" name="HEmpID" id="HEmpID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HEmpList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
@@ -245,7 +245,7 @@
                                             <label class="layui-form-label">浠撳簱</label>
                                             <div class="layui-input-inline">
                                                 <input type="text" name="HWHName" id="HWHName" class="layui-input" value="" style="float:left;width:150px;">
-                                                <input type="hidden" name="HWHID" id="HWHID" class="layui-input" value=0 style="float:left;width:150px;">
+                                                <input type="hidden" name="HWHID" id="HWHID" class="layui-input" value="0" style="float:left;width:150px;">
                                                 <button type="button" lay-submit="" class="layui-btn" lay-filter="HWHList" style="width:40px;">
                                                     <i class="layui-icon layui-icon-search layuiadmin-button-btn" style="margin-left:-9px;"></i>
                                                 </button>
@@ -413,6 +413,8 @@
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Up"><i class="layui-icon layui-icon-form"></i>涓婄Щ</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Under"><i class="layui-icon layui-icon-form"></i>涓嬬Щ</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-batchDelete"><i class="layui-icon layui-icon-form"></i>鎵归噺鍒犻櫎</button>
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Inventory" id="get_Inventory"><i class="layui-icon layui-icon-form"></i>搴撳瓨鏌ヨ</button>
+                            <button type="button" class="layui-btn layui-btn-sm" lay-event="get_InOutSum" id="get_InOutSum"><i class="layui-icon layui-icon-form"></i>鍑哄叆搴撹褰曟煡璇�</button>
                             <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>鍒楄缃�</button>
                         </div>
                     </script>
@@ -435,6 +437,15 @@
         </select>
     </script>
     <script>
+        //#region 鏂囨湰妗嗚緭鍏ユ悳绱㈢浉鍏虫暟鎹�-鍙橀噺
+        var childPage = null;                       //鑾峰彇瀛愮獥鍙e璞★紝鐢ㄤ簬鎿嶄綔瀛愮獥鍙g殑鍙橀噺鍜屾柟娉�
+        var currRowIndex = 0;                       //鐢ㄤ簬瀹氫綅瀛愮獥鍙e綋鍓嶉�変腑鐨勮
+        var childData = null;                       //鐢ㄤ簬鑾峰彇瀛愮獥鍙h繑鍥炵殑鏁版嵁
+        //#endregion
+
+
+
+
         //#region 鎶樺彔娉ㄩ噴
         var HDataEmp = {};
         //#endregion
@@ -456,6 +467,8 @@
             //瀛愯〃娓叉煋鍙傛暟
             window.option = {};
 
+            var titleData = ["HMaterID", "HUnitID", "鎶樻墸鐜�", "瀹為檯鍚◣鍗曚环", "绋庨", "鏈綅甯佷环绋庡悎璁�", "鍑哄簱鏁伴噺", "寮�绁ㄦ暟閲�", "HOrderLevID", "璁㈠崟绛夌骇浠g爜", "閿�鍞嚭搴撴暟閲�", "閿�鍞嚭搴撳鏍告暟閲�", "閿�鍞嚭搴撳鏍搁噾棰�", "鐢熶骇鏁伴噺", "閿�鍞��搴撴暟閲�", "閿�鍞��搴撳鏍告暟閲�"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+
             //璁板綍缁勭粐鐨勫��
             var HOrgIDBar = 0;
 
@@ -476,7 +489,8 @@
 
 
             //#region 杩涘叆椤甸潰鍗冲姞杞�
-
+            //妫�娴嬫槸鍚﹀叿澶囨煡鐪嬮噾棰濇潈闄愶紝璁剧疆闅愯棌鍒�
+            checkRight_Money();
             //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
 
@@ -498,14 +512,7 @@
                 set_InitGrid();
                 //鍔犺浇琛ㄤ綋鍜岃〃浣撴暟鎹�
                 RoadBillMain(linterid);
-                //鏍规嵁閿�鍞鍗曠被鍨嬭缃瓙琛ㄦ槸鍚﹀彇搴撳瓨閫夐」
-                setHisStockGoodsByHBillSubType_For_RoadBillMain();
-
-                //鏍规嵁鏄惁鍙栧簱瀛樿幏鍙栧畾閲戞瘮渚�
-                setHEarnestRateByHisStockGoods();
-
-                //璁剧疆琛ㄥご鎵�闇�閲戦
-                set_HBillMoney($("#HEarnestRate").val() * 1);
+                
 
                 //鐢熸垚骞惰缃富琛ㄧ殑鍐呯爜鍜屽崟鎹彿
                 createBillNo();
@@ -523,14 +530,6 @@
                 set_InitGrid();
                 //鍔犺浇琛ㄤ綋鍜岃〃浣撴暟鎹�
                 RoadBillMain(linterid);
-                //鏍规嵁閿�鍞鍗曠被鍨嬭缃瓙琛ㄦ槸鍚﹀彇搴撳瓨閫夐」
-                setHisStockGoodsByHBillSubType_For_RoadBillMain();
-
-                //鏍规嵁鏄惁鍙栧簱瀛樿幏鍙栧畾閲戞瘮渚�
-                setHEarnestRateByHisStockGoods();
-
-                //璁剧疆琛ㄥご鎵�闇�閲戦
-                set_HBillMoney($("#HEarnestRate").val() * 1);
             }
             //#endregion
 
@@ -607,6 +606,102 @@
                 get_checkWH();
             });
              //#endregion
+            //#endregion
+
+            //#region 琛ㄥご鍩虹璧勬枡閫夋嫨寮圭獥
+            //#region 鏂囨湰妗嗙洃鍚�
+            $(document).ready(function () {
+                //#region 閿�鍞憳鍩虹璧勬枡绛涢�夊脊绐�
+                $("#HEmpName").on('keydown', function (data) {
+                    var errKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
+                    if ($.inArray(event.key, errKeys) == -1) {              //濡傛灉鎸変笅鐨勯敭浣嶄笉鏄� 鏂瑰悜閿紝鍒欏埛鏂板脊绐椾腑鐨勬暟鎹�
+                        if (childPage == null) {                            //鍒ゆ柇褰撳墠瀛愮獥鍙f槸鍚﹀凡缁忔墦寮�锛岃嫢鏈墦鍗★紝鍒欐墦寮�椤甸潰锛屽苟鑾峰彇瀛愮獥鍙g殑瀵硅薄
+                            var offset = $(this).offset();                  //鑾峰彇瑙﹀彂浜嬩欢鐨勫厓绱犵殑浣嶇疆锛岀敤浜庡畾浣嶅瓙绐楀彛鎵撳紑鐨勪綅缃�
+                            var innerHeight = window.innerHeight;
+                            var top = offset.top + 0.05 * innerHeight;
+                            var left = offset.left;
+                            if (top + 0.05 * innerHeight + 0.3 * innerHeight > innerHeight) {
+                                top = top - 0.3 * innerHeight - 0.05 * innerHeight;
+                            }
+                            layer.open({
+                                type: 2                                                                                     //寮圭獥绫诲瀷
+                                , skin: 'layui-layer-rim'                                                                   //鍔犱笂杈规
+                                , area: ['25%', '30%']                                                                      //澶у皬
+                                , shadeClose: true                                                                          //鐐瑰嚮閬僵鏃跺叧闂脊绐�
+                                , offset: [top, left]
+                                , title: false                                                                              //涓嶆樉绀烘爣棰樻爮
+                                //, title: '椤圭洰璐圭敤鍒楄〃'                                                                     //鏍囬
+                                , shift: 2                                                                                  //寮瑰嚭鍔ㄧ敾
+                                , closeBtn: 0                                                                               //绂佺敤鍏抽棴鎸夐挳
+                                , content: ["../../鍩虹璧勬枡/閫氱敤鍩虹璧勬枡/Gy_CommonBaseData.html?OperationType=2", "yes"]
+                                , success: function (layero, index) {
+                                    setTimeout(function () {
+                                        var value = $("#HEmpName").val().replace(/'/g, "");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                        currRowIndex = 0;
+                                        var tableView = "h_v_IF_EmployeeList";
+                                        var childSWhere = "select top(10) HItemID,鑱屽憳鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鑱屽憳浠g爜 like '%" + value + "%' or 鑱屽憳鍚嶇О like '%" + value + "%') order by 鑱屽憳浠g爜";
+                                        childPage.getData(childSWhere, tableView);
+                                    }, 200);
+                                }
+                                , end: function () {
+                                    childPage = null;
+                                    currRowIndex = 0;
+                                    if (childData != null) {
+                                        $("#HEmpName").val(childData.鑱屽憳鍚嶇О);
+                                        $("#HEmpID").val(childData.HItemID);
+
+                                        getEmpInfoByHEmpID(childData.HItemID);
+
+                                        childData = null;
+                                    }
+                                }
+                            });
+                        } else {
+                            setTimeout(function () {
+                                var value = $("#HEmpName").val().replace(/'/g,"");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                currRowIndex = 0;
+                                var tableView = "h_v_IF_EmployeeList";
+                                var childSWhere = "select top(10) HItemID,鑱屽憳鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鑱屽憳浠g爜 like '%" + value + "%' or 鑱屽憳鍚嶇О like '%" + value + "%') order by 鑱屽憳浠g爜";
+                                childPage.getData(childSWhere, tableView);
+                            }, 200);
+                        }
+                    } else {                                                    //濡傛灉鎸変笅鐨勯敭浣嶆槸 鏂瑰悜閿紝鍒欒皟鏁寸獥鍙d腑 閫変腑琛� 鐨勪綅缃�
+                        if (event.key == "ArrowUp") {
+                            currRowIndex--;
+                            childPage.setSelectedRow(currRowIndex);
+                        } else if (event.key == "ArrowDown") {
+                            currRowIndex++;
+                            childPage.setSelectedRow(currRowIndex);
+                        } else if (event.key == "Enter") {
+                            //鎵嬪姩澶辩劍
+                            var element = document.getElementById("HBillNo");
+                            element.focus();
+
+                            childPage.getSelectedData(currRowIndex);
+
+                            if ($("#HEmpName").val() == "") {
+                                $("#HEmpName").val("");
+                                $("#HEmpID").val("0");
+
+                                $("#HDeptID").val("0");
+                                $("#HDeptName").val("");
+                            } else {
+                                $("#HEmpName").val(childData.鑱屽憳鍚嶇О);
+                                $("#HEmpID").val(childData.HItemID);
+
+                                getEmpInfoByHEmpID(childData.HItemID);
+                            }
+                            
+
+                            childPage = null;
+                            currRowIndex = 0;
+                            childData = null;
+                        }
+                    }
+                });
+                //#endregion
+            });
+            //#endregion
             //#endregion
 
             //#region 琛ㄥご鎸夐挳瑙﹀彂浜嬩欢
@@ -719,6 +814,12 @@
                     case 'set_HideColumn':
                         get_HideColumn();
                         break;
+                    //搴撳瓨鏌ヨ
+                    case 'get_Inventory': get_Inventory();
+                        break;
+                    //鍑哄叆搴撹褰曟煡璇�
+                    case 'get_InOutSum': get_InOutSum();
+                        break;
                 }
             });
             //#endregion
@@ -751,7 +852,10 @@
                 //鏁板�兼牸寮忔牎楠屽伐鍏�
                 var ref = /^\d+(\.\d+)?$/;          //闈炶礋鏁版鍒欒〃杈惧紡
                 var 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 oldText = $(this).prev().text();
                 var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
@@ -790,13 +894,12 @@
                         var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
 
-                        //璁剧疆鏁版嵁灏忔暟浣嶆暟
-                        HQty = dealDoubleToFixed(HQty, 1);
-                        HPrice = dealDoubleToFixed(HPrice, 3);
-                        HTaxRate = HTaxRate;
-                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
-                        HMoney = dealDoubleToFixed(HMoney, 2);
-                        HlineTotal = dealDoubleToFixed(HlineTotal, 2);
+                        //鏁板瓧绮惧害
+                        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({
@@ -807,7 +910,7 @@
                             , HMoney: HMoney
                             , HlineTotal: HlineTotal
                         });
-                        //table.render(option);
+                        table.render(option);
 
                         //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
                         setSelectHisStockGoodsByTableRender();
@@ -874,13 +977,12 @@
                         var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
 
-                        //璁剧疆鏁版嵁灏忔暟浣嶆暟
-                        HQty = dealDoubleToFixed(HQty, 1);
-                        HPrice = dealDoubleToFixed(HPrice, 3);
-                        HTaxRate = HTaxRate;
-                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
-                        HMoney = dealDoubleToFixed(HMoney, 2);
-                        HlineTotal = dealDoubleToFixed(HlineTotal, 2);
+                        //鏁板瓧绮惧害
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -891,7 +993,7 @@
                             , HMoney: HMoney
                             , HlineTotal: HlineTotal
                         });
-                        //table.render(option);
+                        table.render(option);
 
                         //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
                         setSelectHisStockGoodsByTableRender();
@@ -929,13 +1031,12 @@
                         var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
 
-                        //璁剧疆鏁版嵁灏忔暟浣嶆暟
-                        HQty = dealDoubleToFixed(HQty, 1);
-                        HPrice = dealDoubleToFixed(HPrice, 3);
-                        HTaxRate = HTaxRate;
-                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
-                        HMoney = dealDoubleToFixed(HMoney, 2);
-                        HlineTotal = dealDoubleToFixed(HlineTotal, 2);
+                        //鏁板瓧绮惧害
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -946,7 +1047,7 @@
                             , HMoney: HMoney
                             , HlineTotal: HlineTotal
                         });
-                        //table.render(option);
+                        table.render(option);
 
                         //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
                         setSelectHisStockGoodsByTableRender();
@@ -1014,13 +1115,12 @@
                         var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
                         var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
 
-                        //璁剧疆鏁版嵁灏忔暟浣嶆暟
-                        HQty = dealDoubleToFixed(HQty, 1);
-                        HPrice = dealDoubleToFixed(HPrice, 3);
-                        HTaxRate = HTaxRate;
-                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
-                        HMoney = dealDoubleToFixed(HMoney, 2);
-                        HlineTotal = dealDoubleToFixed(HlineTotal, 2);
+                        //鏁板瓧绮惧害
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -1031,7 +1131,7 @@
                             , HMoney: HMoney
                             , HlineTotal: HlineTotal
                         });
-                        //table.render(option);
+                        table.render(option);
 
                         //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
                         setSelectHisStockGoodsByTableRender();
@@ -1243,9 +1343,9 @@
                         , { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О', width: 150, style: 'background-color:#efefef4d;' }
                         , { field: '瑙勬牸鍨嬪彿', title: '瑙勬牸鍨嬪彿', width: 100, style: 'background-color:#efefef4d;' }
                         , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
-                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, style: 'background-color:#efefef4d;' }//f7
-                        , { field: 'HRemark_TL', title: '鎶曟枡', width: 100, edit: 'text' }
-                        , { field: 'HRemark_SJG', title: '娣卞姞宸�', width: 100, edit: 'text' }
+                        , { field: '璁¢噺鍗曚綅', title: '璁¢噺鍗曚綅', width: 100, style: 'background-color:#efefef4d;', edit: 'text', event:"HUnitID" }//f7
+                        , { field: 'HRemark_TL', title: '鎶曟枡', width: 100, edit: 'text', event: "HRemark_TL" }
+                        , { field: 'HRemark_SJG', title: '娣卞姞宸�', width: 100, edit: 'text', event: "HRemark_SJG" }
                         , { field: 'HWHID ', title: 'HWHID ', width: 100, hide: true }
                         , { field: '浠撳簱', title: '浠撳簱', width: 100, style: 'background-color:#efefef4d;' ,edit: 'text' ,event: "HWHID" }//f7
                         , { field: 'HisStockGoods', title: '鏄惁鍙栧簱瀛�', width: 120, templet: '#HisStockGoods' }
@@ -1455,7 +1555,7 @@
                                         "浠撳簱": result.data[i]["瀛愪粨搴�"],
                                         "HQty": dealDoubleToFixed(result.data[i]["鏁伴噺"], 1),
                                         "HPrice": dealDoubleToFixed(result.data[i]["鍗曚环"], 3),
-                                        "HTaxPrice": dealDoubleToFixed(result.data[i]["鍚◣鍗曚环"], 3),
+                                        "HTaxPrice": dealDoubleToFixed(result.data[i]["HTaxPrice"], 3),
                                         "HMoney": dealDoubleToFixed(result.data[i]["閲戦"],2),
                                         "HDiscountRate": result.data[i]["鎶樻墸鐜�"],
                                         "HRelTaxPrice": result.data[i]["瀹為檯鍚◣鍗曚环"],
@@ -1484,20 +1584,18 @@
                             }
                             option.data = rowdata;
 
-                            //鍑哄簱鏁伴噺銆佸紑绁ㄦ暟閲忎笉鍙紪杈�
-                            //option.cols[0][22].edit = null;
-                            //option.cols[0][23].edit = null;
-
                             table.render(option);
 
                             //鑾峰彇涓存椂瀹氶噾姣斾緥
-                            HEarnestRateTemp = data.瀹氶噾姣斾緥 + "" == "0" ? "50" : data.瀹氶噾姣斾緥 + "";
+                            HEarnestRateTemp = data.瀹氶噾姣斾緥;
 
-                            //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
-                            setSelectHisStockGoodsByTableRender();
+                            //鏍规嵁閿�鍞鍗曠被鍨嬭缃瓙琛ㄦ槸鍚﹀彇搴撳瓨閫夐」
+                            setHisStockGoodsByHBillSubType_For_RoadBillMain();
 
                             //鏍规嵁鏄惁鍙栧簱瀛樿幏鍙栧畾閲戞瘮渚�
                             setHEarnestRateByHisStockGoods();
+
+                            $("#HEarnestRate").val(data.瀹氶噾姣斾緥);
 
                             //璁剧疆琛ㄥご鎵�闇�閲戦
                             set_HBillMoney($("#HEarnestRate").val() * 1);
@@ -1549,6 +1647,7 @@
             //#endregion
 
             //#region 瀹㈡埛閫夋嫨椤甸潰
+            //#region 瀹㈡埛閫夋嫨椤甸潰
             function get_checkCus() {
                 var HEmpID = $("#HEmpID").val();
                 layer.open({
@@ -1574,6 +1673,35 @@
                     , btn2: function (index, layero) { }
                 })
             }
+            //#endregion
+
+            //#region 瀹㈡埛閫夋嫨椤甸潰-鍩虹璧勬枡
+            //function get_checkCus() {
+            //    var HEmpID = $("#HEmpID").val();
+            //    layer.open({
+            //        type: 2//寮圭獥绫诲瀷
+            //        , skin: 'layui-layer-rim' //鍔犱笂杈规
+            //        , area: ['90%', '90%']//澶у皬
+            //        , title: '瀹㈡埛鍒楄〃'//鏍囬
+            //        , shift: 2//寮瑰嚭鍔ㄧ敾
+            //        , content: ['../../鍩虹璧勬枡/閿�鍞熀纭�璧勬枡/Gy_Customer.html', 'yes']
+            //        , btn: ['纭畾', '鍙栨秷']
+            //        , btn1: function (index, layero) {//鎸夐挳銆愭寜閽竴銆戠殑鍥炶皟
+            //            var iframeWindow = window['layui-layer-iframe' + index]  //鑾峰彇寮规椤甸潰
+            //            var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//鑾峰彇table鐨別lem:"#test"
+            //            if (checkStatus.data.length === 0) {
+            //                return layer.msg('璇烽�夋嫨鏁版嵁');
+            //            }
+            //            getCustomerByCusID(checkStatus.data[0].HItemID);
+            //            //鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛浣欓
+            //            getCustomerBalance(checkStatus.data[0].HItemID);
+
+            //            layer.close(index); //瀹冭幏鍙栫殑濮嬬粓鏄渶鏂板脊鍑虹殑鏌愪釜灞傦紝鍊兼槸鐢眑ayer鍐呴儴鍔ㄦ�侀�掑璁$畻鐨�
+            //        }
+            //        , btn2: function (index, layero) { }
+            //    })
+            //}
+            //#endregion
             //#endregion
 
             //#region 缁撶畻鏂归�夋嫨椤甸潰
@@ -1843,6 +1971,11 @@
                     success: function (data) {
                         if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             layer.msg(data.Message, { icon: 1 });
+                            if (data.Verify == "Y") //鑷姩瀹℃牳
+                            {
+                                $("#HInterID").val(data.HInterID);//鑾峰彇鎻愪氦鎴愬姛杩斿洖鐨勫崟鎹富ID
+                                set_CheckBill(0); //瀹℃牳
+                            }
                             $('#add-btn').addClass("layui-btn-disabled").attr("disabled", true);
                             layer.close(index);
                         }
@@ -1943,6 +2076,7 @@
                 //#region 瀛愯〃 鏁版嵁妫�楠�
                 var RowCount = 0;
                 for (var i = 0; i < option.data.length; i++) {
+
                     if (option.data[i]["HMaterID"] == "0") {
                         continue;
                     }
@@ -1985,6 +2119,11 @@
                     temp = option.data[i]["HTaxRate"] + "";
                     if (!ref.test(temp)) {
                         layer.msg("绗�" + i + "琛岋細绋庣巼璇疯緭鍏ヤ笉灏忎簬0鐨勬暟瀛楋紒");
+                        return false;
+                    }
+
+                    if (temp != "0" && option.data[i]["HTaxPrice"] == option.data[i]["HPrice"]) {
+                        layer.msg("绗�" + i + "琛岋細褰撳墠绋庣巼涓嶄负0锛屽崟浠蜂笌鍚◣鍗曚环涓�鑷达紝璇锋鏌ユ暟鎹槸鍚︽纭紒");
                         return false;
                     }
 
@@ -2532,6 +2671,203 @@
             //#region 琛屽唴蹇嵎閿瓫閫�
             function set_GridCellCheck(obj) {
                 $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+                    //#region 瀛愯〃鏂囨湰妗嗚緭鍏ュ悗妫�绱㈡暟鎹�
+                    if (event.key != "F7") {
+                        var errKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
+                        if (obj.event == "HMaterID") {                           //瀹氫綅褰撳墠姝e湪杈撳叆鐨勬枃鏈鐨勫垪鍚�
+                            if ($.inArray(event.key, errKeys) == -1) {              //濡傛灉鎸変笅鐨勯敭浣嶄笉鏄� 鏂瑰悜閿紝鍒欏埛鏂板脊绐椾腑鐨勬暟鎹�
+                                if (childPage == null) {                            //鍒ゆ柇褰撳墠瀛愮獥鍙f槸鍚﹀凡缁忔墦寮�锛岃嫢鏈墦鍗★紝鍒欐墦寮�椤甸潰锛屽苟鑾峰彇瀛愮獥鍙g殑瀵硅薄
+                                    var offset = $(this).offset();                  //鑾峰彇瑙﹀彂浜嬩欢鐨勫厓绱犵殑浣嶇疆锛岀敤浜庡畾浣嶅瓙绐楀彛鎵撳紑鐨勪綅缃�
+                                    var innerHeight = window.innerHeight;
+                                    var top = offset.top + 0.05 * innerHeight;
+                                    var left = offset.left;
+                                    if (top + 0.05 * innerHeight + 0.3 * innerHeight > innerHeight) {
+                                        top = top - 0.3 * innerHeight - 0.05 * innerHeight;
+                                    }
+                                    layer.open({
+                                        type: 2                                                                                     //寮圭獥绫诲瀷
+                                        , skin: 'layui-layer-rim'                                                                   //鍔犱笂杈规
+                                        , area: ['25%', '30%']                                                                      //澶у皬
+                                        , shadeClose: true                                                                          //鐐瑰嚮閬僵鏃跺叧闂脊绐�
+                                        , offset: [top, left]
+                                        , title: false                                                                              //涓嶆樉绀烘爣棰樻爮
+                                        //, title: '椤圭洰璐圭敤鍒楄〃'                                                                     //鏍囬
+                                        , shift: 2                                                                                  //寮瑰嚭鍔ㄧ敾
+                                        , closeBtn: 0                                                                               //绂佺敤鍏抽棴鎸夐挳
+                                        , content: ["../../鍩虹璧勬枡/閫氱敤鍩虹璧勬枡/Gy_CommonBaseData.html?OperationType=2", "yes"]
+                                        , success: function (layero, index) {
+                                            setTimeout(function () {
+                                                var value = $(e.currentTarget).val().replace("'", "");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                                currRowIndex = 0;
+                                                var tableView = "h_v_Gy_MaterialList";
+                                                var childSWhere = "select top(10) HItemID,鐗╂枡浠g爜,鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,HUnitID,璁¢噺鍗曚綅鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鐗╂枡浠g爜 like '%" + value + "%' or 鐗╂枡鍚嶇О like '%" + value + "%') order by 鐗╂枡浠g爜 desc";
+                                                childPage.getData(childSWhere, tableView);
+                                            }, 200);
+                                        }
+                                        , end: function () {
+                                            obj.event = "";
+                                            childPage = null;
+                                            currRowIndex = 0;
+                                            if (childData != null) {
+                                                var rowIndex = $(obj.tr).attr("data-index") * 1;
+                                                var Dec = getDecByMaterID(childData.HItemID) //鑾峰彇绮惧害
+                                                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 ref = /^\d+(\.\d+)?$/;                                  //闈炶礋鏁版鍒欒〃杈惧紡
+                                                var temp = "";
+                                                //鑾峰彇閫夋嫨鐗╂枡鍓嶅悗鐨勭◣鐜�
+                                                var value_TaxRate = subHTaxRate;                                    //閫夋嫨鐗╂枡鍚庢牴鎹鎴峰緱鍒扮殑绋庣巼
+                                                var oldText = option.data[rowIndex].HTaxRate;           //璇ヨ褰曚腑鍘熸湁鐨勭◣鐜�
+
+                                                //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                                temp = value_TaxRate + "";
+                                                if (!ref.test(temp)) {
+                                                    value_TaxRate = oldText;
+                                                    layer.msg("鑾峰彇鍒扮殑绋庣巼涓嶅悎娉曪紝宸茶嚜鍔ㄥ彉鏇翠负鍘熸湁绋庣巼!");
+                                                }
+
+                                                //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                                var HQty = option.data[rowIndex].HQty * 1;                  //鏁伴噺
+                                                var HPrice = option.data[rowIndex].HPrice * 1;              //鍗曚环
+                                                var HTaxRate = value_TaxRate * 0.01;                                //绋庣巼
+                                                /*var HDiscountRate = obj.data.HDiscountRate * 1;           //鎶樻墸鐜�*/
+                                                var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                                /*var HRelTaxPrice = HTaxPrice * HDiscountRate;             //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                                                //鎶樻墸棰� = 鍚◣鍗曚环 * (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));
+                                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                                HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+
+                                                option.data[rowIndex].HMaterID = childData.HItemID;
+                                                option.data[rowIndex].鐗╂枡浠g爜 = childData.鐗╂枡浠g爜;
+                                                option.data[rowIndex].鐗╂枡鍚嶇О = childData.鐗╂枡鍚嶇О;
+                                                option.data[rowIndex].瑙勬牸鍨嬪彿 = childData.瑙勬牸鍨嬪彿;
+                                                option.data[rowIndex].HUnitID = childData.HUnitID;
+                                                option.data[rowIndex].璁¢噺鍗曚綅 = childData.璁¢噺鍗曚綅鍚嶇О;
+
+                                                option.data[rowIndex].HQty = HQty;
+                                                option.data[rowIndex].HPrice = HPrice;
+                                                option.data[rowIndex].HTaxRate = HTaxRate * 100;
+                                                option.data[rowIndex].HTaxPrice = HTaxPrice;
+                                                option.data[rowIndex].HMoney = HMoney;
+                                                option.data[rowIndex].HlineTotal = HlineTotal;
+
+                                                table.render(option);
+
+                                                //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
+                                                setSelectHisStockGoodsByTableRender();
+
+                                                //璁剧疆琛ㄥご鎵�闇�閲戦
+                                                set_HBillMoney($("#HEarnestRate").val() * 1);
+
+                                                childData = null;
+                                            }
+                                        }
+                                    });
+                                } else {
+                                    setTimeout(function () {
+                                        var value = $(e.currentTarget).val().replace("'", "");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                        currRowIndex = 0;
+                                        var tableView = "h_v_Gy_MaterialList";
+                                        var childSWhere = "select top(10) HItemID,鐗╂枡浠g爜,鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,HUnitID,璁¢噺鍗曚綅鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鐗╂枡浠g爜 like '%" + value + "%' or 鐗╂枡鍚嶇О like '%" + value + "%')  order by 鐗╂枡浠g爜 desc";
+                                        childPage.getData(childSWhere, tableView);
+                                    }, 200);
+                                }
+                            } else {                                                    //濡傛灉鎸変笅鐨勯敭浣嶆槸 鏂瑰悜閿紝鍒欒皟鏁寸獥鍙d腑 閫変腑琛� 鐨勪綅缃�
+                                if (event.key == "ArrowUp") {
+                                    currRowIndex--;
+                                    childPage.setSelectedRow(currRowIndex);
+                                } else if (event.key == "ArrowDown") {
+                                    currRowIndex++;
+                                    childPage.setSelectedRow(currRowIndex);
+                                } else if (event.key == "Enter") {
+                                    //鎵嬪姩澶辩劍
+                                    var element = document.getElementById("HBillNo");
+                                    element.focus();
+
+                                    childPage.getSelectedData(currRowIndex);
+
+
+                                    var Dec = getDecByMaterID(childData.HItemID) //鑾峰彇绮惧害
+                                    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 ref = /^\d+(\.\d+)?$/;                                  //闈炶礋鏁版鍒欒〃杈惧紡
+                                    var temp = "";
+                                    //鑾峰彇閫夋嫨鐗╂枡鍓嶅悗鐨勭◣鐜�
+                                    var value_TaxRate = subHTaxRate;                                    //閫夋嫨鐗╂枡鍚庢牴鎹鎴峰緱鍒扮殑绋庣巼
+                                    var oldText = option.data[rowIndex].HTaxRate;           //璇ヨ褰曚腑鍘熸湁鐨勭◣鐜�
+
+                                    //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                    temp = value_TaxRate + "";
+                                    if (!ref.test(temp)) {
+                                        value_TaxRate = oldText;
+                                        layer.msg("鑾峰彇鍒扮殑绋庣巼涓嶅悎娉曪紝宸茶嚜鍔ㄥ彉鏇翠负鍘熸湁绋庣巼!");
+                                    }
+
+                                    //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                    var HQty = option.data[rowIndex].HQty * 1;                  //鏁伴噺
+                                    var HPrice = option.data[rowIndex].HPrice * 1;              //鍗曚环
+                                    var HTaxRate = value_TaxRate * 0.01;                                //绋庣巼
+                                    /*var HDiscountRate = obj.data.HDiscountRate * 1;           //鎶樻墸鐜�*/
+                                    var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                    /*var HRelTaxPrice = HTaxPrice * HDiscountRate;             //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                                    //鎶樻墸棰� = 鍚◣鍗曚环 * (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));
+                                    HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                    HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                    HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+
+                                    option.data[rowIndex].HMaterID = childData.HItemID;
+                                    option.data[rowIndex].鐗╂枡浠g爜 = childData.鐗╂枡浠g爜;
+                                    option.data[rowIndex].鐗╂枡鍚嶇О = childData.鐗╂枡鍚嶇О;
+                                    option.data[rowIndex].瑙勬牸鍨嬪彿 = childData.瑙勬牸鍨嬪彿;
+                                    option.data[rowIndex].HUnitID = childData.HUnitID;
+                                    option.data[rowIndex].璁¢噺鍗曚綅 = childData.璁¢噺鍗曚綅鍚嶇О;
+
+                                    option.data[rowIndex].HQty = HQty;
+                                    option.data[rowIndex].HPrice = HPrice;
+                                    option.data[rowIndex].HTaxRate = HTaxRate * 100;
+                                    option.data[rowIndex].HTaxPrice = HTaxPrice;
+                                    option.data[rowIndex].HMoney = HMoney;
+                                    option.data[rowIndex].HlineTotal = HlineTotal;
+
+                                    table.render(option);
+
+                                    //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
+                                    setSelectHisStockGoodsByTableRender();
+
+                                    //璁剧疆琛ㄥご鎵�闇�閲戦
+                                    set_HBillMoney($("#HEarnestRate").val() * 1);
+
+                                    childPage = null;
+                                    currRowIndex = 0;
+                                    childData = null;
+                                    obj.event = "";
+                                }
+                            }
+                        }
+
+                    }
+                    //#endregion
+
+
                     if (event.key == "F7") {
                         //鐗╂枡
                         if (obj.event == "HMaterID") {
@@ -2552,18 +2888,18 @@
                                     var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
                                     var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//鑾峰彇閫変腑鐨勬暟鎹�
 
-                                    //if (checkStatus.data.length != 1) {
-                                    //    return layer.msg("璇烽�夋嫨涓�鏉℃暟鎹�");
-                                    //}
-
                                     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);
                                         }
@@ -2586,8 +2922,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+绋庣巼)
@@ -2596,7 +2932,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爜;
@@ -2626,6 +2968,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
@@ -2650,7 +3028,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Unit.html', 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Unit.html?type=AuxiliaryUnit', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -2708,10 +3086,14 @@
                                     layer.close(index);//鍏抽棴寮圭獥
                                 }
                                 , end: function () {
-                                    obj.update({
-                                        "HWHID": OptionData.HItemID
-                                        , "浠撳簱": OptionData.浠撳簱鍚嶇О
-                                    })
+                                    if (typeof (HDataEmp.HItemID) != "undefined") {
+                                        //鏇存柊琛ㄦ牸缂撳瓨鐨勬暟鎹�
+                                        obj.update({
+                                            "HWHID": HDataEmp.HItemID
+                                            , "浠撳簱": HDataEmp.浠撳簱鍚嶇О
+                                        })
+                                        HDataEmp = {};
+                                    }
                                 }
                             })
 
@@ -3078,14 +3460,254 @@
                             set_HBillMoney($("#HEarnestRate").val() * 1);
                         }
 
+                        //鎶曟枡
+                        if (obj.event == "HRemark_TL") {
+                            var oldText = table.cache["mainTable"][rowIndex].HRemark_TL;
+                            var value = e.target.value; //寰楀埌淇敼鍚庣殑鍊�
+
+                            //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                            for (var i = rowIndex * 1; i < option.data.length; i++) {
+                                option.data[i].HRemark_TL = value;
+                            }
+
+                            table.render(option);
+
+                            //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
+                            setSelectHisStockGoodsByTableRender();
+
+                            //璁剧疆琛ㄥご鎵�闇�閲戦
+                            set_HBillMoney($("#HEarnestRate").val() * 1);
+                        }
+
+                        //娣卞姞宸�
+                        if (obj.event == "HRemark_SJG") {
+                            var oldText = table.cache["mainTable"][rowIndex].HRemark_SJG;
+                            var value = e.target.value; //寰楀埌淇敼鍚庣殑鍊�
+
+                            //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                            for (var i = rowIndex * 1; i < option.data.length; i++) {
+                                option.data[i].HRemark_SJG = value;
+                            }
+
+                            table.render(option);
+
+                            //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
+                            setSelectHisStockGoodsByTableRender();
+
+                            //璁剧疆琛ㄥご鎵�闇�閲戦
+                            set_HBillMoney($("#HEarnestRate").val() * 1);
+                        }
+
+
                         obj.event = "";
                         return false;
                     }
 
                     //#endregion
                 })
+
+                //鍙屽嚮
+                $('.layui-table-box tbody td[data-field="鐗╂枡浠g爜"]').off('dblclick').on('dblclick', function () {
+                    var HOrgID = $("#HOrgID").val();
+
+                    layer.open({
+                        type: 2
+                        , skin: "layui-layer-rim" //鍔犱笂杈规
+                        , title: "鐗╂枡鍒楄〃"  //鏍囬
+                        , closeBtn: 1  //绐椾綋鍙充笂瑙掑叧闂� 鐨� 鏍峰紡
+                        , shift: 2 //寮瑰嚭鍔ㄧ敾
+                        , area: ["90%", "90%"] //绐椾綋澶у皬
+                        , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
+                        , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
+                        , btn: ["纭畾", "鍙栨秷"]
+                        , btn1: function (index, laero) {
+                            //鎸夐挳涓�  鐨勫洖璋�
+                            var iframeWindow = window["layui-layer-iframe" + index];//鑾峰彇寮规椤甸潰
+                            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": ""
+                                    }
+                                    btnAddLine(NewRow);
+                                }
+
+                                //鑾峰彇閫変腑鐨勭墿鏂欎俊鎭�
+                                var resultData = checkStatus.data[i];
+
+                                //鏁板�兼牸寮忔牎楠屽伐鍏�
+                                var ref = /^\d+(\.\d+)?$/;                                  //闈炶礋鏁版鍒欒〃杈惧紡
+                                var temp = "";
+                                //鑾峰彇閫夋嫨鐗╂枡鍓嶅悗鐨勭◣鐜�
+                                var value = subHTaxRate;                                    //閫夋嫨鐗╂枡鍚庢牴鎹鎴峰緱鍒扮殑绋庣巼
+                                var oldText = option.data[rowIndex + i].HTaxRate;           //璇ヨ褰曚腑鍘熸湁鐨勭◣鐜�
+
+                                //绋庣巼鏁版嵁鏍煎紡鏍¢獙锛岃嫢鏍规嵁瀹㈡埛鑾峰彇鐨勭◣鐜囦笉鍚堟硶锛屽垯浣跨敤璁板綍涓師鏈夌殑绋庣巼锛屽苟鎻愮ず
+                                temp = value + "";
+                                if (!ref.test(temp)) {
+                                    value = oldText;
+                                    layer.msg("鑾峰彇鍒扮殑绋庣巼涓嶅悎娉曪紝宸茶嚜鍔ㄥ彉鏇翠负鍘熸湁绋庣巼!");
+                                }
+
+                                //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
+                                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+绋庣巼)
+                                /*var HRelTaxPrice = HTaxPrice * HDiscountRate;             //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                                //鎶樻墸棰� = 鍚◣鍗曚环 * (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));
+                                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爜;
+                                option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.鐗╂枡鍚嶇О;
+                                option.data[rowIndex + i].瑙勬牸鍨嬪彿 = resultData.瑙勬牸鍨嬪彿;
+                                option.data[rowIndex + i].HUnitID = resultData.HUnitID;
+                                option.data[rowIndex + i].璁¢噺鍗曚綅 = resultData.璁¢噺鍗曚綅鍚嶇О;
+
+                                option.data[rowIndex + i].HQty = HQty;
+                                option.data[rowIndex + i].HPrice = HPrice;
+                                option.data[rowIndex + i].HTaxRate = HTaxRate * 100;
+                                option.data[rowIndex + i].HTaxPrice = HTaxPrice;
+                                option.data[rowIndex + i].HMoney = HMoney;
+                                option.data[rowIndex + i].HlineTotal = HlineTotal;
+
+
+                            }
+                            table.render(option);
+
+                            //鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
+                            setSelectHisStockGoodsByTableRender();
+
+                            //璁剧疆琛ㄥご鎵�闇�閲戦
+                            set_HBillMoney($("#HEarnestRate").val() * 1);
+
+                            layer.close(index);//鍏抽棴寮圭獥
+                        }
+                        , 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
+                                    , "鐗╂枡浠g爜": HDataEmp.鐗╂枡浠g爜
+                                    , "鐗╂枡鍚嶇О": HDataEmp.鐗╂枡鍚嶇О
+                                    , "瑙勬牸鍨嬪彿": HDataEmp.瑙勬牸鍨嬪彿
+                                    , "HUnitID": HDataEmp.HUnitID
+                                    , "璁¢噺鍗曚綅": HDataEmp.璁¢噺鍗曚綅鍚嶇О
+                                })
+                                HDataEmp = {};
+                            }
+                        }
+                    })
+                });
             }
             //#endregion
+
+            //#region 搴撳瓨鏌ヨ
+            function get_Inventory() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
+                    var HMaterID = data[0].HMaterID.toString();
+                    //寮圭獥鏂规硶
+                    layer.open({
+                        type: 2//寮圭獥绫诲瀷
+                        , skin: 'layui-layer-rim' //鍔犱笂杈规
+                        , area: ['90%', '90%']//澶у皬
+                        , title: '搴撳瓨鏌ヨ鍒楄〃'//鏍囬
+                        , shift: 2//寮瑰嚭鍔ㄧ敾
+                        , content: ['../../浠撳瓨绠$悊/鏉$爜鎶ヨ〃/Kf_ICinventoryQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
+                        , btn: ['鍙栨秷']
+                        , btn1: function (index, layero) {
+                            layer.close(index);
+                        }
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾湁鐗╂枡鏁版嵁鏌ヨ锛�');
+                }
+            }
+            //#endregion
+            //#region 鍑哄叆搴撹褰曟煡璇�
+            function get_InOutSum() {
+                var checkStatus = table.checkStatus('mainTable')
+                    , data = checkStatus.data;
+                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
+                    var HMaterID = data[0].HMaterID.toString();
+                    layer.open({
+                        type: 2//寮圭獥绫诲瀷
+                        , skin: 'layui-layer-rim' //鍔犱笂杈规
+                        , area: ['90%', '90%']//澶у皬
+                        , title: '鍑哄叆搴撹褰曞垪琛�'//鏍囬
+                        , shift: 2//寮瑰嚭鍔ㄧ敾
+                        , content: ['../../浠撳瓨绠$悊/鏉$爜鎶ヨ〃/Kf_StockInOutSumQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
+                        , btn: ['鍙栨秷']
+                        , btn1: function (index, layero) {
+                            layer.close(index);
+                        }
+                    })
+                }
+                else {
+                    layer.msg('璇烽�夋嫨涓�琛屾湁鐗╂枡鏁版嵁鏌ヨ锛�');
+                }
+            }
+            //#endregion
+
 
             //#region 瀛愯〃1锛氶殣钘忓垪璁剧疆
             function get_HideColumn() {
@@ -3126,13 +3748,14 @@
             function DisPlay_HideColumn() {
                 $.ajax({
                     url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
+                    async: false,
                     type: "GET",
                     data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                     async: false,
                     success: function (data1) {
                         if (data1.data.length != 0) {
                             var dataCol = [];//鏁版嵁搴撴煡璇㈠嚭鐨勫垪鏁版嵁
-                            var titleData = ["HMaterID", "HUnitID", "鎶樻墸鐜�", "瀹為檯鍚◣鍗曚环", "绋庨", "鏈綅甯佷环绋庡悎璁�", "鍑哄簱鏁伴噺", "寮�绁ㄦ暟閲�", "HOrderLevID","璁㈠崟绛夌骇浠g爜","閿�鍞嚭搴撴暟閲�","閿�鍞嚭搴撳鏍告暟閲�","閿�鍞嚭搴撳鏍搁噾棰�","鐢熶骇鏁伴噺","閿�鍞��搴撴暟閲�","閿�鍞��搴撳鏍告暟閲�"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
+                            /*var titleData = ["HMaterID", "HUnitID", "鎶樻墸鐜�", "瀹為檯鍚◣鍗曚环", "绋庨", "鏈綅甯佷环绋庡悎璁�", "鍑哄簱鏁伴噺", "寮�绁ㄦ暟閲�", "HOrderLevID","璁㈠崟绛夌骇浠g爜","閿�鍞嚭搴撴暟閲�","閿�鍞嚭搴撳鏍告暟閲�","閿�鍞嚭搴撳鏍搁噾棰�","鐢熶骇鏁伴噺","閿�鍞��搴撴暟閲�","閿�鍞��搴撳鏍告暟閲�"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�*/
                             //titleData = [];
 
                             dataCol = data1.data[0].HGridString.split(',');
@@ -3163,6 +3786,10 @@
                                 if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                     option.cols[0][i + 1]["hide"] = false;
                                 }
+                                if ($.inArray(option.cols[0][i + 1]["title"], titleData) > -1) {
+                                    option.cols[0][i + 1]["hide"] = true;
+                                }
+
                                 //瀛椾綋鎵�鍦ㄤ綅缃�(宸� 灞呬腑 鍙�)
                                 switch (dataCols[2]) {
                                     case "L":
@@ -3174,6 +3801,11 @@
                                     case "R":
                                         option.cols[0][i + 1]["align"] = "right";
                                         break;
+                                }
+
+                                //璁剧疆琛ㄦ牸title灞炴�ф樉绀哄埆鍚�
+                                if (dataCols[4] != null && dataCols[4] != "") {
+                                    option.cols[0][i + 1]["title"] = dataCols[4];
                                 }
                             }
 
@@ -3434,6 +4066,32 @@
             }
             //#endregion
 
+            //#region 鏍规嵁鐗╂枡ID鑾峰彇绮惧害
+            function getDecByMaterID(HMaterID) {
+                var resultData = {};
+                $.ajax({  // 寮傛璇锋眰
+                    url: GetWEBURL() + "Gy_Material/getDecByID",  //璇锋眰鍦板潃
+                    async: false,   //鏄惁寮�鍚紓姝�
+                    type: "GET",   //璇锋眰绫诲瀷
+                    data: {   //瀹氫箟鍙戦�佸埌鏈嶅姟鍣ㄧ殑鏁版嵁
+                        "HMaterID": HMaterID     //  灏唄materid浣滀负璇锋眰鍙傛暟鍙戦��
+                    },
+                    success: function (result) {   // 褰撹姹傛垚鍔熸椂锛屾墽琛岃繖涓嚱鏁�
+                        if (result.code == 1) { // 濡傛灉鏈嶅姟鍣ㄨ繑鍥炵殑鏁版嵁涓殑`code瀛楁绛変簬1锛岃繖鍙兘琛ㄧず瀹℃牳鎿嶄綔鎴愬姛鎵ц
+                            var data = result.data; //澹版槑data鍙橀噺锛屽苟灏嗗叾璧嬪�间负result瀵硅薄涓殑data灞炴��
+                            resultData = data[0];   //灏哾ata鏁扮粍锛堟垨绫绘暟缁勫璞★級鐨勭涓�涓厓绱犺祴鍊肩粰鍙橀噺resultData
+                        }
+                        //else {
+                        //    layer.alert(result.Message, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' }); //result.msg瀵硅薄锛屾彁绀哄脊绐� 绫诲瀷涓�5锛� 鎸夐挳锛屽拰鎸夐挳鐨勫悕绉颁负閫�鍑�  鏃堕棿 涓�100绉掞紝浠ュ強鍋忕Щ閲忥紙`offset: 't'
+                        //}
+                    }, error: function () {
+                        layer.alert("鍙戠敓閿欒!", { icon: 5 });  //鎻愮ず寮圭獥 鍙戠敓閿欒 锛岃绀烘爣蹇椾负5鐨�
+                    }
+                });
+                return resultData;
+            }
+            //#endregion
+
             //#region 鍒锋柊琛ㄦ牸鍚屾椂鏍规嵁option涓璈isStockGoods鍊艰缃笅鎷夊垪琛�
             function setSelectHisStockGoodsByTableRender() {
                 for (var i = 1; i <= option.data.length; i++) {
@@ -3442,6 +4100,30 @@
                 form.render('select');
             }
             //#endregion
+
+            //#region 鏌ョ湅鏄惁鍏峰鏌ョ湅閲戦鏉冮檺锛岃缃噾棰濈瓑瀛楁鏄惁闇�瑕侀殣钘�
+            function checkRight_Money() {
+                $.ajax({
+                    type: "GET",
+                    async: false,
+                    url: GetWEBURL() + "/Xs_SeOrderBill/CheckRight_Money", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                    data: { "user": sessionStorage["HUserName"] },
+                    success: function (result) {
+                        if (result.count == 1) {
+
+                        } else {
+                            var HideColumnList = ["鍓╀綑璁㈤噾", "鍗曚环", "绋庣巼%", "鍚◣鍗曚环", "閲戦", "浠风◣鍚堣"];
+                            for (var i = 0; i < HideColumnList.length; i++) {
+                                titleData.push(HideColumnList[i]);
+                            }
+                        }
+                    }, error: function (err) {
+                        layer.alert("鎺ュ彛璇锋眰澶辫触!", { icon: 5 });
+                    }
+                });
+            }
+            //#endregion
+
             //#endregion
 
 
@@ -3459,6 +4141,16 @@
             getEmpInfoByHEmpID(obj[0].HItemID)
         }
 
+        function GetHCusNameValue(obj)  //杩斿洖瀹㈡埛
+        {
+            //$("#HCusName").val(obj[0].HName);
+            //$("#HCusID").val(obj[0].HItemID);
+            //鏍规嵁瀹㈡埛鑾峰彇鐩稿叧淇℃伅
+            getCustomerByCusID(obj[0].HItemID);
+            //鏍规嵁瀹㈡埛鑾峰彇瀹㈡埛浣欓
+            getCustomerBalance(obj[0].HItemID);
+        }
+
         function GetHSupValue(obj)  //杩斿洖瀹㈡埛
         {
             //$("#HCusName").val(obj[0].HName);
@@ -3471,7 +4163,7 @@
 
         function GetHManagerValue(obj)  //杩斿洖涓荤
         {
-            $("#HManagerName").val(obj[0].HName);
+            $("#HManagerName").val(obj[0].鑱屽憳鍚嶇О);
             $("#HManagerID").val(obj[0].HItemID);
         }
 
@@ -3493,12 +4185,12 @@
             $("#HSellSID").val(obj[0].HItemID);
         }
 
-        function GetMaterValue(obj)           //鐗╂枡鍚嶇О
+        function GetGyMaterial(obj)           //鐗╂枡鍚嶇О
         {
-            HDataEmp = obj[0];
+            HDataEmp = obj;
         }
 
-        function GetUnitValue(obj)           //璁¢噺鍗曚綅
+        function GetAuxiliaryUnitValue(obj)           //璁¢噺鍗曚綅
         {
             HDataEmp = obj[0];
         }
@@ -3507,6 +4199,39 @@
         {
             HDataEmp = obj[0];
         }
+
+        //椤圭洰浠g爜
+        function GetProjectBillValue(obj) {
+            if (obj[0].鍏抽棴浜� == null || obj[0].鍏抽棴浜� == "") {
+                $("#HProjectID").val(obj[0].HInterID);
+                $("#HProjectNumber").val(obj[0].椤圭洰浠g爜);//宸ョ▼椤圭洰浠g爜
+                $("#HProjectName").val(obj[0].椤圭洰鍚嶇О);//宸ョ▼椤圭洰浠g爜
+
+            } else {
+                layer.msg("璇ラ」鐩凡鍏抽棴锛屼笉鍙�夋嫨锛�");
+            }
+        }
+
+        //鍙屽嚮杩斿洖浠撳簱
+        function GetHWHSubValue(data) {
+            HDataEmp = data[0]
+        }
+
+        function GetHWHValue(obj)  //杩斿洖浠撳簱
+        {
+            $("#HWHName").val(obj[0].浠撳簱鍚嶇О);
+            $("#HWHID").val(obj[0].HItemID);
+            if (option.data.length > 0) {
+                for (var i = 0; i < option.data.length; i++) {
+                    if (option.data[i]["HWHID"] == 0 || option.data[i]["浠撳簱"] == undefined) {
+                        option.data[i]["HWHID"] = obj[0].HItemID;
+                        option.data[i]["浠撳簱"] = obj[0].浠撳簱鍚嶇О;
+                    }
+                }
+            }
+            layui.table.render(option);
+        }
+
 
         //#region 鏍规嵁瀹㈡埛鑾峰彇甯佸埆銆佹眹鐜囥�佺粨绠楁柟寮忋�佸鎴蜂俊鐢ㄩ搴︺�佽仈绯讳汉銆佽仈绯荤數璇�
         function getCustomerByCusID(HCusID) {
@@ -3559,7 +4284,7 @@
                         subHTaxRate = data.HTaxRate;
 
                     } else {
-                        layer.alert(result.msg, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
+                        layer.alert(result.Message, { icon: 5, btn: ['閫�鍑�'], time: 100000, offset: 't' });
                     }
                 }, error: function () {
                     layer.alert("鍙戠敓閿欒!", { icon: 5 });
@@ -3626,38 +4351,7 @@
         }
         //#endregion
 
-        //椤圭洰浠g爜
-        function GetProjectBillValue(obj) {
-            if (obj[0].鍏抽棴浜� == null || obj[0].鍏抽棴浜� == "") {
-                $("#HProjectID").val(obj[0].HInterID);
-                $("#HProjectNumber").val(obj[0].椤圭洰浠g爜);//宸ョ▼椤圭洰浠g爜
-                $("#HProjectName").val(obj[0].椤圭洰鍚嶇О);//宸ョ▼椤圭洰浠g爜
-
-            } else {
-                layer.msg("璇ラ」鐩凡鍏抽棴锛屼笉鍙�夋嫨锛�");
-            }
-        }
-
-        //鍙屽嚮杩斿洖浠撳簱
-        function GetHWHSubValue(data) {
-            OptionData = data[0]
-        }
-
-        function GetHWHValue(obj)  //杩斿洖浠撳簱
-        {
-            $("#HWHName").val(obj[0].浠撳簱鍚嶇О);
-            $("#HWHID").val(obj[0].HItemID);
-            if (option.data.length > 0) {
-                for (var i = 0; i < option.data.length; i++) {
-                    if (option.data[i]["HWHID"] == 0 || option.data[i]["浠撳簱"] == undefined) {
-                        option.data[i]["HWHID"] = obj[0].HItemID;
-                        option.data[i]["浠撳簱"] = obj[0].浠撳簱鍚嶇О;
-                    }
-                }
-            }
-            layui.table.render(option);
-        }
-
+       
         //#region 澶勭悊灏忔暟鏄剧ず浣嶆暟锛坉ata锛氶渶瑕佸鐞嗙殑鏁版嵁锛沶um锛氭暟鎹殑绫诲瀷(濡�1:鏁伴噺锛�2:閲戦锛�3:鍗曚环)锛�
         function dealDoubleToFixed(data, num) {
             //鐢ㄤ簬璁剧疆灏忔暟浣嶆暟

--
Gitblit v1.9.1