bug#10655
dev:veloso qua:junia git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@80668 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2586a3cad4
commit
b0d64b93e7
|
@ -28,14 +28,21 @@ public class RelatorioCorridas extends Relatorio {
|
||||||
|
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||||
|
|
||||||
|
Integer origem = (Integer) parametros.get("ORIGEN_ID");
|
||||||
|
Integer destino = (Integer) parametros.get("DESTINO_ID");
|
||||||
|
|
||||||
NamedParameterStatement nps = new NamedParameterStatement(conexao, getSql());
|
NamedParameterStatement nps = new NamedParameterStatement(conexao, getSql(origem, destino));
|
||||||
nps.setInt("numServico", (Integer) parametros.get("CORRIDA_ID"));
|
nps.setInt("numServico", (Integer) parametros.get("CORRIDA_ID"));
|
||||||
nps.setInt("empresaId", Integer.valueOf((String) parametros.get("EMPRESA_ID")));
|
nps.setInt("empresaId", Integer.valueOf((String) parametros.get("EMPRESA_ID")));
|
||||||
nps.setDate("inicioViagem", (java.sql.Date) parametros.get("DATA_DE"));
|
nps.setDate("inicioViagem", (java.sql.Date) parametros.get("DATA_DE"));
|
||||||
nps.setDate("fimViagem", (java.sql.Date) parametros.get("DATA_ATE"));
|
nps.setDate("fimViagem", (java.sql.Date) parametros.get("DATA_ATE"));
|
||||||
nps.setInt("origemId", (Integer) parametros.get("ORIGEN_ID"));
|
if (origem != -1) {
|
||||||
nps.setInt("destinoId", (Integer) parametros.get("DESTINO_ID"));
|
nps.setInt("origemId", (Integer) parametros.get("ORIGEN_ID"));
|
||||||
|
}
|
||||||
|
if (destino != -1) {
|
||||||
|
nps.setInt("destinoId", (Integer) parametros.get("DESTINO_ID"));
|
||||||
|
}
|
||||||
|
|
||||||
ResultSet rset = nps.executeQuery();
|
ResultSet rset = nps.executeQuery();
|
||||||
|
|
||||||
|
@ -85,7 +92,7 @@ public class RelatorioCorridas extends Relatorio {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSql() {
|
private String getSql(Integer origem, Integer destino) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("select b.corrida_id as servico, ");
|
sb.append("select b.corrida_id as servico, ");
|
||||||
sb.append(" porigen.descparada as origem, ");
|
sb.append(" porigen.descparada as origem, ");
|
||||||
|
@ -118,8 +125,12 @@ public class RelatorioCorridas extends Relatorio {
|
||||||
sb.append(" left join clase_servicio cs on b.claseservicio_id = cs.claseservicio_id ");
|
sb.append(" left join clase_servicio cs on b.claseservicio_id = cs.claseservicio_id ");
|
||||||
sb.append("where b.activo = 1 ");
|
sb.append("where b.activo = 1 ");
|
||||||
sb.append(" and b.motivocancelacion_id is null ");
|
sb.append(" and b.motivocancelacion_id is null ");
|
||||||
|
if(origem != -1){
|
||||||
sb.append(" and b.origen_id = :origemId ");
|
sb.append(" and b.origen_id = :origemId ");
|
||||||
|
}
|
||||||
|
if(destino != -1){
|
||||||
sb.append(" and b.destino_id = :destinoId ");
|
sb.append(" and b.destino_id = :destinoId ");
|
||||||
|
}
|
||||||
sb.append(" and e.empresa_id = :empresaId ");
|
sb.append(" and e.empresa_id = :empresaId ");
|
||||||
sb.append(" and b.corrida_id = :numServico ");
|
sb.append(" and b.corrida_id = :numServico ");
|
||||||
sb.append(" and b.feccorrida between :inicioViagem and :fimViagem ");
|
sb.append(" and b.feccorrida between :inicioViagem and :fimViagem ");
|
||||||
|
|
Loading…
Reference in New Issue