daniel.zauli 2017-12-18 23:34:55 +00:00
parent 90218b06e0
commit c2fba4c110
3 changed files with 14 additions and 7 deletions

View File

@ -60,7 +60,7 @@ public class RelatorioDemandasDetalhadoNovoLayout extends RelatorioDemandas {
sql.append(" da.cantasientos as capacidade, "); sql.append(" da.cantasientos as capacidade, ");
sql.append(" count(bo.boleto_id) as ocupacao, "); sql.append(" count(bo.boleto_id) as ocupacao, ");
sql.append(" ts.descservicio as tipo_servico, "); sql.append(" ts.descservicio as tipo_servico, ");
sql.append(" ct.plataforma as plataforma, "); sql.append(" ( select et1.plataforma from esquema_tramo et1 inner join esquema_corrida ec1 on ec1.esquemacorrida_id = et1.esquemacorrida_id where et1.activo =1 and ec1.activo =1 and ec1.NUMCORRIDA = co.corrida_id and et1.numsecuencia = 1 and rownum <2 ) AS plataforma, ");
sql.append(" e.nombempresa as empresa, "); sql.append(" e.nombempresa as empresa, ");
sql.append(" r.INDSENTIDOIDA AS sentido "); sql.append(" r.INDSENTIDOIDA AS sentido ");
sql.append("from boleto bo "); sql.append("from boleto bo ");
@ -76,7 +76,11 @@ public class RelatorioDemandasDetalhadoNovoLayout extends RelatorioDemandas {
sql.append(" join tipo_servicio ts on ts.tiposervicio_id = co.tiposervicio_id "); sql.append(" join tipo_servicio ts on ts.tiposervicio_id = co.tiposervicio_id ");
sql.append("where ct.activo = 1 "); sql.append("where ct.activo = 1 ");
sql.append(" and bo.motivocancelacion_id is null and bo.numasiento is not null and bo.indstatusoperacion = 'F' "); sql.append(" and bo.motivocancelacion_id is null and bo.numasiento is not null and bo.indstatusoperacion = 'F' ");
sql.append(" and bo.fechorviaje >= :DATA_INICIAL and bo.fechorviaje <= :DATA_FINAL "); sql.append(" and co.fechorsalida >= :DATA_INICIAL and co.fechorsalida <= :DATA_FINAL ");
sql.append(" and co.activo = 1 and bo.activo = 1 and ct.activo = 1 and r.activo = 1 and e.activo = 1 and ori.activo = 1 and ");
sql.append(" des.activo = 1 and cs.activo = 1 and ro.activo = 1 and da.activo = 1 and ts.activo = 1 ");
sql.append((parametros.get("RUTA_ID") != null) ? " and r.ruta_id = :RUTA_ID " : ""); sql.append((parametros.get("RUTA_ID") != null) ? " and r.ruta_id = :RUTA_ID " : "");
sql.append((parametros.get("EMPRESA_ID") != null) ? " and e.empresa_id = :EMPRESA_ID " : ""); sql.append((parametros.get("EMPRESA_ID") != null) ? " and e.empresa_id = :EMPRESA_ID " : "");
sql.append((parametros.get("PARADA_ID") != null) ? " and bo.origen_id = :PARADA_ID " : ""); sql.append((parametros.get("PARADA_ID") != null) ? " and bo.origen_id = :PARADA_ID " : "");
@ -99,12 +103,12 @@ public class RelatorioDemandasDetalhadoNovoLayout extends RelatorioDemandas {
sql.append(" ) "); sql.append(" ) ");
} }
sql.append("group by co.feccorrida, co.fechorsalida, r.descruta, r.numruta, co.corrida_id, "); sql.append("group by co.feccorrida, co.fechorsalida, r.descruta, r.numruta, co.corrida_id, ct.plataforma, ");
sql.append(" case when ((ori.indvisibleinternet is null or ori.indvisibleinternet = 1) "); sql.append(" case when ((ori.indvisibleinternet is null or ori.indvisibleinternet = 1) ");
sql.append(" and (des.indvisibleinternet is null or des.indvisibleinternet = 1)) then 'SIM' else 'NÃO' end, "); sql.append(" and (des.indvisibleinternet is null or des.indvisibleinternet = 1)) then 'SIM' else 'NÃO' end, ");
sql.append(" ori.descparada, des.descparada, cs.descclase, "); sql.append(" ori.descparada, des.descparada, cs.descclase, ");
sql.append(" da.cantasientos, ts.descservicio, ct.plataforma, e.nombempresa, r.INDSENTIDOIDA "); sql.append(" da.cantasientos, ts.descservicio, ct.plataforma, e.nombempresa, r.INDSENTIDOIDA ");
sql.append("order by e.nombempresa, data, linha, servico, origem, destino "); sql.append("order by data, horario, servico, linha, origem, destino ");
sql.append(" ), nao_vendidos as ( "); sql.append(" ), nao_vendidos as ( ");
@ -158,6 +162,9 @@ public class RelatorioDemandasDetalhadoNovoLayout extends RelatorioDemandas {
sql.append(" and co.FECHORSALIDA >= :DATA_INICIAL and co.FECHORSALIDA <= :DATA_FINAL "); sql.append(" and co.FECHORSALIDA >= :DATA_INICIAL and co.FECHORSALIDA <= :DATA_FINAL ");
sql.append(" and co.CORRIDA_ID not in (select servico from vendidos ) "); sql.append(" and co.CORRIDA_ID not in (select servico from vendidos ) ");
sql.append(" and co.activo = 1 and ct.activo = 1 and r.activo = 1 and e.activo = 1 and ori.activo = 1 and des.activo = 1 and ");
sql.append(" cs.activo = 1 and ro.activo = 1 and da.activo = 1 and ts.activo = 1 ");
if (parametros.get("HORA_INICIAL") != null && parametros.get("HORA_FINAL") != null) { if (parametros.get("HORA_INICIAL") != null && parametros.get("HORA_FINAL") != null) {
sql.append(" AND "); sql.append(" AND ");
sql.append(" ( "); sql.append(" ( ");
@ -179,8 +186,8 @@ public class RelatorioDemandasDetalhadoNovoLayout extends RelatorioDemandas {
sql.append(" DATA_CORRIDA, DATA, LINHA, CODLINHA, SERVICO, INTERNET, HORARIO, ORIGEM, DESTINO, CLASSE, CAPACIDADE, SUM(OCUPACAO) OCUPACAO, TIPO_SERVICO, PLATAFORMA, EMPRESA, SENTIDO "); sql.append(" DATA_CORRIDA, DATA, LINHA, CODLINHA, SERVICO, INTERNET, HORARIO, ORIGEM, DESTINO, CLASSE, CAPACIDADE, SUM(OCUPACAO) OCUPACAO, TIPO_SERVICO, PLATAFORMA, EMPRESA, SENTIDO ");
sql.append(" from ( "); sql.append(" from ( ");
sql.append(" select * from vendidos v union select * from nao_vendidos ) "); sql.append(" select * from vendidos v union select * from nao_vendidos ) ");
sql.append(" GROUP BY DATA_CORRIDA, DATA, LINHA, CODLINHA, SERVICO, INTERNET, HORARIO, ORIGEM, DESTINO, CLASSE, CAPACIDADE, OCUPACAO, TIPO_SERVICO, PLATAFORMA, EMPRESA, SENTIDO "); sql.append(" GROUP BY DATA_CORRIDA, DATA, LINHA, CODLINHA, SERVICO, INTERNET, HORARIO, ORIGEM, DESTINO, CLASSE, CAPACIDADE, TIPO_SERVICO, PLATAFORMA, EMPRESA, SENTIDO ");
sql.append(" order by empresa, servico "); sql.append(" order by data, horario, servico, linha, origem, destino ");
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString()); NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());

View File

@ -174,7 +174,7 @@
<band splitType="Stretch"/> <band splitType="Stretch"/>
</columnHeader> </columnHeader>
<detail> <detail>
<band height="13" splitType="Stretch"> <band height="13" splitType="Prevent">
<textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true"> <textField isStretchWithOverflow="true" pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="bc091860-adab-47d8-8352-982bc8e484a3" stretchType="RelativeToTallestObject" x="0" y="0" width="61" height="13"/> <reportElement uuid="bc091860-adab-47d8-8352-982bc8e484a3" stretchType="RelativeToTallestObject" x="0" y="0" width="61" height="13"/>
<textElement textAlignment="Center"> <textElement textAlignment="Center">