ireort笔记
??sql.append(sqlOne);
??
??sql.append(" and begin_date >= to_date('"+qDate+"','yyyy-MM') and begin_date < add_months(to_date('"+qDate+"','yyyy-MM'),1)");
??sql.append(" and end_date >= to_date('"+qDate+"','yyyy-MM') and end_date < add_months(to_date('"+qDate+"','yyyy-MM'),1) ");
??
??
??params.put("paramsStr", sql.toString());
??
??Connection connection=this.salesAccountCommissionDAO.getHibernateConnection();
??File business_rpt = new File(request.getSession().getServletContext().getRealPath("/")+"/reports/salaryCalculationRDetailReport.jasper");
??
??JasperPrint jasperPrint = null;
??try {
???jasperPrint = JasperFillManager.fillReport(business_rpt.getPath(),
?????params, connection);
??} catch (JRException e) {
???e.printStackTrace();
??}
??JRExporter exporter = null;
??
??exporter = new JRXlsExporter();
??response.setContentType("application/vnd.ms-excel;charset=gb2312");
??//where referee_code in( $P{refereelistString}) and? to_char(salary_date,'yyyy-MM')= $P{qDate}
??
??exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
??exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "GBK");
??exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE); // 删除记录最下面的空行
??OutputStream ouputStream = response.getOutputStream();?
??
??
??exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
??exporter.exportReport();
??//ouputStream.close();?
??
??
??return null;