ReportFormula.jsp 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <%@page import="java.text.Format"%>
  2. <%@page import="com.businessobjects12.prompting.objectmodel.common.Values"%>
  3. <%@page import="com.crystaldecisions.reports.queryengine.collections.Fields"%>
  4. <%@page import="com.businessobjects.reports.dpom.processingplan.Field"%>
  5. <%@page import="com.crystaldecisions.sdk.occa.report.data.ParameterFieldRangeValue"%>
  6. <%@page import="com.crystaldecisions.sdk.occa.report.data.ParameterFieldDiscreteValue"%>
  7. <%@page import="com.crystaldecisions.reports.queryengine.collections.ParameterValues"%>
  8. <%@page import="com.crystaldecisions.sdk.occa.report.data.ParameterField"%>
  9. <%@page import="com.crystaldecisions.reports.reportengineinterface.JPEReportSourceFactory"%>
  10. <%@page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSourceFactory2"%>
  11. <%@page import="com.crystaldecisions.sdk.occa.report.data.ConnectionInfos"%>
  12. <%@page import="com.crystaldecisions.sdk.occa.report.data.ConnectionInfo"%>
  13. <%@page import="com.crystaldecisions.sdk.occa.report.data.IConnectionInfo"%>
  14. <%@page import="com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"%>
  15. <%@page import="com.crystaldecisions.sdk.occa.report.lib.PropertyBag"%>
  16. <%@ page language="java" contentType="text/html; charset=utf-8"
  17. pageEncoding="utf-8"%>
  18. <%--database connection --%>
  19. <%--webreporting.jar --%>
  20. <%@page import="com.crystaldecisions.report.web.viewer.*" %>
  21. <%--jrcerom.jar --%>
  22. <%@ page import="com.crystaldecisions.reports.sdk.*" %>
  23. <%
  24. /*JRCResultDatasource jrcd = new JRCResultDatasource("view_report.rpt");
  25. if(!jrcd.isReportSourceInSession("reportSource",session)){
  26. response.sendRedirect("error.html");
  27. }*/
  28. // String path="salelist.rpt";
  29. //获取参数
  30. String reportName=request.getParameter("reportfile");
  31. //String reportName=(String)request.getAttribute("reportfile");
  32. String rcondition=request.getParameter("rcondition");
  33. System.out.println(reportName);
  34. System.out.println(rcondition);
  35. IReportSourceFactory2 rsf=new JPEReportSourceFactory();
  36. java.util.Locale localetest=java.util.Locale.CHINA;
  37. // IReportSource rptSource=(IReportSource)rsf.createReportSource(path, localetest);
  38. IReportSource rptSource=(IReportSource)rsf.createReportSource(reportName, localetest);
  39. ConnectionInfos conninfos=new ConnectionInfos();
  40. IConnectionInfo connInfo1=new ConnectionInfo();
  41. PropertyBag propertyBag=new PropertyBag();
  42. propertyBag.put("Database Class Name","oracle.jdbc.driver.OracleDriver");
  43. propertyBag.put("Connection URL","jdbc:oracle:thin:@192.168.253.111:1521:orcl");
  44. connInfo1.setUserName("uaserp600");
  45. connInfo1.setPassword("tx2x9saq");
  46. connInfo1.setAttributes(propertyBag);
  47. conninfos.add(connInfo1);
  48. CrystalReportViewer crViewer = new CrystalReportViewer();
  49. crViewer.setDatabaseLogonInfos(conninfos);
  50. crViewer.setOwnPage(true);
  51. crViewer.setOwnForm(true);
  52. crViewer.setEnableParameterPrompt(false);
  53. crViewer.setDisplayGroupTree(false);
  54. crViewer.setHasSearchButton(false);
  55. crViewer.setHasPrintButton(true);
  56. crViewer.setHasExportButton(true);
  57. crViewer.setHasLogo(false);
  58. crViewer.setGroupTreeWidth(0);
  59. crViewer.setDisplayGroupTree(false);
  60. //crViewer.getParameterFields()
  61. crViewer.setReportSource(rptSource); //reportSource=session.getAttribute("reportSource");
  62. // crViewer.setSelectionFormula("{sale.sa_id}='3267'");
  63. crViewer.setSelectionFormula(rcondition);
  64. //rptSource.refresh();
  65. crViewer.setPrintMode(CrPrintMode.ACTIVEX);
  66. crViewer.processHttpRequest(request,response,this.getServletConfig().getServletContext(),out);
  67. crViewer.refresh();
  68. //crViewer.dispose();
  69. //rptSource.dispose();
  70. %>
  71. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  72. <html>
  73. <head>
  74. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  75. <title>Insert title here</title>
  76. </head>
  77. <body>
  78. </body>
  79. </html>