1
pzy
2024-08-11 db08b0f3239df006eadea02d004451ab6a90eb5f
WebTM/views/ÏúÊÛ¹ÜÀí/Ó¦ÊÕµ¥/Xs_ReceivableBill.html
@@ -186,6 +186,15 @@
                                                <input type="date" class="layui-input" lay-verify="HReceiveDate" name="HReceiveDate" id="HReceiveDate" style="width:190px;">
                                            </div>
                                        </div>
                                        <div class="layui-inline">
                                            <label class="layui-form-label">单价类型</label>
                                            <div class="layui-input-inline">
                                                <select name="HPriceType" id="HPriceType" lay-filter="HPriceType" style="width: 190px; ">
                                                    <option value="成本价" selected="selected">成本价</option>
                                                    <option value="结算价">结算价</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-inline">
@@ -305,20 +314,37 @@
                        </div>
                    </div>
                    <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                    <script type="text/html" id="toolbarDemo">
                        <div class="layui-btn-container">
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-InsertLine"><i class="layui-icon layui-icon-form"></i>插入一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Up"><i class="layui-icon layui-icon-form"></i>上移</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Under"><i class="layui-icon layui-icon-form"></i>下移</button>
                            <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
                        <ul class="layui-tab-title" lay-filter="tab-all">
                            <li style="padding:1px;" class="layui-this">汇总表格</li>
                            <li style="padding:1px;">明细表格</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table class="layui-hide" id="mainTable" lay-filter="mainTable"></table>
                                <script type="text/html" id="toolbarDemo">
                                    <div class="layui-btn-container">
                                        {{# if(haveSource == false){ }}/
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-AddLine"><i class="layui-icon layui-icon-form"></i>增加一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-InsertLine"><i class="layui-icon layui-icon-form"></i>插入一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-CopyLine"><i class="layui-icon layui-icon-form"></i>复制一行</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Up"><i class="layui-icon layui-icon-form"></i>上移</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-Under"><i class="layui-icon layui-icon-form"></i>下移</button>
                                        {{# } }}
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Inventory" id="get_Inventory"><i class="layui-icon layui-icon-form"></i>库存查询</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="get_InOutSum" id="get_InOutSum"><i class="layui-icon layui-icon-form"></i>出入库记录查询</button>
                                        <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                                    </div>
                                </script>
                                <script type="text/html" id="xuhao">
                                    {{d.LAY_TABLE_INDEX+1}}
                                </script>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-hide" id="mainTableEntry" lay-filter="mainTableEntry"></table>
                            </div>
                        </div>
                    </script>
                    <script type="text/html" id="xuhao">
                        {{d.LAY_TABLE_INDEX+1}}
                    </script>
                    </div>
                </form>
            </div>
        </div>
@@ -330,6 +356,8 @@
    <script>
        //#region æŠ˜å æ³¨é‡Š
        //#endregion
        //是否有源单
        var haveSource = false;
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -383,6 +411,11 @@
            //初始化子表
            set_InitGrid();
            //初始化组织
            Organ();
            //获取源单类型
            HBillType();
            //#region åˆ¤æ–­æ“ä½œç±»åž‹å¹¶åˆå§‹åŒ–界面
            if (OperationType == 1) {                                                   //无源单新增
               /* $("#HItemID").val(0);*/
@@ -415,11 +448,7 @@
            DisPlay_HideColumn();
            //初始化组织
            Organ();
            //获取源单类型
            HBillType();
            //#endregion
@@ -619,6 +648,12 @@
                    case 'set_HideColumn':
                        get_HideColumn();
                        break;
                    //库存查询
                    case 'get_Inventory': get_Inventory();
                        break;
                    //出入库记录查询
                    case 'get_InOutSum': get_InOutSum();
                        break;
                }
            });
            //#endregion
@@ -643,189 +678,188 @@
                    , field = obj.field; //得到字段
                //layer.msg('[ID: ' + data.id + '] ' + field + ' å­—段更改为:' + value);
                //switch (field) {
                //    case "HQty":                                                       //数量
                //        //数据格式校验
                //        temp = value + "";
                //        if (!ref.test(temp) || temp == 0) {
                //            //恢复数据到编辑前
                //            obj.update({
                //                HQty: oldText
                //            });
                //            table.render(option);
                switch (field) {
                    case "HQty":                                                       //数量
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp) || temp == 0) {
                            //恢复数据到编辑前
                            obj.update({
                                HQty: oldText
                            });
                            table.render(option);
                //            layer.msg("数量请输入大于0的数字!");
                //            return;
                //        }
                            layer.msg("数量请输入大于0的数字!");
                            return;
                        }
                //        //数据校验合格,重算记录
                //        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 * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                        //数据校验合格,重算记录
                        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 * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                //        //设置数据小数位数
                //        HQty = dealDoubleToFixed(HQty, 1);
                //        HPrice = dealDoubleToFixed(HPrice, 3);
                //        HTaxRate = HTaxRate;
                //        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                //        HMoney = dealDoubleToFixed(HMoney, 2);
                //        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                        //设置数据小数位数
                        HQty = dealDoubleToFixed(HQty, 1);
                        HPrice = dealDoubleToFixed(HPrice, 3);
                        HTaxRate = HTaxRate;
                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                //        //同步更新表格和缓存对应的值
                //        obj.update({
                //            HQty: HQty
                //            , HPrice: HPrice
                //            , HTaxRate: HTaxRate * 100
                //            , HTaxPrice: HTaxPrice
                //            , HMoney: HMoney
                //            , HTaxMoney: HTaxMoney
                //        });
                //        table.render(option);
                //        break;
                //    case "HPrice":                                                       //单价
                //        //数据格式校验
                //        temp = value + "";
                //        if (!ref.test(temp) || temp == 0) {
                //            //恢复数据到编辑前
                //            obj.update({
                //                HPrice: oldText
                //            });
                //            table.render(option);
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HTaxRate: HTaxRate * 100
                            , HTaxPrice: HTaxPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        table.render(option);
                        break;
                    case "HPrice":                                                       //单价
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp) || temp == 0) {
                            //恢复数据到编辑前
                            obj.update({
                                HPrice: oldText
                            });
                            table.render(option);
                //            layer.msg("单价请输入大于0的数字!");
                //            return;
                //        }
                            layer.msg("单价请输入大于0的数字!");
                            return;
                        }
                //        //数据校验合格,重算记录
                //        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;   //实际含税单价=含税单价*折扣率*/
                //        //折扣额 = å«ç¨Žå•ä»· * (1 - æŠ˜æ‰£çއ) * æ•°é‡
                //        var HMoney = HQty * HPrice;                     //金额=数量*单价
                //        var HTaxMoney = HMoney * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                        //数据校验合格,重算记录
                        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;   //实际含税单价=含税单价*折扣率*/
                        //折扣额 = å«ç¨Žå•ä»· * (1 - æŠ˜æ‰£çއ) * æ•°é‡
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxMoney = HMoney * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                //        //设置数据小数位数
                //        HQty = dealDoubleToFixed(HQty, 1);
                //        HPrice = dealDoubleToFixed(HPrice, 3);
                //        HTaxRate = HTaxRate;
                //        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                //        HMoney = dealDoubleToFixed(HMoney, 2);
                //        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                        //设置数据小数位数
                        HQty = dealDoubleToFixed(HQty, 1);
                        HPrice = dealDoubleToFixed(HPrice, 3);
                        HTaxRate = HTaxRate;
                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                //        //同步更新表格和缓存对应的值
                //        obj.update({
                //            HQty: HQty
                //            , HPrice: HPrice
                //            , HTaxRate: HTaxRate * 100
                //            , HTaxPrice: HTaxPrice
                //            , HMoney: HMoney
                //            , HTaxMoney: HTaxMoney
                //        });
                //        table.render(option);
                //        break;
                //    case "HTaxRate":                                                       //数量
                //        //数据格式校验
                //        temp = value + "";
                //        if (!ref.test(temp)) {
                //            //恢复数据到编辑前
                //            obj.update({
                //                HTaxRate: oldText
                //            });
                //            table.render(option);
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HTaxRate: HTaxRate * 100
                            , HTaxPrice: HTaxPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        table.render(option);
                        break;
                    case "HTaxRate":                                                       //数量
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp)) {
                            //恢复数据到编辑前
                            obj.update({
                                HTaxRate: oldText
                            });
                            table.render(option);
                //            layer.msg("税率请输入不小于0的数字!");
                //            return;
                //        }
                            layer.msg("税率请输入不小于0的数字!");
                            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 * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                        //数据校验合格,重算记录
                        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 * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                //        //设置数据小数位数
                //        HQty = dealDoubleToFixed(HQty, 1);
                //        HPrice = dealDoubleToFixed(HPrice, 3);
                //        HTaxRate = HTaxRate;
                //        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                //        HMoney = dealDoubleToFixed(HMoney, 2);
                //        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                        //设置数据小数位数
                        HQty = dealDoubleToFixed(HQty, 1);
                        HPrice = dealDoubleToFixed(HPrice, 3);
                        HTaxRate = HTaxRate;
                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                //        //同步更新表格和缓存对应的值
                //        obj.update({
                //            HQty: HQty
                //            , HPrice: HPrice
                //            , HTaxRate: HTaxRate * 100
                //            , HTaxPrice: HTaxPrice
                //            , HMoney: HMoney
                //            , HTaxMoney: HTaxMoney
                //        });
                //        table.render(option);
                //        break;
                //    case "HTaxPrice":                                                       //数量
                //        //数据格式校验
                //        temp = value + "";
                //        if (!ref.test(temp)) {
                //            //恢复数据到编辑前
                //            obj.update({
                //                HTaxPrice: oldText
                //            });
                //            table.render(option);
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HTaxRate: HTaxRate * 100
                            , HTaxPrice: HTaxPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        table.render(option);
                        break;
                    case "HTaxPrice":                                                       //数量
                        //数据格式校验
                        temp = value + "";
                        if (!ref.test(temp)) {
                            //恢复数据到编辑前
                            obj.update({
                                HTaxPrice: oldText
                            });
                            table.render(option);
                //            layer.msg("含税单据请输入不小于0的数字!");
                //            return;
                //        }
                //        //数据校验合格,重算记录
                //        var HQty = obj.data.HQty * 1;                   //数量
                //        var HTaxRate = obj.data.HTaxRate * 0.01;        //税率
                //        var HTaxPrice = value * 1;                          //含税单价=单价*(1+税率)
                //        var HPrice = HTaxPrice / (1 + HTaxRate);        //单价=含税单据/(1+税率)
                            layer.msg("含税单据请输入不小于0的数字!");
                            return;
                        }
                        //数据校验合格,重算记录
                        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 HDiscountRate = obj.data.HDiscountRate * 1; //折扣率*/
                //        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //实际含税单价=含税单价*折扣率*/
                //        //折扣额 = å«ç¨Žå•ä»· * (1 - æŠ˜æ‰£çއ) * æ•°é‡
                //        var HMoney = HQty * HPrice;                     //金额=数量*单价
                //        var HTaxMoney = HMoney * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                        /*var HRelTaxPrice = HTaxPrice * HDiscountRate;   //实际含税单价=含税单价*折扣率*/
                        //折扣额 = å«ç¨Žå•ä»· * (1 - æŠ˜æ‰£çއ) * æ•°é‡
                        var HMoney = HQty * HPrice;                     //金额=数量*单价
                        var HTaxMoney = HMoney * (1 + HTaxRate);            //价税合计=金额 * (1 + ç¨Žçއ)
                //        //设置数据小数位数
                //        HQty = dealDoubleToFixed(HQty, 1);
                //        HPrice = dealDoubleToFixed(HPrice, 3);
                //        HTaxRate = HTaxRate;
                //        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                //        HMoney = dealDoubleToFixed(HMoney, 2);
                //        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                        //设置数据小数位数
                        HQty = dealDoubleToFixed(HQty, 1);
                        HPrice = dealDoubleToFixed(HPrice, 3);
                        HTaxRate = HTaxRate;
                        HTaxPrice = dealDoubleToFixed(HTaxPrice, 3);
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HTaxMoney = dealDoubleToFixed(HTaxMoney, 2);
                //        //同步更新表格和缓存对应的值
                //        obj.update({
                //            HQty: HQty
                //            , HPrice: HPrice
                //            , HTaxRate: HTaxRate * 100
                //            , HTaxPrice: HTaxPrice
                //            , HMoney: HMoney
                //            , HTaxMoney: HTaxMoney
                //        });
                //        table.render(option);
                //        break;
                //    default:
                //}
                        //同步更新表格和缓存对应的值
                        obj.update({
                            HQty: HQty
                            , HPrice: HPrice
                            , HTaxRate: HTaxRate * 100
                            , HTaxPrice: HTaxPrice
                            , HMoney: HMoney
                            , HTaxMoney: HTaxMoney
                        });
                        break;
                    default:
                }
            });
            //#endregion
            //#endregion
@@ -1247,9 +1281,103 @@
                    , "HSeOrderEntryID": "0"
                    , "HSeOrderBillNo": ""
                }];
                optionEntry = {
                    elem: '#mainTableEntry'
                    , totalRow: true
                    , limit: 500
                    , height: 500
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', width: 100 }
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '物料代码', title: '物料代码', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: '物料名称', title: '物料名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: '规格型号', title: '规格型号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '计量单位', title: '计量单位', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HQty', title: '数量', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPrice', title: '单价', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HMoney', title: '金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HTaxPrice', title: '含税单价', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HDiscountRate', title: '折扣率', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HRelTaxPrice', title: '实际含税单价', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HTaxRate', title: '税率', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HTaxMoney', title: '税额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HMoneyBB', title: '本位币金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotalBB', title: '本位币价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRemark', title: '备注', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceInterID', title: '源单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceEntryID', title: '源单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceBillNo', title: '源单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceBillType', title: '源单类型', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRelationQty', title: '关联数量', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRelationMoney', title: '关联金额', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderInterID', title: '采购订单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderEntryID', title: '采购订单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderBillNo', title: '采购订单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderTaxPrice', title: '订单含税单价', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderInterID', title: '销售订单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderEntryID', title: '销售订单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderBillNo', title: '销售订单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                    ]]
                }
                option.data = rowdata;
                table.render(option);
                table.render(optionEntry);
            }
            function set_InitGridHaveSource() {
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , totalRow: true
                    , limit: 500
                    , height: 500
                    , loading: false
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', width: 100 }
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '物料代码', title: '物料代码', width: 150, edit: 'text', event: "HMaterID" }//f7
                        , { field: '物料名称', title: '物料名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: '规格型号', title: '规格型号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '计量单位', title: '计量单位', width: 100, edit: 'text', event: "HUnitID" }//f7
                        , { field: 'HQty', title: '数量', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPrice', title: '单价', width: 100, edit: 'text', event: "HPrice" }
                        , { field: 'HMoney', title: '金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HTaxPrice', title: '含税单价', width: 100, edit: 'text', event: "HTaxPrice" }
                        , { field: 'HDiscountRate', title: '折扣率', width: 100, edit: 'text' }
                        , { field: 'HRelTaxPrice', title: '实际含税单价', width: 100, edit: 'text' }
                        , { field: 'HTaxRate', title: '税率', width: 100, edit: 'text' }
                        , { field: 'HTaxMoney', title: '税额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HMoneyBB', title: '本位币金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotalBB', title: '本位币价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
                        , { field: 'HSourceInterID', title: '源单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceEntryID', title: '源单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceBillNo', title: '源单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSourceBillType', title: '源单类型', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRelationQty', title: '关联数量', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HRelationMoney', title: '关联金额', width: 100, totalRow: true, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderInterID', title: '采购订单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderEntryID', title: '采购订单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HPOOrderBillNo', title: '采购订单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderTaxPrice', title: '订单含税单价', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderInterID', title: '销售订单内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderEntryID', title: '销售订单子内码', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HSeOrderBillNo', title: '销售订单号', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                }
            }
            //#endregion
@@ -1276,7 +1404,7 @@
                                , "HMainSourceEntryID": data.HMainSourceEntryID
                                , "HMainSourceBillNo": data.HMainSourceBillNo
                                , "HMainSourceBillType": data.HMainSourceBillType
                                , "HPriceType": data.单价类型
                                , "HDeptID": data.HDeptID
                                , "HDeptName": data.部门
                                , "HMangerID": data.HMangerID
@@ -1308,6 +1436,11 @@
                                , "HDeleteMan": data.作废人
                                , "HDeleteDate": data.作废日期 == null ? "" : Format(new Date(data.作废日期), "yyyy-MM-dd")
                            });
                            if (data.HMainSourceBillType != "") {
                                haveSource = true;
                                $("#BillType").val(data.HMainSourceBillType);
                            }
                            HOrgIDBar = sessionStorage["OrganizationID"];
@@ -1355,6 +1488,12 @@
                            }
                            option.data = rowdata;
                            table.render(option);
                            //子表  èµ‹å€¼
                            var rowdata = result.list[0];
                            optionEntry.data = rowdata;
                            table.render(optionEntry);
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);
@@ -1574,6 +1713,20 @@
                    }
                }
                var sSubStr = JSON.stringify(num);
                var sSubStr2;
                if (haveSource == true) {
                    //获取子表2数据
                    var num = [];
                    for (var i = 0; i < table.cache["mainTableEntry"].length; i++) {
                        if (table.cache["mainTableEntry"][i] != "") {
                            table.cache["mainTableEntry"][i].LAY_TABLE_INDEX = i;
                            num.push(table.cache["mainTableEntry"][i])
                        }
                    }
                    sSubStr2 = JSON.stringify(num);
                } else {
                    sSubStr2 = JSON.stringify([]);
                }
                //获取操作方式
                var refSav = "";
@@ -1584,7 +1737,7 @@
                    refSav = "Update";
                }
                var sMainSub = sMainStr + ';' + sSubStr + ';' + refSav + ';' + sessionStorage["HUserName"];
                var sMainSub = sMainStr + ';' + sSubStr + ';' + sSubStr2 + ';' + refSav + ';' + sessionStorage["HUserName"];
                $.ajax({
                    type: "POST",
@@ -1768,30 +1921,62 @@
                                    if (checkStatus.data.length != 1) {
                                        return layer.msg("请选择一条数据");
                                    }
                                    //更新表格缓存的数据
                                    obj.update({
                                        "HMaterID": checkStatus.data[0].HItemID
                                        , "物料代码": checkStatus.data[0].物料代码
                                        , "物料名称": checkStatus.data[0].物料名称
                                        , "规格型号": checkStatus.data[0].规格型号
                                        , "HUnitID": checkStatus.data[0].HUnitID
                                        , "计量单位": checkStatus.data[0].计量单位名称
                                    })
                                    OptionData = checkStatus.data[0];
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    if (typeof (OptionData.HItemID) != "undefined") {
                                        //更新表格缓存的数据
                                        obj.update({
                                            "HMaterID": OptionData.HItemID
                                            , "物料代码": OptionData.物料代码
                                            , "物料名称": OptionData.物料名称
                                            , "规格型号": OptionData.规格型号
                                            , "HUnitID": OptionData.HUnitID
                                            , "计量单位": OptionData.计量单位名称
                                        })
                                        OptionData = [];
                                        //通过供应商id获取税率
                                        var HSupID = $("#HCusID").val();
                                        if (HSupID != 0) {
                                            $.ajax({
                                                url: GetWEBURL() + "/Gy_Customer/xg",
                                                //url: "http://localhost:12761/Gy_Supplier/xg",
                                                type: "GET",
                                                data: {
                                                    "HInterID": HSupID
                                                },
                                                success: function (d) {
                                                    var HTaxRate = parseInt(d.data[0].增值税率) * 0.01;
                                                    var HExRate = $("#HExRate").val();                      //汇率
                                                    //数据校验合格,重算记录
                                                    var HQty = obj.data.HQty * 1;                           //数量
                                                    var HPrice = obj.data.HPrice * 1;               //单价
                                                    var HMoney = HQty * HPrice;                     //金额=数量*单价
                                                    var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                                    var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                                    var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //含税单价=单价*(1+税率)
                                                    var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));     //本位币价税合计=(税额+金额)*汇率
                                                    obj.update({ //更新表格数据
                                                        "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                        , "物料代码": OptionData.物料代码
                                                        , "物料名称": OptionData.物料名称
                                                        , "规格型号": OptionData.规格型号
                                                        , "HUnitID": OptionData.HUnitID
                                                        , "计量单位": OptionData.计量单位名称
                                                        , "HTaxRate": HTaxRate * 100
                                                        , HQty: HQty                               //更新HQty字段,HQty
                                                        , HPrice: HPrice                         //更新HPrice字段,HPrice
                                                        , HMoney: HMoney                      //更新HMoney字段,HMoney
                                                        , HTaxMoney: HTaxMoney                  //更新HTaxMoney字段,HTaxMoney
                                                        , HlineTotal: HlineTotal             //更新HlineTotal字段,HlineTotal
                                                        , HTaxPrice, HTaxPrice                   //更新HTaxPrice字段,HTaxPrice
                                                        , HlineTotalBB: HlineTotalBB              //更新HlineTotalBB字段,其值来自变量HlineTotalBB
                                                    })
                                                    OptionData = [];
                                                }
                                            });
                                        } else {
                                            obj.update({ //更新表格数据
                                                "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                , "物料代码": OptionData.物料代码
                                                , "物料名称": OptionData.物料名称
                                                , "规格型号": OptionData.规格型号
                                                , "HUnitID": OptionData.HUnitID
                                                , "计量单位": OptionData.计量单位名称
                                            })
                                            OptionData = [];
                                        }
                                    }
                                }
                            })
@@ -1839,6 +2024,87 @@
                        return false;
                    }
                })
                //双击
                $('.layui-table-box tbody td[data-field="物料代码"]').off('dblclick').on('dblclick', function () {
                    layer.open({
                        type: 2
                        , skin: "layui-layer-rim" //加上边框
                        , title: "物料列表"  //标题
                        , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                        , shift: 2 //弹出动画
                        , area: ["90%", "90%"] //窗体大小
                        , maxmin: true //设置最大最小按钮是否显示
                        , content: ['../../基础资料/公用基础资料/Gy_Material.html', 'yes']
                        , btn: ["确定", "取消"]
                        , btn1: function (index, laero) {
                            //按钮一  çš„回调
                            var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                            var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                            if (checkStatus.data.length != 1) {
                                return layer.msg("请选择一条数据");
                            }
                            OptionData = checkStatus.data[0];
                            layer.close(index);//关闭弹窗
                        }
                        , end: function () {
                            if (typeof (OptionData.HItemID) != "undefined") {
                                //通过供应商id获取税率
                                var HSupID = $("#HCusID").val();
                                if (HSupID != 0) {
                                    $.ajax({
                                        url: GetWEBURL() + "/Gy_Customer/xg",
                                        //url: "http://localhost:12761/Gy_Supplier/xg",
                                        type: "GET",
                                        data: {
                                            "HInterID": HSupID
                                        },
                                        success: function (d) {
                                            var HTaxRate = parseInt(d.data[0].增值税率) * 0.01;
                                            var HExRate = $("#HExRate").val();                      //汇率
                                            //数据校验合格,重算记录
                                            var HQty = obj.data.HQty * 1;                           //数量
                                            var HPrice = obj.data.HPrice * 1;               //单价
                                            var HMoney = HQty * HPrice;                     //金额=数量*单价
                                            var HTaxMoney = Number((HMoney * HTaxRate).toFixed(4));         //税额=金额*税率
                                            var HlineTotal = HMoney + HTaxMoney;            //价税合计=金额+税额
                                            var HTaxPrice = Number((HPrice * (1 + HTaxRate)).toFixed(4));        //含税单价=单价*(1+税率)
                                            var HlineTotalBB = Number(((HMoney + HTaxMoney) * HExRate).toFixed(4));     //本位币价税合计=(税额+金额)*汇率
                                            obj.update({ //更新表格数据
                                                "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                                , "物料代码": OptionData.物料代码
                                                , "物料名称": OptionData.物料名称
                                                , "规格型号": OptionData.规格型号
                                                , "HUnitID": OptionData.HUnitID
                                                , "计量单位": OptionData.计量单位名称
                                                , "HTaxRate": HTaxRate * 100
                                                , HQty: HQty                               //更新HQty字段,HQty
                                                , HPrice: HPrice                         //更新HPrice字段,HPrice
                                                , HMoney: HMoney                      //更新HMoney字段,HMoney
                                                , HTaxMoney: HTaxMoney                  //更新HTaxMoney字段,HTaxMoney
                                                , HlineTotal: HlineTotal             //更新HlineTotal字段,HlineTotal
                                                , HTaxPrice, HTaxPrice                   //更新HTaxPrice字段,HTaxPrice
                                                , HlineTotalBB: HlineTotalBB              //更新HlineTotalBB字段,其值来自变量HlineTotalBB
                                            })
                                            OptionData = [];
                                        }
                                    });
                                } else {
                                    obj.update({ //更新表格数据
                                        "HMaterID": OptionData.HItemID             //设置HItemID的值为“HBillNo”字段的值HItemID`的值
                                        , "物料代码": OptionData.物料代码
                                        , "物料名称": OptionData.物料名称
                                        , "规格型号": OptionData.规格型号
                                        , "HUnitID": OptionData.HUnitID
                                        , "计量单位": OptionData.计量单位名称
                                    })
                                    OptionData = [];
                                }
                            }
                        }
                    })
                });
            }
            //#endregion
@@ -1851,7 +2117,9 @@
                        console.log("索引为:" + rowIndex);
                        if (rowIndex === '0') {
                            layer.msg('首行无法删除!!!');
                        } else {
                        } else if (haveSource == true) {
                            layer.msg('有源单无法删除!!!');
                        }else {
                            obj.del();
                            option.data = table.cache["mainTable"];//将数据绑定到data上
                            table.reload(option);
@@ -1944,7 +2212,55 @@
                }
            }
            //#endregion
            //#region åº“存查询
            function get_Inventory() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    //弹窗方法
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '库存查询列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_ICinventoryQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region å‡ºå…¥åº“记录查询
            function get_InOutSum() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1 && data[0].HMaterID != 0) {
                    var HMaterID = data[0].HMaterID.toString();
                    layer.open({
                        type: 2//弹窗类型
                        , skin: 'layui-layer-rim' //加上边框
                        , area: ['90%', '90%']//大小
                        , title: '出入库记录列表'//标题
                        , shift: 2//弹出动画
                        , content: ['../../仓存管理/条码报表/Kf_StockInOutSumQueryReport.html?Type=1&HMaterID=' + HMaterID, 'yes']
                        , btn: ['取消']
                        , btn1: function (index, layero) {
                            layer.close(index);
                        }
                    })
                }
                else {
                    layer.msg('请选择一行有物料数据查询!');
                }
            }
            //#endregion
            //#region ä¸‹ç§»
            function btn_under() {
                var checkStatus = table.checkStatus('mainTable')
@@ -2177,49 +2493,115 @@
                    , "HSellSName": dataArray[0].销售方式
                });
                //子表  èµ‹å€¼
                var rowdata = [];
                for (var i = 0; i < dataArray.length; i++) {
                    rowdata.push(
                        {
                             "HMaterID": dataArray[i].HMaterID
                            , "物料代码": dataArray[i].物料代码
                            , "物料名称": dataArray[i].物料名称
                            , "规格型号": dataArray[i].规格型号
                            , "HUnitID": dataArray[i].HUnitID
                            , "计量单位": dataArray[i].计量单位
                            , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                            , "HPrice": dealDoubleToFixed(dataArray[i].单价, 3)
                            , "HTaxPrice": dealDoubleToFixed(dataArray[i].含税单价, 3)
                            , 'HDiscountRate':"0"                                                     //
                            , 'HRelTaxPrice': "0"
                            , "HTaxRate": dataArray[i].税率
                            , 'HTaxMoney':"0"                                                         //
                            , "HMoney": dealDoubleToFixed(dataArray[i].金额, 2)
                            , 'HMoneyBB': dealDoubleToFixed(dataArray[i].金额 * dataArray[0].汇率, 2)
                            , 'HlineTotal': dealDoubleToFixed(dataArray[i].价税合计, 2)
                            , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].价税合计 * dataArray[0].汇率, 2)
                            , "HRemark": ""
                if ($("#HPriceType").val() == "成本价") {
                    //子表成本价Entry  èµ‹å€¼
                    var rowdataEntry = [];
                    for (var i = 0; i < dataArray.length; i++) {
                            , "HSourceInterID": dataArray[i].hmainid
                            , "HSourceEntryID": dataArray[i].hsubid
                            , "HSourceBillNo": dataArray[i].单据号
                            , "HSourceBillType": dataArray[i].HBillType
                            , "HRelationQty": "0"
                            , "HRelationMoney": "0"
                        rowdataEntry.push(
                            {
                                "HMaterID": dataArray[i].HMaterID
                                , "物料代码": dataArray[i].物料代码
                                , "物料名称": dataArray[i].物料名称
                                , "规格型号": dataArray[i].规格型号
                                , "HUnitID": dataArray[i].HUnitID
                                , "计量单位": dataArray[i].计量单位
                                , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                                , "HPrice": dealDoubleToFixed(dataArray[i].HNoTaxCost, 3)
                                , "HTaxPrice": dealDoubleToFixed(dataArray[i].HTaxCost, 3)
                                , 'HDiscountRate': "0"                                                     //
                                , 'HRelTaxPrice': "0"
                                , "HTaxRate": dataArray[i].税率
                                , 'HTaxMoney': "0"                                                         //
                                , "HMoney": dealDoubleToFixed(dataArray[i].数量 * dataArray[i].HNoTaxCost, 2)
                                , 'HMoneyBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].HNoTaxCost, 2)
                                , 'HlineTotal': dealDoubleToFixed(dataArray[i].价税合计, 2)
                                , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].价税合计 * dataArray[0].汇率, 2)
                                , "HRemark": ""
                            , 'HPOOrderInterID': "0"
                            , 'HPOOrderEntryID': "0"
                            , 'HPOOrderBillNo': ""
                                , "HSourceInterID": dataArray[i].hmainid
                                , "HSourceEntryID": dataArray[i].hsubid
                                , "HSourceBillNo": dataArray[i].单据号
                                , "HSourceBillType": dataArray[i].HBillType
                                , "HRelationQty": "0"
                                , "HRelationMoney": "0"
                            , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].含税单价, 3)
                            , "HSeOrderInterID": dataArray[i].hmainid
                            , "HSeOrderEntryID": dataArray[i].hsubid
                            , "HSeOrderBillNo": dataArray[i].单据号
                        }
                    );
                                , 'HPOOrderInterID': "0"
                                , 'HPOOrderEntryID': "0"
                                , 'HPOOrderBillNo': ""
                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].HTaxPrice, 3)
                                , "HSeOrderInterID": dataArray[i].hmainid
                                , "HSeOrderEntryID": dataArray[i].hsubid
                                , "HSeOrderBillNo": dataArray[i].单据号
                            }
                        );
                    }
                } else {
                    //子表Entry  èµ‹å€¼
                    var rowdataEntry = [];
                    for (var i = 0; i < dataArray.length; i++) {
                        rowdataEntry.push(
                            {
                                "HMaterID": dataArray[i].HMaterID
                                , "物料代码": dataArray[i].物料代码
                                , "物料名称": dataArray[i].物料名称
                                , "规格型号": dataArray[i].规格型号
                                , "HUnitID": dataArray[i].HUnitID
                                , "计量单位": dataArray[i].计量单位
                                , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                                , "HPrice": dealDoubleToFixed(dataArray[i].单价, 3)
                                , "HTaxPrice": dealDoubleToFixed(dataArray[i].HTaxPrice, 3)
                                , 'HDiscountRate': "0"                                                     //
                                , 'HRelTaxPrice': "0"
                                , "HTaxRate": dataArray[i].税率
                                , 'HTaxMoney': "0"                                                         //
                                , "HMoney": dealDoubleToFixed(dataArray[i].金额, 2)
                                , 'HMoneyBB': dealDoubleToFixed(dataArray[i].金额 * dataArray[0].汇率, 2)
                                , 'HlineTotal': dealDoubleToFixed(dataArray[i].价税合计, 2)
                                , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].价税合计 * dataArray[0].汇率, 2)
                                , "HRemark": ""
                                , "HSourceInterID": dataArray[i].hmainid
                                , "HSourceEntryID": dataArray[i].hsubid
                                , "HSourceBillNo": dataArray[i].单据号
                                , "HSourceBillType": dataArray[i].HBillType
                                , "HRelationQty": "0"
                                , "HRelationMoney": "0"
                                , 'HPOOrderInterID': "0"
                                , 'HPOOrderEntryID': "0"
                                , 'HPOOrderBillNo': ""
                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].HTaxPrice, 3)
                                , "HSeOrderInterID": dataArray[i].hmainid
                                , "HSeOrderEntryID": dataArray[i].hsubid
                                , "HSeOrderBillNo": dataArray[i].单据号
                            }
                        );
                    }
                }
                option.data = rowdata;
                optionEntry.data = rowdataEntry;
                table.render(optionEntry);
                //子表汇总
                for (var i = 0; i < rowdataEntry.length; i++) {
                    var item = rowdataEntry[i];
                    for (var j = i + 1; j < rowdataEntry.length; j++) {
                        if (rowdataEntry[j].HMaterID == item.HMaterID) {
                            rowdataEntry[i].HQty += rowdataEntry[j].HQty;
                            rowdataEntry[i].HMoney = rowdataEntry[i].HQty * rowdataEntry[i].HPrice//金额=数量*单价
                            rowdataEntry[i].HTaxMoney = Number((rowdataEntry[i].HMoney * rowdataEntry[i].HTaxRate).toFixed(4))//税额
                            rowdataEntry[i].HlineTotal = rowdataEntry[i].HMoney + rowdataEntry[i].HTaxMoney //价税合计
                            var HExRate = $("#HExRate").val();
                            rowdataEntry[i].HlineTotalBB = Number(((rowdataEntry[i].HMoney + rowdataEntry[i].HTaxMoney) * HExRate).toFixed(4)) //本位币价税合计
                            rowdataEntry.splice(j, 1);
                            j = j - 1;
                        }
                    }
                }
                set_InitGridHaveSource();
                option.data = rowdataEntry;
                haveSource = true;
                table.render(option);
            }
            //#endregion
@@ -2280,50 +2662,116 @@
                    , "HSellSID": dataArray[0].HSellSID
                    , "HSellSName": dataArray[0].销售方式
                });
                if ($("#HPriceType").val() == "成本价") {
                    //子表  èµ‹å€¼
                    var rowdataEntry = [];
                    for (var i = 0; i < dataArray.length; i++) {
                        rowdataEntry.push(
                            {
                                "HMaterID": dataArray[i].hmaterid
                                , "物料代码": dataArray[i].物料代码
                                , "物料名称": dataArray[i].物料名称
                                , "规格型号": dataArray[i].规格型号
                                , "HUnitID": dataArray[i].hunitid
                                , "计量单位": dataArray[i].计量单位
                                , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                                , "HPrice": dealDoubleToFixed(dataArray[i].成本单价, 3)
                                , "HTaxPrice": dealDoubleToFixed(dataArray[i].含税单价, 3)
                                , 'HDiscountRate': "0"                                                     //
                                , 'HRelTaxPrice': "0"
                                , "HTaxRate": dataArray[i].税率
                                , 'HTaxMoney': "0"                                                         //
                                , "HMoney": dealDoubleToFixed(dataArray[i].数量 * dataArray[i].成本单价, 2)
                                , 'HMoneyBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].成本单价 * dataArray[0].汇率, 2)
                                , 'HlineTotal': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价, 2)
                                , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价 * dataArray[0].汇率, 2)
                                , "HRemark": ""
                //子表  èµ‹å€¼
                var rowdata = [];
                for (var i = 0; i < dataArray.length; i++) {
                    rowdata.push(
                        {
                            "HMaterID": dataArray[i].hmaterid
                            , "物料代码": dataArray[i].物料代码
                            , "物料名称": dataArray[i].物料名称
                            , "规格型号": dataArray[i].规格型号
                            , "HUnitID": dataArray[i].hunitid
                            , "计量单位": dataArray[i].计量单位
                            , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                            , "HPrice": dealDoubleToFixed(dataArray[i].单价, 3)
                            , "HTaxPrice": dealDoubleToFixed(dataArray[i].含税单价, 3)
                            , 'HDiscountRate': "0"                                                     //
                            , 'HRelTaxPrice': "0"
                            , "HTaxRate": dataArray[i].税率
                            , 'HTaxMoney': "0"                                                         //
                            , "HMoney": dealDoubleToFixed(dataArray[i].数量 * dataArray[i].单价, 2)
                            , 'HMoneyBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].单价 * dataArray[0].汇率, 2)
                            , 'HlineTotal': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价, 2)
                            , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价 * dataArray[0].汇率, 2)
                            , "HRemark": ""
                                , "HSourceInterID": dataArray[i].hmainid
                                , "HSourceEntryID": dataArray[i].hsubid
                                , "HSourceBillNo": dataArray[i].单据号
                                , "HSourceBillType": dataArray[i].HBillType
                                , "HRelationQty": "0"
                                , "HRelationMoney": "0"
                            , "HSourceInterID": dataArray[i].hmainid
                            , "HSourceEntryID": dataArray[i].hsubid
                            , "HSourceBillNo": dataArray[i].单据号
                            , "HSourceBillType": dataArray[i].HBillType
                            , "HRelationQty": "0"
                            , "HRelationMoney": "0"
                                , 'HPOOrderInterID': "0"
                                , 'HPOOrderEntryID': "0"
                                , 'HPOOrderBillNo': ""
                            , 'HPOOrderInterID': "0"
                            , 'HPOOrderEntryID': "0"
                            , 'HPOOrderBillNo': ""
                            , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].含税单价, 3)
                            , "HSeOrderInterID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceInterID: "0"
                            , "HSeOrderEntryID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceEntryID : "0"
                            , "HSeOrderBillNo": dataArray[i].HSourceBillType == "1401" ? dataArray[i].源单单号 : ""
                        }
                    );
                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].含税单价, 3)
                                , "HSeOrderInterID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceInterID : "0"
                                , "HSeOrderEntryID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceEntryID : "0"
                                , "HSeOrderBillNo": dataArray[i].HSourceBillType == "1401" ? dataArray[i].源单单号 : ""
                            }
                        );
                    }
                }
                option.data = rowdata;
                else {
                    //子表  èµ‹å€¼
                    var rowdataEntry = [];
                    for (var i = 0; i < dataArray.length; i++) {
                        rowdataEntry.push(
                            {
                                "HMaterID": dataArray[i].hmaterid
                                , "物料代码": dataArray[i].物料代码
                                , "物料名称": dataArray[i].物料名称
                                , "规格型号": dataArray[i].规格型号
                                , "HUnitID": dataArray[i].hunitid
                                , "计量单位": dataArray[i].计量单位
                                , "HQty": dealDoubleToFixed(dataArray[i].数量, 1)
                                , "HPrice": dealDoubleToFixed(dataArray[i].单价, 3)
                                , "HTaxPrice": dealDoubleToFixed(dataArray[i].含税单价, 3)
                                , 'HDiscountRate': "0"                                                     //
                                , 'HRelTaxPrice': "0"
                                , "HTaxRate": dataArray[i].税率
                                , 'HTaxMoney': "0"                                                         //
                                , "HMoney": dealDoubleToFixed(dataArray[i].数量 * dataArray[i].单价, 2)
                                , 'HMoneyBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].单价 * dataArray[0].汇率, 2)
                                , 'HlineTotal': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价, 2)
                                , 'HlineTotalBB': dealDoubleToFixed(dataArray[i].数量 * dataArray[i].含税单价 * dataArray[0].汇率, 2)
                                , "HRemark": ""
                                , "HSourceInterID": dataArray[i].hmainid
                                , "HSourceEntryID": dataArray[i].hsubid
                                , "HSourceBillNo": dataArray[i].单据号
                                , "HSourceBillType": dataArray[i].HBillType
                                , "HRelationQty": "0"
                                , "HRelationMoney": "0"
                                , 'HPOOrderInterID': "0"
                                , 'HPOOrderEntryID': "0"
                                , 'HPOOrderBillNo': ""
                                , 'HSeOrderTaxPrice': dealDoubleToFixed(dataArray[i].含税单价, 3)
                                , "HSeOrderInterID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceInterID : "0"
                                , "HSeOrderEntryID": dataArray[i].HSourceBillType == "1401" ? dataArray[i].HSourceEntryID : "0"
                                , "HSeOrderBillNo": dataArray[i].HSourceBillType == "1401" ? dataArray[i].源单单号 : ""
                            }
                        );
                    }
                }
                optionEntry.data = rowdataEntry;
                table.render(optionEntry);
                //子表汇总
                for (var i = 0; i < rowdataEntry.length; i++) {
                    var item = rowdataEntry[i];
                    for (var j = i + 1; j < rowdataEntry.length; j++) {
                        if (rowdataEntry[j].HMaterID == item.HMaterID) {
                            rowdataEntry[i].HQty += rowdataEntry[j].HQty;
                            rowdataEntry[i].HMoney = rowdataEntry[i].HQty * rowdataEntry[i].HPrice//金额=数量*单价
                            rowdataEntry[i].HTaxMoney = Number((rowdataEntry[i].HMoney * rowdataEntry[i].HTaxRate).toFixed(4))//税额
                            rowdataEntry[i].HlineTotal = rowdataEntry[i].HMoney + rowdataEntry[i].HTaxMoney //价税合计
                            var HExRate = $("#HExRate").val();
                            rowdataEntry[i].HlineTotalBB = Number(((rowdataEntry[i].HMoney + rowdataEntry[i].HTaxMoney) * HExRate).toFixed(4)) //本位币价税合计
                            rowdataEntry.splice(j, 1);
                            j = j - 1;
                        }
                    }
                }
                set_InitGridHaveSource();
                option.data = rowdataEntry;
                haveSource = true;
                table.render(option);
            }
            //#endregion