wilian 2016-06-17 20:44:51 +00:00
parent 689f8912ef
commit 7e86af5aef
5 changed files with 34 additions and 39 deletions

View File

@ -1,25 +1,24 @@
package com.rjconsultores.ventaboletos.relatorios.impl; package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasPacotesBoletos extends Relatorio { public class RelatorioVendasPacotesBoletos extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasPacotesBoletos.class); private static Logger log = Logger.getLogger(RelatorioVendasPacotesBoletos.class);
@ -28,8 +27,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
private List<RelatorioVendasPacotesBoletosBean> lsDadosRelatorio; private List<RelatorioVendasPacotesBoletosBean> lsDadosRelatorio;
private Date fecInicio; private Timestamp fecInicio;
private Date fecFinal; private Timestamp fecFinal;
private Integer empresaId; private Integer empresaId;
private Integer origenId; private Integer origenId;
private Integer destinoId; private Integer destinoId;
@ -45,8 +44,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
@Override @Override
public void initDados() throws Exception { public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros(); Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime()); fecInicio = new java.sql.Timestamp(sdf.parse(parametros.get("fecInicio").toString()).getTime());
fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime()); fecFinal = new java.sql.Timestamp(sdf.parse(parametros.get("fecFinal").toString()).getTime());
empresaId = parametros.get("empresaId") != null && !parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null; empresaId = parametros.get("empresaId") != null && !parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null;
origenId = parametros.get("origenId") != null && !parametros.get("origenId").equals("null") ? Integer.valueOf(parametros.get("origenId").toString()) : null; origenId = parametros.get("origenId") != null && !parametros.get("origenId").equals("null") ? Integer.valueOf(parametros.get("origenId").toString()) : null;
destinoId = parametros.get("destinoId") != null && !parametros.get("destinoId").equals("null") ? Integer.valueOf(parametros.get("destinoId").toString()) : null; destinoId = parametros.get("destinoId") != null && !parametros.get("destinoId").equals("null") ? Integer.valueOf(parametros.get("destinoId").toString()) : null;
@ -146,10 +145,6 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
relatorioVendasPacotesBoletosBean.setDescorigen(rset.getString("origem")); relatorioVendasPacotesBoletosBean.setDescorigen(rset.getString("origem"));
relatorioVendasPacotesBoletosBean.setCvedestino(rset.getString("cvedestino")); relatorioVendasPacotesBoletosBean.setCvedestino(rset.getString("cvedestino"));
relatorioVendasPacotesBoletosBean.setCveorigen(rset.getString("cveorigem")); relatorioVendasPacotesBoletosBean.setCveorigen(rset.getString("cveorigem"));
/*relatorioVendasPacotesBoletosBean.setTotais(new ArrayList<RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemTotaisBean>());
relatorioVendasPacotesBoletosBean.getTotais().add(relatorioVendasPacotesBoletosBean.new RelatorioVendasPacotesBoletosItemTotaisBean("CWB-MOR","ADULTO",2));
relatorioVendasPacotesBoletosBean.getTotais().add(relatorioVendasPacotesBoletosBean.new RelatorioVendasPacotesBoletosItemTotaisBean("CWB-MOR","CHD",2));
relatorioVendasPacotesBoletosBean.getTotais().add(relatorioVendasPacotesBoletosBean.new RelatorioVendasPacotesBoletosItemTotaisBean("MOR-CWB","SEGURO",2));*/
return relatorioVendasPacotesBoletosBean; return relatorioVendasPacotesBoletosBean;
} }
@ -207,10 +202,10 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) { if(fecInicio != null) {
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(DateUtil.inicioFecha(fecInicio).getTime())); stmt.setTimestamp("fecInicio", fecInicio);
} }
if(fecFinal != null) { if(fecFinal != null) {
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(DateUtil.fimFecha(fecFinal).getTime())); stmt.setTimestamp("fecFinal", fecFinal);
} }
if (empresaId != null && empresaId > 0){ if (empresaId != null && empresaId > 0){
stmt.setInt("empresaId", empresaId); stmt.setInt("empresaId", empresaId);

View File

@ -1,16 +1,14 @@
package com.rjconsultores.ventaboletos.relatorios.impl; package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe; import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe;
@ -18,8 +16,11 @@ import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesDetalhadoBean; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesDetalhadoBean;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasPacotesDetalhado extends Relatorio { public class RelatorioVendasPacotesDetalhado extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasPacotesDetalhado.class); private static Logger log = Logger.getLogger(RelatorioVendasPacotesDetalhado.class);
@ -28,8 +29,8 @@ public class RelatorioVendasPacotesDetalhado extends Relatorio {
private List<RelatorioVendasPacotesDetalhadoBean> lsDadosRelatorio; private List<RelatorioVendasPacotesDetalhadoBean> lsDadosRelatorio;
private Date fecInicio; private Timestamp fecInicio;
private Date fecFinal; private Timestamp fecFinal;
private Integer empresaId; private Integer empresaId;
private Integer pacoteId; private Integer pacoteId;
private Integer origenId; private Integer origenId;
@ -44,8 +45,8 @@ public class RelatorioVendasPacotesDetalhado extends Relatorio {
@Override @Override
public void initDados() throws Exception { public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros(); Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime()); fecInicio = new java.sql.Timestamp(DateUtil.inicioFecha(sdf.parse(parametros.get("fecInicio").toString())).getTime());
fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime()); fecFinal = new java.sql.Timestamp(DateUtil.fimFecha(sdf.parse(parametros.get("fecFinal").toString())).getTime());
empresaId = parametros.get("empresaId") != null && !parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null; empresaId = parametros.get("empresaId") != null && !parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null;
pacoteId = parametros.get("pacoteId") != null && !parametros.get("pacoteId").equals("null") ? Integer.valueOf(parametros.get("pacoteId").toString()) : null; pacoteId = parametros.get("pacoteId") != null && !parametros.get("pacoteId").equals("null") ? Integer.valueOf(parametros.get("pacoteId").toString()) : null;
origenId = parametros.get("origenId") != null && !parametros.get("origenId").equals("null") ? Integer.valueOf(parametros.get("origenId").toString()) : null; origenId = parametros.get("origenId") != null && !parametros.get("origenId").equals("null") ? Integer.valueOf(parametros.get("origenId").toString()) : null;
@ -74,10 +75,10 @@ public class RelatorioVendasPacotesDetalhado extends Relatorio {
stmt = new NamedParameterStatement(conexao, sql); stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) { if(fecInicio != null) {
stmt.setDate("fecInicio", fecInicio); stmt.setTimestamp("fecInicio", fecInicio);
} }
if(fecFinal != null) { if(fecFinal != null) {
stmt.setDate("fecFinal", fecFinal); stmt.setTimestamp("fecFinal", fecFinal);
} }
if (empresaId != null && empresaId > 0){ if (empresaId != null && empresaId > 0){
stmt.setInt("empresaId", empresaId); stmt.setInt("empresaId", empresaId);

View File

@ -1,23 +1,24 @@
package com.rjconsultores.ventaboletos.relatorios.impl; package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesResumidoBean; import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesResumidoBean;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasPacotesResumido extends Relatorio { public class RelatorioVendasPacotesResumido extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasPacotesResumido.class); private static Logger log = Logger.getLogger(RelatorioVendasPacotesResumido.class);
@ -26,8 +27,8 @@ public class RelatorioVendasPacotesResumido extends Relatorio {
private List<RelatorioVendasPacotesResumidoBean> lsDadosRelatorio; private List<RelatorioVendasPacotesResumidoBean> lsDadosRelatorio;
private Date fecInicio; private Timestamp fecInicio;
private Date fecFinal; private Timestamp fecFinal;
private Integer empresaId; private Integer empresaId;
public RelatorioVendasPacotesResumido(Map<String, Object> parametros, Connection conexao) throws Exception { public RelatorioVendasPacotesResumido(Map<String, Object> parametros, Connection conexao) throws Exception {
@ -37,8 +38,8 @@ public class RelatorioVendasPacotesResumido extends Relatorio {
@Override @Override
public void initDados() throws Exception { public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros(); Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime()); fecInicio = new java.sql.Timestamp(DateUtil.inicioFecha(sdf.parse(parametros.get("fecInicio").toString())).getTime());
fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime()); fecFinal = new java.sql.Timestamp(DateUtil.fimFecha(sdf.parse(parametros.get("fecFinal").toString())).getTime());
empresaId = parametros.get("empresaId") != null && parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null; empresaId = parametros.get("empresaId") != null && parametros.get("empresaId").equals("null") ? Integer.valueOf(parametros.get("empresaId").toString()) : null;
Connection conexao = this.relatorio.getConexao(); Connection conexao = this.relatorio.getConexao();
@ -62,12 +63,12 @@ public class RelatorioVendasPacotesResumido extends Relatorio {
stmt = new NamedParameterStatement(conexao, sql); stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) { if(fecInicio != null) {
stmt.setDate("fecInicio", fecInicio); stmt.setTimestamp("fecInicio", fecInicio);
} }
if(fecFinal != null) { if(fecFinal != null) {
stmt.setDate("fecFinal", fecFinal); stmt.setTimestamp("fecFinal", fecFinal);
} }
if (empresaId != null){ if (empresaId != null && empresaId > 0){
stmt.setInt("empresaId", empresaId); stmt.setInt("empresaId", empresaId);
} }
@ -115,10 +116,10 @@ public class RelatorioVendasPacotesResumido extends Relatorio {
stmt = new NamedParameterStatement(conexao, sql); stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) { if(fecInicio != null) {
stmt.setDate("fecInicio", fecInicio); stmt.setTimestamp("fecInicio", fecInicio);
} }
if(fecFinal != null) { if(fecFinal != null) {
stmt.setDate("fecFinal", fecFinal); stmt.setTimestamp("fecFinal", fecFinal);
} }
if (empresaId != null){ if (empresaId != null){
stmt.setInt("empresaId", empresaId); stmt.setInt("empresaId", empresaId);

View File

@ -79,9 +79,7 @@ public class RelatorioVendasPacotesBoletosController extends MyGenericForwardCom
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = new ArrayList<Empresa>(); lsEmpresa = empresaService.obtenerTodosIncluindoEmpresaTodas();
lsEmpresa.add(new Empresa(-1, "TODAS"));
lsEmpresa.addAll(empresaService.obtenerTodos());
lsTipoTarifaPacote = new ArrayList<TipoTarifaPacote>(); lsTipoTarifaPacote = new ArrayList<TipoTarifaPacote>();
lsTipoTarifaPacote.add(new TipoTarifaPacote(-1, "TODAS")); lsTipoTarifaPacote.add(new TipoTarifaPacote(-1, "TODAS"));

View File

@ -51,7 +51,7 @@ public class RelatorioVendasPacotesResumidoController extends MyGenericForwardCo
@Override @Override
public void doAfterCompose(Component comp) throws Exception { public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos(); lsEmpresa = empresaService.obtenerTodosIncluindoEmpresaTodas();
super.doAfterCompose(comp); super.doAfterCompose(comp);
} }