zrg
2024-08-13 ba1fb184917b1651221a6decf1144911ff489f86
WebTM/views/ÏúÊÛ¹ÜÀí/ÆäËûÓ¦ÊÕµ¥/YS_ReceiveOtherBillMain.html
@@ -316,7 +316,7 @@
    </script>
    <script>
        var HDataTemp = {};
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -336,6 +336,8 @@
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  1添加 ä¿å­˜  2复制  3 ç¼–辑
            var linterid = params[params[1]]; //从参数中获取 å•据内码
            var closeType = params[params[3]];//客户应收账款明细 åŒå‡»å¼¹çª—弹出只能查看不能编辑  ç¦ç”¨æŒ‰é’®
            //#endregion
@@ -379,6 +381,13 @@
            }
            else if (OperationType == 3) {                                                 //编辑
                if (closeType == 10) {
                    $('#btnSave').addClass("layui-btn-disabled").attr("disabled", true);
                    $('#set_CheckBill').addClass("layui-btn-disabled").attr("disabled", true);
                    $('#set_AbandonCheck').addClass("layui-btn-disabled").attr("disabled", true);
                }
                //子表页面初始化
                get_InitGrid();
@@ -510,7 +519,10 @@
                //数值格式校验工具
                var ref = /^\d+(\.\d+)?$/;          //非负数正则表达式
                var temp = "";
                var Dec = getDecByMaterID(obj.data.HMaterID) //获取精度
                var HQtyDec = (Dec["HQtyDec"] == null || Dec["HQtyDec"] == 0) ? 4 : Dec["HQtyDec"];  //数量精度
                var HPriceDec = (Dec["HPriceDec"] == null || Dec["HPriceDec"] == 0) ? 4 : Dec["HPriceDec"];  //单价精度
                var HMoneyDec = (Dec["HMoneyDec"] == null || Dec["HMoneyDec"] == 0) ? 2 : Dec["HMoneyDec"];  //金额精度
                // å•元格编辑之前的值
                var oldText = $(this).prev().text();
                var value = obj.value //得到修改后的值
@@ -543,11 +555,10 @@
                        var HMoney = HQty * HPrice; //不含税金额=数量*单据
                        //设置数据小数位数
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HQty = dealDoubleToFixed(HQty, 2);;
                        HTaxRate = HTaxRate;
                        HPrice = dealDoubleToFixed(HPrice, 2);;
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HSumMoney = dealDoubleToFixed(HSumMoney, 2);
@@ -559,6 +570,7 @@
                            , HTaxRate: HTaxRate
                            , HSumMoney: HSumMoney
                        });
                        table.render(option)
                        break;
                    case "HPrice":                                                       //单价
                        //数据格式校验
@@ -584,11 +596,12 @@
                        var HMoney = HQty * HPrice; //不含税金额=数量*单据
                        //设置数据小数位数
                        HMoney = dealDoubleToFixed(HMoney, 2);
                        HQty = dealDoubleToFixed(HQty, 2);;
                        HTaxRate = HTaxRate;
                        HPrice = dealDoubleToFixed(HPrice, 2);;
                        //数字精度
                        HQty = Number(HQty.toFixed(HQtyDec));
                        HPrice = Number(HPrice.toFixed(HPriceDec));
                        HMoney = Number(HMoney.toFixed(HMoneyDec));
                        HlineTotal = Number(HlineTotal.toFixed(HMoneyDec));
                        HTaxPrice = Number(HPrice.toFixed(HPriceDec));
                        HSumMoney = dealDoubleToFixed(HSumMoney, 2);
@@ -601,6 +614,7 @@
                            , HTaxRate: HTaxRate
                            , HSumMoney: HSumMoney
                        });
                        table.render(option)
                        break;
                }
            });
@@ -856,18 +870,20 @@
                    , toolbar: '#toolbarDemo'
                    , totalRow: true
                    , cellMinWidth: 120
                    , limit: 100
                    , height: 400
                    ,limit:100
                    , cols: [[
                        { type: 'checkbox', totalRowText: '合计行' }
                        , { type: 'numbers', title: '序号', style: 'background-color: #f9f9f9;' }
                        , { field: 'HProjectMoneyID', title: '费用项目ID', hide: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HPMoneyName', title: '费用项目名称', edit: 'text', event: "HPMoneyName",style: 'background-color: #f9f9f9;' }     //f7
                        , { field: 'HTypeSub', title: '发票类型', hide: true, templet: '#HTypeSub' }
                        , { field: 'HMoney', title: '不含税金额', hide: true, edit: 'text', style: 'background-color: #f9f9f9;' }
                        , { field: 'HMoney', title: '不含税金额', hide: true, edit: 'text', totalRow: true, style: 'background-color: #f9f9f9;' }
                        , { field: 'HTaxRate', title: '税率', hide: true, edit: 'text', style: 'background-color: #f9f9f9;' }
                        , { field: 'HQty', title: '数量',  edit: 'text', style: 'background-color: #f9f9f9;' }
                        , { field: 'HQty', title: '数量', edit: 'text', style: 'background-color: #f9f9f9;', totalRow: true }
                        , { field: 'HPrice', title: '单价', edit: 'text', style: 'background-color: #f9f9f9;' }
                        , { field: 'HSumMoney', title: '总金额', style: 'background-color: #f9f9f9;' }
                        , { field: 'HSumMoney', title: '总金额', style: 'background-color: #f9f9f9;', totalRow: true }
                        , { field: 'HRemark', title: '子表备注', edit: 'text', style: 'background-color: #f9f9f9;' }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                    ]]
@@ -942,6 +958,16 @@
                                    })
                                    layer.close(index);//关闭弹窗
                                }
                                , end: function () {
                                    if (typeof (HDataTemp.HItemID) != "undefined") {
                                        //更新表格缓存的数据
                                        obj.update({
                                            "HProjectMoneyID": HDataTemp.HItemID
                                            , "HPMoneyName": HDataTemp.项目费用名称
                                        })
                                        HDataTemp = {};
                                    }
                                }
                            });
                        }
                        obj.event = "";
@@ -984,7 +1010,7 @@
                    , area: ['90%', '90%']//大小
                    , title: '销售员列表'//标题
                    , shift: 2//弹出动画
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html', 'yes']
                    , content: ['../../基础资料/公用基础资料/Gy_EmployeeList.html?Type=HEmp', 'yes']
                    , btn: ['确定', '取消']
                    , btn1: function (index, layero) {//按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
@@ -1306,7 +1332,7 @@
                            for (var i = 0; i <data1.length; i++) {
                                //延迟原因
                                //发票类型
                                $('#HTypeSub' + (i + 1)).find("option[value='" + data1[i].HTypeSub + "']").attr("selected", true);
                            }
                            form.render('select');
@@ -1356,28 +1382,29 @@
            }
            //#endregion
            //#region æ ¹æ®å®¢æˆ·èŽ·å–å®¢æˆ·å¯¹åº”ç¨ŽçŽ‡
            function getHTaxRateByCusID(HCusID) {
                $.ajax({
                    url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
                    async: false,
                    type: "GET",
                    data: {
                        "HCusID": HCusID
            //#region æ ¹æ®ç‰©æ–™ID获取精度
            function getDecByMaterID(HMaterID) {
                var resultData = {};
                $.ajax({  // å¼‚步请求
                    url: GetWEBURL() + "Gy_Material/getDecByID",  //请求地址
                    async: false,   //是否开启异步
                    type: "GET",   //请求类型
                    data: {   //定义发送到服务器的数据
                        "HMaterID": HMaterID     //  å°†hmaterid作为请求参数发送
                    },
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data[0];
                            $("#HTaxRate").val(data.HTaxRate);
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    success: function (result) {   // å½“请求成功时,执行这个函数
                        if (result.code == 1) { // å¦‚果服务器返回的数据中的`code字段等于1,这可能表示审核操作成功执行
                            var data = result.data; //声明data变量,并将其赋值为result对象中的data属性
                            resultData = data[0];   //将data数组(或类数组对象)的第一个元素赋值给变量resultData
                        }
                        //else {
                        //    layer.alert(result.Message, { icon: 5, btn: ['退出'], time: 100000, offset: 't' }); //result.msg对象,提示弹窗 ç±»åž‹ä¸º5, æŒ‰é’®ï¼Œå’ŒæŒ‰é’®çš„名称为退出  æ—¶é—´ ä¸º100秒,以及偏移量(`offset: 't'
                        //}
                    }, error: function () {
                        layer.alert("发生错误!", { icon: 5 });
                        layer.alert("发生错误!", { icon: 5 });  //提示弹窗 å‘生错误 ï¼Œè­¦ç¤ºæ ‡å¿—为5的
                    }
                });
                return resultData;
            }
            //#endregion
@@ -1409,57 +1436,37 @@
                });
            }
            //#endregion
            //#region æ ¹æ®å®¢æˆ·èŽ·å–å¸åˆ«ã€æ±‡çŽ‡ ç¨Žçއ
            function getCustomerByCusID(HCusID) {
                $.ajax({
                    url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
                    async: false,
                    type: "GET",
                    data: {
                        "HCusID": HCusID
                    },
                    success: function (result) {
                        if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data[0];
                            $("#HCusID").val(data.HCusID);
                            $("#HCusName").val(data.HCusName);
                            $("#HCurID").val(data.HCurID);
                            $("#HCurName").val(data.HCurName);
                            $("#HExRate").val(data.HExRate);
                            $("#HTaxRate").val(data.HTaxRate);
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.alert("发生错误!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#endregion
        });
        function GetHEmpValue(obj)  //返回业务员
        {
            $("#HEmpName").val(obj[0].职员名称);
            $("#HEmpID").val(obj[0].HItemID);
        //function GetHDeptNameValue(obj)  //返回部门
        //{
        //    $("#HDeptName").val(obj[0].HName);
        //    $("#HDeptID").val(obj[0].HItemID);
        //}
            getEmpInfoByHEmpID(obj[0].HItemID)
        }
        //function GetHEmpValue(obj)  //返回经手人
        //{
        //    $("#HEmpName").val(obj[0].HName);
        //    $("#HEmpID").val(obj[0].HItemID);
        //}
        function GetHDeptNameValue(obj)  //返回部门
        {
            $("#HDeptName").val(obj[0].部门名称);
            $("#HDeptID").val(obj[0].HItemID);
        }
                //function GetHSupValue(obj)  //返回客户
                //{
                //    $("#HCusName").val(obj[0].HName);
                //    $("#HCusID").val(obj[0].HItemID);
                //}
        function GetProjectMoneyValue(obj)  //返回费用项目
        {
            HDataTemp = obj[0];
        }
        function GetHSupValue(obj)  //返回客户
        {
            $("#HCusName").val(obj[0].HName);
            $("#HCusID").val(obj[0].HItemID);
            var HCusID = $("#HCusID").val();
            getHTaxRateByCusID(HCusID);//根据客户获取客户对应税率
            getCustomerByCusID(HCusID);//根据客户获取币别、汇率,税率
        }
        //#region å¤„理小数显示位数(data:需要处理的数据;num:数据的类型(如1:数量;2:金额;3:单价))
        function dealDoubleToFixed(data, num) {
            //用于设置小数位数
@@ -1520,6 +1527,59 @@
            });
        }
        //#endregion
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å®¢æˆ·å¯¹åº”ç¨ŽçŽ‡
        function getHTaxRateByCusID(HCusID) {
            $.ajax({
                url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
                async: false,
                type: "GET",
                data: {
                    "HCusID": HCusID
                },
                success: function (result) {
                    if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data[0];
                        $("#HTaxRate").val(data.HTaxRate);
                    } else {
                        layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    }
                }, error: function () {
                    layer.alert("发生错误!", { icon: 5 });
                }
            });
        }
            //#endregion
        //#region æ ¹æ®å®¢æˆ·èŽ·å–å¸åˆ«ã€æ±‡çŽ‡ ç¨Žçއ
        function getCustomerByCusID(HCusID) {
            $.ajax({
                url: GetWEBURL() + "/Xs_SeOrderBill/getCustomerByCusID",
                async: false,
                type: "GET",
                data: {
                    "HCusID": HCusID
                },
                success: function (result) {
                    if (result.code == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                        var data = result.data[0];
                        $("#HCusID").val(data.HCusID);
                        $("#HCusName").val(data.HCusName);
                        $("#HCurID").val(data.HCurID);
                        $("#HCurName").val(data.HCurName);
                        $("#HExRate").val(data.HExRate);
                        $("#HTaxRate").val(data.HTaxRate);
                    } else {
                        layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                    }
                }, error: function () {
                    layer.alert("发生错误!", { icon: 5 });
                }
            });
        }
            //#endregion
    </script>
</body>
</html>