fixes bug#20983

qua:
dev:Valdevir

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@104921 d1611594-4594-4d17-8e1d-87c2c4800839
master
valdevir 2021-01-03 18:27:15 +00:00
parent 3056cb69d7
commit 476449859c
11 changed files with 1667 additions and 274 deletions

View File

@ -0,0 +1,653 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioLinhasHorarioBean;
import com.rjconsultores.ventaboletos.service.ConstanteService;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
@SuppressWarnings({"unused", "unchecked"})
public class RelatorioLinhasHorarioSimplificado extends Relatorio {
private static Logger log = Logger.getLogger(RelatorioLinhasHorarioSimplificado.class);
private List<RelatorioLinhasHorarioBean> lsDadosRelatorio;
private static String CONSTANTE_GRATUIDADE_CRIANCA;
public RelatorioLinhasHorarioSimplificado(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
@Override
public void initDados() throws Exception {
CONSTANTE_GRATUIDADE_CRIANCA = buscarConstante("GRATUIDADE_CRIANCA");
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
ArrayList<Ruta> lsNumLinha = (ArrayList<Ruta>) parametros.get("lsNumLinha");
ArrayList<Corrida> lsNumServico = (ArrayList<Corrida>) parametros.get("lsNumServico");
String servicoFiltro = "";
if (lsNumServico.size() > 0) {
for (Corrida corrida : lsNumServico) {
if (lsNumServico.indexOf(corrida) == 0) {
servicoFiltro = "" + corrida.getId().getCorridaId();
} else {
servicoFiltro += ", " + corrida.getId().getCorridaId();
}
}
} else {
servicoFiltro = "TODOS";
}
parametros.put("SERVICO_FILTRO", servicoFiltro);
String linhaFiltro = "";
if (lsNumLinha.size() > 0) {
for (Ruta ruta : lsNumLinha) {
if (lsNumLinha.indexOf(ruta) == 0) {
linhaFiltro = "" + ruta.getRutaId();
} else {
linhaFiltro += ", " + ruta.getRutaId();
}
}
} else {
linhaFiltro = "TODOS";
}
parametros.put("LINHA_FILTRO", linhaFiltro);
Empresa empresa = (Empresa) parametros.get("EMPRESA");
GrupoRuta grupoRuta = (GrupoRuta) parametros.get("GRUPORUTA");
Integer tipoServico = (Integer) parametros.get("TIPOSERVICIO_ID");
String sql = getSql(lsNumLinha, lsNumServico, empresa, tipoServico, grupoRuta);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
if (parametros.get("HORA_INICIAL") == null) {
stmt.setTimestamp("DATA_INICIO", (Timestamp) parametros.get("DATA_INICIO"));
stmt.setTimestamp("DATA_FINAL", (Timestamp) parametros.get("DATA_FINAL"));
}else {
setaParametroDataHora(parametros, stmt);
}
rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioLinhasHorarioBean>();
BigDecimal totalPassagens = BigDecimal.ZERO;
BigDecimal totalSeguro = BigDecimal.ZERO;
BigDecimal totalBagagens = BigDecimal.ZERO;
BigDecimal totalSeuroOpcional = BigDecimal.ZERO;
BigDecimal totalTotal = BigDecimal.ZERO;
BigDecimal totalOrdinario = BigDecimal.ZERO;
BigDecimal totalExtra = BigDecimal.ZERO;
BigDecimal totalViagem = BigDecimal.ZERO;
BigDecimal totalKmRodado = BigDecimal.ZERO;
BigDecimal totalAbsoluto = BigDecimal.ZERO;
BigDecimal totalEquivalente = BigDecimal.ZERO;
BigDecimal mediaMPA = BigDecimal.ZERO;
BigDecimal mediaMPE = BigDecimal.ZERO;
BigDecimal mediaRsPorKm = BigDecimal.ZERO;
BigDecimal totalEQ = BigDecimal.ZERO;
BigDecimal mediaRSPorViagem = BigDecimal.ZERO;
BigDecimal totalPaxKMOfertado = BigDecimal.ZERO;
BigDecimal totalPaxKMTransportado = BigDecimal.ZERO;
BigDecimal totalIAP = BigDecimal.ZERO;
BigDecimal totalTxEmbarque = BigDecimal.ZERO;
BigDecimal totalPedagio = BigDecimal.ZERO;
String group = null;
while (rset.next()) {
RelatorioLinhasHorarioBean horarioBean = new RelatorioLinhasHorarioBean();
group = ((String) rset.getObject("GRUPO_RUTA"));
horarioBean.setGrupoRuta(group);
horarioBean.setTipoLinha((String) rset.getObject("TIPO_LINHA"));
horarioBean.setHora((String) rset.getObject("HORA"));
horarioBean.setServico((BigDecimal) rset.getObject("SERVICO"));
if (rset.getObject("SENTIDO") != null) {
horarioBean.convetSentido((BigDecimal) rset.getObject("SENTIDO"));
} else {
horarioBean.convetSentido(null);
}
horarioBean.setLot((BigDecimal) rset.getObject("LOT"));
horarioBean.setCla((String) rset.getObject("CLA"));
horarioBean.setExtensao((BigDecimal) rset.getObject("EXTENSAO"));
horarioBean.setTarifa((BigDecimal) rset.getObject("TARIFA"));
horarioBean.setPassagens((BigDecimal) rset.getObject("PASSAGENS"));
horarioBean.setSeguro((BigDecimal) rset.getObject("SEGURO"));
horarioBean.setBagagens((BigDecimal) rset.getObject("BAGAGENS"));
horarioBean.setTxEmbarque((BigDecimal) rset.getObject("TX_EMBARQUE"));
horarioBean.setPedagio((BigDecimal) rset.getObject("PEDAGIO"));
// Substituir a coluna Seg. Opcional por Tx. Embarque
horarioBean.setSegOpc(horarioBean.getTxEmbarque());
horarioBean.setOrd((BigDecimal) rset.getObject("ORD"));
horarioBean.setExtra((BigDecimal) rset.getObject("EXTRA"));
horarioBean.setAbsol((BigDecimal) rset.getObject("ABSOL"));
horarioBean.setOrigem((String) rset.getObject("ORIGEM"));
horarioBean.setDestino((String) rset.getObject("DESTINO"));
horarioBean.setSomaExtensaoTrecho((BigDecimal) rset.getObject("EXTENSAO_TRECHO"));
horarioBean.setPaxKmTransportado((BigDecimal) rset.getObject("KM_REAL"));
horarioBean.setDescRuta((String) rset.getObject("DESCRUTA"));
horarioBean = trecho(horarioBean);
horarioBean = calcTotal(horarioBean);
horarioBean = calcMediaReceitaTotal(horarioBean);
horarioBean = calcTotalViagem(horarioBean);
horarioBean = calcKmRodado(horarioBean);
horarioBean = calcEquivalente(horarioBean);
horarioBean = calcMpa(horarioBean);
horarioBean = calcMpe(horarioBean);
horarioBean = calcRsKm(horarioBean);
horarioBean = calcEq(horarioBean);
horarioBean = calcRsViagem(horarioBean);
horarioBean = calcPaxKmOfertado(horarioBean);
horarioBean = calcIap(horarioBean);
lsDadosRelatorio.add(horarioBean);
totalPassagens = totalPassagens.add(horarioBean.getPassagens() != null ? horarioBean.getPassagens() : BigDecimal.ZERO);
totalSeguro = totalSeguro.add(horarioBean.getSeguro() != null ? horarioBean.getSeguro() : BigDecimal.ZERO);
totalBagagens = totalBagagens.add(horarioBean.getBagagens() != null ? horarioBean.getBagagens() : BigDecimal.ZERO);
totalSeuroOpcional = totalSeuroOpcional.add(horarioBean.getSegOpc() != null ? horarioBean.getSegOpc() : BigDecimal.ZERO);
totalTotal = totalTotal.add(horarioBean.getTotal() != null ? horarioBean.getTotal() : BigDecimal.ZERO);
totalOrdinario = totalOrdinario.add(horarioBean.getOrd() != null ? horarioBean.getOrd() : BigDecimal.ZERO);
totalExtra = totalExtra.add(horarioBean.getExtra() != null ? horarioBean.getExtra() : BigDecimal.ZERO);
totalViagem = totalViagem.add(horarioBean.getTotalViagem() != null ? horarioBean.getTotalViagem() : BigDecimal.ZERO);
totalKmRodado = totalKmRodado.add(horarioBean.getKmRodado() != null ? horarioBean.getKmRodado() : BigDecimal.ZERO);
totalAbsoluto = totalAbsoluto.add(horarioBean.getAbsol() != null ? horarioBean.getAbsol() : BigDecimal.ZERO);
totalEquivalente = totalEquivalente.add(horarioBean.getEquivalente() != null ? horarioBean.getEquivalente() : BigDecimal.ZERO);
totalTxEmbarque = totalTxEmbarque.add(horarioBean.getTxEmbarque() != null ? horarioBean.getTxEmbarque() : BigDecimal.ZERO);
totalPedagio = totalPedagio.add(horarioBean.getPedagio() != null ? horarioBean.getPedagio() : BigDecimal.ZERO);
mediaMPA = mediaMPA.add(horarioBean.getMpa() != null ? horarioBean.getMpa() : BigDecimal.ZERO);
mediaMPE = mediaMPE.add(horarioBean.getMpe() != null ? horarioBean.getMpe() : BigDecimal.ZERO);
mediaRsPorKm = mediaRsPorKm.add(horarioBean.getRsKm() != null ? horarioBean.getRsKm() : BigDecimal.ZERO);
totalEQ = totalEQ.add(horarioBean.getEq() != null ? horarioBean.getEq() : BigDecimal.ZERO);
mediaRSPorViagem = mediaRSPorViagem.add(horarioBean.getRsViagem() != null ? horarioBean.getRsViagem() : BigDecimal.ZERO);
totalPaxKMOfertado = totalPaxKMOfertado.add(horarioBean.getPaxKmOfertado() != null ? horarioBean.getPaxKmOfertado() : BigDecimal.ZERO);
totalPaxKMTransportado = totalPaxKMTransportado.add(horarioBean.getPaxKmTransportado() != null ? horarioBean.getPaxKmTransportado() : BigDecimal.ZERO);
totalIAP = totalIAP.add(horarioBean.getIap());
}
BigDecimal qtdeRegistros = new BigDecimal(lsDadosRelatorio.size());
if (lsDadosRelatorio.size() > 0) {
setLsDadosRelatorio(lsDadosRelatorio);
parametros.put("TOTAL_PASSAGENS", totalPassagens);
parametros.put("TOTAL_SEGURO", totalSeguro);
parametros.put("TOTAL_BAGAGENS", totalBagagens);
parametros.put("TOTAL_SEURO_OPCIONAL", totalSeuroOpcional);
parametros.put("TOTAL_TOTAL", totalTotal);
parametros.put("TOTAL_ORDINARIO", totalOrdinario);
parametros.put("TOTAL_EXTRA", totalExtra);
parametros.put("TOTAL_VIAGEM", totalViagem);
parametros.put("TOTAL_KM_RODADO", totalKmRodado);
parametros.put("TOTAL_ABSOLUTO", totalAbsoluto);
parametros.put("TOTAL_EQUIVALENTE", totalEquivalente);
parametros.put("MEDIA_MPA", mediaMPA);
parametros.put("MEDIA_MPE", mediaMPE);
parametros.put("MEDIA_RS_POR_KM", mediaRsPorKm);
parametros.put("TOTAL_EQ", totalEQ);
parametros.put("TOTAL_TX_EMBARQUE", totalTxEmbarque);
parametros.put("TOTAL_PEDAGIO", totalPedagio);
parametros.put("MEDIA_RS_POR_VIAGEM", mediaRSPorViagem);
parametros.put("TOTAL_PAX_KM_OFERTADO", totalPaxKMOfertado);
parametros.put("TOTAL_PAX_KM_TRANSPORTADO", totalPaxKMTransportado);
parametros.put("TOTAL_IAP", totalIAP);
}
}
});
}
private void setaParametroDataHora(Map<String, Object> parametros, NamedParameterStatement stmt) throws SQLException {
Calendar dataInicial = Calendar.getInstance();
dataInicial.setTime((Date) parametros.get("DATA_INICIO"));
Calendar horaInicialCal = Calendar.getInstance();
horaInicialCal.setTime((Date) parametros.get("HORA_INICIAL"));
mesclarDataHora(dataInicial, horaInicialCal);
stmt.setTimestamp("DATA_INICIO", new Timestamp(dataInicial.getTimeInMillis()));
if (parametros.get("HORA_FINAL") != null) {
Calendar dataFinal = Calendar.getInstance();
dataFinal.setTime((Date) parametros.get("DATA_FINAL"));
Calendar horaFinalCal = Calendar.getInstance();
horaFinalCal.setTime((Date) parametros.get("HORA_FINAL"));
mesclarDataHora(dataFinal, horaFinalCal);
stmt.setTimestamp("DATA_FINAL", new Timestamp( dataFinal.getTimeInMillis()));
}else {
stmt.setTimestamp("DATA_FINAL", (Timestamp) parametros.get("DATA_FINAL"));
}
}
public List<RelatorioLinhasHorarioBean> getLsDadosRelatorio() {
return lsDadosRelatorio;
}
public void setLsDadosRelatorio(List<RelatorioLinhasHorarioBean> lsDadosRelatorio) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
this.lsDadosRelatorio = lsDadosRelatorio;
}
private RelatorioLinhasHorarioBean trecho(RelatorioLinhasHorarioBean horarioBean) {
horarioBean.setTrecho(horarioBean.getOrigem() + " - " + horarioBean.getDestino());
return horarioBean;
}
private RelatorioLinhasHorarioBean calcTotal(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal total = horarioBean.getPassagens();
total = total.add(horarioBean.getBagagens());
total = total.add(horarioBean.getSeguro());
total = total.add(horarioBean.getPedagio());
total = total.add(horarioBean.getTxEmbarque());
horarioBean.setTotal(total);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcMediaReceitaTotal(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal mediaTotal = horarioBean.getPassagens();
horarioBean.setMediaReceitaViagem(mediaTotal);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcTotalViagem(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal totalViagem = horarioBean.getOrd().add(horarioBean.getExtra());
horarioBean.setTotalViagem(totalViagem);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcKmRodado(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal kmRodado = horarioBean.getTotalViagem().multiply(horarioBean.getExtensao());
horarioBean.setKmRodado(kmRodado);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcEquivalente(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal equivalente = new BigDecimal(0);
try {
equivalente = horarioBean.getSomaExtensaoTrecho().divide(horarioBean.getExtensao(), 2, RoundingMode.HALF_UP);
} catch (ArithmeticException e) {
equivalente = BigDecimal.ZERO;
} catch (NullPointerException nex) {
equivalente = BigDecimal.ZERO;
} catch (Exception ex) {
log.error("", ex);
}
horarioBean.setEquivalente(equivalente);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcMpa(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal mpa = new BigDecimal(0);
try {
mpa = horarioBean.getAbsol().divide(horarioBean.getTotalViagem(), 2, 4);
} catch (ArithmeticException e) {
mpa = BigDecimal.ZERO;
} catch (NullPointerException nex) {
mpa = BigDecimal.ZERO;
} catch (Exception ex) {
log.error("", ex);
}
horarioBean.setMpa(mpa);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcMpe(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal mpe = horarioBean.getEquivalente().divide(horarioBean.getTotalViagem(), 2, 4);
horarioBean.setMpe(mpe);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcRsKm(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal rsKm = horarioBean.getTotal().divide(horarioBean.getKmRodado(), 2, 4);
horarioBean.setRsKm(rsKm);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcEq(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal eq = null;
try {
eq = horarioBean.getMediaReceitaViagem().divide(horarioBean.getTarifa(), 2, 4);
} catch (ArithmeticException e) {
eq = BigDecimal.ZERO;
} catch (NullPointerException nex) {
eq = BigDecimal.ZERO;
} catch (Exception ex) {
log.error("", ex);
}
horarioBean.setEq(eq);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcRsViagem(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal RSViagem = horarioBean.getPassagens().divide(horarioBean.getTotalViagem(), 2, 4);
horarioBean.setRsViagem(RSViagem);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcPaxKmOfertado(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal paxKmOfertado = horarioBean.getLot().multiply(horarioBean.getTotalViagem());
paxKmOfertado = paxKmOfertado.multiply(horarioBean.getExtensao());
horarioBean.setPaxKmOfertado(paxKmOfertado);
return horarioBean;
}
private RelatorioLinhasHorarioBean calcIap(RelatorioLinhasHorarioBean horarioBean) {
BigDecimal iap = null;
BigDecimal CENTO = BigDecimal.TEN.multiply(BigDecimal.TEN);
try {
iap = (horarioBean.getPaxKmTransportado().multiply(CENTO)).divide(horarioBean.getPaxKmOfertado(), 2, 4);
} catch (ArithmeticException e) {
iap = BigDecimal.ZERO;
} catch (NullPointerException nex) {
iap = BigDecimal.ZERO;
} catch (Exception ex) {
log.error("", ex);
}
horarioBean.setIap(iap);
return horarioBean;
}
private BigDecimal calcTotalIap(BigDecimal totalPaxKMTransportado, BigDecimal totalPaxKMOfertado) {
BigDecimal iap = null;
BigDecimal CENTO = BigDecimal.TEN.multiply(BigDecimal.TEN);
try {
iap = (totalPaxKMTransportado.multiply(CENTO)).divide(totalPaxKMOfertado, 2, 4);
} catch (ArithmeticException e) {
iap = BigDecimal.ZERO;
} catch (NullPointerException nex) {
iap = BigDecimal.ZERO;
} catch (Exception ex) {
log.error("", ex);
}
return iap;
}
@Override
protected void processaParametros() throws Exception {
}
private String getSql(ArrayList<Ruta> lsNumLinha, ArrayList<Corrida> lsNumServico, Empresa empresa, Integer tipoServico, GrupoRuta grupoRuta) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" GRUPO_RUTA, ");
sql.append(" HORA, ");
sql.append(" DESCRUTA, ");
sql.append(" SERVICO, ");
sql.append(" SENTIDO , ");
sql.append(" LOT, ");
sql.append(" CLA, ");
sql.append(" TARIFA, ");
sql.append(" ORIGEM, ");
sql.append(" DESTINO, ");
sql.append(" EXTENSAO, ");
sql.append(" COALESCE(SUM(EQUIVALENTE * EXTENSAO) ,0) AS EXTENSAO_TRECHO, ");
sql.append(" COALESCE(BAGAGENS, 0) AS BAGAGENS, ");
sql.append(" COALESCE(SUM(SEGURO), 0) AS SEGURO, ");
sql.append(" COALESCE(SUM(TX_EMBARQUE), 0) AS TX_EMBARQUE, ");
sql.append(" COALESCE(SUM(PEDAGIO), 0) AS PEDAGIO, ");
sql.append(" COALESCE(SUM(PASSAGENS), 0) AS PASSAGENS, ");
sql.append(" ORD, ");
sql.append(" EXTRA, ");
sql.append(" TIPO_LINHA, ");
sql.append(" ABSOL, ");
sql.append(" COALESCE(SUM(KM_REAL), 0) AS KM_REAL ");
sql.append(" FROM ");
sql.append(" (SELECT ");
sql.append(" R.RUTA_ID, ");
sql.append(" R.DESCRUTA AS DESCRUTA, ");
sql.append(" NVL(GR.DESCGRUPO, 'Não Definido') AS GRUPO_RUTA, ");
sql.append(" TO_CHAR(C.FECHORSALIDA, 'HH24:MI') AS HORA, ");
sql.append(" C.CORRIDA_ID AS SERVICO, ");
sql.append(" R.INDSENTIDOIDA AS SENTIDO, ");
sql.append(" DA.CANTASIENTOS AS LOT, ");
sql.append(" NVL(CS.DESCCLASE, '') AS CLA, ");
sql.append(" MAX(NVL(TF.PRECIOORIGINAL, 0)) AS TARIFA, ");
sql.append(" ORIGEM.CVEPARADA AS ORIGEM, ");
sql.append(" DESTINO.CVEPARADA AS DESTINO, ");
sql.append(" EXTENSAO AS EXTENSAO, ");
sql.append(" CJ.EQUIVALENTE AS EQUIVALENTE, ");
sql.append(" SUM(EE.IMPINGRESO) AS BAGAGENS, ");
sql.append(" CJ.IMPORTESEGURO AS SEGURO, ");
sql.append(" CJ.IMPORTETAXAEMBARQUE AS TX_EMBARQUE, ");
sql.append(" CJ.IMPORTEPEDAGIO AS PEDAGIO, ");
sql.append(" CJ.PRECIOPAGADO AS PASSAGENS, ");
sql.append(" CJ.BOLETO_ID, ");
sql.append(" TB2.ORD, ");
sql.append(" TB2.EXTRA, ");
sql.append(" CASE WHEN CO.ESTADO_ID <> CD.ESTADO_ID THEN 'INTERESTADUAL' ELSE 'INTERMUNICIPAL' END TIPO_LINHA, ");
sql.append(" ABSOL, ");
sql.append(" CJ.KM_REAL AS KM_REAL ");
sql.append(" FROM CORRIDA C ");
sql.append(" INNER JOIN (");
sql.append(" SELECT ");
sql.append(" C.CORRIDA_ID, ");
sql.append(" c.ruta_id as c_ruta_id, ");
sql.append(" Destino.Cveparada AS DESTINO, ");
sql.append(" ORIGEM.CVEPARADA AS ORIGEM, ");
sql.append(" C.ROLOPERATIVO_ID, ");
sql.append(" TO_CHAR(C.FECHORSALIDA, 'HH24:MI') AS HORASALIDA, ");
sql.append(" COUNT(CASE WHEN C.TIPOSERVICIO_ID = 1 THEN 1 ELSE NULL END) AS ORD, ");
sql.append(" COUNT(CASE WHEN C.TIPOSERVICIO_ID = 2 THEN 1 ELSE NULL END) AS EXTRA ");
sql.append(" FROM CORRIDA C ");
sql.append(" INNER JOIN PARADA ORIGEM ON C.Origen_Id = ORIGEM.PARADA_ID ");
sql.append(" INNER JOIN PARADA DESTINO ON C.DESTINO_ID = DESTINO.PARADA_ID ");
sql.append(empresa == null ? "" : " INNER JOIN MARCA M ON (C.MARCA_ID = M.MARCA_ID AND M.EMPRESA_ID=" + empresa.getEmpresaId() + ")");
sql.append(" WHERE ");
sql.append(" EXISTS (SELECT * FROM CAJA CA WHERE CA.CORRIDA_ID = C.CORRIDA_ID AND CA.FECCORRIDA = C.FECCORRIDA AND CA.MOTIVOCANCELACION_ID IS NULL) ");
sql.append(" AND C.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
sql.append(" GROUP BY C.CORRIDA_ID, ");
sql.append(" C.ROLOPERATIVO_ID, ");
sql.append(" c.ruta_id, ");
sql.append(" Destino.Cveparada, ");
sql.append(" ORIGEM.CVEPARADA, ");
sql.append(" TO_CHAR(C.FECHORSALIDA, 'HH24:MI') ");
sql.append(" ) TB2 ON (TB2.CORRIDA_ID = C.CORRIDA_ID and tb2.c_ruta_id = c.ruta_id ) ");
sql.append(" AND TB2.ROLOPERATIVO_ID = C.ROLOPERATIVO_ID ");
sql.append(" AND TB2.HORASALIDA = TO_CHAR(C.FECHORSALIDA, 'HH24:MI') ");
sql.append(" INNER JOIN (");
sql.append(" SELECT ");
sql.append(" C.CORRIDA_ID, ");
sql.append(" c.ruta_id as c_ruta_id, ");
sql.append(" C.ROLOPERATIVO_ID, ");
sql.append(" C.DESTINO_ID, ");
sql.append(" C.ORIGEN_ID, ");
sql.append(" TO_CHAR(C.FECHORSALIDA, 'HH24:MI') AS HORASALIDA, ");
sql.append(" COUNT(B.BOLETO_ID) AS ABSOL ");
sql.append(" FROM CORRIDA C ");
sql.append(empresa == null ? "" : " INNER JOIN MARCA M ON (C.MARCA_ID = M.MARCA_ID AND M.EMPRESA_ID=" + empresa.getEmpresaId() + ")");
sql.append(" LEFT JOIN BOLETO B ON (B.CORRIDA_ID = C.CORRIDA_ID AND B.FECCORRIDA = C.FECCORRIDA AND B.ACTIVO = 1 AND B.MOTIVOCANCELACION_ID IS NULL ");
sql.append(" AND B.CATEGORIA_ID <> ").append(CONSTANTE_GRATUIDADE_CRIANCA).append(") ");
sql.append(" WHERE C.ACTIVO = 1 AND C.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
if (lsNumServico.size() > 0) {
for (Corrida corrida : lsNumServico) {
if (lsNumServico.indexOf(corrida) == 0) {
sql.append(" AND B.CORRIDA_ID IN ( " + corrida.getId().getCorridaId());
} else {
sql.append(" , " + corrida.getId().getCorridaId() + " ");
}
}
sql.append(" ) ");
}
sql.append(" GROUP BY C.CORRIDA_ID, c.ruta_id, C.ROLOPERATIVO_ID, C.DESTINO_ID, C.ORIGEN_ID, TO_CHAR(C.FECHORSALIDA, 'HH24:MI') ");
sql.append(" ) TB4 ON (TB4.CORRIDA_ID = C.CORRIDA_ID and tb4.c_ruta_id = c.ruta_id) ");
sql.append(" AND c.DESTINO_ID = TB4.DESTINO_ID ");
sql.append(" AND c.ORIGEN_ID = TB4.ORIGEN_ID ");
sql.append(" AND TB4.ROLOPERATIVO_ID = C.ROLOPERATIVO_ID ");
sql.append(" AND TB4.HORASALIDA = TO_CHAR(C.FECHORSALIDA, 'HH24:MI') ");
sql.append("LEFT JOIN ");
sql.append(" (SELECT CO.FECCORRIDA, ");
sql.append(" CO.CORRIDA_ID, ");
sql.append(" CO.ROLOPERATIVO_ID, ");
sql.append(" CO.RUTA_ID, ");
sql.append(" CO.EMPRESACORRIDA_ID, ");
sql.append(" BO.BOLETO_ID, ");
sql.append(" BO.NUMKMVIAJE * COUNT(1) AS KM_REAL, ");
sql.append(" CASE ");
sql.append("WHEN T.CANTKMREAL<>0 AND BO.NUMKMVIAJE<>0 ");
sql.append("THEN ROUND(BO.NUMKMVIAJE * COUNT(1) / T.CANTKMREAL, 3) ");
sql.append("ELSE 0 ");
sql.append("END AS EQUIVALENTE, ");
sql.append(" NVL(BO.IMPORTESEGURO, 0) AS IMPORTESEGURO, ");
sql.append(" NVL(BO.IMPORTETAXAEMBARQUE, 0) AS IMPORTETAXAEMBARQUE, ");
sql.append(" NVL(BO.IMPORTEPEDAGIO, 0) AS IMPORTEPEDAGIO, ");
sql.append(" NVL(BO.PRECIOPAGADO, 0) AS PRECIOPAGADO ");
sql.append(" FROM CORRIDA CO ");
sql.append(empresa == null ? "" : " INNER JOIN MARCA M ON (CO.MARCA_ID = M.MARCA_ID AND M.EMPRESA_ID=" + empresa.getEmpresaId() + ")");
sql.append(" INNER JOIN BOLETO BO ON CO.CORRIDA_ID = BO.CORRIDA_ID AND CO.FECCORRIDA = BO.FECCORRIDA AND BO.ACTIVO = 1 ");
sql.append(" INNER JOIN RUTA_COMBINACION RC ON RC.RUTA_ID = CO.RUTA_ID ");
sql.append(" INNER JOIN TRAMO T ON RC.TRAMO_ID = T.TRAMO_ID AND T.ORIGEN_ID = BO.ORIGEN_ID AND T.DESTINO_ID = BO.DESTINO_ID ");
sql.append(" WHERE CO.ACTIVO = 1 ");
sql.append(" AND RC.ACTIVO = 1");
sql.append(" AND T.ACTIVO = 1");
sql.append(" AND BO.INDSTATUSBOLETO != 'S' AND BO.MOTIVOCANCELACION_ID IS NULL ");
sql.append(" AND BO.CATEGORIA_ID <> ").append(CONSTANTE_GRATUIDADE_CRIANCA);
sql.append(" AND BO.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
if (lsNumServico.size() > 0) {
for (Corrida corrida : lsNumServico) {
if (lsNumServico.indexOf(corrida) == 0) {
sql.append(" AND BO.CORRIDA_ID IN ( " + corrida.getId().getCorridaId());
} else {
sql.append(" , " + corrida.getId().getCorridaId() + " ");
}
}
sql.append(" ) ");
}
sql.append(" GROUP BY CO.FECCORRIDA, CO.CORRIDA_ID, CO.ROLOPERATIVO_ID, CO.RUTA_ID, CO.EMPRESACORRIDA_ID, BO.NUMKMVIAJE, BO.BOLETO_ID, T.CANTKMREAL, ");
sql.append(" NVL(BO.IMPORTESEGURO, 0), NVL(BO.IMPORTETAXAEMBARQUE, 0), NVL(BO.IMPORTEPEDAGIO, 0), NVL(BO.PRECIOPAGADO, 0)) CJ ");
sql.append(" ON (CJ.CORRIDA_ID = C.CORRIDA_ID AND CJ.FECCORRIDA = C.FECCORRIDA AND CJ.ROLOPERATIVO_ID = C.ROLOPERATIVO_ID ");
sql.append(" AND CJ.RUTA_ID = C.RUTA_ID AND CJ.EMPRESACORRIDA_ID = C.EMPRESACORRIDA_ID) ");
sql.append("INNER JOIN PARADA ORIGEM ON (C.ORIGEN_ID = ORIGEM.PARADA_ID ) ");
sql.append("INNER JOIN PARADA DESTINO ON ( C.DESTINO_ID = DESTINO.PARADA_ID ) ");
sql.append("INNER JOIN CIUDAD CO ON (CO.CIUDAD_ID = ORIGEM.CIUDAD_ID ) ");
sql.append("INNER JOIN CIUDAD CD ON (CD.CIUDAD_ID = DESTINO.CIUDAD_ID ) ");
sql.append("INNER JOIN RUTA R ON (C.RUTA_ID = R.RUTA_ID ) ");
sql.append("LEFT JOIN GRUPO_RUTA GR ON (R.GRUPORUTA_ID = GR.GRUPORUTA_ID ) ");
sql.append("LEFT JOIN ROL_OPERATIVO RO ON (C.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID ) ");
sql.append("LEFT JOIN DIAGRAMA_AUTOBUS DA ON (DA.DIAGRAMAAUTOBUS_ID = RO.DIAGRAMAAUTOBUS_ID ) ");
sql.append("LEFT JOIN CLASE_SERVICIO CS ON (CS.CLASESERVICIO_ID = C.CLASESERVICIO_ID ) ");
sql.append("LEFT JOIN EVENTO_EXTRA EE ON (EE.CORRIDA_ID = C.CORRIDA_ID AND EE.FECCORRIDA = C.FECCORRIDA AND EE.TIPOEVENTOEXTRA_ID = 1 ) ");
sql.append("LEFT JOIN TARIFA TF ON (TF.CLASESERVICIO_ID = C.CLASESERVICIO_ID AND TF.DESTINO_ID = C.DESTINO_ID AND TF.ORIGEN_ID = C.ORIGEN_ID AND TF.MARCA_ID = C.MARCA_ID AND TF.RUTA_ID = C.RUTA_ID ) ");
sql.append("LEFT JOIN VIGENCIA_TARIFA VTF ON (TF.VIGENCIATARIFA_ID = VTF.VIGENCIATARIFA_ID AND C.FECCORRIDA BETWEEN VTF.FECINICIOVIGENCIA AND VTF.FECFINVIGENCIA ) ");
sql.append("INNER JOIN ");
sql.append("( ");
sql.append("SELECT RC.RUTA_ID, T.ORIGEN_ID, T.DESTINO_ID, NVL(T.CANTKMREAL,0) AS EXTENSAO ");
sql.append("FROM RUTA_COMBINACION RC ");
sql.append("INNER JOIN TRAMO T ON RC.TRAMO_ID = T.TRAMO_ID ");
sql.append("WHERE RC.ACTIVO = 1 ");
sql.append(") TB5 ON TB5.RUTA_ID = C.RUTA_ID ");
sql.append("AND TB5.ORIGEN_ID = ORIGEM.PARADA_ID ");
sql.append("AND TB5.DESTINO_ID = DESTINO.PARADA_ID ");
sql.append("WHERE C.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
sql.append(" ");
if (lsNumServico.size() > 0) {
for (Corrida corrida : lsNumServico) {
if (lsNumServico.indexOf(corrida) == 0) {
sql.append(" AND C.CORRIDA_ID IN ( " + corrida.getId().getCorridaId());
} else {
sql.append(" , " + corrida.getId().getCorridaId() + " ");
}
}
sql.append(" ) ");
}
sql.append(grupoRuta == null ? "" : " AND R.GRUPORUTA_ID IN ( " + grupoRuta.getGrupoRutaId() + " ) ");
if (lsNumLinha.size() > 0) {
for (Ruta ruta : lsNumLinha) {
if (lsNumLinha.indexOf(ruta) == 0) {
sql.append(" AND R.RUTA_ID IN ( " + ruta.getRutaId());
} else {
sql.append(" , " + ruta.getRutaId() + " ");
}
}
sql.append(" ) ");
}
sql.append(tipoServico > 0 ? " AND C.TIPOSERVICIO_ID = " + tipoServico + " " : "");
sql.append(" AND C.ACTIVO <> 0 AND ORIGEM.ACTIVO = 1 AND DESTINO.ACTIVO = 1 AND TB2.ORIGEM = ORIGEM.CVEPARADA AND TB2.DESTINO = DESTINO.CVEPARADA ");
sql.append("AND R.ACTIVO = 1 AND RO.ACTIVO = 1 AND DA.ACTIVO = 1 AND CS.ACTIVO = 1 ");
sql.append("GROUP BY R.RUTA_ID, R.DESCRUTA, NVL(GR.DESCGRUPO, 'Não Definido'), TO_CHAR(C.FECHORSALIDA, 'HH24:MI'), C.CORRIDA_ID, R.INDSENTIDOIDA, ");
sql.append(" DA.CANTASIENTOS, CS.DESCCLASE, TB5.EXTENSAO, TB2.ORD, TB2.EXTRA, ABSOL, ");
sql.append(" CO.ESTADO_ID, CD.ESTADO_ID, ORIGEM.CVEPARADA, DESTINO.CVEPARADA, CJ.PRECIOPAGADO, ");
sql.append(" CJ.IMPORTESEGURO, CJ.IMPORTETAXAEMBARQUE, CJ.IMPORTEPEDAGIO, ");
sql.append(" CJ.EQUIVALENTE, CJ.KM_REAL , CJ.BOLETO_ID ) ");
sql.append("GROUP BY GRUPO_RUTA, HORA, DESCRUTA, SERVICO, SENTIDO, LOT, CLA, TARIFA, ORIGEM, DESTINO, ");
sql.append(" EXTENSAO, BAGAGENS, ORD, EXTRA, TIPO_LINHA, ABSOL ");
sql.append("ORDER BY TIPO_LINHA, GRUPO_RUTA, SERVICO, ORIGEM, DESTINO ");
return sql.toString();
}
private String buscarConstante(String nomeConstante) {
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
return constanteService.buscarPorNomeConstante(nomeConstante).getValorconstante();
}
protected void mesclarDataHora(Calendar pData, Calendar pHora) {
pData.set(Calendar.HOUR_OF_DAY, pHora.get(Calendar.HOUR_OF_DAY));
pData.set(Calendar.MINUTE, pHora.get(Calendar.MINUTE));
pData.set(Calendar.SECOND, pHora.get(Calendar.SECOND));
}
}

View File

@ -0,0 +1,60 @@
#geral
msg.noData=Não foi possivel obter dados com os parâmetros informados.
msg.a=à
#Labels header
header.titulo.relatorio=Resumo de Linhas por Horário - RLH
header.periodo=Per\u00EDodo\:
header.data.hora=Data/Hora\:
header.pagina=P\u00E1gina\:
header.filtro=Filtro\:
header.filtro.servico=Servi\u00E7o\:
header.filtro.linha=Linha\:
header.filtro.grupo=Grupo de Linhas\:
cabecalho.impressorPor=Impresso por
#Labels detail
detail.receita=RECEITA
detail.viagens=VIAGENS
detail.passageiros=PASSAGEIROS
detail.parametrosOperacionais=PARÂMETROS OPERACIONAIS
detail.hora=Hora
detail.servico=Serviço
detail.trecho=Trecho
detail.setido=Sentido
detail.lot=Lot.
detail.cal=Cla.
detail.extensao=Extensão
detail.tarifa=Tarifa
detail.passagens=Passagens
detail.seguro=Seguro
detail.bagagens=Bagagens
detail.segOpc=Tx. Embarque
detail.total=Total
detail.ord=Ord.
detail.extra=Extra
detail.totalViagem=Total
detail.km.rodad=Km Rodad.
detail.absol=Absol.
detail.equivalente=Equivalente
detail.mpa=MPA
detail.mpe=MPE
detail.rsKm=R$/Km
detail.eq=Eq.
detail.rsViagem=R$/Viagem
detail.paxOfer=Pax.Km Ofer.
detail.paxTrans=Pax.Km Transportado
detail.iap=IAP%
detail.pedagio=Pedágio
detail.linha=Linha
#Group
group.total=Total do Grupo
sub.total=Sub Total
total.geral=Total Geral
linhas=Linhas

View File

@ -11,6 +11,7 @@ header.filtro=Filtro\:
header.filtro.servico=Servi\u00E7o\:
header.filtro.linha=Linha\:
header.filtro.grupo=Grupo de Linhas\:
cabecalho.impressorPor=Impresso por
#Labels detail

View File

@ -0,0 +1,611 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioLinhasHorario" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ae2cbb01-bc79-4d18-8206-3b59273fe793">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="929"/>
<property name="ireport.y" value="48"/>
<parameter name="NOMBEMPRESA" class="java.lang.String"/>
<parameter name="DATA_INICIO" class="java.sql.Timestamp">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="DATA_FINAL" class="java.sql.Timestamp"/>
<parameter name="USUARIO_ID" class="java.lang.String"/>
<parameter name="LINHA_FILTRO" class="java.lang.String"/>
<parameter name="SERVICO_FILTRO" class="java.lang.String"/>
<parameter name="TOTAL_PASSAGENS" class="java.math.BigDecimal"/>
<parameter name="TOTAL_SEGURO" class="java.math.BigDecimal"/>
<parameter name="TOTAL_BAGAGENS" class="java.math.BigDecimal"/>
<parameter name="TOTAL_SEURO_OPCIONAL" class="java.math.BigDecimal"/>
<parameter name="TOTAL_TOTAL" class="java.math.BigDecimal"/>
<parameter name="TOTAL_ORDINARIO" class="java.math.BigDecimal"/>
<parameter name="TOTAL_EXTRA" class="java.math.BigDecimal"/>
<parameter name="TOTAL_VIAGEM" class="java.math.BigDecimal"/>
<parameter name="TOTAL_KM_RODADO" class="java.math.BigDecimal"/>
<parameter name="TOTAL_ABSOLUTO" class="java.math.BigDecimal"/>
<parameter name="TOTAL_EQUIVALENTE" class="java.math.BigDecimal"/>
<parameter name="MEDIA_MPA" class="java.math.BigDecimal"/>
<parameter name="MEDIA_MPE" class="java.math.BigDecimal"/>
<parameter name="MEDIA_RS_POR_KM" class="java.math.BigDecimal"/>
<parameter name="TOTAL_EQ" class="java.math.BigDecimal"/>
<parameter name="MEDIA_RS_POR_VIAGEM" class="java.math.BigDecimal"/>
<parameter name="TOTAL_PAX_KM_OFERTADO" class="java.math.BigDecimal"/>
<parameter name="TOTAL_IAP" class="java.math.BigDecimal"/>
<parameter name="TOTAL_PAX_KM_TRANSPORTADO" class="java.math.BigDecimal"/>
<parameter name="DESCGRUPO" class="java.lang.String"/>
<parameter name="TOTAL_PEDAGIO" class="java.math.BigDecimal"/>
<parameter name="NOME_USUARIO" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="rsKm" class="java.math.BigDecimal"/>
<field name="totalViagem" class="java.math.BigDecimal"/>
<field name="mediaReceitaViagem" class="java.math.BigDecimal"/>
<field name="grupoRuta" class="java.lang.String"/>
<field name="kmRodado" class="java.math.BigDecimal"/>
<field name="total" class="java.math.BigDecimal"/>
<field name="extensao" class="java.math.BigDecimal"/>
<field name="sentido" class="java.lang.String"/>
<field name="hora" class="java.lang.String"/>
<field name="passagens" class="java.math.BigDecimal"/>
<field name="paxKmTransportado" class="java.math.BigDecimal"/>
<field name="paxKmOfertado" class="java.math.BigDecimal"/>
<field name="rsViagem" class="java.math.BigDecimal"/>
<field name="seguro" class="java.math.BigDecimal"/>
<field name="tipoLinha" class="java.lang.String"/>
<field name="descRuta" class="java.lang.String"/>
<variable name="passagens_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{passagens}]]></variableExpression>
</variable>
<variable name="total_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{total}]]></variableExpression>
</variable>
<variable name="totalViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{totalViagem}]]></variableExpression>
</variable>
<variable name="kmRodado_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{kmRodado}]]></variableExpression>
</variable>
<variable name="rsKm_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Average">
<variableExpression><![CDATA[$F{rsKm}]]></variableExpression>
</variable>
<variable name="rsViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{rsViagem}]]></variableExpression>
</variable>
<variable name="paxKmOfertado_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{paxKmOfertado}]]></variableExpression>
</variable>
<variable name="paxKmTransportad_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{paxKmTransportado}]]></variableExpression>
</variable>
<variable name="media_rsViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$F{rsViagem}]]></variableExpression>
</variable>
<variable name="media_rsKm_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta">
<variableExpression><![CDATA[$P{TOTAL_TOTAL}.divide( $P{TOTAL_KM_RODADO}, 2, BigDecimal.ROUND_HALF_UP )]]></variableExpression>
</variable>
<variable name="linha_passagens_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{passagens_group}]]></variableExpression>
</variable>
<variable name="linha_total_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{total_group}]]></variableExpression>
</variable>
<variable name="linhas_totalViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{totalViagem_group}]]></variableExpression>
</variable>
<variable name="linha_kmRodado_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{kmRodado_group}]]></variableExpression>
</variable>
<variable name="linha_rsViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{rsViagem_group}]]></variableExpression>
</variable>
<variable name="linha_rsKm_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupTipoLinha" calculation="Average">
<variableExpression><![CDATA[$V{rsKm_group}]]></variableExpression>
</variable>
<variable name="linha_paxKmOfertado_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" calculation="Sum">
<variableExpression><![CDATA[$F{paxKmOfertado}]]></variableExpression>
</variable>
<variable name="linha_paxKmTransportad_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" incrementType="Group" incrementGroup="groupRuta" calculation="Sum">
<variableExpression><![CDATA[$V{paxKmTransportad_group}]]></variableExpression>
</variable>
<variable name="linha_media_rsViagem_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha" calculation="Sum">
<variableExpression><![CDATA[$F{rsViagem}]]></variableExpression>
</variable>
<variable name="linha_media_rsKm_group" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha">
<variableExpression><![CDATA[$P{TOTAL_PASSAGENS}.divide( $P{TOTAL_KM_RODADO}, 2, BigDecimal.ROUND_HALF_UP )]]></variableExpression>
</variable>
<variable name="TOTAL_RSKM" class="java.math.BigDecimal">
<variableExpression><![CDATA[$P{TOTAL_PASSAGENS}.divide( $P{TOTAL_KM_RODADO}, 2, BigDecimal.ROUND_HALF_UP )]]></variableExpression>
</variable>
<variable name="TOTAL_VIAGEM" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{rsViagem}]]></variableExpression>
</variable>
<variable name="TOTAL_PAX" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{paxKmOfertado}]]></variableExpression>
</variable>
<variable name="media_group_rsKm" class="java.math.BigDecimal" resetType="Group" resetGroup="groupRuta">
<variableExpression><![CDATA[$V{total_group}.divide( $V{kmRodado_group}, 2, BigDecimal.ROUND_HALF_UP )]]></variableExpression>
</variable>
<variable name="variable1" class="java.lang.String"/>
<variable name="linha_media_group_rsKm" class="java.math.BigDecimal" resetType="Group" resetGroup="groupTipoLinha">
<variableExpression><![CDATA[$V{linha_total_group}.divide( $V{linha_kmRodado_group}, 2, BigDecimal.ROUND_HALF_UP )]]></variableExpression>
</variable>
<group name="groupTipoLinha">
<groupExpression><![CDATA[$F{tipoLinha}]]></groupExpression>
<groupHeader>
<band height="11">
<textField>
<reportElement uuid="ec272582-7d97-4f4f-b17f-6b2fc07cce24" x="0" y="0" width="22" height="10"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$R{linhas}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="5d89bbb4-1324-4ab5-8779-340eecf810d9" x="0" y="10" width="802" height="1"/>
</line>
<textField isBlankWhenNull="true">
<reportElement uuid="e75e3f46-1173-42d0-9830-e40b067c2135" x="22" y="0" width="47" height="10"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{tipoLinha}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="11">
<textField>
<reportElement uuid="e74ae70a-978d-4983-b173-561bc2cea6ae" x="0" y="0" width="53" height="10"/>
<textElement>
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{sub.total}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="25517b93-4d63-44cc-b309-a8f40ab2e960" x="0" y="10" width="802" height="1"/>
</line>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="d5b91df5-2453-4baa-94f1-06a052273bc7" x="210" y="0" width="33" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_passagens_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="09708c24-ac71-4328-a5ad-bdf2e3234e9e" x="349" y="0" width="38" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_total_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="69d35909-758e-4b93-8a1a-8a2e7e664dec" x="448" y="0" width="36" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_kmRodado_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="622e24e6-fc0c-4f69-8682-ddf8be13b171" x="611" y="0" width="46" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_paxKmOfertado_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="93820d28-161d-45ac-8f58-6606eba9ba9f" x="657" y="0" width="88" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_paxKmTransportad_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="ea1384dd-eabe-4bc8-a3fb-6b539e7fdc4f" x="535" y="0" width="29" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{linha_media_group_rsKm}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
<group name="groupRuta">
<groupExpression><![CDATA[$F{grupoRuta}]]></groupExpression>
<groupHeader>
<band height="11">
<textField isBlankWhenNull="true">
<reportElement uuid="f1171f5c-2175-4176-82b0-c1a31f78f1d3" x="0" y="0" width="69" height="10"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{grupoRuta}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="6e1204b5-dc16-40df-b592-9046e0b31a14" x="0" y="10" width="802" height="1"/>
</line>
</band>
</groupHeader>
<groupFooter>
<band height="12">
<line>
<reportElement uuid="8dd18564-6d32-4232-a0fd-f39054849109" positionType="Float" x="0" y="0" width="803" height="1"/>
</line>
<textField>
<reportElement uuid="a7c33cf2-944b-4bd1-bb55-72ab698cc599" x="0" y="1" width="53" height="10"/>
<textElement>
<font size="6" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA[$R{group.total}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="2b63a56a-7ac3-4799-8e6e-5c2b7d8a3e8d" x="210" y="1" width="33" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{passagens_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="27802809-5617-44e5-a89b-cc64e8bde961" x="349" y="1" width="38" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{total_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="25f0464f-b216-44bd-aad1-d1b4f4dbe0ea" x="448" y="1" width="36" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{kmRodado_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="21287996-9232-449d-bccd-ed6ea18e1178" x="611" y="1" width="46" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{paxKmOfertado_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="e05e5006-df09-4a56-8f1f-c28a115b7e7d" x="657" y="1" width="88" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{paxKmTransportad_group}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="d6bdd9c3-6810-4f3b-8b0a-6d90a8abbb2c" x="535" y="1" width="29" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{media_group_rsKm}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="736a47e0-7471-44d8-98df-c61d122bf3ac" x="0" y="11" width="802" height="1"/>
</line>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band height="91" splitType="Stretch">
<textField>
<reportElement uuid="2523431f-2c2c-4a2b-a34f-785b8ea8f9dd" mode="Opaque" x="0" y="15" width="657" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.titulo.relatorio}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="9bb1d24c-1a5c-4281-b900-d35779e00807" mode="Opaque" x="0" y="30" width="49" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.periodo}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="eac5ed08-4a34-42e5-807e-2d40be1cc0f5" mode="Opaque" x="49" y="30" width="608" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[new SimpleDateFormat("dd/MM/yyyy").format($P{DATA_INICIO}) + " à " + new SimpleDateFormat("dd/MM/yyyy").format($P{DATA_FINAL})]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="77235663-6b8a-411f-89be-24b315b65adb" mode="Opaque" x="657" y="0" width="66" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.data.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cf1bcbcf-84b8-4d90-bbc7-22d9c7186952" mode="Opaque" x="657" y="15" width="98" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.pagina}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement uuid="efdae9bf-3550-4620-acd0-20c9c7b0e3b1" mode="Opaque" x="723" y="0" width="79" height="15" backcolor="#CDCDCD"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="4070d457-cdcc-434e-8e50-5494a05815f9" mode="Opaque" x="755" y="15" width="25" height="15" backcolor="#CDCDCD"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="26156964-8733-4ad1-96fd-2ae8414636b7" mode="Opaque" x="780" y="15" width="22" height="15" backcolor="#CDCDCD"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="27a77abc-db13-4836-9261-8208f3825802" x="0" y="60" width="802" height="1"/>
</line>
<textField>
<reportElement uuid="06a43567-1fd2-4c86-a0cc-443618ddf965" mode="Opaque" x="0" y="45" width="802" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.filtro} + $R{header.filtro.linha} + " ( " + $P{LINHA_FILTRO} + " ) " + $R{header.filtro.servico} + " ( " + $P{SERVICO_FILTRO} + " ) " + $R{header.filtro.grupo} + " ( " + $P{DESCGRUPO} + " ) "]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="c11155fe-5b61-44d7-8ad6-f9a3181f6c0a" x="549" y="67" width="185" height="10"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.parametrosOperacionais}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="9c896277-f8e2-41ce-bf13-95499b7d3da7" x="535" y="77" width="210" height="1"/>
</line>
<textField>
<reportElement uuid="169274ca-49ff-4136-9eb3-3f3384ebcdb8" x="409" y="67" width="64" height="10"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.viagens}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="5e64ae31-94b7-4b72-872c-d68ac8262db5" x="397" y="77" width="87" height="1"/>
</line>
<textField>
<reportElement uuid="b350299e-c005-4896-b5b3-2a20af2166ce" x="193" y="67" width="183" height="10"/>
<textElement textAlignment="Center">
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.receita}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="c4e021a7-182e-4edc-a927-b3fbba87f5cc" x="193" y="77" width="194" height="1"/>
</line>
<textField>
<reportElement uuid="c0f124b2-3691-4f49-9b86-69d76f249584" x="0" y="80" width="22" height="9"/>
<textElement markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="30b30f3d-c4f3-40a2-825a-812ae5475414" x="129" y="80" width="24" height="10"/>
<textElement markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.setido}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b4d0878e-61e8-436c-a83b-8f95548e52be" x="153" y="80" width="40" height="11"/>
<textElement textAlignment="Right" markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.extensao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7cf8f759-fbec-487c-af73-6d5d3c10137d" x="210" y="80" width="33" height="11"/>
<textElement markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.passagens}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="723b5317-9cfc-4722-900f-5d94c2050b39" x="349" y="80" width="38" height="10"/>
<textElement textAlignment="Center" markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.total}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b97305e9-580b-4cdb-a5f2-eae59e567ec7" x="448" y="80" width="36" height="10"/>
<textElement textAlignment="Center">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.km.rodad}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="f9fd6d4e-46da-4f69-a9bd-6e4183f317b4" x="535" y="81" width="29" height="8"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.rsKm}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="bd2bf73d-3952-4bf3-83ba-554d5edfe9ea" x="611" y="81" width="46" height="8"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.paxOfer}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="1d3df7eb-9705-4f8e-b2fd-ecd5a4a7f80a" x="657" y="81" width="88" height="8"/>
<textElement textAlignment="Right" verticalAlignment="Top">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.paxTrans}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="b6bdef50-f793-4c23-b188-505c0fb7bf18" x="0" y="90" width="803" height="1"/>
</line>
<textField>
<reportElement uuid="f7a61ca8-00fd-400d-b1c4-e22f5295941f" x="22" y="80" width="107" height="10"/>
<textElement markup="none">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.linha}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5f633340-6d79-46a6-a540-6eb09b2f7f8e" mode="Opaque" x="657" y="30" width="66" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$R{cabecalho.impressorPor}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e87d0055-94ea-4d7a-900e-24944a6c5f0f" mode="Opaque" x="0" y="0" width="657" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$P{NOMBEMPRESA}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="da09a6c8-d710-4967-8595-5b5111cc3b4c" mode="Opaque" x="723" y="30" width="79" height="15" backcolor="#CDCDCD"/>
<textElement/>
<textFieldExpression><![CDATA[$P{USUARIO_ID}+"-"+$P{NOME_USUARIO}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="10" splitType="Stretch">
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="f75ac988-7ec6-4d13-a51e-3a9f933eee66" x="349" y="0" width="38" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="e1bac278-5cfb-4732-8e2d-2973b3e847e4" x="448" y="0" width="36" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{kmRodado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="ac86ec2e-f3d6-4841-b40f-7b37d53c3f04" x="0" y="0" width="22" height="10"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{hora}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="34173f78-c597-498a-9277-929b9458ec25" x="210" y="0" width="33" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{passagens}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="afdc1c7a-72f8-4992-b747-97e4744034a1" x="153" y="0" width="40" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{extensao}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="a1a23dd1-bd8b-42e1-b63b-4d4408b85510" x="657" y="0" width="88" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{paxKmTransportado}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="9f3b6452-9748-435b-8509-4a38beeb2766" x="611" y="0" width="46" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{paxKmOfertado}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00">
<reportElement uuid="8c3fd018-651e-4cb3-96da-7c33a0c8db83" x="535" y="0" width="29" height="10"/>
<textElement textAlignment="Right">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{rsKm}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="d5b5f4cf-5f24-4f8c-8a81-b86bc0420d08" x="129" y="0" width="24" height="10"/>
<textElement textAlignment="Center">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{sentido}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="3850d6a2-d8f1-4e97-9dfb-b93b8ef5472f" x="22" y="0" width="107" height="10"/>
<textElement textAlignment="Center">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$F{descRuta}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<lastPageFooter>
<band/>
</lastPageFooter>
<summary>
<band height="10" splitType="Stretch">
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="fb2fa43e-b87b-4b4d-9e15-dd60bfe81787" positionType="Float" x="210" y="0" width="33" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{TOTAL_PASSAGENS}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="7bbb0c46-57d5-449b-ac94-15eba31bae5b" positionType="Float" x="349" y="0" width="38" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{TOTAL_TOTAL}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="0497b315-b7d5-436d-9e66-144db5dec2c1" positionType="Float" x="448" y="0" width="36" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{TOTAL_KM_RODADO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6813f5a3-1810-4b53-82ea-3df08df9548f" x="0" y="0" width="51" height="10"/>
<textElement>
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{total.geral}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="c89eabd5-2f70-4834-a49a-a44efa77b8c8" positionType="Float" x="535" y="0" width="29" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true" isStrikeThrough="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{TOTAL_RSKM}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="cf7bbf9b-a37a-4bd3-a629-7958b51bacf7" positionType="Float" x="611" y="0" width="46" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{TOTAL_PAX}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement uuid="9098e4b0-55e4-44ea-8d26-05a85a1b9774" positionType="Float" x="657" y="0" width="88" height="10"/>
<textElement textAlignment="Right">
<font size="6" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{TOTAL_PAX_KM_TRANSPORTADO}]]></textFieldExpression>
</textField>
</band>
</summary>
<noData>
<band height="20">
<textField>
<reportElement uuid="3429e199-e682-4e28-b2ce-1bc9f2d031b2" x="0" y="0" width="803" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -41,6 +41,8 @@ public class RelatorioLinhasHorarioBean {
private BigDecimal ordLinha;
private BigDecimal extraLinha;
private BigDecimal somaExtensaoTrecho;
private String descRuta;
public RelatorioLinhasHorarioBean() {
}
@ -354,4 +356,11 @@ public class RelatorioLinhasHorarioBean {
public void setSomaExtensaoTrecho(BigDecimal somaExtensaoTrecho) {
this.somaExtensaoTrecho = somaExtensaoTrecho;
}
public String getDescRuta() {
return descRuta;
}
public void setDescRuta(String descRuta) {
this.descRuta = descRuta;
}
}

View File

@ -17,23 +17,27 @@ import org.zkoss.util.resource.Labels;
import org.zkoss.zhtml.Messagebox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Intbox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Timebox;
import com.rjconsultores.ventaboletos.entidad.Corrida;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.GrupoRuta;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioLinhasHorario;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioLinhasHorarioSimplificado;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.service.CorridaService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.GrupoRutaService;
import com.rjconsultores.ventaboletos.service.RutaService;
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCorridaOrigemDestino;
@ -84,6 +88,9 @@ public class RelatorioLinhasHorarioController extends MyGenericForwardComposer {
private Radio rdOrdinario;
private Radio rdExtraOrdinario;
private Radio rdTodos;
private Checkbox chkSimplificado;
private Timebox horaInicial;
private Timebox horaFinal;
@SuppressWarnings({ "unchecked", "rawtypes" })
private void executarRelatorio() throws Exception {
@ -117,6 +124,11 @@ public class RelatorioLinhasHorarioController extends MyGenericForwardComposer {
parametros.put("DATA_INICIO", dataInicio);
parametros.put("DATA_FINAL", dataFinal);
parametros.put("ISSIMPLIFICADO", chkSimplificado.isChecked());
parametros.put("USUARIO_ID", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
parametros.put("NOME_USUARIO", UsuarioLogado.getUsuarioLogado().getNombusuario().toString());
if(cmbEmpresa.getSelectedItem() != null && cmbEmpresa.getSelectedItem().getValue() != null) {
Empresa empresa = (Empresa) cmbEmpresa.getSelectedItem().getValue();
parametros.put("EMPRESA", empresa);
@ -145,8 +157,19 @@ public class RelatorioLinhasHorarioController extends MyGenericForwardComposer {
parametros.put("lsNumLinha", lsNumLinha);
parametros.put("lsNumServico", lsNumServico);
Relatorio relatorio = null;
if(!chkSimplificado.isChecked()) {
relatorio = new RelatorioLinhasHorario(parametros, dataSourceRead.getConnection());
}else {
if(horaInicial.getValue() != null){
parametros.put("HORA_INICIAL", horaInicial.getValue());
}
if(horaFinal.getValue()!= null){
parametros.put("HORA_FINAL", horaFinal.getValue());
}
relatorio = new RelatorioLinhasHorarioSimplificado(parametros, dataSourceRead.getConnection());
Relatorio relatorio = new RelatorioLinhasHorario(parametros, dataSourceRead.getConnection());
}
Map<String, Object> args = new HashMap<String, Object>();
args.put("relatorio", relatorio);

View File

@ -643,6 +643,9 @@ relatorioLinhasHorarioController.rdTipoServico.label = Tipos de Serviços
relatorioLinhasHorarioController.rdOrdinario.label = Ordinários
relatorioLinhasHorarioController.rdExtraOrdinario.label = Extraordinários
relatorioLinhasHorarioController.rdTodos.label = Todos
relatorioLinhasHorarioController.lblSimplificado.value = Emite relatório Simplificado
relatorioLinhasHorarioController.lbHoraSaidaInicial.value = Hora Saída
relatorioLinhasHorarioController.lbHoraSaidaFinal.value = à
#Relatorio Trecho Vendido
relatorioTrechoVendidoController.lbDataIni.value = Data Inicial
@ -918,7 +921,7 @@ relatorioDemandasController.lbFiltrarGratuidadeCrianca.value = Excluir Gratuidad
relatorioDemandasController.lbTipoRelatorioDetalhado.value = Detalhado
relatorioDemandasController.lbTipoRelatorioDiario.value = Diário
relatorioDemandasController.lbTipoRelatorioConsolidado.value = Consolidado
relatorioDemandasController.ConstanteGratuidadeError = A constante 'GRATUIDADE CRIANÇA' não esta definida no banco de dados
relatorioDemandasController.ConstanteGratuidadeError = A constante 'GRATUIDADE CRIANÇA' não esta definida no banco de dadosf
#Relatorio de Cancelamento de Passagem por Cartão
relatorioCancelamentoVendaCartaoController.window.title = Relatório de Cancelamento de Venda por Cartão

View File

@ -7,15 +7,15 @@
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioLinhasHorario"
apply="${relatorioLinhasHorarioController}"
contentStyle="overflow:auto" height="464px" width="550px"
contentStyle="overflow:auto" height="538px" width="600px"
border="normal">
<grid fixedLayout="true">
<columns>
<column width="20%" />
<column width="30%" />
<column width="20%" />
<column width="30%" />
<column width="13%" />
<column width="37%" />
<column width="13%" />
<column width="37%" />
</columns>
<rows>
@ -32,6 +32,20 @@
format="dd/MM/yyyy" constraint="no empty"
maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioLinhasHorarioController.lbHoraSaidaInicial.value')}" />
<timebox id="horaInicial" width="50%" format="HH:mm"
mold="rounded" maxlength="10" cols="14" />
<label
value="${c:l('relatorioLinhasHorarioController.lbHoraSaidaFinal.value')}" />
<timebox id="horaFinal" width="50%" format="HH:mm"
mold="rounded" maxlength="10" cols="14" >
<attribute name="onFocus">
horaFinal.setText(horaInicial.getText());
</attribute>
</timebox>
</row>
</rows>
</grid>
@ -82,7 +96,6 @@
</row>
<row>
<cell colspan="4">
<borderlayout height="100px">
@ -220,6 +233,13 @@
</hbox>
</radiogroup>
</row>
<row height="40px" >
<cell colspan="2">
<checkbox id="chkSimplificado"
label="${c:l('relatorioLinhasHorarioController.lblSimplificado.value')}" >
</checkbox>
</cell>
</row>
</rows>
</grid>