案例效果

报表数据格式化展示与多列报表穿透

实现思路

  1. 创建两个sql数据源并使用该数据源配置两个报表:项目主信息报表,与详细信息报表
  2. 在主项目信息中,注册【编辑事件】
  3. 在数据项目格式化事件中编写js实现数据格式化展示
  4. 在数据项目格式化事件中编写js实现点击对应的列弹出详细信息报表并过滤数据

操作步骤

  1. 创建两个sql数据源并使用该数据源配置两个报表:

项目主项目信息报表:

详细信息报表:

  1. 在主项目信息中,注册【编辑事件】

  1. 在数据项目格式化事件中编写js实现数据格式化展示

  1. 在数据项目格式化事件中编写js实现点击对应的列弹出详细信息报表并过滤数据

相关代码

//详细
SELECT km.KEMU_KMSX,gnmc,djbh,theme,JE_HS,JE_BHS,kmmc,kmbm,xmmc,xmdm,deptcodea,jzsj,SY_CURRENTTASK FROM jingyingmingxi jy
left join xingxikmu  km
on jy.kmbm = km.KEMU_KMBM
WHERE SY_CURRENTTASK = '已结束'
AND IF('{xmdm}' = '',1=1,xmdm LIKE CONCAT('{xmdm}','%'))
AND IF('{kmbm}' = '',1=1,kmbm LIKE CONCAT('{kmbm}','%'))
AND IF('{jzsj}' = '',1=1,LEFT(jzsj,7) = LEFT('{jzsj}',7))
and IF('{kmsx}' = '',1=1,km.KEMU_KMSX='{kmsx}')
ORDER BY jzsj ASC
SELECT xmmc,xmdm,IFNULL(SUM(0Y1),0) AS 0Y1, IFNULL(SUM(NBHT),0) AS NBHT, IFNULL(SUM(0Y2),0) AS 0Y2,IFNULL(SUM(B),0) AS B,IFNULL(SUM(C),0) AS C,IFNULL(SUM(D),0) AS D,
IFNULL(SUM(F),0) AS F, IFNULL(SUM(J1),0) AS J1, IFNULL(SUM(B)+SUM(C)-SUM(D),0) AS E,IFNULL(SUM(GDFY),0) AS GDFY, IFNULL(SUM(KBFY),0) AS KBFY, IFNULL(SUM(KBFY)/(SUM(B)+SUM(C)-SUM(D)),0) AS KBFYZB,
IFNULL((SUM(B)+SUM(C)-SUM(D))-SUM(F),0) AS I,IFNULL((SUM(B)+SUM(C)-SUM(D)-SUM(F))/SUM(J1),0) AS I3,IF('{yf}' = '',LEFT(now(),7),'{yf}') AS jzsj_yf
FROM(
    SELECT jzxm.XIANGMU_XMMC AS xmmc, jzxm.XIANGMU_XMDM AS xmdm,IFNULL(SUM(IF('{lx}'='含税',xxht.hetong_JE,xxht.HETONG_HTJEBHS)),0) AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_HETONG xxht INNER JOIN JE_XIANGMU jzxm ON xxht.hetong_XMDM = jzxm.XIANGMU_XMDM2
    AND jzxm.XIANGMU_ZZXM = '主项目' AND XIANGMU_XMDM != ''
    AND IF('{yf}' <> '',1=1,LEFT(xxht.hetong_JZRQ,7) = LEFT('{yf}',7))
    GROUP BY jzxm.XIANGMU_XMDM
    UNION ALL
    SELECT NBJYHT_SKXMMC AS xmmc, NBJYHT_SKXMBM AS xmdm, 0 AS 0Y1, IFNULL(SUM(IF('{lx}'='含税',NBJYHT_FKJEXX,NBJYHT_HTJEBHS)),0) AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_AMB_NBJYHT WHERE 1=1 AND SY_AUDFLAG='ENDED'
    AND IF('{yf}' = '',1=1,LEFT(NBJYHT_JZSJ,7) = LEFT('{yf}',7))
    GROUP BY NBJYHT_SKXMBM
    UNION ALL
    SELECT JIZHANGMINGXI_XMMC AS xmmc,JIZHANGMINGXI_XMDM AS xmdm,0 AS 0Y1, 0 AS NBHT, IFNULL(SUM(JIZHANGMINGXI_JE),0) AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_JIZHANGMINGXI WHERE 1=1  AND JIZHANGLEIXING_CODE='0' AND SY_AUDFLAG='ENDED'
    AND IF('{yf}' = '',1=1,LEFT(JIZHANGMINGXI_JZSJ,7) = LEFT('{yf}',7))
    GROUP BY JIZHANGMINGXI_XMDM
    UNION ALL
    SELECT JIZHANGMINGXI_XMMC AS xmmc,JIZHANGMINGXI_XMDM AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, IFNULL(SUM(IF('{lx}'='含税',JIZHANGMINGXI_BHSSR,JIZHANGMINGXI_JE)),0) AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_JIZHANGMINGXI WHERE 1=1  AND JIZHANGLEIXING_CODE='1' AND SY_AUDFLAG='ENDED'
    AND IF('{yf}' = '',1=1,LEFT(JIZHANGMINGXI_JZSJ,7) = LEFT('{yf}',7))
    GROUP BY JIZHANGMINGXI_XMDM
    UNION ALL
    SELECT FKSQNB_SKXMMC AS xmmc,FKSQNB_SKXMBM AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, IFNULL(SUM(FKSQNB_FKJEXX),0) AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_BXSQ_FKSQNB WHERE 1=1  AND SY_AUDFLAG='ENDED'
    AND IF('{yf}' = '',1=1,LEFT(FKSQNB_JZSJ,7) = LEFT('{yf}',7))
    GROUP BY FKSQNB_SKXMBM
    UNION ALL
    SELECT FKSQNB_XMMC AS xmmc,FKSQNB_XMDM AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, IFNULL(SUM(FKSQNB_FKJEXX),0) AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_BXSQ_FKSQNB WHERE 1=1  AND SY_AUDFLAG='ENDED'
    AND IF('{yf}' = '',1=1,LEFT(FKSQNB_JZSJ,7) = LEFT('{yf}',7))
    GROUP BY FKSQNB_XMDM
    UNION ALL
    SELECT XMMC AS xmmc,XMBH AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    IFNULL(SUM(IF('{lx}'='含税',zcJEhs,zcJE)),0) AS F, 0 AS J1, 0 AS GDFY, 0 AS KBFY
    FROM je_jizhang_all jall WHERE  1=1 AND XMBH != ''
    AND (jall.t = '出差计划及借款' OR jall.t = '出差计划及借款' OR jall.t = '差旅费用报销单' OR jall.t = '差旅费用报销单huankuan' OR jall.t = '付款申请单' OR jall.t = '费用报销单'
    OR jall.t = '费用报销单huankuan' OR jall.t = '借款单' OR jall.t = '物料报销单(A07)' OR jall.t = '物料报销单(A07)Huankuan' OR jall.t = '(物料采购)付款申请')
    AND LEFT(CONCAT(kmbm,zckmbm),1) = 'F' AND SY_CURRENTTASK = '已结束'
    AND IF('{yf}' = '',1=1,LEFT(jall.jzsj,7) = LEFT('{yf}',7))
    GROUP BY XMBH
    UNION ALL
    SELECT gongshi_XMMC AS xmmc,gongshi_XMDM AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, IFNULL(SUM(gongshi_GZS),0) AS J1, 0 AS GDFY, 0 AS KBFY
    FROM JE_GONGSHI WHERE 1=1  AND SY_AUDFLAG='ENDED' AND gongshi_XMDM!=''
    AND IF('{yf}' = '',1=1,LEFT(gongshi_RQ,7) = LEFT('{yf}',7))
    GROUP BY gongshi_XMDM
    UNION ALL
    SELECT jall.XMMC AS xmmc,jall.XMBH AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, IFNULL(SUM(IF('{lx}'='含税',jall.zcJEhs,jall.zcJE)),0) AS GDFY, 0 AS KBFY
    FROM `je_jizhang_all` jall INNER JOIN JE_KEMU km ON CONCAT(jall.kmbm,jall.zckmbm) = km.KEMU_KMBM
    AND (jall.t = '出差计划及借款' OR jall.t = '出差计划及借款' OR jall.t = '差旅费用报销单' OR jall.t = '差旅费用报销单huankuan' OR jall.t = '付款申请单' OR jall.t = '费用报销单'
    OR jall.t = '费用报销单huankuan' OR jall.t = '借款单' OR jall.t = '物料报销单(A07)' OR jall.t = '物料报销单(A07)Huankuan' OR jall.t = '(物料采购)付款申请')
    AND km.KEMU_KMSX = '01' AND SY_CURRENTTASK = '已结束'
    AND IF('{yf}' = '',1=1,LEFT(jall.jzsj,7) = LEFT('{yf}',7))
    GROUP BY jall.XMBH
    UNION ALL
    SELECT jall.XMMC AS xmmc,jall.XMBH AS xmdm,0 AS 0Y1, 0 AS NBHT, 0 AS 0Y2, 0 AS B, 0 AS C, 0 AS D,
    0 AS F, 0 AS J1, 0 AS GDFY, IFNULL(SUM(IF('{lx}'='含税',jall.zcJEhs,jall.zcJE)),0) AS KBFY
    FROM `je_jizhang_all` jall INNER JOIN JE_KEMU km ON CONCAT(jall.kmbm,jall.zckmbm) = km.KEMU_KMBM
    AND (jall.t = '出差计划及借款' OR jall.t = '出差计划及借款' OR jall.t = '差旅费用报销单' OR jall.t = '差旅费用报销单huankuan' OR jall.t = '付款申请单' OR jall.t = '费用报销单'
    OR jall.t = '费用报销单huankuan' OR jall.t = '借款单' OR jall.t = '物料报销单(A07)' OR jall.t = '物料报销单(A07)Huankuan' OR jall.t = '(物料采购)付款申请')
    AND km.KEMU_KMSX = '02' AND SY_CURRENTTASK = '已结束'
    AND IF('{yf}' = '',1=1,LEFT(jall.jzsj,7) = LEFT('{yf}',7))
    GROUP BY jall.XMBH
)z INNER JOIN JE_XIANGMU jzxm ON z.xmdm = jzxm.XIANGMU_XMDM
AND 1=1
AND IF('{bdm}' = '', 1=1, jzxm.XIANGMU_BMBM2 LIKE CONCAT('{bdm}','%'))
AND IF('{xmdm}' = '', 1=1, xmdm = '{xmdm}')

GROUP BY xmdm
ORDER BY xmdm
/**
 * 数据项格式化
 * @param {String} value 数据项值
 * @param {Object} metaData 数据项信息
 * @param {Object} objDS 循环报表的单条数据
 * @param {Number} objDSIndex 循环报表的单条数据索引
*/
function(value,metaData,objDS,objDSIndex){
    if(metaData.info.text=='0Y1' || metaData.info.text=='0Y2' || metaData.info.text=='B'
     || metaData.info.text=='C' || metaData.info.text=='D' || metaData.info.text=='E'|| metaData.info.text=='F'
     || metaData.info.text=='GDFY' || metaData.info.text=='KBFY' || metaData.info.text=='I'){
       //value = JE.format(JE.toNum(value),'0,000.00');
       value = JE.format(JE.toNum(value)/10000,'0,000.00');
    }  
    if(metaData.info.text=='I3'){
        value = JE.format(JE.toNum(value),'0,000.00');
    }
    if(metaData.info.text=='KBFYZB'){
        value = JE.format(JE.toNum(value)*100,'000.00')+"%";
    }
    if(metaData.info.text=='yslb'){
        if(value == '1'){
            value = "存量";
        }else if(value == '2'){
            value = "新增";
        }
    }


    //========================================报表穿透
    var info = metaData.info;
    //销售合同穿透
   if(info.code == '556223c086a173300f70'){
       var ds = metaData.dataSource[info.formula.split('.')[0]];
       var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "0Y1";
        var jzsj_yf = data['jzsj_yf'];
        console.log(data);
        var je = data['0Y1'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_556223){
                window.__demo_report_click_556223 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" data-xmdm="'+xmdm+
           '" data-kmbm="'+kmbm+
           '"  data-jzsj_yfaa="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_556223(this)">'+value+'</span>';
       }
   }



    //内部合同穿透
    if(info.code == '042073ab399366800317'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "NBHT";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['NBHT'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_042073){
                window.__demo_report_click_042073 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdm="'+xmdm+
           '" data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_042073(this)">'+value+'</span>';
        }
    }


//回款金额穿透
 if(info.code == '6cf09a0df14ff98f1bbc'){
        debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        var kmbm = "0Y2";
        var xmdm = (data!=undefined) ? data['xmdm'] : '无';
        var jzsj_yf = (data!=undefined) ? data['jzsj_yf'] : '无';
        var je = (data!=undefined) ? data['0Y2'] : '0';

        if(je > 0 || je < 0){
            // debugger;
            // 全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_6cf09a){
                window.__demo_report_click_6cf09a = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbmaa');
                    var xmdm = dom.getAttribute('data-xmdmaa');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yfaa');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdmaa="'+xmdm+
           '"  data-kmbmaa="'+kmbm+
           '"  data-jzsj_yfaa="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_6cf09a(this)">'+value+'</span>';
       }
   }



    //外部收入穿透
    if(info.code == '2ecb2dfa28ce6c2d30a8'){
        // debugger;
       var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "B";
        var xmdm = (data!=undefined) ? data['xmdm'] : '无';
        var jzsj_yf = (data!=undefined) ? data['jzsj_yf'] : '无';
        var je = (data!=undefined) ? data['B'] : '0';

        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_2ecb2d){
                window.__demo_report_click_2ecb2d = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息"'+
           '  data-xmdm="'+xmdm+
           '"  data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_2ecb2d(this)">'+value+'</span>';
        }
    }

    //内部收入穿透
    if(info.code == '778d15d7d8226bbaf5a2'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "C";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['C'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_778d15){
                window.__demo_report_click_778d15 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           '  data-xmdm="'+xmdm+
           '"  data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_778d15(this)">'+value+'</span>';
       }
   }


    //内部费用穿透
    if(info.code == '4e4d3039f38c37532c6c'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "D";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['D'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_4e4d30){
                window.__demo_report_click_4e4d30 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdm="'+xmdm+
           '"  data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_4e4d30(this)">'+value+'</span>';
        }
    }


    //F穿透
    if(info.code == 'b70713b10fb3b8618f5f'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "F";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['F'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_b70713){
                window.__demo_report_click_b70713 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('4f51b48a43dcfa2965db',{
                        title:'项目代码:'+xmdm+"   科目:"+kmbm,
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdm="'+xmdm+
           '"  data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_b70713(this)">'+value+'</span>';
       }
   }



    //固定费用穿透穿透
    if(info.code == 'f6b72d8240dbae1cad39'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "F"
        var kmsx = "01";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['GDFY'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_f6b72d){
                window.__demo_report_click_f6b72d = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var kmsx = dom.getAttribute('data-kmsx');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('fc07b41af4cc218c2083',{
                        title:'项目代码:'+xmdm+"   科目:"+"固定费用",
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,kmsx:kmsx,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdm="'+xmdm+
           '" data-kmsx="'+kmsx+
           '"  data-kmbm="'+kmbm+
           '" data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_f6b72d(this)">'+value+'</span>';
        }
    }


    //可变费用穿透穿透
    if(info.code == '5d9b4574c53efe2834ba'){
        // debugger;
        var ds = metaData.dataSource[info.formula.split('.')[0]];
        var data = ds[metaData.rowIndex-3];//rowIndex -3 中 3 这个数字需要根据实际报表表头行数不同进行更改
        if(data==undefined){
            return value;
        }
        var xmdm = data['xmdm'];
        var kmbm = "F"
        var kmsx = "02";
        var jzsj_yf = data['jzsj_yf'];
        var je = data['GDFY'];
        if(je > 0 || je < 0){
            //全局静态方法,也可以写在“脚本编辑器”里.方法修改后需要刷新页面才能生效!
            if(!window.__demo_report_click_5d9b45){
                window.__demo_report_click_5d9b45 = function(dom){
                    debugger;
                    var kmbm = dom.getAttribute('data-kmbm');
                    var kmsx = dom.getAttribute('data-kmsx');
                    var xmdm = dom.getAttribute('data-xmdm');
                    var jzsj_yf = dom.getAttribute('data-jzsj_yf');
                    JE.showReport('fc07b41af4cc218c2083',{
                        title:'项目代码:'+xmdm+"   科目:",
                        width:1200,
                        height:850,
                        params:{kmbm:kmbm,kmsx:kmsx,xmdm:xmdm,jzsj:jzsj_yf}
                    })
                };
            }
           value = '<span style="color:blue;cursor: pointer;text-decoration: underline;" '+
           'title="查看详细信息" '+
           'data-xmdm="'+xmdm+
           '" data-kmsx="'+kmsx+
           '" data-kmbm="'+kmbm+
           '"  data-jzsj_yf="'+jzsj_yf+'"  '+
           'onclick="__demo_report_click_5d9b45(this)">'+value+'</span>';
        }
    } 
    return value;
}

关键字,相关问题

  • 报表格式化显示数据
  • 报表穿透
  • 报表过滤
最后编辑: 肖海杰  文档更新时间: 2024-07-05 09:35   作者:肖海杰