diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoBilhetes.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoBilhetes.java new file mode 100644 index 000000000..827b205b8 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoBilhetes.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +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.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioObservacaoBilhetes extends Relatorio { + + private static Logger log = Logger.getLogger(RelatorioObservacaoBilhetes.class); + private Integer empresaId; + private Integer puntoventaId; + private Date dataInicial; + private Date dataFinal; + + public RelatorioObservacaoBilhetes(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + Connection conexao = this.relatorio.getConexao(); + definirFiltros(this.relatorio.getParametros()); + List lsDadosRelatorio = processarRelatorio(conexao); + setLsDadosRelatorio(lsDadosRelatorio); + } + }); + } + + private List processarRelatorio(Connection conexao) throws ParseException { + List lsDadosRelatorio = new ArrayList(); + ResultSet rset = null; + NamedParameterStatement stmt = null; + try { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT PV.NOMBPUNTOVENTA, C.DATAMOVIMENTO, LOG.STATUS, LOG.OBSERVACAO, B.NUMFOLIOSISTEMA, CAT.DESCCATEGORIA, LOG.PRECO, LOG.FECMODIF, LOG.INDCREDITO, B.TIPOVENTA_ID, U.NOMBUSUARIO ") + .append("FROM LOG_CONFERENCIA LOG ") + .append("INNER JOIN CONFERENCIA C ON C.CONFERENCIA_ID = LOG.CONFERENCIA_ID ") + .append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = C.EMPRESA_ID ") + .append("INNER JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append("INNER JOIN USUARIO U ON U.USUARIO_ID = LOG.USUARIO_ID ") + .append("INNER JOIN BOLETO B ON B.BOLETO_ID = LOG.BOLETO_ID ") + .append("INNER JOIN CATEGORIA CAT ON CAT.CATEGORIA_ID = B.CATEGORIA_ID ") + .append("WHERE LOG.ACTIVO = 1 ") + .append("AND C.DATAMOVIMENTO BETWEEN :dataInicial AND :dataFinal "); + + if(empresaId != null) { + sQuery.append("AND C.EMPRESA_ID = :empresaId "); + } + + if(puntoventaId != null) { + sQuery.append("AND PV.PUNTOVENTA_ID = :puntoventaId "); + } + + sQuery.append("ORDER BY C.DATAMOVIMENTO"); + + log.info(sQuery.toString()); + + stmt = new NamedParameterStatement(conexao, sQuery.toString()); + if(empresaId != null) { + stmt.setInt("empresaId", empresaId); + } + + if(puntoventaId != null) { + stmt.setInt("puntoventaId", puntoventaId); + } + stmt.setDate("dataInicial", new java.sql.Date(dataInicial.getTime())); + stmt.setDate("dataFinal", new java.sql.Date(dataFinal.getTime())); + + rset = stmt.executeQuery(); + + while (rset.next()) { + LogConferenciaVO logConferencia = new LogConferenciaVO(); + logConferencia.setDatamovimento(rset.getDate("datamovimento")); + logConferencia.setNombpuntoventa(rset.getString("nombpuntoventa")); + logConferencia.setStatus(rset.getInt("status")); + logConferencia.setNumfoliosistema(rset.getString("numfoliosistema")); + logConferencia.setTipoventa(rset.getInt("tipoventa_id")); + logConferencia.setObservacao(rset.getString("observacao")); + logConferencia.setDesccategoria(rset.getString("desccategoria")); + logConferencia.setFecmodif(rset.getDate("fecmodif")); + logConferencia.setIndcredito(rset.getBoolean("indcredito")); + logConferencia.setNombusuario(rset.getString("nombusuario")); + logConferencia.setPreco(rset.getBigDecimal("preco")); + + lsDadosRelatorio.add(logConferencia); + } + + return lsDadosRelatorio; + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if(rset != null) { + rset.close(); + } + if(stmt != null) { + stmt.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + return null; + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + } + + @Override + protected void processaParametros() throws Exception { + } + + private void definirFiltros(Map parametros) throws ParseException { + Integer puntoventaId = (Integer) parametros.get("puntoventaId"); + Integer empresaId = (Integer) parametros.get("empresaId"); + this.dataInicial = (Date) parametros.get("dataFiltroInicial"); + this.dataFinal = (Date) parametros.get("dataFiltroFinal"); + + if(empresaId != null) { + this.empresaId = empresaId; + } + if(puntoventaId != null) { + this.puntoventaId = puntoventaId; + } + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoEventosFinanceiros.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoEventosFinanceiros.java new file mode 100644 index 000000000..86f866e5f --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioObservacaoEventosFinanceiros.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +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.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioObservacaoEventosFinanceiros extends Relatorio { + + private static Logger log = Logger.getLogger(RelatorioObservacaoEventosFinanceiros.class); + private Integer empresaId; + private Integer puntoventaId; + private Date dataInicial; + private Date dataFinal; + + public RelatorioObservacaoEventosFinanceiros(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + + this.setCustomDataSource(new DataSource(this) { + @Override + public void initDados() throws Exception { + Connection conexao = this.relatorio.getConexao(); + definirFiltros(this.relatorio.getParametros()); + List lsDadosRelatorio = processarRelatorio(conexao); + setLsDadosRelatorio(lsDadosRelatorio); + } + }); + } + + private List processarRelatorio(Connection conexao) throws ParseException { + List lsDadosRelatorio = new ArrayList(); + ResultSet rset = null; + NamedParameterStatement stmt = null; + try { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT PV.NOMBPUNTOVENTA, C.DATAMOVIMENTO, LOG.STATUS, LOG.OBSERVACAO, EE.DESCINFO, TEE.DESCTIPOEVENTO, LOG.PRECO, LOG.FECMODIF, LOG.INDCREDITO, U.NOMBUSUARIO ") + .append("FROM LOG_CONFERENCIA LOG ") + .append("INNER JOIN CONFERENCIA C ON C.CONFERENCIA_ID = LOG.CONFERENCIA_ID ") + .append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = C.EMPRESA_ID ") + .append("INNER JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append("INNER JOIN USUARIO U ON U.USUARIO_ID = LOG.USUARIO_ID ") + .append("INNER JOIN EVENTO_EXTRA EE ON EE.EVENTOEXTRA_ID = LOG.EVENTOEXTRA_ID ") + .append("INNER JOIN TIPO_EVENTO_EXTRA TEE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("WHERE LOG.ACTIVO = 1 ") + .append("AND C.DATAMOVIMENTO BETWEEN :dataInicial AND :dataFinal "); + + if(empresaId != null) { + sQuery.append("AND C.EMPRESA_ID = :empresaId "); + } + + if(puntoventaId != null) { + sQuery.append("AND PV.PUNTOVENTA_ID = :puntoventaId "); + } + + sQuery.append("ORDER BY C.DATAMOVIMENTO"); + + log.info(sQuery.toString()); + + stmt = new NamedParameterStatement(conexao, sQuery.toString()); + if(empresaId != null) { + stmt.setInt("empresaId", empresaId); + } + + if(puntoventaId != null) { + stmt.setInt("puntoventaId", puntoventaId); + } + stmt.setDate("dataInicial", new java.sql.Date(dataInicial.getTime())); + stmt.setDate("dataFinal", new java.sql.Date(dataFinal.getTime())); + + rset = stmt.executeQuery(); + + while (rset.next()) { + LogConferenciaVO logConferencia = new LogConferenciaVO(); + logConferencia.setDatamovimento(rset.getDate("datamovimento")); + logConferencia.setNombpuntoventa(rset.getString("nombpuntoventa")); + logConferencia.setStatus(rset.getInt("status")); + logConferencia.setDescinfoevento(rset.getString("descinfo")); + logConferencia.setDesctipoevento(rset.getString("desctipoevento")); + logConferencia.setObservacao(rset.getString("observacao")); + logConferencia.setFecmodif(rset.getDate("fecmodif")); + logConferencia.setIndcredito(rset.getBoolean("indcredito")); + logConferencia.setNombusuario(rset.getString("nombusuario")); + logConferencia.setPreco(rset.getBigDecimal("preco")); + + lsDadosRelatorio.add(logConferencia); + } + + return lsDadosRelatorio; + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if(rset != null) { + rset.close(); + } + if(stmt != null) { + stmt.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + return null; + } + + public void setLsDadosRelatorio(List lsDadosRelatorio) { + this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio)); + } + + @Override + protected void processaParametros() throws Exception { + } + + private void definirFiltros(Map parametros) throws ParseException { + Integer puntoventaId = (Integer) parametros.get("puntoventaId"); + Integer empresaId = (Integer) parametros.get("empresaId"); + this.dataInicial = (Date) parametros.get("dataFiltroInicial"); + this.dataFinal = (Date) parametros.get("dataFiltroFinal"); + + if(empresaId != null) { + this.empresaId = empresaId; + } + if(puntoventaId != null) { + this.puntoventaId = puntoventaId; + } + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_es.properties new file mode 100644 index 000000000..a46a76329 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_es.properties @@ -0,0 +1,27 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Observações Bilhetes +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.usuario=Usuário: +cabecalho.puntoventa=Punto Venta: +cabecalho.empresa=Empresa: +label.puntoventa=Punto Venta +label.usuario=Usuário +label.datamovimento=Data Mov. +label.statusDescricao=Situação +label.numfoliosistema=Nº Bilhete +label.desccategoria=Categoria +label.observacao=Observação +label.preco=Valor +label.debitoCredito=D/C +label.fecmodif=Dt. Alt. +label.tipoventa=Tipo Venta \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_pt_BR.properties new file mode 100644 index 000000000..a46a76329 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoBilhetes_pt_BR.properties @@ -0,0 +1,27 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Observações Bilhetes +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.usuario=Usuário: +cabecalho.puntoventa=Punto Venta: +cabecalho.empresa=Empresa: +label.puntoventa=Punto Venta +label.usuario=Usuário +label.datamovimento=Data Mov. +label.statusDescricao=Situação +label.numfoliosistema=Nº Bilhete +label.desccategoria=Categoria +label.observacao=Observação +label.preco=Valor +label.debitoCredito=D/C +label.fecmodif=Dt. Alt. +label.tipoventa=Tipo Venta \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_es.properties new file mode 100644 index 000000000..4d272ce34 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_es.properties @@ -0,0 +1,26 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Observações Eventos Financeiros +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.usuario=Usuário: +cabecalho.puntoventa=Punto Venta: +cabecalho.empresa=Empresa: +label.puntoventa=Punto Venta +label.usuario=Usuário +label.datamovimento=Data Mov. +label.statusDescricao=Situação +label.desctipoevento=Tipo Evento +label.descinfoevento=Evento Extra +label.observacao=Observação +label.preco=Valor +label.debitoCredito=D/C +label.fecmodif=Dt. Alt. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_pt_BR.properties new file mode 100644 index 000000000..4d272ce34 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioObservacaoEventosFinanceiros_pt_BR.properties @@ -0,0 +1,26 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + +#Labels cabeçalho +cabecalho.nome=Relatório Observações Eventos Financeiros +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: +cabecalho.usuario=Usuário: +cabecalho.puntoventa=Punto Venta: +cabecalho.empresa=Empresa: +label.puntoventa=Punto Venta +label.usuario=Usuário +label.datamovimento=Data Mov. +label.statusDescricao=Situação +label.desctipoevento=Tipo Evento +label.descinfoevento=Evento Extra +label.observacao=Observação +label.preco=Valor +label.debitoCredito=D/C +label.fecmodif=Dt. Alt. \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jasper new file mode 100644 index 000000000..259598331 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jrxml new file mode 100644 index 000000000..39ce40dfe --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioObservacaoBilhetes.jrxml @@ -0,0 +1,265 @@ + + + + + +