xinyb
2022-11-25 a8416958abc018d314b31c7b5e4c9b89779a92e3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%
  String parm=request.getParameter("parm");
  parm = parm!=null?parm.replaceAll("_pb","="):"";
  parm = parm!=null?parm.replaceAll("%","_th"):"";
  parm = parm!=null?parm.replaceAll("_fen","&"):"";
  //底下这几个为控制打印次数用到
  String format=request.getParameter("format");
  String reportId=request.getParameter("reportId");
  String formId=request.getParameter("formId");
  String formtype=request.getParameter("formtype");
  String doccode=request.getParameter("doccode");
  doccode=doccode.replaceAll("\"","");
  String urlAdd=("printformat="+format+"&reportId="+reportId+"&formId="+formId+"&formtype="+formtype+"&doccode="+doccode).replaceAll("&","_fen");//doccode=<a href=javascript:void(0);  onclick=top.addTab()
  String _print=request.getParameter("print");
  String Formats=request.getParameter("Formats");
  String daoqian="1";
  Formats=(Formats!=null&&!Formats.equals("null"))?Formats.replaceAll(",",";"):"html";//测试使用  
  String FlashVars="/printReport.do?m=xml&"+parm+"&printNum="+urlAdd +"&printLoad="+_print +"&Formats="+Formats +"&fetchSize=3&printFun="+daoqian+"&xAdd=5";//;
  //jrpxml 为获得报表路径   fetchSize 应该为查询页面大小比如一次查3页(但第一次总是为查询一页)
    //printNum=控制打印次数调用  printLoad=1 即加载就直接打印printFun=1为打印前执行回调函数
    //添加了xAdd参数 为控制报表宽度追加数,发现很多报表内容大于设置纸张宽度,那报表不至于显示滚动条加这参数,叫报表重设计改动麻烦 也就是为了显示一下,虽设置出错还是可以打印完整
    //如果不当当是显示问题,则必须改报表的还是请改报表,这参数只为显示需要
%>
<html>
<head>
<title>
Flash Viewer
</title>
<script type="text/javascript">
<%//必须的  必须与flash同时存在,为方便扩展而 写在外面,
//根据需要可以更改函数,避免去改flash编译文件
//   修改这里面的js方法 可以实现flash的不同效果
%>
var daoqian=<%=daoqian%>;
var cis=1;
var printFlash={
   close:function(){<%//关闭当前窗口%>
        parent.closeTab();
   },
   printBack:function(url,format,op,fun){<%//打印回调函数   1.打印url 2.打印格式(pdf,html,xls,rtf,xls....),3 op作为控制执行什么函数回调的判断%>
       var printNum=false;     
       switch(format){<%//页面控制是否执行回调 默认情况暂时是所有打印都回调执行%>
            case "pdf":
           printNum=true;
           break;
           default:               
          printNum=true;
          break;           
       }       
       if(isChrome()&&format="html"){        
           op=cis                
                  }
       if(printNum){           
            parent.$.post('setPrintNum.do?printfun='+op+'&'+url,'',function(d){//调用打印次数函数执行过程
                if(d!=""){
                     alert(d);
                }                
                if(typeof fun=='function'){
                    fun();
                }
            });
       }
   },
   reload:function(){<%//刷新 直接刷新页面 返回false:刷新但前页数据(不刷新页) %>
    var ret=true;
    if(1==1){<%//暂时 默认为刷新当前网页,不是当前页面 %>
         location.reload();
         ret= true;
    }else{ret=false;}
       return ret;
   },
   importPrint:function(u,url,format){<%//导出 1.导出执行url 2.回调执行url 3.执行的打印格式(参数需要处理)%>
      <% //format=u.substring(0,u.indexOf(".do"));%>
       format=format.substring(0,format.indexOf(".do"));
       if(daoqian==1){
           this.printBack(url,format,1,function(){
               parent.addTab(format+"导出报表","","","",u);<%//导出报表%>
               });<%//导出前执行回调   %>
       }else{
              parent.addTab(format+"导出报表","","","",u);<%//导出报表%>
       }
       this.printBack(url,format,0);<%//导出后执行回调%>
   }
}
function isChrome(){
    return navigator.userAgent.indexOf("Chrome") > -1;
}
</script>
</head>
<body bgcolor="white" topmargin="0" leftmargin="0">
<object width="100%" height="98%">
  <param name="movie" value="<%=FlashVars %>"/> 
  <embed src="flash_pb.swf"  FlashVars="<%=FlashVars %>" width="100%" height="98%"></embed>
</object>
</body>
</html>