WebTM/views/ÏúÊÛ¹ÜÀí/ÏúÊÛ¶©µ¥/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;                       //获取子窗口对象,用于操作子窗口的变量和方法
        var currRowIndex = 0;                       //用于定位子窗口当前选中的行
        var childData = null;                       //用于获取子窗口返回的数据
        //#endregion
        //#region æŠ˜å æ³¨é‡Š
        var HDataEmp = {};
        //#endregion
@@ -444,7 +463,7 @@
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).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", "订单等级代码", "销售出库数量", "销售出库审核数量", "销售出库审核金额", "生产数量", "销售退库数量", "销售退库审核数量"];//不需要显示的字段 å¯æ‰©å±•
            //记录组织的值
            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) {                            //判断当前子窗口是否已经打开,若未打卡,则打开页面,并获取子窗口的对象
                            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 (职员代码 like '%" + value + "%' or èŒå‘˜åç§° like '%" + value + "%') order by èŒå‘˜ä»£ç ";
                                        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 (职员代码 like '%" + value + "%' or èŒå‘˜åç§° like '%" + value + "%') order by èŒå‘˜ä»£ç ";
                                childPage.getData(childSWhere, tableView);
                            }, 200);
                        }
                    } else {                                                    //如果按下的键位是 æ–¹å‘键,则调整窗口中 é€‰ä¸­è¡Œ çš„位置
                        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.主仓库id
                                , "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") {                           //定位当前正在输入的文本框的列名
                    //        if ($.inArray(event.key, errKeys) == -1) {              //如果按下的键位不是 æ–¹å‘键,则刷新弹窗中的数据
                    //            if (childPage == null) {                            //判断当前子窗口是否已经打开,若未打卡,则打开页面,并获取子窗口的对象
                    //                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,物料代码,物料名称,规格型号,HUnitID,计量单位名称 from " + tableView + " where 1=1 and ç»„织名称 = '" + sessionStorage["Organization"] + "' and (物料代码 like '%" + value + "%' or ç‰©æ–™åç§° like '%" + value + "%') order by ç‰©æ–™ä»£ç  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].物料代码 = childData.物料代码;
                    //                            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中HisStockGoods值设置下拉列表
                    //                            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,物料代码,物料名称,规格型号,HUnitID,计量单位名称 from " + tableView + " where 1=1 and ç»„织名称 = '" + sessionStorage["Organization"] + "' and (物料代码 like '%" + value + "%' or ç‰©æ–™åç§° like '%" + value + "%')  order by ç‰©æ–™ä»£ç  desc";
                    //                    childPage.getData(childSWhere, tableView);
                    //                }, 200);
                    //            }
                    //        } else {                                                    //如果按下的键位是 æ–¹å‘键,则调整窗口中 é€‰ä¸­è¡Œ çš„位置
                    //            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].物料代码 = childData.物料代码;
                    //                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中HisStockGoods值设置下拉列表
                    //                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].物料代码 = resultData.物料代码;
                                        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="物料代码"]').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].物料代码 = resultData.物料代码;
                                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="物料代码"] .layui-table-edit',
                    checkedKey: 'HItemID',
                    searchKey: '物料代码,物料名称',
                    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: '物料代码', title: '物料代码' },
                            { 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", "物料代码": "", "物料名称": "", "规格型号": "", "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].物料代码 = resultData.物料代码;
                                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中HisStockGoods值设置下拉列表
                            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","订单等级代码","销售出库数量","销售出库审核数量","销售出库审核金额","生产数量","销售退库数量","销售退库审核数量"];//不需要显示的字段 å¯æ‰©å±•
                            /*var titleData = ["HMaterID", "HUnitID", "折扣率", "实际含税单价", "税额", "本位币价税合计", "出库数量", "开票数量", "HOrderLevID","订单等级代码","销售出库数量","销售出库审核数量","销售出库审核金额","生产数量","销售退库数量","销售退库审核数量"];//不需要显示的字段 å¯æ‰©å±•*/
                            //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