我正在報告,使用參數: Start date
,end date
和type
(其可以是:輸入,輸出或輸入和輸出)。直到我試圖讓該得到的輸入和輸出傳爲碧玉雙參數的報告
我試過它在許多方面的報告,我不能得到的結果
,一切工作正常。
查詢在報告:
的Java:
protected void relEntrada(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
SessionImplementor sim = (SessionImplementor) HibernateUtil.getSessionFactory().openSession();
Connection con = sim.connection();
String tipoMov = 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();
}
}
有人能幫助我嗎?
你的問題是什麼? –
我得到的結果只有輸入,輸出總和的結果,但我無法得到輸入和輸出的結果......你會怎麼做? – sounobre