CORREÇÕES DO RELATORIO LINHA POR HORARIO
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@29716 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5d37274afc
commit
b9c3065ef9
|
@ -68,6 +68,8 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
Integer tipoServico = (Integer) parametros.get("TIPOSERVICIO_ID");
|
||||
String sql = getSql(lsNumLinha, lsNumServico, empresa, tipoServico);
|
||||
|
||||
System.out.println(sql);
|
||||
|
||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||
ResultSet rset = null;
|
||||
|
||||
|
@ -102,7 +104,6 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
horarioBean.setOrd((BigDecimal) rset.getObject("ORD"));
|
||||
horarioBean.setExtra((BigDecimal) rset.getObject("EXTRA"));
|
||||
horarioBean.setAbsol((BigDecimal) rset.getObject("ABSOL"));
|
||||
horarioBean.setQuanPasTrecho((BigDecimal) rset.getObject("QUAN_PAS_TRECHO"));
|
||||
|
||||
horarioBean.setOrigem((String) rset.getObject("ORIGEM"));
|
||||
horarioBean.setDestino((String) rset.getObject("DESTINO"));
|
||||
|
@ -126,6 +127,8 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
horarioBean = calcPaxKmTransportado(horarioBean);
|
||||
horarioBean = calcIap(horarioBean);
|
||||
|
||||
horarioBean.setExtensao(horarioBean.getExtensaoTrecho());
|
||||
|
||||
lsDadosRelatorio.add(horarioBean);
|
||||
}
|
||||
parametros.put("lsDadosRelatorio", lsDadosRelatorio);
|
||||
|
@ -162,7 +165,7 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
}
|
||||
|
||||
private RelatorioLinhasHorarioBean calcKmRodado(RelatorioLinhasHorarioBean horarioBean) {
|
||||
BigDecimal kmRodado = horarioBean.getTotalViagem().multiply(horarioBean.getExtensao());
|
||||
BigDecimal kmRodado = horarioBean.getTotalViagem().multiply(horarioBean.getExtensaoTrecho());
|
||||
horarioBean.setKmRodado(kmRodado);
|
||||
return horarioBean;
|
||||
}
|
||||
|
@ -171,7 +174,7 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
BigDecimal equivalente = new BigDecimal(0);
|
||||
try {
|
||||
equivalente = horarioBean.getExtensao().divide(horarioBean.getExtensaoTrecho(), RoundingMode.CEILING);
|
||||
equivalente = equivalente.multiply(horarioBean.getQuanPasTrecho());
|
||||
equivalente = equivalente.multiply(horarioBean.getAbsol());
|
||||
|
||||
} catch (ArithmeticException e) {
|
||||
equivalente = new BigDecimal(0);
|
||||
|
@ -186,7 +189,16 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
}
|
||||
|
||||
private RelatorioLinhasHorarioBean calcMpa(RelatorioLinhasHorarioBean horarioBean) {
|
||||
BigDecimal mpa = horarioBean.getAbsol().divide(horarioBean.getTotalViagem(), RoundingMode.CEILING);
|
||||
BigDecimal mpa = new BigDecimal(0);
|
||||
try {
|
||||
mpa = horarioBean.getAbsol().divide(horarioBean.getTotalViagem(), RoundingMode.CEILING);
|
||||
} catch (ArithmeticException e) {
|
||||
mpa = new BigDecimal(0);
|
||||
} catch (NullPointerException nex) {
|
||||
mpa = new BigDecimal(0);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
horarioBean.setMpa(mpa);
|
||||
return horarioBean;
|
||||
}
|
||||
|
@ -199,7 +211,7 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
|
||||
private RelatorioLinhasHorarioBean calcRsKm(RelatorioLinhasHorarioBean horarioBean) {
|
||||
BigDecimal rsKm = horarioBean.getTotal().divide(horarioBean.getTotalViagem(), RoundingMode.CEILING);
|
||||
rsKm = rsKm.multiply(horarioBean.getExtensao());
|
||||
rsKm = rsKm.multiply(horarioBean.getExtensaoTrecho());
|
||||
horarioBean.setRsKm(rsKm);
|
||||
return horarioBean;
|
||||
}
|
||||
|
@ -233,7 +245,7 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
}
|
||||
|
||||
private RelatorioLinhasHorarioBean calcPaxKmTransportado(RelatorioLinhasHorarioBean horarioBean) {
|
||||
BigDecimal paxKmTransportado = horarioBean.getExtensao().multiply(horarioBean.getEquivalente());
|
||||
BigDecimal paxKmTransportado = horarioBean.getExtensaoTrecho().multiply(horarioBean.getEquivalente());
|
||||
horarioBean.setPaxKmTransportado(paxKmTransportado);
|
||||
return horarioBean;
|
||||
}
|
||||
|
@ -276,28 +288,38 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
sql.append(" SUM(NVL(EE.IMPINGRESO, 0)) AS BAGAGENS, ");
|
||||
sql.append(" SUM(NVL(CJ.PRECIOBASE, 0)) AS PASSAGENS, ");
|
||||
sql.append(" SUM(NVL(CJ.IMPORTETAXAEMBARQUE, 0)) AS SEGURO, ");
|
||||
sql.append(" COUNT(CASE ");
|
||||
sql.append(" WHEN C.TIPOSERVICIO_ID = 1 ");
|
||||
sql.append(" OR C.TIPOSERVICIO_ID IS NULL THEN 1 ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END) AS ORD, ");
|
||||
sql.append(" COUNT(CASE ");
|
||||
sql.append(" WHEN C.TIPOSERVICIO_ID = 2 ");
|
||||
sql.append(" OR C.TIPOSERVICIO_ID IS NULL THEN 1 ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END) AS EXTRA, ");
|
||||
sql.append(" COUNT(CASE ");
|
||||
sql.append(" WHEN CJ.FECCORRIDA > :DATA_INICIO ");
|
||||
sql.append(" AND CJ.FECCORRIDA < :DATA_FINAL THEN 1 ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END) AS ABSOL, ");
|
||||
sql.append(" COUNT(CJ.CORRIDA_ID) AS QUAN_PAS_TRECHO ");
|
||||
|
||||
sql.append(" ORD, ");
|
||||
sql.append(" EXTRA, ");
|
||||
|
||||
sql.append(" COUNT(CJ.CORRIDA_ID) AS ABSOL ");
|
||||
|
||||
sql.append(" FROM (SELECT RS.RUTA_ID, ");
|
||||
sql.append(" SUM(NVL(T.CANTKMREAL, 0)) AS EXTENSAO ");
|
||||
sql.append(" FROM RUTA_SECUENCIA RS ");
|
||||
sql.append(" LEFT JOIN TRAMO T ");
|
||||
sql.append(" ON ( RS.TRAMO_ID = T.TRAMO_ID ) ");
|
||||
sql.append(" GROUP BY RS.RUTA_ID) TB1, ");
|
||||
|
||||
sql.append(" (SELECT C.CORRIDA_ID, ");
|
||||
sql.append(" COUNT(CASE ");
|
||||
sql.append(" WHEN C.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
|
||||
sql.append(" AND C.TIPOSERVICIO_ID = 1 THEN 1 ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END) AS ORD ");
|
||||
sql.append(" FROM CORRIDA C ");
|
||||
sql.append(" WHERE C.ACTIVO = 1 ");
|
||||
sql.append(" GROUP BY C.CORRIDA_ID) TB2, ");
|
||||
sql.append(" (SELECT C.CORRIDA_ID, ");
|
||||
sql.append(" COUNT(CASE ");
|
||||
sql.append(" WHEN C.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
|
||||
sql.append(" AND C.TIPOSERVICIO_ID = 2 THEN 1 ");
|
||||
sql.append(" ELSE NULL ");
|
||||
sql.append(" END) AS EXTRA ");
|
||||
sql.append(" FROM CORRIDA C ");
|
||||
sql.append(" WHERE C.ACTIVO = 1 ");
|
||||
sql.append(" GROUP BY C.CORRIDA_ID) TB3, ");
|
||||
|
||||
sql.append(" CORRIDA C ");
|
||||
sql.append(" LEFT JOIN CAJA CJ ");
|
||||
sql.append(" ON ( CJ.CORRIDA_ID = C.CORRIDA_ID ");
|
||||
|
@ -322,6 +344,8 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
sql.append(" AND EE.TIPOEVENTOEXTRA_ID = 1 ) ");
|
||||
sql.append(" WHERE CJ.FECCORRIDA BETWEEN :DATA_INICIO AND :DATA_FINAL ");
|
||||
sql.append(" AND TB1.RUTA_ID = C.RUTA_ID ");
|
||||
sql.append(" AND TB2.CORRIDA_ID = C.CORRIDA_ID ");
|
||||
sql.append(" AND TB3.CORRIDA_ID = C.CORRIDA_ID ");
|
||||
|
||||
if (empresa != null) {
|
||||
sql.append(" AND C.EMPRESACORRIDA_ID IN ( " + empresa.getEmpresaId() + " ) ");
|
||||
|
@ -353,6 +377,15 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
sql.append(" AND C.TIPOSERVICIO_ID = " + tipoServico + " ");
|
||||
}
|
||||
|
||||
sql.append(" AND C.ACTIVO = 1 ");
|
||||
sql.append(" AND CJ.ACTIVO = 1 ");
|
||||
sql.append(" AND ORIGEM.ACTIVO = 1 ");
|
||||
sql.append(" AND DESTINO.ACTIVO = 1 ");
|
||||
sql.append(" AND R.ACTIVO = 1 ");
|
||||
sql.append(" AND RO.ACTIVO = 1 ");
|
||||
sql.append(" AND DA.ACTIVO = 1 ");
|
||||
sql.append(" AND CS.ACTIVO = 1 ");
|
||||
|
||||
sql.append(" GROUP BY ");
|
||||
sql.append(" NVL(GR.DESCGRUPO, 'Não Informado'), ");
|
||||
sql.append(" TO_CHAR(CJ.FECHORVIAJE, 'HH24:MI'), ");
|
||||
|
@ -363,9 +396,12 @@ public class RelatorioLinhasHorario extends Relatorio {
|
|||
sql.append(" CS.CVECLASE, ");
|
||||
sql.append(" CJ.NUMKMVIAJE, ");
|
||||
sql.append(" EXTENSAO, ");
|
||||
sql.append(" ORD, ");
|
||||
sql.append(" EXTRA, ");
|
||||
sql.append(" ORIGEM.CVEPARADA, ");
|
||||
sql.append(" DESTINO.CVEPARADA ");
|
||||
sql.append(" ORDER BY C.CORRIDA_ID ");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
<?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" 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="705"/>
|
||||
<property name="ireport.x" value="0"/>
|
||||
<property name="ireport.y" value="0"/>
|
||||
<subDataset name="dataset1" uuid="0071d032-5d46-4665-9806-aa548a2ddde3">
|
||||
<field name="grupoRuta" class="java.lang.String"/>
|
||||
|
@ -22,7 +22,6 @@
|
|||
<field name="ord" class="java.math.BigDecimal"/>
|
||||
<field name="extra" class="java.math.BigDecimal"/>
|
||||
<field name="absol" class="java.math.BigDecimal"/>
|
||||
<field name="quanPasTrecho" class="java.math.BigDecimal"/>
|
||||
<field name="mediaReceitaViagem" class="java.math.BigDecimal"/>
|
||||
<field name="totalViagem" class="java.math.BigDecimal"/>
|
||||
<field name="kmRodado" class="java.math.BigDecimal"/>
|
||||
|
@ -74,18 +73,18 @@
|
|||
<textElement/>
|
||||
<textFieldExpression><![CDATA[$R{header.periodo}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<textField pattern="dd/MM/yyyy">
|
||||
<reportElement uuid="1b08c6ad-b995-4fec-aab0-88534f3a3f13" x="49" y="40" width="53" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression><![CDATA[$P{DATA_INICIO}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement uuid="eac5ed08-4a34-42e5-807e-2d40be1cc0f5" x="102" y="40" width="13" height="20"/>
|
||||
<reportElement uuid="eac5ed08-4a34-42e5-807e-2d40be1cc0f5" x="102" y="40" width="24" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression><![CDATA[" à"]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField>
|
||||
<reportElement uuid="caf9beb2-d99f-4fa1-8558-18cf2fe17085" x="126" y="40" width="42" height="20"/>
|
||||
<textField pattern="dd/MM/yyyy">
|
||||
<reportElement uuid="caf9beb2-d99f-4fa1-8558-18cf2fe17085" x="126" y="40" width="55" height="20"/>
|
||||
<textElement/>
|
||||
<textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression>
|
||||
</textField>
|
||||
|
|
|
@ -24,7 +24,6 @@ public class RelatorioLinhasHorarioBean {
|
|||
private BigDecimal ord;
|
||||
private BigDecimal extra;
|
||||
private BigDecimal absol;
|
||||
private BigDecimal quanPasTrecho;
|
||||
private BigDecimal mediaReceitaViagem;
|
||||
private BigDecimal totalViagem;
|
||||
private BigDecimal kmRodado;
|
||||
|
@ -210,14 +209,6 @@ public class RelatorioLinhasHorarioBean {
|
|||
this.absol = absol;
|
||||
}
|
||||
|
||||
public BigDecimal getQuanPasTrecho() {
|
||||
return quanPasTrecho;
|
||||
}
|
||||
|
||||
public void setQuanPasTrecho(BigDecimal quanPasTrecho) {
|
||||
this.quanPasTrecho = quanPasTrecho;
|
||||
}
|
||||
|
||||
public BigDecimal getMediaReceitaViagem() {
|
||||
return mediaReceitaViagem;
|
||||
}
|
||||
|
|
|
@ -99,14 +99,15 @@
|
|||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.lbServico.label')}"
|
||||
width="20%" />
|
||||
<listheader label="Dia"
|
||||
width="15%" />
|
||||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.horaSaida.label')}"
|
||||
width="10%" />
|
||||
width="15%" />
|
||||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.rutaId.label')}"
|
||||
width="45%" />
|
||||
width="20%" />
|
||||
<listheader
|
||||
label="${c:l('relatorioLinhasHorarioController.origem.destino.label')}"
|
||||
width="35%" />
|
||||
<listheader width="10%" />
|
||||
|
||||
</listhead>
|
||||
|
|
Loading…
Reference in New Issue