From 7bb3ffb383e41f66ea9e89b8b0f8182726e77d1b Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 27 一月 2026 15:14:07 +0800
Subject: [PATCH] 华舟 新增 器具保养规程 器具点检规程 设备点检规程 设备保养规程 的默认结果选择

---
 WebTM/views/销售管理/销售订单/Add_Edit_Xs_SeOrderBillList.html |  772 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 604 insertions(+), 168 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 e5f2fc7..d6606af 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"
@@ -56,6 +56,7 @@
                 <form class="layui-form" lay-filter="component-form-group" action="">
                     <div class="layui-card-header">
                         <div class="layui-btn-group">
+                            <button type="button" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="set_AddNew" id="set_AddNew">鏂板</button>
                             <button type="button" id="add-btn" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_SaveBill">淇濆瓨</button>
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_CheckBill">瀹℃牳</button>
                             <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit="" lay-filter="set_AbandonCheck">鍙嶅鏍�</button>
@@ -77,7 +78,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 +92,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>
@@ -153,6 +154,15 @@
                                                 <select name="HBillSubType" id="HBillSubType" lay-filter="HBillSubType" style="width: 180px; ">
                                                     <option style="color:blue;" selected="selected" value="0">鏅�氬崟鎹�</option>
                                                     <option style="color:blue;" value="1">杩斾慨鍗曟嵁</option>
+                                                </select>
+                                            </div>
+                                        </div>
+                                        <div class="layui-inline">
+                                            <label class="layui-form-label">浜у搧绫诲瀷</label>
+                                            <div class="layui-input-inline">
+                                                <select name="HProductType" id="HProductType" lay-filter="HProductType" style="width: 180px; ">
+                                                    <option style="color:blue;" selected="selected" value="闈炴牱鍝�">闈炴牱鍝�</option>
+                                                    <option style="color:blue;" value="鏍峰搧">鏍峰搧</option>
                                                 </select>
                                             </div>
                                         </div>
@@ -437,6 +447,15 @@
         </select>
     </script>
     <script>
+        //#region 鏂囨湰妗嗚緭鍏ユ悳绱㈢浉鍏虫暟鎹�-鍙橀噺
+        var childPage = null;                       //鑾峰彇瀛愮獥鍙e璞★紝鐢ㄤ簬鎿嶄綔瀛愮獥鍙g殑鍙橀噺鍜屾柟娉�
+        var currRowIndex = 0;                       //鐢ㄤ簬瀹氫綅瀛愮獥鍙e綋鍓嶉�変腑鐨勮
+        var childData = null;                       //鐢ㄤ簬鑾峰彇瀛愮獥鍙h繑鍥炵殑鏁版嵁
+        //#endregion
+
+
+
+
         //#region 鎶樺彔娉ㄩ噴
         var HDataEmp = {};
         //#endregion
@@ -444,7 +463,7 @@
             base: '../../../layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
         }).extend({
             index: 'lib/index' //涓诲叆鍙fā鍧�
-        }).use(['index', 'form', 'laydate', 'table', 'element'], function () {
+        }).use(['index', 'form', 'laydate', 'table', 'element', 'tableSelect'], function () {
 
             //#region 鍏敤鍙橀噺
             var $ = layui.$
@@ -453,10 +472,13 @@
                 , table = layui.table
                 , form = layui.form
                 , laydate = layui.laydate
-                , element = layui.element;
+                , element = layui.element
+                , tableSelect = layui.tableSelect;
 
             //瀛愯〃娓叉煋鍙傛暟
             window.option = {};
+            var topScroll = 0;//璁板綍婊氬姩鏉$殑浣嶇疆
+            var titleData = ["HMaterID", "HUnitID", "鎶樻墸鐜�", "瀹為檯鍚◣鍗曚环", "绋庨", "鏈綅甯佷环绋庡悎璁�", "鍑哄簱鏁伴噺", "寮�绁ㄦ暟閲�", "HOrderLevID", "璁㈠崟绛夌骇浠g爜", "閿�鍞嚭搴撴暟閲�", "閿�鍞嚭搴撳鏍告暟閲�", "閿�鍞嚭搴撳鏍搁噾棰�", "鐢熶骇鏁伴噺", "閿�鍞��搴撴暟閲�", "閿�鍞��搴撳鏍告暟閲�"];//涓嶉渶瑕佹樉绀虹殑瀛楁 鍙墿灞�
 
             //璁板綍缁勭粐鐨勫��
             var HOrgIDBar = 0;
@@ -478,7 +500,8 @@
 
 
             //#region 杩涘叆椤甸潰鍗冲姞杞�
-
+            //妫�娴嬫槸鍚﹀叿澶囨煡鐪嬮噾棰濇潈闄愶紝璁剧疆闅愯棌鍒�
+            checkRight_Money();
             //#region 鍒ゆ柇鏄惁鐧诲綍 鏈櫥褰曞垯璺冲埌鐧诲綍椤�
             get_LoginIs();
 
@@ -596,12 +619,115 @@
              //#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 琛ㄥご鎸夐挳瑙﹀彂浜嬩欢
             //#region 淇濆瓨鎸夐挳
             form.on('submit(set_SaveBill)', function (data) {
                 if (AllowLoadData(data)) {
                     set_SaveBill(data);
                 }
+            });
+            //#endregion
+
+            //#region 鏂板
+            form.on('submit(set_AddNew)', function (data) {
+                const url = new URL(location.href);
+                location.href = url.origin + url.pathname;
             });
             //#endregion
 
@@ -748,6 +874,7 @@
                 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"];  //閲戦绮惧害
+                topScroll = $('#mainTable').next('.layui-table-view').find('.layui-table-body').scrollTop();//鑾峰彇婊氬姩鏉′綅缃�
                 // 鍗曞厓鏍肩紪杈戜箣鍓嶇殑鍊�
                 var oldText = $(this).prev().text();
                 var value = obj.value //寰楀埌淇敼鍚庣殑鍊�
@@ -775,23 +902,21 @@
 
 
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                        var HQty = value * 1;                           //鏁伴噺
-                        var HPrice = obj.data.HPrice * 1;               //鍗曚环
-                        var HTaxRate = obj.data.HTaxRate * 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;            //浠风◣鍚堣=閲戦+绋庨
-
-                        //鏁板瓧绮惧害
+                        var HQty = value * 1;                                   //鏁伴噺
                         HQty = Number(HQty.toFixed(HQtyDec));
+                        var HPrice = obj.data.HPrice * 1;                       //鍗曚环
                         HPrice = Number(HPrice.toFixed(HPriceDec));
+                        var HTaxRate = obj.data.HTaxRate * 0.01;                //绋庣巼
+                        /*var HDiscountRate = obj.data.HDiscountRate * 1;       //鎶樻墸鐜�*/
+                        var HTaxPrice = obj.data.HTaxPrice * 1;                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;         //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                        //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
+                        var HMoney = HQty * HPrice;                             //閲戦=鏁伴噺*鍗曚环
                         HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        var HTaxMoney = HMoney * HTaxRate;                      //绋庨=閲戦*绋庣巼
+                        var HlineTotal = HQty * HTaxPrice;                      //浠风◣鍚堣=鏁伴噺*鍚◣鍗曚环
                         HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
-                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -858,24 +983,23 @@
                         }
 
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                        var HQty = obj.data.HQty * 1;                   //鏁伴噺
-                        var HPrice = value * 1;                         //鍗曚环
-                        var HTaxRate = obj.data.HTaxRate * 0.01;           //绋庣巼
-                        /*var HDiscountRate = obj.data.HDiscountRate * 1; //鎶樻墸鐜�*/
-                        var HTaxPrice = HPrice * (1 + HTaxRate);        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
-                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
+                        var HQty = obj.data.HQty * 1;                           //鏁伴噺
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        var HPrice = value * 1;                                 //鍗曚环
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        var HTaxRate = obj.data.HTaxRate * 0.01;                //绋庣巼
+                        /*var HDiscountRate = obj.data.HDiscountRate * 1;       //鎶樻墸鐜�*/
+                        var HTaxPrice = HPrice * (1 + HTaxRate);                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;         //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
                         //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
-                        var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                        var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
-                        var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                        var HMoney = HQty * HPrice;                             //閲戦=鏁伴噺*鍗曚环
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        var HTaxMoney = HMoney * HTaxRate;                      //绋庨=閲戦*绋庣巼
+                        var HlineTotal = HQty * HTaxPrice;                      //浠风◣鍚堣=鏁伴噺*鍚◣鍗曚环
+                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                         //鏁板瓧绮惧害
-                        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
@@ -910,25 +1034,19 @@
                             return;
                         }
 
-
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                        var HQty = obj.data.HQty * 1;                   //鏁伴噺
-                        var HPrice = obj.data.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;            //浠风◣鍚堣=閲戦+绋庨
-
-                        //鏁板瓧绮惧害
+                        var HQty = obj.data.HQty * 1;                           //鏁伴噺
                         HQty = Number(HQty.toFixed(HQtyDec));
+                        var HTaxRate = value * 0.01;                            //绋庣巼
+                        var HPrice = obj.data.HPrice * 1;                       //鍗曚环
                         HPrice = Number(HPrice.toFixed(HPriceDec));
+                        var HTaxPrice = HPrice * (1 + HTaxRate);                //鍚◣鍗曚环
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+                        var HMoney = HQty * HPrice;                             //閲戦=鏁伴噺*鍗曚环
                         HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        var HTaxMoney = HMoney * HTaxRate;                      //绋庨=閲戦*绋庣巼
+                        var HlineTotal = HQty * HTaxPrice;                      //浠风◣鍚堣=鏁伴噺*鍚◣鍗曚环
                         HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
-                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
 
                         //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                         obj.update({
@@ -994,26 +1112,21 @@
                             }
                         }
                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                        var HQty = obj.data.HQty * 1;                   //鏁伴噺
-                        var HTaxRate = obj.data.HTaxRate * 0.01;        //绋庣巼
-                        var HTaxPrice = value * 1;                          //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
-                        var HPrice = HTaxPrice / (1 + HTaxRate);        //鍗曚环=鍚◣鍗曟嵁/(1+绋庣巼)
-
-                        /*var HDiscountRate = obj.data.HDiscountRate * 1; //鎶樻墸鐜�*/
-
-                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
-                        //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
-                        var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                        var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
-                        var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                        var HQty = obj.data.HQty * 1;                           //鏁伴噺
+                        HQty = Number(HQty.toFixed(HQtyDec));
+                        var HTaxRate = obj.data.HTaxRate * 0.01;                //绋庣巼
+                        var HTaxPrice = value * 1;                              //鍚◣鍗曚环
+                        HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+                        var HPrice = HTaxPrice / (1 + HTaxRate);                //鍗曚环
+                        HPrice = Number(HPrice.toFixed(HPriceDec));
+                        
+                        var HMoney = HQty * HPrice;                             //閲戦=鏁伴噺*鍗曚环
+                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                        var HTaxMoney = HMoney * HTaxRate;                      //绋庨=閲戦*绋庣巼
+                        var HlineTotal = HQty * HTaxPrice;                      //浠风◣鍚堣=鏁伴噺*鍚◣鍗曚环
+                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                         //鏁板瓧绮惧害
-                        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
@@ -1280,6 +1393,7 @@
                                 }
                             });
                         });
+                        $(".layui-table-main").scrollTop(topScroll);
                     }
                 }
 
@@ -1353,7 +1467,7 @@
 
                 //鍒濆鍖栧苟鍒楄缃細瀛愯〃1
                 set_InitGrid();
-                DisPlay_HideColumn();
+                // DisPlay_HideColumn();
 
                 //鏍规嵁鏄惁鍙栧簱瀛樿幏鍙栧畾閲戞瘮渚�
                 setHEarnestRateByHisStockGoods();
@@ -1408,6 +1522,7 @@
                                 , "HProjectName": data.椤圭洰鍚嶇О
                                 , "HWHID": data.涓讳粨搴搃d
                                 , "HWHName": data.涓讳粨搴�
+                                , "HProductType": data.浜у搧绫诲瀷
                                 , "HCreditRating_Now": data.HCreditRating_Now
                                 , "HRemark": data.琛ㄥご澶囨敞
                                 , "HMaker": data.鍒跺崟浜�
@@ -1432,6 +1547,11 @@
                             //瀛愯〃  璧嬪��
                             var rowdata = [];
                             for (var i = 0; i < result.data.length; i++) {
+                                var HTaxPrice_Temp = result.data[i]["鍚◣鍗曚环"];
+                                if (typeof (HTaxPrice_Temp) == "undefined") {
+                                    HTaxPrice_Temp = result.data[i]["HTaxPrice"];
+                                }
+
                                 rowdata.push(
                                     {
                                         "HMaterID": result.data[i]["HMaterID"],
@@ -1447,7 +1567,7 @@
                                         "浠撳簱": result.data[i]["瀛愪粨搴�"],
                                         "HQty": dealDoubleToFixed(result.data[i]["鏁伴噺"], 1),
                                         "HPrice": dealDoubleToFixed(result.data[i]["鍗曚环"], 3),
-                                        "HTaxPrice": dealDoubleToFixed(result.data[i]["HTaxPrice"], 3),
+                                        "HTaxPrice": dealDoubleToFixed(HTaxPrice_Temp, 3),
                                         "HMoney": dealDoubleToFixed(result.data[i]["閲戦"],2),
                                         "HDiscountRate": result.data[i]["鎶樻墸鐜�"],
                                         "HRelTaxPrice": result.data[i]["瀹為檯鍚◣鍗曚环"],
@@ -2014,6 +2134,11 @@
                         return false;
                     }
 
+                    if (temp != "0" && option.data[i]["HTaxPrice"] == option.data[i]["HPrice"]) {
+                        layer.msg("绗�" + i + "琛岋細褰撳墠绋庣巼涓嶄负0锛屽崟浠蜂笌鍚◣鍗曚环涓�鑷达紝璇锋鏌ユ暟鎹槸鍚︽纭紒");
+                        return false;
+                    }
+
                     //鍚◣鍗曚环鏍煎紡鏍¢獙
                     temp = option.data[i]["HTaxPrice"] + "";
                     if ($("#HBillSubType").val() == "0") {
@@ -2502,7 +2627,7 @@
                 if (obj.event === 'del') {
                     layer.confirm('鐪熺殑鍒犻櫎琛屼箞', function (index) {
                         console.log("绱㈠紩涓�:" + rowIndex);
-                        if (rowIndex === '0') {
+                        if (rowIndex === '0' && table.cache["mainTable"].length == 1) {
                             layer.msg('棣栬鏃犳硶鍒犻櫎锛侊紒锛�');
                         } else {
                             //obj.del();
@@ -2558,6 +2683,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") {
@@ -2571,7 +2893,7 @@
                                 , shift: 2 //寮瑰嚭鍔ㄧ敾
                                 , area: ["90%", "90%"] //绐椾綋澶у皬
                                 , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
+                                , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID + '&openType2=SeOrder', 'yes']
                                 , btn: ["纭畾", "鍙栨秷"]
                                 , btn1: function (index, laero) {
                                     //鎸夐挳涓�  鐨勫洖璋�
@@ -2612,24 +2934,21 @@
                                         }
 
                                         //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                        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;                        //浠风◣鍚堣=閲戦+绋庨
-                                        //鏁板瓧绮惧害
+                                        var HQty = option.data[rowIndex + i].HQty * 1;              //鏁伴噺
                                         HQty = Number(HQty.toFixed(HQtyDec));
+                                        var HTaxRate = value * 0.01;                                //绋庣巼
+                                        var HPrice = option.data[rowIndex + i].HPrice * 1;          //鍗曚环
                                         HPrice = Number(HPrice.toFixed(HPriceDec));
-                                        HMoney = Number(HMoney.toFixed(HMoneyDec));
-                                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
-                                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                        var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
                                         HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
-
+                                        var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
+                                        HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                        var HTaxMoney = HMoney * HTaxRate;                          //绋庨=閲戦*绋庣巼
+                                        HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                        var HlineTotal = HQty * HTaxPrice;                        //浠风◣鍚堣=閲戦+绋庨
+                                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                        //鏁板瓧绮惧害
+                                        
                                         option.data[rowIndex + i].HMaterID = resultData.HItemID;
                                         option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.鐗╂枡浠g爜;
                                         option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.鐗╂枡鍚嶇О;
@@ -2670,20 +2989,19 @@
                                             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+绋庣巼)
+                                            HQty = Number(HQty.toFixed(HQtyDec));
+                                            var HTaxRate = value * 0.01;                            //绋庣巼
+                                            var HPrice = obj.data.HPrice * 1;                //鍗曚环
+                                            HPrice = Number(HPrice.toFixed(HPriceDec));
+                                            var HTaxPrice = HPrice * (1 + HTaxRate);                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                            HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
                                             var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                                            HMoney = Number(HMoney.toFixed(HMoneyDec));
                                             var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
-                                            var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                                            var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
+                                            HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                                             //鏁板瓧绮惧害
-                                            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
@@ -2864,25 +3182,22 @@
 
                             for (var i = rowIndex * 1; i < option.data.length; i++) {
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                var HQty = value * 1;                           //鏁伴噺
-                                var HPrice = option.data[i].HPrice * 1;               //鍗曚环
-                                var HTaxRate = option.data[i].HTaxRate * 0.01;           //绋庣巼
-                                /*var HDiscountRate = option.data[i].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;            //浠风◣鍚堣=閲戦+绋庨
-
-                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
+                                var HQty = value * 1;                                   //鏁伴噺
                                 HQty = dealDoubleToFixed(HQty, 1);
-                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HTaxRate = option.data[i].HTaxRate * 0.01;           //绋庣巼
                                 HTaxRate = HTaxRate;
+                                var HPrice = option.data[i].HPrice * 1;                 //鍗曚环
+                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HTaxPrice = HPrice * (1 + HTaxRate)                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
                                 HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+                                var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                                 HMoney = dealDoubleToFixed(HMoney, 2);
+                                var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
                                 HlineTotal = dealDoubleToFixed(HlineTotal, 2);
 
+                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
+                                
                                 //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                 option.data[i].HQty = HQty;
                                 option.data[i].HPrice = HPrice;
@@ -2950,24 +3265,23 @@
                             for (var i = rowIndex * 1; i < option.data.length; i++) {
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
                                 var HQty = option.data[i].HQty * 1;                           //鏁伴噺
+                                HQty = dealDoubleToFixed(HQty, 1);
                                 var HPrice = value * 1;               //鍗曚环
+                                HPrice = dealDoubleToFixed(HPrice, 3);
                                 var HTaxRate = option.data[i].HTaxRate * 0.01;           //绋庣巼
+                                HTaxRate = HTaxRate;
                                 /*var HDiscountRate = option.data[i].HDiscountRate * 1; //鎶樻墸鐜�*/
                                 var HTaxPrice = HPrice * (1 + HTaxRate);        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                                 /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
                                 //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
                                 var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                                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);
+                                var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
                                 HlineTotal = dealDoubleToFixed(HlineTotal, 2);
 
+                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
                                 //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                 option.data[i].HQty = HQty;
                                 option.data[i].HPrice = HPrice;
@@ -3008,25 +3322,22 @@
 
                             for (var i = rowIndex * 1; i < option.data.length; i++) {
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                var HQty = option.data[i].HQty * 1;                           //鏁伴噺
-                                var HPrice = option.data[i].HPrice * 1;               //鍗曚环
-                                var HTaxRate = value * 1 * 0.01;           //绋庣巼
-                                /*var HDiscountRate = option.data[i].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;            //浠风◣鍚堣=閲戦+绋庨
-
-                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
+                                var HQty = option.data[i].HQty * 1;
                                 HQty = dealDoubleToFixed(HQty, 1);
-                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HTaxRate = value * 1 * 0.01;           //绋庣巼
                                 HTaxRate = HTaxRate;
+                                var HPrice = option.data[i].HPrice * 1;                 //鍗曚环
+                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HTaxPrice = HPrice * (1 + HTaxRate)                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
                                 HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+                                var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                                 HMoney = dealDoubleToFixed(HMoney, 2);
+                                var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
                                 HlineTotal = dealDoubleToFixed(HlineTotal, 2);
 
+                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
+                                
                                 //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                 option.data[i].HQty = HQty;
                                 option.data[i].HPrice = HPrice;
@@ -3093,26 +3404,21 @@
                             //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
                             for (var i = rowIndex * 1; i < option.data.length; i++) {
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
-                                var HQty = option.data[i].HQty * 1;                           //鏁伴噺
-                                var HTaxRate = option.data[i].HTaxRate * 0.01;           //绋庣巼
-                                /*var HDiscountRate = option.data[i].HDiscountRate * 1; //鎶樻墸鐜�*/
-                                var HTaxPrice = value * 1;;        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
-                                var HPrice = HTaxPrice / (1 + HTaxRate);        //鍗曚环=鍚◣鍗曟嵁/(1+绋庣巼)
-
-                                /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //瀹為檯鍚◣鍗曚环=鍚◣鍗曚环*鎶樻墸鐜�*/
-                                //鎶樻墸棰� = 鍚◣鍗曚环 * (1 - 鎶樻墸鐜�) * 鏁伴噺
-                                var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
-                                var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
-                                var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
-
-                                //璁剧疆鏁版嵁灏忔暟浣嶆暟
+                                var HQty = option.data[i].HQty * 1;
                                 HQty = dealDoubleToFixed(HQty, 1);
-                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HTaxRate = option.data[i].HTaxRate * 0.01;           //绋庣巼
                                 HTaxRate = HTaxRate;
+                                var HTaxPrice = value * 1;;        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
                                 HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
+                                var HPrice = HTaxPrice / (1 + HTaxRate);               //鍗曚环
+                                HPrice = dealDoubleToFixed(HPrice, 3);
+                                var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
                                 HMoney = dealDoubleToFixed(HMoney, 2);
+                                var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
+                                var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
                                 HlineTotal = dealDoubleToFixed(HlineTotal, 2);
 
+                                
                                 //鍚屾鏇存柊琛ㄦ牸鍜岀紦瀛樺搴旂殑鍊�
                                 option.data[i].HQty = HQty;
                                 option.data[i].HPrice = HPrice;
@@ -3198,6 +3504,10 @@
 
                 //鍙屽嚮
                 $('.layui-table-box tbody td[data-field="鐗╂枡浠g爜"]').off('dblclick').on('dblclick', function () {
+                    //鎵嬪姩澶辩劍
+                    var element = document.getElementById("HBillNo");
+                    element.focus();
+
                     var HOrgID = $("#HOrgID").val();
 
                     layer.open({
@@ -3208,7 +3518,7 @@
                         , shift: 2 //寮瑰嚭鍔ㄧ敾
                         , area: ["90%", "90%"] //绐椾綋澶у皬
                         , maxmin: true //璁剧疆鏈�澶ф渶灏忔寜閽槸鍚︽樉绀�
-                        , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID, 'yes']
+                        , content: ['../../鍩虹璧勬枡/鍏敤鍩虹璧勬枡/Gy_Material.html?openType=2&HOrgID=' + HOrgID + '&openType2=SeOrder', 'yes']
                         , btn: ["纭畾", "鍙栨秷"]
                         , btn1: function (index, laero) {
                             //鎸夐挳涓�  鐨勫洖璋�
@@ -3250,23 +3560,20 @@
 
                                 //鏁版嵁鏍¢獙鍚堟牸锛岄噸绠楄褰�
                                 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));
+                                var HTaxRate = value * 0.01;
+                                var HPrice = option.data[rowIndex + i].HPrice * 1;              //鍗曚环
                                 HPrice = Number(HPrice.toFixed(HPriceDec));
-                                HMoney = Number(HMoney.toFixed(HMoneyDec));
-                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
-                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                var HTaxPrice = HPrice * (1 + HTaxRate);                    //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
                                 HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
-
+                                var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
+                                HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                var HTaxMoney = HMoney * HTaxRate;                          //绋庨=閲戦*绋庣巼
+                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                var HlineTotal = HQty * HTaxPrice;                        //浠风◣鍚堣=閲戦+绋庨
+                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                //鏁板瓧绮惧害
+                                
                                 option.data[rowIndex + i].HMaterID = resultData.HItemID;
                                 option.data[rowIndex + i].鐗╂枡浠g爜 = resultData.鐗╂枡浠g爜;
                                 option.data[rowIndex + i].鐗╂枡鍚嶇О = resultData.鐗╂枡鍚嶇О;
@@ -3305,22 +3612,22 @@
                                     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+绋庣巼)
+                                    HQty = Number(HQty.toFixed(HQtyDec));
+                                    var HTaxRate = value * 0.01;                            //绋庣巼
+                                    var HPrice = obj.data.HPrice * 1;                       //鍗曚环
+                                    HPrice = Number(HPrice.toFixed(HPriceDec));
+                                    var HTaxPrice = HPrice * (1 + HTaxRate)                 //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                    HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
                                     var HMoney = HQty * HPrice;                     //閲戦=鏁伴噺*鍗曚环
+                                    HMoney = Number(HMoney.toFixed(HMoneyDec));
                                     var HTaxMoney = HMoney * HTaxRate;              //绋庨=閲戦*绋庣巼
-                                    var HlineTotal = HMoney + HTaxMoney;            //浠风◣鍚堣=閲戦+绋庨
+                                    var HlineTotal = HQty * HTaxPrice;            //浠风◣鍚堣=閲戦+绋庨
+                                    HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
 
                                     //鏁板瓧绮惧害
-                                    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
@@ -3344,7 +3651,108 @@
                             }
                         }
                     })
+
+                    obj.event = "";
                 });
+
+                //鐗╂枡琛ㄦ牸涓嬫媺鎼滅储妗�
+                tableSelect.render({
+                    elem: 'td[data-field="鐗╂枡浠g爜"] .layui-table-edit',
+                    checkedKey: 'HItemID',
+                    searchKey: '鐗╂枡浠g爜,鐗╂枡鍚嶇О',
+                    sWhere: " and 鐗╂枡灞炴��='鑷埗'",//table鎼滅储sWhere鏉′欢
+                    table: {
+                        url: GetWEBURL() + 'Gy_Material/page',
+                        where: { user: sessionStorage["HUserName"], Organization: sessionStorage["Organization"] },
+                        cols: [[
+                            { type: 'checkbox', fixed: 'left' },
+                            { field: 'HItemID', title: 'HItemID' },
+                            { field: '鐗╂枡浠g爜', title: '鐗╂枡浠g爜' },
+                            { field: '鐗╂枡鍚嶇О', title: '鐗╂枡鍚嶇О' },
+                        ]],
+                        page: true,
+                        limit: 5,
+                        limits: [5]
+                    },
+                    done: function (elem, data) {
+                        if (data != []) {
+                            checkStatus = data;
+                            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;                  //鏁伴噺
+                                HQty = Number(HQty.toFixed(HQtyDec));
+                                var HTaxRate = value * 0.01;                                    //绋庣巼
+                                var HPrice = option.data[rowIndex + i].HPrice * 1;              //鍗曚环
+                                HPrice = Number(HPrice.toFixed(HPriceDec));
+                                var HTaxPrice = HPrice * (1 + HTaxRate)        //鍚◣鍗曚环=鍗曚环*(1+绋庣巼)
+                                HTaxPrice = Number(HTaxPrice.toFixed(HPriceDec));
+                                var HMoney = HQty * HPrice;                                 //閲戦=鏁伴噺*鍗曚环
+                                HMoney = Number(HMoney.toFixed(HMoneyDec));
+                                var HTaxMoney = HMoney * HTaxRate;                          //绋庨=閲戦*绋庣巼
+                                HTaxMoney = Number(HTaxMoney.toFixed(HMoneyDec));
+                                var HlineTotal = HQty * HTaxPrice;                        //浠风◣鍚堣=閲戦+绋庨
+                                HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
+                                //鏁板瓧绮惧害
+                                
+                                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);
+                        }
+                        
+                    }
+                })
             }
             //#endregion
 
@@ -3445,7 +3853,7 @@
                     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(',');
@@ -3476,6 +3884,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":
@@ -3786,6 +4198,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
 
 

--
Gitblit v1.9.1