0004870: Relatório de Aproveitamento

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@33508 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2014-02-07 12:49:42 +00:00
parent 51be27db4b
commit 62ded94dc9
5 changed files with 337 additions and 178 deletions

View File

@ -3,15 +3,22 @@
*/
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ProcessadorParametros;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.SaidaRelatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioAproveitamentoBean;
import com.rjconsultores.ventaboletos.web.utilerias.CurrencyUtil;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
/**
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
@ -19,12 +26,14 @@ import com.rjconsultores.ventaboletos.web.utilerias.CurrencyUtil;
*/
public class RelatorioAproveitamento extends Relatorio {
public RelatorioAproveitamento(Map<String, Object> parametros, Connection conexao) {
private List<RelatorioAproveitamentoBean> lsDadosRelatorio;
public RelatorioAproveitamento(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setProcessadorParametros(new ProcessadorParametros(this) {
this.setCustomDataSource(new DataSource(this) {
@Override
public void processaParametros() throws Exception {
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
@ -42,7 +51,6 @@ public class RelatorioAproveitamento extends Relatorio {
if (rset.next()) {
// TODO Alterar para injeção de acordo com usuário logado ou outro meio para obter o Locale correto
Locale locale = new Locale("pt", "BR");
parametros.put("P_NOMINAL_KM", CurrencyUtil.getCurrencyStrFromStr(rset.getString("NOMINAL_KM"), locale));
@ -53,23 +61,141 @@ public class RelatorioAproveitamento extends Relatorio {
parametros.put("P_TOTAL_NOMINAL", CurrencyUtil.getCurrencyStrFromStr(rset.getString("TOTAL_NOMINAL"), locale));
parametros.put("P_OCUPACAO_S_ARRECADACAO", CurrencyUtil.getPercentStrFromStr(rset.getString("OCUPACAO_S_ARRECADACAO"), locale));
}
NamedParameterStatement nps = new NamedParameterStatement(conexao, getSqlDetail());
nps.setInt("CORRIDA_ID", Integer.valueOf((String) parametros.get("CORRIDA_ID")));
nps.setDate("FECCORRIDA", (java.sql.Date) parametros.get("FECCORRIDA"));
rset = nps.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioAproveitamentoBean>();
while (rset.next()) {
RelatorioAproveitamentoBean aproveitamentoBean = new RelatorioAproveitamentoBean();
aproveitamentoBean.setCveparada((String) rset.getObject("CVEPARADA"));
aproveitamentoBean.setAsiento((BigDecimal) rset.getObject("ASIENTO"));
aproveitamentoBean.setOcupado((BigDecimal) rset.getObject("OCUPADO"));
aproveitamentoBean.setOcupadoOperacao((BigDecimal) rset.getObject("OCUPADO_OPERACAO"));
aproveitamentoBean.setNumsecuencia((BigDecimal) rset.getObject("NUMSECUENCIA"));
lsDadosRelatorio.add(aproveitamentoBean);
}
Integer asiento = 1;
BigDecimal ocupado = null;
Integer secOcupado = 0;
for (RelatorioAproveitamentoBean i : lsDadosRelatorio) {
if (asiento.equals(i.getAsiento().intValue())) {
if (i.getOcupado() != null) {
if (secOcupado.equals(0)) {
secOcupado++;
ocupado = i.getOcupado();
i.setOcupado(new BigDecimal(secOcupado));
} else {
if (!i.getOcupado().equals(ocupado)) {
secOcupado++;
ocupado = i.getOcupado();
i.setOcupado(new BigDecimal(secOcupado));
} else {
i.setOcupado(new BigDecimal(secOcupado));
}
}
}
} else {
secOcupado = 0;
if (i.getOcupado() != null)
i.setOcupado(BigDecimal.ONE);
}
asiento = i.getAsiento().intValue();
}
setLsDadosRelatorio(lsDadosRelatorio);
}
}
);
});
}
/*
* (non-Javadoc)
*
* @see com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio#processaParametros()
*/
@Override
public void processaParametros() throws Exception {
this.getProcessadorParametros().processaParametros();
}
private String getSqlDetail() {
StringBuilder sql = new StringBuilder();
sql.append("SELECT DISTINCT PR.CVEPARADA AS CVEPARADA, ");
sql.append(" TO_NUMBER(DD.ASIENTO) AS ASIENTO, ");
sql.append(" (SELECT BO.BOLETO_ID ");
sql.append(" FROM BOLETO BO, ");
sql.append(" CORRIDA_TRAMO CTD, ");
sql.append(" CORRIDA_TRAMO CTO ");
sql.append(" WHERE BO.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND BO.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND BO.NUMASIENTO = DD.ASIENTO ");
sql.append(" AND BO.ORIGEN_ID = CTO.ORIGEN_ID ");
sql.append(" AND BO.DESTINO_ID = CTD.DESTINO_ID ");
sql.append(" AND CTD.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND CTD.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND CTO.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND CTO.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND CTO.ACTIVO = 1 ");
sql.append(" AND CTD.ACTIVO = 1 ");
sql.append(" AND VT.NUMSECUENCIA BETWEEN ");
sql.append(" CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA + 1 ");
sql.append(" AND BO.ACTIVO = 1 ");
sql.append(" AND ( BO.MOTIVOCANCELACION_ID IS NULL ");
sql.append(" OR BO.MOTIVOCANCELACION_ID = 0 ) ");
sql.append(" AND ROWNUM = 1) OCUPADO, ");
sql.append(" (SELECT DECODE(AE.VENDIBLE, 1, 1, ");
sql.append(" 0, 2) ");
sql.append(" FROM ASIENTO_EXCLUSIVO AE, ");
sql.append(" CORRIDA_TRAMO CTD, ");
sql.append(" CORRIDA_TRAMO CTO ");
sql.append(" WHERE AE.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND AE.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND AE.NUMASIENTO = DD.ASIENTO ");
sql.append(" AND AE.PARADA_ID = CTO.ORIGEN_ID ");
sql.append(" AND NVL(AE.DESTINO_ID, CR.DESTINO_ID) = CTD.DESTINO_ID ");
sql.append(" AND CTD.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND CTD.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND CTO.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND CTO.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND CTO.ACTIVO = 1 ");
sql.append(" AND CTD.ACTIVO = 1 ");
sql.append(" AND VT.NUMSECUENCIA BETWEEN ");
sql.append(" CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA + 1 ");
sql.append(" AND AE.ACTIVO = 1) OCUPADO_OPERACAO, ");
sql.append(" VT.NUMSECUENCIA AS NUMSECUENCIA ");
sql.append("FROM CORRIDA CR, ");
sql.append(" (SELECT CT.ORIGEN_ID PARADA_ID, ");
sql.append(" CT.NUMSECUENCIA ");
sql.append(" FROM CORRIDA_TRAMO CT ");
sql.append(" WHERE CT.CORRIDA_ID = :CORRIDA_ID ");
sql.append(" AND TRUNC(CT.FECCORRIDA) = :FECCORRIDA ");
sql.append(" AND CT.ACTIVO = 1 ");
sql.append(" UNION ");
sql.append(" SELECT CT.DESTINO_ID, ");
sql.append(" CT.NUMSECUENCIA + 1 ");
sql.append(" FROM CORRIDA_TRAMO CT ");
sql.append(" WHERE CT.CORRIDA_ID = :CORRIDA_ID ");
sql.append(" AND TRUNC(CT.FECCORRIDA) = :FECCORRIDA ");
sql.append(" AND CT.ACTIVO = 1 ");
sql.append(" ORDER BY 2) VT, ");
sql.append(" PARADA PR, ");
sql.append(" ROL_OPERATIVO RO, ");
sql.append(" DET_DIAGRAMA_AUTOBUS DD ");
sql.append("WHERE CR.CORRIDA_ID = :CORRIDA_ID ");
sql.append(" AND TRUNC(CR.FECCORRIDA) = :FECCORRIDA ");
sql.append(" AND VT.PARADA_ID = PR.PARADA_ID ");
sql.append(" AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID ");
sql.append(" AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID ");
sql.append(" AND DD.VENDIBLE = 1 ");
sql.append("ORDER BY TO_NUMBER(DD.ASIENTO), ");
sql.append(" VT.NUMSECUENCIA ");
return sql.toString();
}
private String getSql() {
@ -281,10 +407,23 @@ public class RelatorioAproveitamento extends Relatorio {
sql.append(" AND DD.ACTIVO = 1 ");
sql.append(" AND CT.ACTIVO = 1) TOTAL_OCUPADOS_OPERACAO ");
sql.append(" FROM CORRIDA CR ");
sql.append(" WHERE CR.CORRIDA_ID = ?");
sql.append(" WHERE CR.CORRIDA_ID = ? ");
sql.append(" AND CR.FECCORRIDA = ? ) TAB ");
return sql.toString();
}
public List<RelatorioAproveitamentoBean> getLsDadosRelatorio() {
return lsDadosRelatorio;
}
public void setLsDadosRelatorio(List<RelatorioAproveitamentoBean> lsDadosRelatorio) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
this.lsDadosRelatorio = lsDadosRelatorio;
}
@Override
protected void processaParametros() throws Exception {
}
}

View File

@ -1,6 +1,6 @@
<?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="RelatorioAproveitamento" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3308e98f-a36a-4ee6-bb41-be017c32427e">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.zoom" value="1.6105100000000019"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Crosstab Data Text" hAlign="Center"/>
@ -41,284 +41,215 @@
<parameter name="CORRIDA_ID" class="java.lang.String"/>
<parameter name="FECCORRIDA" class="java.util.Date"/>
<queryString>
<![CDATA[SELECT DISTINCT PR.CVEPARADA,
TO_NUMBER(DD.ASIENTO) AS ASIENTO,
(SELECT 1
FROM BOLETO BO, CORRIDA_TRAMO CTD, CORRIDA_TRAMO CTO
WHERE BO.CORRIDA_ID = CR.CORRIDA_ID
AND BO.FECCORRIDA = CR.FECCORRIDA
AND BO.NUMASIENTO = DD.ASIENTO
AND BO.ORIGEN_ID = CTO.ORIGEN_ID
AND BO.DESTINO_ID = CTD.DESTINO_ID
AND CTD.CORRIDA_ID = CR.CORRIDA_ID
AND CTD.FECCORRIDA = CR.FECCORRIDA
AND CTO.CORRIDA_ID = CR.CORRIDA_ID
AND CTO.FECCORRIDA = CR.FECCORRIDA
AND CTO.ACTIVO = 1
AND CTD.ACTIVO = 1
AND VT.NUMSECUENCIA BETWEEN CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA + 1
AND BO.ACTIVO = 1
AND (BO.MOTIVOCANCELACION_ID IS NULL OR
BO.MOTIVOCANCELACION_ID = 0)
AND ROWNUM = 1) OCUPADO,
(SELECT DECODE(AE.VENDIBLE, 1, 1,0,2)
FROM ASIENTO_EXCLUSIVO AE, CORRIDA_TRAMO CTD, CORRIDA_TRAMO CTO
WHERE AE.CORRIDA_ID = CR.CORRIDA_ID
AND AE.FECCORRIDA = CR.FECCORRIDA
AND AE.NUMASIENTO = DD.ASIENTO
AND AE.PARADA_ID = CTO.ORIGEN_ID
AND NVL(AE.DESTINO_ID,CR.DESTINO_ID) = CTD.DESTINO_ID
AND CTD.CORRIDA_ID = CR.CORRIDA_ID
AND CTD.FECCORRIDA = CR.FECCORRIDA
AND CTO.CORRIDA_ID = CR.CORRIDA_ID
AND CTO.FECCORRIDA = CR.FECCORRIDA
AND CTO.ACTIVO = 1
AND CTD.ACTIVO = 1
AND VT.NUMSECUENCIA BETWEEN CTO.NUMSECUENCIA AND CTD.NUMSECUENCIA + 1
AND AE.ACTIVO = 1
) OCUPADO_OPERACAO,
VT.NUMSECUENCIA
FROM CORRIDA CR,
(SELECT CT.ORIGEN_ID PARADA_ID, CT.NUMSECUENCIA
FROM CORRIDA_TRAMO CT
WHERE CT.CORRIDA_ID = $P{CORRIDA_ID}
AND TRUNC(CT.FECCORRIDA) = $P{FECCORRIDA}
AND CT.ACTIVO = 1
UNION
SELECT CT.DESTINO_ID, CT.NUMSECUENCIA + 1
FROM CORRIDA_TRAMO CT
WHERE CT.CORRIDA_ID = $P{CORRIDA_ID}
AND TRUNC(CT.FECCORRIDA) = $P{FECCORRIDA}
AND CT.ACTIVO = 1
ORDER BY 2) VT,
PARADA PR,
ROL_OPERATIVO RO,
DET_DIAGRAMA_AUTOBUS DD
WHERE CR.CORRIDA_ID = $P{CORRIDA_ID}
AND TRUNC(CR.FECCORRIDA) = $P{FECCORRIDA}
AND VT.PARADA_ID = PR.PARADA_ID
AND CR.ROLOPERATIVO_ID = RO.ROLOPERATIVO_ID
AND RO.DIAGRAMAAUTOBUS_ID = DD.DIAGRAMAAUTOBUS_ID
AND DD.VENDIBLE = 1
ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<![CDATA[]]>
</queryString>
<field name="CVEPARADA" class="java.lang.String"/>
<field name="ASIENTO" class="java.math.BigDecimal"/>
<field name="OCUPADO" class="java.math.BigDecimal"/>
<field name="OCUPADO_OPERACAO" class="java.math.BigDecimal"/>
<field name="NUMSECUENCIA" class="java.math.BigDecimal"/>
<sortField name="NUMSECUENCIA"/>
<sortField name="OCUPADO"/>
<field name="cveparada" class="java.lang.String"/>
<field name="asiento" class="java.math.BigDecimal"/>
<field name="ocupado" class="java.math.BigDecimal"/>
<field name="ocupadoOperacao" class="java.math.BigDecimal"/>
<field name="numsecuencia" class="java.math.BigDecimal"/>
<sortField name="numsecuencia"/>
<sortField name="ocupado"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="106" splitType="Stretch">
<rectangle>
<reportElement uuid="8f226d21-ccdb-41b4-a01d-fb0712f0b4d3" x="0" y="0" width="802" height="30"/>
<reportElement x="0" y="0" width="802" height="30" uuid="8f226d21-ccdb-41b4-a01d-fb0712f0b4d3"/>
<graphicElement>
<pen lineWidth="0.75" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<rectangle>
<reportElement uuid="b6aa9717-79c4-4f13-91df-9b0255003a16" x="0" y="40" width="802" height="39"/>
<reportElement x="0" y="40" width="802" height="39" uuid="b6aa9717-79c4-4f13-91df-9b0255003a16"/>
<graphicElement>
<pen lineWidth="0.75" lineStyle="Solid"/>
</graphicElement>
</rectangle>
<textField>
<reportElement uuid="eb300dc6-1610-409d-8589-72b1539f86d3" x="77" y="0" width="478" height="15"/>
<reportElement x="77" y="0" width="478" height="15" uuid="eb300dc6-1610-409d-8589-72b1539f86d3"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a125ac5c-e00c-4ac5-bc03-317c514f1ad8" x="12" y="15" width="65" height="15"/>
<reportElement x="12" y="15" width="65" height="15" uuid="a125ac5c-e00c-4ac5-bc03-317c514f1ad8"/>
<textElement markup="none">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.servico}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="88bb80e0-40a4-490c-914a-01a41178168b" x="244" y="15" width="65" height="15"/>
<reportElement x="244" y="15" width="65" height="15" uuid="88bb80e0-40a4-490c-914a-01a41178168b"/>
<textElement markup="none">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.data}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a3d3c093-a9f4-4b32-823f-b4f548e46c2f" x="77" y="15" width="167" height="15"/>
<reportElement x="77" y="15" width="167" height="15" uuid="a3d3c093-a9f4-4b32-823f-b4f548e46c2f"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{CORRIDA_ID}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="995111bb-4726-421b-a538-db8b53b3f206" x="12" y="40" width="78" height="11"/>
<reportElement x="12" y="40" width="78" height="11" uuid="995111bb-4726-421b-a538-db8b53b3f206"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.totalArrecadado}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3a0c6793-e57f-44c7-8588-1692055bf62a" x="12" y="51" width="78" height="11"/>
<reportElement x="12" y="51" width="78" height="11" uuid="3a0c6793-e57f-44c7-8588-1692055bf62a"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.arrecadadoKm}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a0ec9db5-a7be-4407-b257-e49dd7fe6811" x="255" y="40" width="130" height="11"/>
<reportElement x="255" y="40" width="130" height="11" uuid="a0ec9db5-a7be-4407-b257-e49dd7fe6811"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.ocupacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0325af45-b23b-45ba-a8c6-dea75a36bb75" x="255" y="51" width="130" height="11"/>
<reportElement x="255" y="51" width="130" height="11" uuid="0325af45-b23b-45ba-a8c6-dea75a36bb75"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.ocupacaoComArrecadacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="bec7dafe-b775-495d-8233-301b351597ac" x="12" y="63" width="78" height="11"/>
<reportElement x="12" y="63" width="78" height="11" uuid="bec7dafe-b775-495d-8233-301b351597ac"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.nominalKm}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="fcaa51c2-2057-4aa4-bb84-adae3ef5c34e" x="255" y="63" width="130" height="11"/>
<reportElement x="255" y="63" width="130" height="11" uuid="fcaa51c2-2057-4aa4-bb84-adae3ef5c34e"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.ocupacaoSemArrecadacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5cc7b439-0a60-4581-a67c-83519a4fd977" x="542" y="40" width="78" height="11"/>
<reportElement x="542" y="40" width="78" height="11" uuid="5cc7b439-0a60-4581-a67c-83519a4fd977"/>
<textElement markup="none">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$R{sumario.totalNominal}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="5b56b7a4-1abd-43cc-8071-e949d5575a45" x="243" y="40" width="1" height="39" forecolor="#CCCCCC"/>
<reportElement x="243" y="40" width="1" height="39" forecolor="#CCCCCC" uuid="5b56b7a4-1abd-43cc-8071-e949d5575a45"/>
</line>
<line>
<reportElement uuid="98b93926-7900-4445-bbe6-024e456fd45e" x="530" y="40" width="1" height="39" forecolor="#CCCCCC"/>
<reportElement x="530" y="40" width="1" height="39" forecolor="#CCCCCC" uuid="98b93926-7900-4445-bbe6-024e456fd45e"/>
</line>
<textField>
<reportElement uuid="bdfd7f9e-e50e-4a8b-bba4-2fc8a909f38b" x="90" y="63" width="85" height="11"/>
<reportElement x="90" y="63" width="85" height="11" uuid="bdfd7f9e-e50e-4a8b-bba4-2fc8a909f38b"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_NOMINAL_KM}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7eb2d8d3-4a3f-40cd-8117-8e53ab128f34" x="90" y="40" width="85" height="11"/>
<reportElement x="90" y="40" width="85" height="11" uuid="7eb2d8d3-4a3f-40cd-8117-8e53ab128f34"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_TOTAL_ARRECADADO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="64600377-6028-4c56-b0f1-3acf6ceeb708" x="90" y="51" width="85" height="11"/>
<reportElement x="90" y="51" width="85" height="11" uuid="64600377-6028-4c56-b0f1-3acf6ceeb708"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_ARRECADO_KM}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6b68d2b4-0fa0-41a4-bdf5-0eaccb7d1f59" x="385" y="40" width="33" height="11"/>
<reportElement x="385" y="40" width="33" height="11" uuid="6b68d2b4-0fa0-41a4-bdf5-0eaccb7d1f59"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_OCUPACAO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="66317ebd-e503-420c-8886-8385b782770d" x="385" y="51" width="33" height="11"/>
<reportElement x="385" y="51" width="33" height="11" uuid="66317ebd-e503-420c-8886-8385b782770d"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_OCUPACAO_ARRECADACAO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a6ff7221-60b5-4d08-b7e8-7b10db0b97a6" x="385" y="63" width="33" height="11"/>
<reportElement x="385" y="63" width="33" height="11" uuid="a6ff7221-60b5-4d08-b7e8-7b10db0b97a6"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_OCUPACAO_S_ARRECADACAO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="9eebfdd7-504b-4e98-8893-63bdb8c02b54" x="628" y="40" width="74" height="11"/>
<reportElement x="628" y="40" width="74" height="11" uuid="9eebfdd7-504b-4e98-8893-63bdb8c02b54"/>
<textElement textAlignment="Right">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{P_TOTAL_NOMINAL}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="0eccc14c-3288-43e8-8731-7c876e4d659e" x="309" y="15" width="100" height="15"/>
<reportElement x="309" y="15" width="100" height="15" uuid="0eccc14c-3288-43e8-8731-7c876e4d659e"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="11a895de-bf79-45dc-8d47-ea6ef8bf562c" x="12" y="0" width="65" height="15"/>
<reportElement x="12" y="0" width="65" height="15" uuid="11a895de-bf79-45dc-8d47-ea6ef8bf562c"/>
<textElement>
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.relatorio}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="3a123294-f53f-40c2-b412-ff71cb7f2d98" style="Crosstab Data Text" x="147" y="89" width="18" height="8"/>
<reportElement style="Crosstab Data Text" x="72" y="87" width="18" height="8" uuid="3a123294-f53f-40c2-b412-ff71cb7f2d98"/>
<textElement>
<font size="6" isBold="true"/>
</textElement>
<text><![CDATA[O]]></text>
</staticText>
<staticText>
<reportElement uuid="756fd1c7-16bc-4f9a-8e98-c31b46cc48b6" style="Crosstab Data Text" x="269" y="89" width="18" height="8" backcolor="#FFFFFF"/>
<reportElement style="Crosstab Data Text" x="200" y="87" width="18" height="8" backcolor="#FFFFFF" uuid="756fd1c7-16bc-4f9a-8e98-c31b46cc48b6"/>
<textElement>
<font size="6" isBold="true"/>
</textElement>
<text><![CDATA[E]]></text>
</staticText>
<textField>
<reportElement uuid="c2ff3a87-55cb-407b-a791-6d3ba28bab24" x="49" y="89" width="76" height="9"/>
<textElement markup="none">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$R{legenda.ocupacaoArrecadacao}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="ed96b163-866d-4f9c-8955-38eee360f49e" x="165" y="89" width="76" height="8"/>
<reportElement x="90" y="87" width="76" height="8" uuid="ed96b163-866d-4f9c-8955-38eee360f49e"/>
<textElement markup="none">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$R{legenda.ocupacaoOperacional}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="1eb3ad3e-e20c-4852-892c-dff3ecf5da3f" x="287" y="89" width="76" height="8"/>
<reportElement x="218" y="87" width="76" height="8" uuid="1eb3ad3e-e20c-4852-892c-dff3ecf5da3f"/>
<textElement markup="none">
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$R{legenda.poltronaExclusiva}]]></textFieldExpression>
</textField>
<rectangle radius="10">
<reportElement uuid="312d6433-b0ba-4707-b371-1fbdf1140877" style="Crosstab Data Text" x="25" y="90" width="20" height="8" forecolor="#CCCCCC" backcolor="#CCCCFF"/>
</rectangle>
</band>
</title>
<summary>
<band height="47">
<crosstab>
<reportElement uuid="eff55ca1-3935-4726-82a1-4a15e4518714" x="0" y="0" width="802" height="47"/>
<rowGroup name="ASIENTO" width="16">
<reportElement x="0" y="0" width="802" height="47" uuid="eff55ca1-3935-4726-82a1-4a15e4518714"/>
<rowGroup name="asiento" width="16">
<bucket class="java.math.BigDecimal">
<bucketExpression><![CDATA[$F{ASIENTO}]]></bucketExpression>
<bucketExpression><![CDATA[$F{asiento}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
@ -326,11 +257,11 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="1d4e483e-bf24-4da5-ab8c-62bf83e6c1bb" style="Crosstab Data Text" x="0" y="0" width="15" height="8"/>
<reportElement style="Crosstab Data Text" x="0" y="0" width="15" height="8" uuid="1d4e483e-bf24-4da5-ab8c-62bf83e6c1bb"/>
<textElement>
<font size="6"/>
</textElement>
<textFieldExpression><![CDATA[$V{ASIENTO}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{asiento}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
@ -338,9 +269,9 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="NUMSECUENCIA" height="0">
<columnGroup name="numsecuencia" height="0">
<bucket class="java.math.BigDecimal">
<bucketExpression><![CDATA[$F{NUMSECUENCIA}]]></bucketExpression>
<bucketExpression><![CDATA[$F{numsecuencia}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
@ -353,9 +284,9 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="CVEPARADA" height="10">
<columnGroup name="cveparada" height="10">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{CVEPARADA}]]></bucketExpression>
<bucketExpression><![CDATA[$F{cveparada}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
@ -363,11 +294,11 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="92b133ad-3903-4c0c-8aeb-593d907cac98" style="Crosstab Data Text" x="0" y="0" width="20" height="10"/>
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="10" uuid="92b133ad-3903-4c0c-8aeb-593d907cac98"/>
<textElement>
<font size="7"/>
</textElement>
<textFieldExpression><![CDATA[$V{CVEPARADA}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{cveparada}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
@ -375,99 +306,131 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="OCUPADOMeasure" class="java.math.BigDecimal" calculation="Lowest">
<measureExpression><![CDATA[$F{OCUPADO}]]></measureExpression>
<measure name="ocupadoMeasure" class="java.math.BigDecimal" calculation="Lowest">
<measureExpression><![CDATA[$F{ocupado}]]></measureExpression>
</measure>
<measure name="OCUPADO_OPERACAOMeasure" class="java.lang.Number" calculation="Lowest">
<measureExpression><![CDATA[$F{OCUPADO_OPERACAO}]]></measureExpression>
<measure name="ocupadoOperacaoMeasure" class="java.lang.Number" calculation="Lowest">
<measureExpression><![CDATA[$F{ocupadoOperacao}]]></measureExpression>
</measure>
<crosstabCell width="20" height="8">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<rectangle radius="10">
<reportElement uuid="bc96586e-75d2-4c8a-9225-f63fe33165d0" style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#CCCCCC" backcolor="#CCCCFF">
<printWhenExpression><![CDATA[$V{OCUPADOMeasure}.intValue() == 1]]></printWhenExpression>
</reportElement>
</rectangle>
<elementGroup>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#00FFFF" uuid="bc96586e-75d2-4c8a-9225-f63fe33165d0">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 1]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#FFAFAF" uuid="259b2b7f-cade-4df7-9c89-72a225c62776">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 2]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#C0C0C0" uuid="8e43f640-9de0-457e-938d-ca2d7012d919">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 3]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#00FF00" uuid="81e379b2-8a72-44d9-9561-e43b82e98e3c">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 4]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#FF0000" uuid="14f27af8-ce53-48f5-ab9d-991aafbe15bb">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 5]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#FF00FF" uuid="b98ab63f-8b99-4e97-a439-e5b0d4afa627">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 6]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#000000" backcolor="#FFFF00" uuid="a7c3a624-f104-421e-afb0-01abc19644ec">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() == 7]]></printWhenExpression>
</reportElement>
</rectangle>
<rectangle radius="0">
<reportElement style="Crosstab Data Text" x="0" y="0" width="20" height="8" forecolor="#FFFFFF" backcolor="#000000" uuid="0f50449e-8901-4eec-bca1-c7343268a0ff">
<printWhenExpression><![CDATA[$V{ocupadoMeasure}.intValue() > 7]]></printWhenExpression>
</reportElement>
</rectangle>
</elementGroup>
<staticText>
<reportElement uuid="8fcc35fd-62a3-4480-bc4e-467eb3668653" style="Crosstab Data Text" x="0" y="0" width="20" height="8">
<printWhenExpression><![CDATA[$V{OCUPADO_OPERACAOMeasure}.intValue() == 2]]></printWhenExpression>
<reportElement style="Crosstab Data Text" x="0" y="2" width="20" height="2" uuid="8fcc35fd-62a3-4480-bc4e-467eb3668653">
<printWhenExpression><![CDATA[$V{ocupadoOperacaoMeasure}.intValue() == 2]]></printWhenExpression>
</reportElement>
<textElement>
<font size="6" isBold="true"/>
<font isBold="true"/>
</textElement>
<text><![CDATA[O]]></text>
</staticText>
<staticText>
<reportElement uuid="55cf6871-62ff-4e1f-867f-8e22dbfdc305" style="Crosstab Data Text" x="0" y="0" width="20" height="8">
<printWhenExpression><![CDATA[$V{OCUPADO_OPERACAOMeasure}.intValue() == 1]]></printWhenExpression>
<reportElement style="Crosstab Data Text" x="0" y="4" width="20" height="2" uuid="55cf6871-62ff-4e1f-867f-8e22dbfdc305">
<printWhenExpression><![CDATA[$V{ocupadoOperacaoMeasure}.intValue() == 1]]></printWhenExpression>
</reportElement>
<textElement>
<font size="6" isBold="true"/>
<font isBold="true"/>
</textElement>
<text><![CDATA[E]]></text>
</staticText>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="ASIENTO">
<crosstabCell height="25" rowTotalGroup="asiento">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="10f494b4-33d7-49c7-ac38-32cb02d7c493" style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{OCUPADOMeasure}]]></textFieldExpression>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="10f494b4-33d7-49c7-ac38-32cb02d7c493"/>
<textFieldExpression><![CDATA[$V{ocupadoMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="NUMSECUENCIA">
<crosstabCell width="50" columnTotalGroup="numsecuencia">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="294894a3-4154-42ab-a716-5b0b0baac4d1" style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{OCUPADOMeasure}]]></textFieldExpression>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="294894a3-4154-42ab-a716-5b0b0baac4d1"/>
<textFieldExpression><![CDATA[$V{ocupadoMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="ASIENTO" columnTotalGroup="NUMSECUENCIA">
<crosstabCell rowTotalGroup="asiento" columnTotalGroup="numsecuencia">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="39e993e0-05ef-447e-82db-d0ae1829485b" style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{OCUPADOMeasure}]]></textFieldExpression>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF" uuid="39e993e0-05ef-447e-82db-d0ae1829485b"/>
<textFieldExpression><![CDATA[$V{ocupadoMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="CVEPARADA">
<crosstabCell width="50" columnTotalGroup="cveparada">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="5b616be4-ef52-429c-8752-84f5873a23da" style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{OCUPADOMeasure}]]></textFieldExpression>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="5b616be4-ef52-429c-8752-84f5873a23da"/>
<textFieldExpression><![CDATA[$V{ocupadoMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="ASIENTO" columnTotalGroup="CVEPARADA">
<crosstabCell rowTotalGroup="asiento" columnTotalGroup="cveparada">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement uuid="4adf1aa7-2515-434f-98c7-26072ed402b5" style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{OCUPADOMeasure}]]></textFieldExpression>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" uuid="4adf1aa7-2515-434f-98c7-26072ed402b5"/>
<textFieldExpression><![CDATA[$V{ocupadoMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
@ -477,7 +440,7 @@ ORDER BY VT.NUMSECUENCIA, TO_NUMBER(DD.ASIENTO)]]>
<noData>
<band height="50">
<textField>
<reportElement uuid="4a218426-e82c-4eed-9f30-eb9430eef10b" x="12" y="16" width="530" height="20"/>
<reportElement x="12" y="16" width="530" height="20" uuid="4a218426-e82c-4eed-9f30-eb9430eef10b"/>
<textElement markup="none">
<font size="11" isBold="true"/>
</textElement>

View File

@ -0,0 +1,58 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.math.BigDecimal;
public class RelatorioAproveitamentoBean {
private String cveparada;
private BigDecimal asiento;
private BigDecimal ocupado;
private BigDecimal ocupadoOperacao;
private BigDecimal numsecuencia;
public String getCveparada() {
return cveparada;
}
public void setCveparada(String cveparada) {
this.cveparada = cveparada;
}
public BigDecimal getAsiento() {
return asiento;
}
public void setAsiento(BigDecimal asiento) {
this.asiento = asiento;
}
public BigDecimal getOcupado() {
return ocupado;
}
public void setOcupado(BigDecimal ocupado) {
this.ocupado = ocupado;
}
public BigDecimal getOcupadoOperacao() {
return ocupadoOperacao;
}
public void setOcupadoOperacao(BigDecimal ocupado_operacao) {
this.ocupadoOperacao = ocupado_operacao;
}
public BigDecimal getNumsecuencia() {
return numsecuencia;
}
public void setNumsecuencia(BigDecimal numsecuencia) {
this.numsecuencia = numsecuencia;
}
@Override
public String toString() {
return "RelatorioAproveitamentoBean [cveparada=" + cveparada + ", asiento=" + asiento + ", ocupado=" + ocupado + ", ocupadoOperacao=" + ocupadoOperacao + ", numsecuencia=" + numsecuencia + "]";
}
}

View File

@ -47,6 +47,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCorridaAproveit
@Scope("prototype")
public class RelatorioAproveitamentoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private Datebox fecCorrida;
private MyTextbox txtCorridaId;
@ -156,15 +157,14 @@ public class RelatorioAproveitamentoController extends MyGenericForwardComposer
btnExecutarRelatorio.setDisabled(false);
}
public void onChanging$txtCorridaId(InputEvent ev) {
if(ev.getValue().equals(""))
if (ev.getValue().equals(""))
btnExecutarRelatorio.setDisabled(true);
else
btnExecutarRelatorio.setDisabled(false);
}
private void refreshLista() {
btnExecutarRelatorio.setDisabled(true);
@ -229,8 +229,7 @@ public class RelatorioAproveitamentoController extends MyGenericForwardComposer
parametros.put("FECCORRIDA", new java.sql.Date(((java.util.Date) this.fecCorrida.getValue()).getTime()));
parametros.put("DATA", DateUtil.getStringDate((java.util.Date) this.fecCorrida.getValue())); // Utilizada para exibição no cabeçalho
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioAproveitamentoController.window.title"));
Relatorio relatorio = new RelatorioAproveitamento(parametros, dataSource.getConnection());
Map args = new HashMap();
args.put("relatorio", relatorio);