I'm making a report that passes as parameters:
Start date, end date and type (which can be: input, output or input and output).
Everything works fine until I try to get the report that gets input and output ... I've tried it in many ways and I can not get results.
Query on Jasper.
Javacode:
protectedvoidrelEntrada(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{try{SessionImplementorsim=(SessionImplementor)HibernateUtil.getSessionFactory().openSession();Connectioncon=sim.connection();StringtipoMov=request.getParameter("tipMov");
String dataini = request.getParameter("dataini");
String dtini[] = dataini.split("/");
String diai = dtini[0];
String mesi = dtini[1];
String anoi = dtini[2];
String datafim = request.getParameter("datafim");
String dtfim[] = datafim.split("/");
String diaf = dtfim[0];
String mesf = dtfim[1];
String anof = dtfim[2];
HashMap param = new HashMap();
param.put("dataini", anoi +"-"+mesi+"-"+diai + " 00:00:00" );
param.put("datafim", anof +"-"+mesf+"-"+diaf + " 23:59:59" );
if (tipoMov.equalsIgnoreCase("entrada")) {
param.put("tipmov", "entrada" );
} else if(tipoMov.equalsIgnoreCase("saida")) {
param.put("tipmov", "saida" );
} //else if(tipoMov.equalsIgnoreCase("entradaesaida")) {
//param.put("tipmov", "entrada or tipo = "+'"'+"saida"+'"');
//}
InputStream arquivo = getServletContext().getResourceAsStream("/relatorios/RelMoviment.jasper");
byte[] pdf = JasperRunManager.runReportToPdf(arquivo, param ,con);
ServletOutputStream out = response.getOutputStream();
out.write(pdf);
out.flush();
} catch(Exception e) {
e.printStackTrace();
}
}