fixed bug #9233
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@70873 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
26a5f86a7b
commit
5ea1bdd878
|
@ -17,13 +17,14 @@ import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
||||||
public class RelatorioCancelamentoTransacao extends Relatorio {
|
public class RelatorioCancelamentoTransacao extends Relatorio {
|
||||||
|
|
||||||
private ConstanteService constanteService;
|
private ConstanteService constanteService;
|
||||||
|
|
||||||
public RelatorioCancelamentoTransacao(Map<String, Object> parametros, Connection conexao, ConstanteService constanteService) throws Exception {
|
public RelatorioCancelamentoTransacao(Map<String, Object> parametros, Connection conexao, ConstanteService constanteService) throws Exception {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
this.constanteService = constanteService;
|
this.constanteService = constanteService;
|
||||||
|
|
||||||
this.setCustomDataSource(new ArrayDataSource(this) {
|
this.setCustomDataSource(new ArrayDataSource(this) {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initDados() throws Exception {
|
public void initDados() throws Exception {
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
Map<String, Object> parametros = this.relatorio.getParametros();
|
Map<String, Object> parametros = this.relatorio.getParametros();
|
||||||
|
@ -36,7 +37,7 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
|
||||||
|
|
||||||
while (rset.next()) {
|
while (rset.next()) {
|
||||||
Map<String, Object> dataResult = new HashMap<String, Object>();
|
Map<String, Object> dataResult = new HashMap<String, Object>();
|
||||||
|
|
||||||
dataResult.put("empresa", rset.getString("empresa"));
|
dataResult.put("empresa", rset.getString("empresa"));
|
||||||
dataResult.put("dataSolicitacaoCliente", rset.getDate("dataSolicitacaoCliente"));
|
dataResult.put("dataSolicitacaoCliente", rset.getDate("dataSolicitacaoCliente"));
|
||||||
dataResult.put("nomePassageiro", rset.getString("nomePassageiro"));
|
dataResult.put("nomePassageiro", rset.getString("nomePassageiro"));
|
||||||
|
@ -49,7 +50,7 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
|
||||||
dataResult.put("valorTotalCompra", rset.getBigDecimal("valorTotalCompra"));
|
dataResult.put("valorTotalCompra", rset.getBigDecimal("valorTotalCompra"));
|
||||||
dataResult.put("valorCompra", rset.getBigDecimal("valorCompra"));
|
dataResult.put("valorCompra", rset.getBigDecimal("valorCompra"));
|
||||||
dataResult.put("valorASerRestituido", rset.getBigDecimal("valorASerRestituido"));
|
dataResult.put("valorASerRestituido", rset.getBigDecimal("valorASerRestituido"));
|
||||||
|
|
||||||
this.dados.add(dataResult);
|
this.dados.add(dataResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,8 +64,8 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSql() {
|
private String getSql() {
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
sql.append("SELECT B.BOLETO_ID, OCD.FECINC AS DATASOLICITACAOCLIENTE, E.NOMBEMPRESA AS EMPRESA, B.NOMBPASAJERO AS NOMEPASSAGEIRO, B.FECHORVENTA AS DATACOMPRA, ")
|
sql.append("SELECT B.BOLETO_ID, OCD.FECINC AS DATASOLICITACAOCLIENTE, E.NOMBEMPRESA AS EMPRESA, B.NOMBPASAJERO AS NOMEPASSAGEIRO, B.FECHORVENTA AS DATACOMPRA, ")
|
||||||
.append("B.NUMFOLIOSISTEMA AS NUMEROPASSAGEM, B.NUMOPERACION AS LOCALIZADOR, B.FECHORVIAJE AS DATAVIAGEM, B.CORRIDA_ID AS SERVICO, B.NUMASIENTO AS ASSENTO, ")
|
.append("B.NUMFOLIOSISTEMA AS NUMEROPASSAGEM, B.NUMOPERACION AS LOCALIZADOR, B.FECHORVIAJE AS DATAVIAGEM, B.CORRIDA_ID AS SERVICO, B.NUMASIENTO AS ASSENTO, ")
|
||||||
.append("(COALESCE(B.PRECIOPAGADO,0) + COALESCE(B.IMPORTEOUTROS,0) + COALESCE(B.IMPORTEPEDAGIO,0) + COALESCE(B.IMPORTESEGURO,0) + COALESCE(B.IMPORTETAXAEMBARQUE,0)) AS VALORCOMPRA, ")
|
.append("(COALESCE(B.PRECIOPAGADO,0) + COALESCE(B.IMPORTEOUTROS,0) + COALESCE(B.IMPORTEPEDAGIO,0) + COALESCE(B.IMPORTESEGURO,0) + COALESCE(B.IMPORTETAXAEMBARQUE,0)) AS VALORCOMPRA, ")
|
||||||
|
@ -80,26 +81,27 @@ public class RelatorioCancelamentoTransacao extends Relatorio {
|
||||||
.append("INNER JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID ")
|
.append("INNER JOIN MARCA M ON M.MARCA_ID = B.MARCA_ID ")
|
||||||
.append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
|
.append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ")
|
||||||
.append("WHERE OCD.FECINC BETWEEN :dataInicial AND :dataFinal ");
|
.append("WHERE OCD.FECINC BETWEEN :dataInicial AND :dataFinal ");
|
||||||
|
|
||||||
Constante constante = constanteService.buscarPorNomeConstante("PUNTO_VENTA_J3");
|
Constante constante = constanteService.buscarPorNomeConstante("PUNTO_VENTA_J3");
|
||||||
if(constante != null
|
if(constante != null
|
||||||
&& constante.getActivo()
|
&& constante.getActivo()
|
||||||
&& constante.getValorconstante() != null
|
&& constante.getValorconstante() != null
|
||||||
&& !constante.getValorconstante().isEmpty()){
|
&& !constante.getValorconstante().isEmpty()){
|
||||||
sql.append("AND (B.PTOVTAVENTA_ID = ")
|
sql.append("AND (B.PTOVTAVENTA_ID = ")
|
||||||
.append(constante.getValorconstante())
|
.append(constante.getValorconstante())
|
||||||
.append(" OR B.PUNTOVENTA_ID = ")
|
.append(" OR B.PUNTOVENTA_ID = ")
|
||||||
.append(constante.getValorconstante())
|
.append(constante.getValorconstante())
|
||||||
|
.append(" OR OCD.INDPUNTOVENTAESTORNO = 1 ")
|
||||||
.append(") ");
|
.append(") ");
|
||||||
}else{
|
}else{
|
||||||
sql.append("AND (B.PTOVTAVENTA_ID = 99999 ")
|
sql.append("AND (B.PTOVTAVENTA_ID = 99999 ")
|
||||||
.append("OR B.PUNTOVENTA_ID = 99999) ");
|
.append("OR B.PUNTOVENTA_ID = 99999) ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parametros.get("EMPRESA_ID") != null) {
|
if (parametros.get("EMPRESA_ID") != null) {
|
||||||
sql.append(" AND E.EMPRESA_ID = " + parametros.get("EMPRESA_ID"));
|
sql.append(" AND E.EMPRESA_ID = " + parametros.get("EMPRESA_ID"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue