duhe
2024-11-19 474e195d85c5123e965fe4e49437937d3f8a89ec
WebTM/views/Ó¦ÊÕ¹ÜÀí/±¨±í·ÖÎö/YS_CusShouldIncomeEntryReport.html
@@ -295,9 +295,198 @@
            });
            //#endregion
            //#region åŒå‡»è¿›å…¥ç¼–辑
            table.on('rowDouble(mainTable)', function (obj) {
                //选中高亮 åŒå‡»è¡Œ
                obj.tr.find(':checkbox').prop('checked', true);
                obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
                $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
                //mainTable ä¸ºè¡¨æ ¼ID   æ³¨æ„æ­¤å¤„如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = true;
                    }
                });
                var HBillNo = obj.data["单据号"];
                var sWhere = "";
                if (obj.data.单据类型 == "销售出库单") {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                    $.ajax({
                        url: GetWEBURL() + '/Kf_SellOutBill/GetSellOutBillList',
                        type: "GET",
                        data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                        success: function (data1) {
                            if (data1.count == 1) {
                                var linterid = data1.data[0].hmainid
                                layer.open({
                                    type: 2
                                    , area: ['100%', '100%']
                                    , title: '编辑销售订单'
                                    , closeBtn: 1
                                    , shade: 0.6 //遮罩透明度
                                    , maxmin: true //允许全屏最小化
                                    , anim: 0 //0-6的动画形式,-1不开启
                                    , content: '../../领料发货/销售出库/Kf_SellOutBill.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=10'
                                    , resize: false,
                                    end: function () {
                                        //刷新页面,
                                        $("#btnSearch").trigger('click');
                                    }
                                    , cancel: function () {
                                    }
                                })
                            }
                            else {
                                layer.close(ajaxLoad);
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.close(ajaxLoad);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else if (obj.data.单据类型 == "收款单") {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                    $.ajax({
                        url: GetWEBURL() + '/YS_ReceiveBill/list',
                        async: false,
                        type: "GET",
                        data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                        success: function (data1) {
                            if (data1.count == 1) {
                                var linterid = data1.data[0].hmainid
                                layer.open({
                                    type: 2
                                    , area: ['100%', '100%']
                                    , title: '编辑销售订单'
                                    , closeBtn: 1
                                    , shade: 0.6 //遮罩透明度
                                    , maxmin: true //允许全屏最小化
                                    , anim: 0 //0-6的动画形式,-1不开启
                                    , content: '../../销售管理/收款单/YS_ReceiveBill.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=10'
                                    , resize: false,
                                    end: function () {
                                        //刷新页面,
                                        $("#btnSearch").trigger('click');
                                    }
                                    , cancel: function () {
                                    }
                                })
                            }else {
                                layer.close(ajaxLoad);
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.close(ajaxLoad);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else if (obj.data.单据类型 == "其他应收单") {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                    $.ajax({
                        url: GetWEBURL() + '/YS_ReceiveOtherBill/YS_ReceiveOtherBillMainList',
                        async: false,
                        type: "GET",
                        data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                        success: function (data1) {
                            if (data1.count == 1) {
                                var linterid = data1.data[0].hmainid
                                layer.open({
                                    type: 2
                                    , area: ['100%', '100%']
                                    , title: '编辑其他应收单'
                                    , closeBtn: 1
                                    , shade: 0.6 //遮罩透明度
                                    , maxmin: true //允许全屏最小化
                                    , anim: 0 //0-6的动画形式,-1不开启
                                    , content: '../../销售管理/其他应收单/YS_ReceiveOtherBillMain.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=10'
                                    , resize: false,
                                    end: function () {
                                        //刷新页面,
                                        $("#btnSearch").trigger('click');
                                    }
                                    , cancel: function () {
                                    }
                                })
                            } else {
                                layer.close(ajaxLoad);
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.close(ajaxLoad);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else if (obj.data.单据类型 == "销售退货单") {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                    $.ajax({
                        url: GetWEBURL() + '/Kf_ICStockBackBill/GetKf_ICStockBackBillList',
                        async: false,
                        type: "GET",
                        data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                        success: function (data1) {
                            if (data1.count == 1) {
                                var linterid = data1.data[0].hmainid
                                layer.open({
                                    type: 2
                                    , area: ['100%', '100%']
                                    , title: '编辑销售退货单'
                                    , closeBtn: 1
                                    , shade: 0.6 //遮罩透明度
                                    , maxmin: true //允许全屏最小化
                                    , anim: 0 //0-6的动画形式,-1不开启
                                    , content: '../../销售管理/销售退货单/Kf_ICStockBackBill.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=10'
                                    , resize: false,
                                    end: function () {
                                        //刷新页面,
                                        $("#btnSearch").trigger('click');
                                    }
                                    , cancel: function () {
                                    }
                                })
                            } else {
                                layer.close(ajaxLoad);
                                layer.alert(data1.code + data1.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.close(ajaxLoad);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
            });
            //#endregion
            //#region å¯¼å‡ºExecel
            function get_Export() {
                table.exportFile(ins.config.id, option.data, "xls");
                var ModRightNameCheck = "YS_CusShouldIncomeEntryReport_ExportExcel";
                //逻辑审核方法
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + "/LMES/getReportByModRightNameCheck", //方法所在页面和方法名
                    data: { "ModRightNameCheck": ModRightNameCheck, "user": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            table.exportFile(ins.config.id, option.data, "xls");
                        } else {
                            layer.alert("当前模块没有导出权限!", { icon: 5 });
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
@@ -314,14 +503,20 @@
                sWhere = "'" + HBeginDate + "','" + HEndDate + "'," + HCusID + ",'" + HCustomer + "'," + HStockOrgID;
                //根据用户过滤用户关联客户的记录
                sWhere += ",'";
                sWhere += getSWhereByHUser();
                sWhere += "'";
                var ajaxLoad = layer.load();
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + '/YS_ReceiveReportController/GetYS_CusShouldIncomeEntryReport_Json',
                    async: false,    //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
                    data: { "sWhere": sWhere },
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var totalArray = ["收款", "支出"];
                            var data = [];
                            var col = [];
                            //给空的数组赋值
@@ -336,10 +531,12 @@
                            }
                            //在列表左边添加勾选框
                            //col.push({ type: 'checkbox', fixed: 'left' });
                            for (var i = 0; i < data.length; i++) {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else if ($.inArray(data[i].name, totalArray) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true, width: 120 });
                                }
                                else {
                                    switch (data[i].Type) {
@@ -348,7 +545,12 @@
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                            if (data[i].name == '收款' || data[i].name == '支出') {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', totalRow: true });
                                            } else {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                            }
                                    }
                                }
                            }
@@ -517,6 +719,31 @@
            }
            //#endregion
            //#region æ ¹æ®ç”¨æˆ·èŽ·å–ç”¨æˆ·å…³è”å®¢æˆ·çš„è¿‡æ»¤æ¡ä»¶
            function getSWhereByHUser() {
                var res = "";
                $.ajax({
                    type: "GET",
                    async: false,
                    url: GetWEBURL() + "/Xs_SeOrderBill/getCusIDListByUser", //方法所在页面和方法名
                    data: { "CurUserID": sessionStorage["Czybm"], "CurUserName": sessionStorage["HUserName"] },
                    success: function (result) {
                        if (result.count == 1) {
                            res = result.data;
                        } else {
                            res = result.data;
                            layer.alert(result.code + result.Message, { icon: 5 });
                        }
                    }, error: function (err) {
                        res = " and 1 = 0";
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                res = res.replaceAll("'", "''");
                return res;
            }
            //#endregion
        //#endregion