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;
import java.sql.Connection;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
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.RelatorioVendasPacotesBoletosBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioVendasPacotesBoletosBean.RelatorioVendasPacotesBoletosItemBean;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioVendasPacotesBoletos extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioVendasPacotesBoletos.class);
@ -28,8 +27,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
private List<RelatorioVendasPacotesBoletosBean> lsDadosRelatorio;
private Date fecInicio;
private Date fecFinal;
private Timestamp fecInicio;
private Timestamp fecFinal;
private Integer empresaId;
private Integer origenId;
private Integer destinoId;
@ -45,8 +44,8 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
@Override
public void initDados() throws Exception {
Map<String, Object> parametros = this.relatorio.getParametros();
fecInicio = new java.sql.Date(sdf.parse(parametros.get("fecInicio").toString()).getTime());
fecFinal = new java.sql.Date(sdf.parse(parametros.get("fecFinal").toString()).getTime());
fecInicio = new java.sql.Timestamp(sdf.parse(parametros.get("fecInicio").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;
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;
@ -146,10 +145,6 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
relatorioVendasPacotesBoletosBean.setDescorigen(rset.getString("origem"));
relatorioVendasPacotesBoletosBean.setCvedestino(rset.getString("cvedestino"));
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;
}
@ -207,10 +202,10 @@ public class RelatorioVendasPacotesBoletos extends Relatorio {
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
if(fecInicio != null) {
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(DateUtil.inicioFecha(fecInicio).getTime()));
stmt.setTimestamp("fecInicio", fecInicio);
}
if(fecFinal != null) {
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(DateUtil.fimFecha(fecFinal).getTime()));
stmt.setTimestamp("fecFinal", fecFinal);
}
if (empresaId != null && empresaId > 0){
stmt.setInt("empresaId", empresaId);

View File

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

View File

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

View File

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

View File

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