diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java index 7c86b8ab5..abff05498 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioGratuidadeARTESP.java @@ -7,6 +7,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.log4j.Logger; + import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioGratuidadeARTESPBean; @@ -17,6 +19,7 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; public class RelatorioGratuidadeARTESP extends Relatorio { private List lsDadosRelatorio; + private static Logger log = Logger.getLogger(RelatorioGratuidadeARTESP.class); public RelatorioGratuidadeARTESP(Map parametros, Connection conexao) throws Exception { super(parametros, conexao); @@ -25,79 +28,85 @@ public class RelatorioGratuidadeARTESP extends Relatorio { @Override public void initDados() throws Exception { - - Connection conexao = this.relatorio.getConexao(); - - Map parametros = this.relatorio.getParametros(); - - String fecInicioVenda = null; - if (parametros.get("fecInicioVenda") != null) { - fecInicioVenda = parametros.get("fecInicioVenda").toString() + " 00:00:00"; - } - String fecFinalVenda = null; - if (parametros.get("fecFinalVenda") != null) { - fecFinalVenda = parametros.get("fecFinalVenda").toString() + " 23:59:59"; - } - - String tipGratuIds = parametros.get("tipGratuIds").toString(); - String linhaIds = parametros.get("linhaIds").toString(); - String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : ""; - String codOrgaoConcedente = parametros.get("CodOrgaoConcedente").toString(); - - String sql = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa, codOrgaoConcedente); - - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); - NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); - - if (fecInicioVenda != null) { - stmt.setTimestamp("fecInicioVenda", new java.sql.Timestamp(sdf.parse(fecInicioVenda).getTime())); - } - - if (fecFinalVenda != null) { - stmt.setTimestamp("fecFinalVenda", new java.sql.Timestamp(sdf.parse(fecFinalVenda).getTime())); - } - - if (empresa != null && !empresa.equals("")) { - stmt.setInt("empresa_id", Integer.parseInt(empresa)); - } + try { + Connection conexao = this.relatorio.getConexao(); + + Map parametros = this.relatorio.getParametros(); + + String fecInicioVenda = null; + if (parametros.get("fecInicioVenda") != null) { + fecInicioVenda = parametros.get("fecInicioVenda").toString() + " 00:00:00"; + } + String fecFinalVenda = null; + if (parametros.get("fecFinalVenda") != null) { + fecFinalVenda = parametros.get("fecFinalVenda").toString() + " 23:59:59"; + } + + String tipGratuIds = parametros.get("tipGratuIds").toString(); + String linhaIds = parametros.get("linhaIds").toString(); + String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : ""; + String codOrgaoConcedente = parametros.get("CodOrgaoConcedente").toString(); + + String sql = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa, codOrgaoConcedente); + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + + if (fecInicioVenda != null) { + stmt.setTimestamp("fecInicioVenda", new java.sql.Timestamp(sdf.parse(fecInicioVenda).getTime())); + } + + if (fecFinalVenda != null) { + stmt.setTimestamp("fecFinalVenda", new java.sql.Timestamp(sdf.parse(fecFinalVenda).getTime())); + } + + if (empresa != null && !empresa.equals("")) { + stmt.setInt("empresa_id", Integer.parseInt(empresa)); + } + + if (codOrgaoConcedente != null) { + stmt.setString("codOrgaoConcedente", codOrgaoConcedente); + } + + ResultSet rset = null; + + rset = stmt.executeQuery(); + + lsDadosRelatorio = new ArrayList(); + + while (rset.next()) { + RelatorioGratuidadeARTESPBean bean = new RelatorioGratuidadeARTESPBean(); + + bean.setCodEmpresa(rset.getInt("empresa")); + bean.setOrgao(rset.getString("ORGAO")); + bean.setDataViagem(rset.getString("dataViagem")); + bean.setHoraViagem(rset.getString("horaViagem")); + bean.setCodOrigem(rset.getString("codOrigem")); + bean.setDescOrigem(rset.getString("descOrigem")); + bean.setCodDestino(rset.getString("codDestino")); + bean.setDescDestino(rset.getString("descDestino")); + bean.setPoltrona(rset.getString("poltrona")); + bean.setLinha(rset.getString("linha")); + bean.setNumBilhete(rset.getString("numBilhete")); + bean.setNomeIdoso(rset.getString("NOMBPASAJERO")); + bean.setRG(rset.getString("RG")); + bean.setCPF(rset.getString("CPF")); + bean.setTelEmail(rset.getString("telEmail")); + bean.setEndereco(rset.getString("endereco")); + bean.setDesistencia(rset.getBoolean("desistencia")); + bean.setVlrGratuidade(rset.getBigDecimal("vlrGratuidade")); + + lsDadosRelatorio.add(bean); + } + + if (lsDadosRelatorio.size() > 0) { + setLsDadosRelatorio(lsDadosRelatorio); + } - if (codOrgaoConcedente != null) { - stmt.setString("codOrgaoConcedente", codOrgaoConcedente); - } - - ResultSet rset = null; - - rset = stmt.executeQuery(); - - lsDadosRelatorio = new ArrayList(); - - while (rset.next()) { - RelatorioGratuidadeARTESPBean bean = new RelatorioGratuidadeARTESPBean(); - - bean.setCodEmpresa(rset.getInt("empresa")); - bean.setOrgao(rset.getString("ORGAO")); - bean.setDataViagem(rset.getString("dataViagem")); - bean.setHoraViagem(rset.getString("horaViagem")); - bean.setCodOrigem(rset.getString("codOrigem")); - bean.setDescOrigem(rset.getString("descOrigem")); - bean.setCodDestino(rset.getString("codDestino")); - bean.setDescDestino(rset.getString("descDestino")); - bean.setPoltrona(rset.getString("poltrona")); - bean.setLinha(rset.getString("linha")); - bean.setNumBilhete(rset.getString("numBilhete")); - bean.setNomeIdoso(rset.getString("NOMBPASAJERO")); - bean.setRG(rset.getString("RG")); - bean.setCPF(rset.getString("CPF")); - bean.setTelEmail(rset.getString("telEmail")); - bean.setEndereco(rset.getString("endereco")); - bean.setDesistencia(rset.getBoolean("desistencia")); - bean.setVlrGratuidade(rset.getBigDecimal("vlrGratuidade")); - - lsDadosRelatorio.add(bean); - } - - if (lsDadosRelatorio.size() > 0) { - setLsDadosRelatorio(lsDadosRelatorio); + } catch (Exception e) { + log.error("Erro na geração do relatorio ARTESP: \n" + e); + e.printStackTrace(); + throw e; } } }); diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper index cc1863c49..fc5c000a5 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml index c76dfd578..f3e01d223 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioGratuidadeARTESP.jrxml @@ -1,12 +1,8 @@ - - - - - + - + @@ -15,9 +11,6 @@ - - - @@ -35,103 +28,80 @@ - - - - - - - - + - + " + $P{TITULO} + ""]]> - - - - - - - - - - - - - - + - + + + + + + + + + - - - + + + + - + - - + + - + + + + + - - + + - - - - - + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -143,7 +113,7 @@ - + @@ -152,70 +122,10 @@ - + - - - - - - - - - - - - - - - - - - - - - - " + $R{detail.poltrona} + ""]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -227,31 +137,7 @@ - - - - - - - - - - - - - - - - - - - - - - " + $R{detail.desistencia} + ""]]> - - - + @@ -264,7 +150,103 @@ " + $R{detail.gratuidade} + ""]]> - + + + + + + + + + + " + $R{detail.desistencia} + ""]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -276,7 +258,7 @@ - + @@ -287,23 +269,24 @@ - - - - - - - + + + + + + + + + + + " + $R{detail.poltrona} + ""]]> - - - - + - + @@ -315,7 +298,7 @@ " + $F{descOrigem} + ""]]> - + @@ -327,7 +310,7 @@ " + $F{descDestino} + ""]]> - + @@ -339,7 +322,7 @@ - + @@ -351,7 +334,7 @@ - + @@ -363,7 +346,7 @@ - + @@ -375,7 +358,7 @@ " + $F{linha} + ""]]> - + @@ -387,7 +370,7 @@ - + @@ -399,7 +382,7 @@ " + $F{nomeIdoso} + ""]]> - + @@ -411,7 +394,7 @@ " + $F{RG} + ""]]> - + @@ -423,7 +406,7 @@ " + $F{CPF} + ""]]> - + @@ -435,7 +418,7 @@ " + $F{endereco} + ""]]> - + @@ -447,7 +430,7 @@ " + ($F{desistencia} == true ? "SIM" : "NÃO") + ""]]> - + @@ -457,11 +440,10 @@ - " + $F{vlrGratuidade} + ""]]> + " + $F{vlrGratuidade} + ""]]> - + @@ -473,7 +455,7 @@ " + $F{numBilhete} + ""]]> - + @@ -486,13 +468,10 @@ - - - - +