Relatório por Empresa corrida (fixed bug #5394)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@36236 d1611594-4594-4d17-8e1d-87c2c4800839
master
leonardo 2014-06-26 20:23:34 +00:00
parent 7471294f54
commit 2dba73c74d
13 changed files with 664 additions and 158 deletions

View File

@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -11,14 +12,13 @@ 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.RelatorioEmpresaCorridaBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioLinhasHorarioBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioEmpresaCorrida extends Relatorio {
private List<RelatorioEmpresaCorridaBean> lsDadosRelatorio;
public RelatorioEmpresaCorrida(Map<String, Object> parametros, Connection conexao, final boolean empresaCorrida) throws Exception {
public RelatorioEmpresaCorrida(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
@ -29,32 +29,34 @@ public class RelatorioEmpresaCorrida extends Relatorio {
Map<String, Object> parametros = this.relatorio.getParametros();
@SuppressWarnings("unchecked")
String fecInicio = parametros.get("fecInicio").toString();
@SuppressWarnings("unchecked")
String fecFinal = parametros.get("fecFinal").toString();
String sql = getSql(fecInicio, fecFinal, empresaCorrida);
String sql = getSql(fecInicio, fecFinal);
System.out.println(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
stmt.setDate("fecInicio", new java.sql.Date(sdf.parse(fecInicio).getTime()));
stmt.setDate("fecFinal", new java.sql.Date(sdf.parse(fecFinal).getTime()));
rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioEmpresaCorridaBean>();
while (rset.next()) {
RelatorioEmpresaCorridaBean empresaCorridaBean = new RelatorioEmpresaCorridaBean();
empresaCorridaBean.setCorridaId(rset.getInt("corridaId"));
empresaCorridaBean.setEmpresa(rset.getString("empresa"));
empresaCorridaBean.setCoche(Integer.parseInt(rset.getString("coche")));
empresaCorridaBean.setDestino(rset.getString("destino"));
empresaCorridaBean.setDia(rset.getDate("dia"));
empresaCorridaBean.setHora(rset.getString("hora"));
empresaCorridaBean.setKmts(rset.getInt("kmts"));
empresaCorridaBean.setOrigem(rset.getString("origem"));
empresaCorridaBean.setAbonos(rset.getBigDecimal("abonos"));
empresaCorridaBean.setBoletos(rset.getBigDecimal("boletos"));
empresaCorridaBean.setEmpresa(rset.getString("nombempresa"));
empresaCorridaBean.setKmOnibusArrendados(rset.getInt("kmOnibusArrendados"));
empresaCorridaBean.setKmOnibusProprio(rset.getInt("kmOnibusProprio"));
empresaCorridaBean.setKmTotal(rset.getInt("kmTotal"));
empresaCorridaBean.setLinea(rset.getString("linea"));
empresaCorridaBean.setPasajerosTransportados(rset.getInt("passageirosTransp"));
lsDadosRelatorio.add(empresaCorridaBean);
}
@ -76,25 +78,82 @@ public class RelatorioEmpresaCorrida extends Relatorio {
protected void processaParametros() throws Exception {
}
private String getSql(String fecInicio, String fecFinal, boolean empresaCorrida) {
private String getSql(String fecInicio, String fecFinal) {
StringBuffer sql = new StringBuffer();
sql.append(" select c.corrida_Id corridaId, e.nombempresa empresa, c.feccorrida dia, a.numautobus coche, ");
sql.append(" o.cveparada origem, d.cveparada destino, ");
sql.append(" to_char(c.fechorsalida, 'HH24:MI') Hora, t.cantkmreal KMTS ");
sql.append(" from corrida c ");
sql.append(" left join parada o on o.parada_id = c.origen_id ");
sql.append(" left join parada d on d.parada_id = c.destino_id ");
sql.append(" left join tramo t on t.origen_id = c.origen_id and t.destino_id = c.destino_id ");
sql.append(" inner join autobus a on a.autobus_id = c.autobus_id ");
if (empresaCorrida){
sql.append(" left join empresa e on e.empresa_id = c.empresacorrida_id ");
} else {
sql.append(" left join empresa e on e.empresa_id = a.empresa_id ");
}
sql.append(" where extract(month from c.feccorrida) = 6 ");
sql.append(" and c.activo = 1 and c.feccorrida between to_date('" + fecInicio + "', 'DD/MM/YYYY') and to_date('" + fecFinal + "', 'DD/MM/YYYY') ");
sql.append(" order by e.nombempresa, c.feccorrida ");
sql.append("SELECT DISTINCT empresa_id, ");
sql.append(" nombempresa, ");
sql.append(" Concat(o.descparada, Concat('-', d.descparada)) ");
sql.append(" linea, ");
sql.append(" (SELECT COALESCE(Sum(preciopagado), 0) ");
sql.append(" FROM boleto b1 ");
sql.append(" WHERE b1.motivocancelacion_id IS NULL ");
sql.append(" AND b1.empresacorrida_id = empresa_id ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) boletos, ");
sql.append(" (SELECT COALESCE(Sum(preciopagado), 0) ");
sql.append(" FROM boleto b1 ");
sql.append(" WHERE b1.motivocancelacion_id IS NOT NULL ");
sql.append(" AND b1.empresacorrida_id = empresa_id ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) abonos, ");
sql.append(" (SELECT COALESCE(Sum(cantkmreal), 0) ");
sql.append(" FROM tramo t, ");
sql.append(" boleto b1, ");
sql.append(" autobus a, ");
sql.append(" corrida c ");
sql.append(" WHERE t.origen_id = b1.origen_id ");
sql.append(" AND t.destino_id = b1.destino_id ");
sql.append(" AND c.corrida_id = b1.corrida_id ");
sql.append(" AND a.autobus_id = c.autobus_id ");
sql.append(" AND b1.empresacorrida_id = empresa_id ");
sql.append(" AND a.empresa_id = empresa_id ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) kmOnibusProprio, ");
sql.append(" (SELECT COALESCE(Sum(cantkmreal), 0) ");
sql.append(" FROM tramo t, ");
sql.append(" boleto b1, ");
sql.append(" autobus a, ");
sql.append(" corrida c ");
sql.append(" WHERE t.origen_id = b1.origen_id ");
sql.append(" AND t.destino_id = b1.destino_id ");
sql.append(" AND c.corrida_id = b1.corrida_id ");
sql.append(" AND a.autobus_id = c.autobus_id ");
sql.append(" AND b1.empresacorrida_id = empresa_id ");
sql.append(" AND a.empresa_id <> empresa_id ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) kmOnibusArrendados, ");
sql.append(" (SELECT COALESCE(Sum(cantkmreal), 0) ");
sql.append(" FROM tramo t, ");
sql.append(" boleto b1 ");
sql.append(" WHERE t.origen_id = b1.origen_id ");
sql.append(" AND t.destino_id = b1.destino_id ");
sql.append(" AND b1.empresacorrida_id = empresa_id ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) kmTotal, ");
sql.append(" (SELECT COALESCE(Count(boleto_id), 0) ");
sql.append(" FROM boleto b1 ");
sql.append(" WHERE b1.empresacorrida_id = empresa_id ");
sql.append(" AND b1.motivocancelacion_id IS NULL ");
sql.append(" AND b1.origen_id = b.origen_id ");
sql.append(" AND b1.destino_id = b.destino_id ");
sql.append(" AND b1.fechorventa BETWEEN :fecInicio AND :fecFinal) passageirosTransp ");
sql.append("FROM empresa, ");
sql.append(" parada o, ");
sql.append(" parada d, ");
sql.append(" boleto b ");
sql.append("WHERE o.parada_id = b.origen_id ");
sql.append(" AND d.parada_id = b.destino_id ");
sql.append(" AND b.motivocancelacion_id IS NULL ");
sql.append(" AND b.empresacorrida_id = empresa_id ");
sql.append(" AND b.fechorventa BETWEEN :fecInicio AND :fecFinal ");
sql.append("ORDER BY empresa_id, ");
sql.append(" linea ");
return sql.toString();
}

View File

@ -0,0 +1,95 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
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.RelatorioEmpresaCorridaBean;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioEmpresaOnibusBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
public class RelatorioEmpresaOnibus extends Relatorio {
private List<RelatorioEmpresaOnibusBean> lsDadosRelatorio;
public RelatorioEmpresaOnibus(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.setCustomDataSource(new DataSource(this) {
@Override
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
String fecInicio = parametros.get("fecInicio").toString();
String fecFinal = parametros.get("fecFinal").toString();
String sql = getSql(fecInicio, fecFinal);
System.out.println(sql);
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
ResultSet rset = null;
rset = stmt.executeQuery();
lsDadosRelatorio = new ArrayList<RelatorioEmpresaOnibusBean>();
while (rset.next()) {
RelatorioEmpresaOnibusBean empresaOnibusBean = new RelatorioEmpresaOnibusBean();
empresaOnibusBean.setCorridaId(rset.getInt("corridaId"));
empresaOnibusBean.setEmpresa(rset.getString("empresa"));
empresaOnibusBean.setCoche(Integer.parseInt(rset.getString("coche")));
empresaOnibusBean.setDestino(rset.getString("destino"));
empresaOnibusBean.setDia(rset.getDate("dia"));
empresaOnibusBean.setHora(rset.getString("hora"));
empresaOnibusBean.setKmts(rset.getInt("kmts"));
empresaOnibusBean.setOrigem(rset.getString("origem"));
lsDadosRelatorio.add(empresaOnibusBean);
}
if (lsDadosRelatorio.size() > 0) {
setLsDadosRelatorio(lsDadosRelatorio);
}
}
});
}
public void setLsDadosRelatorio(List<RelatorioEmpresaOnibusBean> lsDadosRelatorio) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
this.lsDadosRelatorio = lsDadosRelatorio;
}
@Override
protected void processaParametros() throws Exception {
}
private String getSql(String fecInicio, String fecFinal) {
StringBuffer sql = new StringBuffer();
sql.append(" select c.corrida_Id corridaId, e.nombempresa empresa, c.feccorrida dia, a.numautobus coche, ");
sql.append(" o.cveparada origem, d.cveparada destino, ");
sql.append(" to_char(c.fechorsalida, 'HH24:MI') Hora, t.cantkmreal KMTS ");
sql.append(" from corrida c ");
sql.append(" left join parada o on o.parada_id = c.origen_id ");
sql.append(" left join parada d on d.parada_id = c.destino_id ");
sql.append(" left join tramo t on t.origen_id = c.origen_id and t.destino_id = c.destino_id ");
sql.append(" inner join autobus a on a.autobus_id = c.autobus_id ");
sql.append(" left join empresa e on e.empresa_id = a.empresa_id ");
sql.append(" where extract(month from c.feccorrida) = 6 ");
sql.append(" and c.activo = 1 and c.feccorrida between to_date('" + fecInicio + "', 'DD/MM/YYYY') and to_date('" + fecFinal + "', 'DD/MM/YYYY') ");
sql.append(" order by e.nombempresa, c.feccorrida ");
return sql.toString();
}
}

View File

@ -13,13 +13,13 @@ header.filtro.grupo=Grupo de l
#Labels detail
detail.dia=Dia
detail.coche=Coche
detail.origen=Origen
detail.destino=Destino
detail.hora=Hora
detail.kmts=Kmts
detail.corridaId=Corrida
detail.linea=Línea origen - destino
detail.boletos=Recaudaciones Boletos ($)
detail.abonos=Recaudaciones abonos ($)
detail.kmOnibusProprio=Distancia recorrida ómnibus propios (km)
detail.kmOnibusArrendados=Distancia recorrida ómnibus arrendados (km)
detail.kmTotal=Distancia recorrida total (km)
detail.pasajerosTransportados=Pasajeros transportados
linhas=Líneas

View File

@ -0,0 +1,25 @@
#geral
msg.noData=No se pudo obtener datos con los parámetros reportados.
msg.a=a
#Labels header
header.periodo=Período:
header.data.hora=Fecha/Hora\:
header.pagina=Página\:
header.filtro=Filtro\:
header.filtro.servico=Servicio\:
header.filtro.linha=Línea\:
header.filtro.grupo=Grupo de líneas\:
#Labels detail
detail.dia=Dia
detail.coche=Coche
detail.origen=Origen
detail.destino=Destino
detail.hora=Hora
detail.kmts=Kmts
detail.corridaId=Corrida
linhas=Líneas

View File

@ -1,8 +1,8 @@
<?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="RelatorioEmpresaCorrida" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaCorrida" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.x" value="264"/>
<property name="ireport.y" value="48"/>
<parameter name="fecInicio" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
@ -15,102 +15,137 @@
<queryString>
<![CDATA[]]>
</queryString>
<field name="dia" class="java.util.Date"/>
<field name="coche" class="java.lang.Integer"/>
<field name="origem" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="hora" class="java.lang.String"/>
<field name="kmts" class="java.lang.Integer"/>
<field name="linea" class="java.lang.String"/>
<field name="boletos" class="java.math.BigDecimal"/>
<field name="abonos" class="java.math.BigDecimal"/>
<field name="kmOnibusProprio" class="java.lang.Integer"/>
<field name="kmOnibusArrendados" class="java.lang.Integer"/>
<field name="kmTotal" class="java.lang.Integer"/>
<field name="pasajerosTransportados" class="java.lang.Integer"/>
<field name="empresa" class="java.lang.String"/>
<field name="corridaId" class="java.lang.Integer"/>
<variable name="sum.kmts" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{kmts}]]></variableExpression>
<variable name="sum.boletos" class="java.math.BigDecimal" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{boletos}]]></variableExpression>
</variable>
<variable name="sum.abonos" class="java.math.BigDecimal" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{abonos}]]></variableExpression>
</variable>
<variable name="sum.kmOnibusProprio" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{kmOnibusProprio}]]></variableExpression>
</variable>
<variable name="sum.kmOnibusArrendados" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{kmOnibusArrendados}]]></variableExpression>
</variable>
<variable name="sum.kmTotal" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{kmTotal}]]></variableExpression>
</variable>
<variable name="sum.pasajerosTransportados" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{pasajerosTransportados}]]></variableExpression>
</variable>
<group name="empresa">
<groupExpression><![CDATA[$F{empresa}]]></groupExpression>
<groupHeader>
<band height="69">
<textField>
<reportElement uuid="09306494-79f1-44dd-9eed-c39684384bbf" x="0" y="33" width="231" height="20"/>
<reportElement uuid="09306494-79f1-44dd-9eed-c39684384bbf" x="0" y="0" width="231" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e8355048-a037-4837-866b-e6cf7a3e90ed" x="122" y="53" width="56" height="15"/>
<textElement markup="none">
<reportElement uuid="e8355048-a037-4837-866b-e6cf7a3e90ed" x="221" y="21" width="74" height="47"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.coche}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.abonos}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="edd89ef1-92d6-4b5f-b249-851532fad9df" x="373" y="53" width="37" height="15"/>
<textElement markup="none">
<reportElement uuid="edd89ef1-92d6-4b5f-b249-851532fad9df" x="415" y="21" width="62" height="48"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.hora}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.kmTotal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="73c02335-4bbe-44ba-9c73-1201ed6b3967" x="410" y="53" width="47" height="15"/>
<textElement markup="none">
<reportElement uuid="73c02335-4bbe-44ba-9c73-1201ed6b3967" x="487" y="21" width="68" height="48"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.kmts}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.pasajerosTransportados}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d88253ec-b6d4-4e99-b677-3c1a0b273a81" x="61" y="53" width="61" height="15"/>
<textElement markup="none">
<reportElement uuid="d88253ec-b6d4-4e99-b677-3c1a0b273a81" x="137" y="21" width="73" height="48"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.dia}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.boletos}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="569add1e-cb73-4278-b800-fa44631527f6" x="274" y="53" width="99" height="15"/>
<textElement markup="none">
<reportElement uuid="569add1e-cb73-4278-b800-fa44631527f6" x="359" y="20" width="43" height="48"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.destino}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.kmOnibusArrendados}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="31387dbf-1cdc-4c27-992f-2e439abea576" x="178" y="53" width="96" height="15"/>
<textElement markup="none">
<reportElement uuid="31387dbf-1cdc-4c27-992f-2e439abea576" x="306" y="21" width="43" height="48"/>
<textElement textAlignment="Justified" markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.origen}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.kmOnibusProprio}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="76104c33-e003-4a38-98bb-9db4d0f8636b" x="0" y="53" width="555" height="1"/>
<reportElement uuid="76104c33-e003-4a38-98bb-9db4d0f8636b" x="0" y="20" width="555" height="1"/>
</line>
<line>
<reportElement uuid="97639de4-d619-4f05-9b3e-e615b643b778" x="0" y="68" width="555" height="1"/>
</line>
<textField>
<reportElement uuid="12ef050d-3938-4dd6-8e82-bfeca7adaa2a" x="0" y="54" width="61" height="15"/>
<reportElement uuid="12ef050d-3938-4dd6-8e82-bfeca7adaa2a" x="0" y="21" width="137" height="48"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.corridaId}]]></textFieldExpression>
<textFieldExpression><![CDATA[$R{detail.linea}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="19">
<band height="48">
<textField isBlankWhenNull="true">
<reportElement uuid="96095298-1c13-4089-8a8b-fd324b377e45" x="410" y="0" width="57" height="16"/>
<textElement textAlignment="Left">
<reportElement uuid="96095298-1c13-4089-8a8b-fd324b377e45" x="137" y="3" width="73" height="16"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.kmts}]]></textFieldExpression>
<textFieldExpression><![CDATA[$V{sum.boletos}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="1b8e90f1-09d3-4419-8d8b-a917b3b1f414" x="373" y="0" width="37" height="16"/>
<textElement/>
<text><![CDATA[Total]]></text>
</staticText>
<line>
<reportElement uuid="6cef9de7-7dee-488b-aea7-3d02a8e3634a" x="0" y="0" width="555" height="1"/>
</line>
<textField>
<reportElement uuid="354a3daa-dbb6-45c0-93c3-b9c4f485cbb5" x="221" y="3" width="74" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum.abonos}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2f518abc-f4b9-411b-bb4f-5e58c0a2b301" x="306" y="3" width="43" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum.kmOnibusProprio}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6ce0a6db-3435-4ef2-be61-273af168410f" x="359" y="2" width="43" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum.kmOnibusArrendados}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3abc13c1-b7df-49e7-977a-c49638f639c2" x="415" y="3" width="62" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum.kmTotal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="9a3560b6-4371-4d7c-9336-f7578ccadda8" x="487" y="3" width="68" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{sum.pasajerosTransportados}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
@ -165,55 +200,55 @@
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="17" splitType="Stretch">
<band height="35" splitType="Stretch">
<textField>
<reportElement uuid="c29b2244-5b3e-48a2-9adf-8e10ee2a3856" x="178" y="0" width="96" height="16"/>
<textElement textAlignment="Left">
<reportElement uuid="c29b2244-5b3e-48a2-9adf-8e10ee2a3856" x="306" y="1" width="43" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{kmOnibusProprio}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="3111776a-f727-4313-841c-55dabd804df4" x="373" y="0" width="37" height="16"/>
<textElement textAlignment="Left">
<reportElement uuid="3111776a-f727-4313-841c-55dabd804df4" x="415" y="1" width="62" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{hora}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{kmTotal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3343aea7-212b-4bd5-a29c-8dcab3cb7568" x="122" y="0" width="56" height="16"/>
<textElement textAlignment="Left">
<textField pattern="">
<reportElement uuid="3343aea7-212b-4bd5-a29c-8dcab3cb7568" x="221" y="1" width="74" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{coche}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="b36dbddb-2fa9-48a5-809e-0e15ad54c529" x="61" y="0" width="61" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dia}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{abonos}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="4a68f71a-7be1-467a-b3eb-641a0c1f9a48" x="410" y="0" width="47" height="16"/>
<textElement textAlignment="Left">
<reportElement uuid="4a68f71a-7be1-467a-b3eb-641a0c1f9a48" x="487" y="1" width="68" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{kmts}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{pasajerosTransportados}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="cee727cd-cbc7-41d0-8020-d70aa33d8c9f" x="274" y="0" width="99" height="16"/>
<textElement textAlignment="Left">
<reportElement uuid="cee727cd-cbc7-41d0-8020-d70aa33d8c9f" x="359" y="0" width="43" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{kmOnibusArrendados}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement uuid="9f731da4-307a-4409-a8d5-28b2c4c40fce" x="0" y="1" width="61" height="16"/>
<reportElement uuid="9f731da4-307a-4409-a8d5-28b2c4c40fce" x="0" y="1" width="137" height="34"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{corridaId}]]></textFieldExpression>
<textFieldExpression><![CDATA[$F{linea}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="b36dbddb-2fa9-48a5-809e-0e15ad54c529" x="137" y="1" width="73" height="34"/>
<textElement textAlignment="Right">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{boletos}]]></textFieldExpression>
</textField>
</band>
</detail>

View File

@ -0,0 +1,229 @@
<?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="RelatorioEmpresaCorrida" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaCorrida" whenResourceMissingType="Empty" uuid="94834362-0ecc-46da-b0a2-5cdee355da3e">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="21"/>
<parameter name="fecInicio" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="NOMBEMPRESA" class="java.lang.String"/>
<parameter name="fecFinal" class="java.lang.String"/>
<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="TITULO" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="dia" class="java.util.Date"/>
<field name="coche" class="java.lang.Integer"/>
<field name="origem" class="java.lang.String"/>
<field name="destino" class="java.lang.String"/>
<field name="hora" class="java.lang.String"/>
<field name="kmts" class="java.lang.Integer"/>
<field name="empresa" class="java.lang.String"/>
<field name="corridaId" class="java.lang.Integer"/>
<variable name="sum.kmts" class="java.lang.Integer" resetType="Group" resetGroup="empresa" calculation="Sum">
<variableExpression><![CDATA[$F{kmts}]]></variableExpression>
</variable>
<group name="empresa">
<groupExpression><![CDATA[$F{empresa}]]></groupExpression>
<groupHeader>
<band height="69">
<textField>
<reportElement uuid="09306494-79f1-44dd-9eed-c39684384bbf" x="0" y="33" width="231" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{empresa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e8355048-a037-4837-866b-e6cf7a3e90ed" x="122" y="53" width="56" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.coche}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="edd89ef1-92d6-4b5f-b249-851532fad9df" x="373" y="53" width="37" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="73c02335-4bbe-44ba-9c73-1201ed6b3967" x="410" y="53" width="47" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.kmts}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d88253ec-b6d4-4e99-b677-3c1a0b273a81" x="61" y="53" width="61" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.dia}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="569add1e-cb73-4278-b800-fa44631527f6" x="274" y="53" width="99" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.destino}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="31387dbf-1cdc-4c27-992f-2e439abea576" x="178" y="53" width="96" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.origen}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="76104c33-e003-4a38-98bb-9db4d0f8636b" x="0" y="53" width="555" height="1"/>
</line>
<line>
<reportElement uuid="97639de4-d619-4f05-9b3e-e615b643b778" x="0" y="68" width="555" height="1"/>
</line>
<textField>
<reportElement uuid="12ef050d-3938-4dd6-8e82-bfeca7adaa2a" x="0" y="54" width="61" height="15"/>
<textElement markup="none">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.corridaId}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="19">
<textField isBlankWhenNull="true">
<reportElement uuid="96095298-1c13-4089-8a8b-fd324b377e45" x="410" y="0" width="57" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$V{sum.kmts}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="1b8e90f1-09d3-4419-8d8b-a917b3b1f414" x="373" y="0" width="37" height="16"/>
<textElement/>
<text><![CDATA[Total]]></text>
</staticText>
<line>
<reportElement uuid="6cef9de7-7dee-488b-aea7-3d02a8e3634a" x="0" y="0" width="555" height="1"/>
</line>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="60" splitType="Stretch">
<textField>
<reportElement uuid="e5d4714c-07cc-42ff-a7a8-76d6f6d3e716" x="0" y="20" width="49" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.periodo}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="66b2d0f6-2bf1-4bc7-9ec0-a34444e04d60" x="401" y="0" width="56" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.data.hora}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="8ca68351-fc00-4f19-b94f-f2fd1f41964f" x="533" y="20" width="22" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="be1692e9-f130-4d08-9173-6ca3e4699030" x="467" y="20" width="42" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.pagina}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="4914d9e7-6ce8-4512-b1f8-13f3b572ac50" x="49" y="20" width="182" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{fecInicio} + " à " + $P{fecFinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="652312bd-292a-424d-a234-5f157e3699c6" x="0" y="0" width="231" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{TITULO}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement uuid="6f671365-868e-41a6-81ee-a308d1d91e1d" x="457" y="0" width="98" height="20"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7548d623-fb6c-48d4-b8b7-504f5437a79a" x="509" y="20" width="24" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="17" splitType="Stretch">
<textField>
<reportElement uuid="c29b2244-5b3e-48a2-9adf-8e10ee2a3856" x="178" y="0" width="96" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{origem}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="3111776a-f727-4313-841c-55dabd804df4" x="373" y="0" width="37" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3343aea7-212b-4bd5-a29c-8dcab3cb7568" x="122" y="0" width="56" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{coche}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="b36dbddb-2fa9-48a5-809e-0e15ad54c529" x="61" y="0" width="61" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{dia}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="4a68f71a-7be1-467a-b3eb-641a0c1f9a48" x="410" y="0" width="47" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{kmts}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="cee727cd-cbc7-41d0-8020-d70aa33d8c9f" x="274" y="0" width="99" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{destino}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement uuid="9f731da4-307a-4409-a8d5-28b2c4c40fce" x="0" y="1" width="61" height="16"/>
<textElement textAlignment="Left">
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{corridaId}]]></textFieldExpression>
</textField>
</band>
</detail>
<noData>
<band height="20">
<textField>
<reportElement uuid="5a6c1b7b-2242-4cf1-b957-723b906ee620" x="0" y="0" width="803" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -1,62 +1,62 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.util.Date;
import java.math.BigDecimal;
public class RelatorioEmpresaCorridaBean {
protected Integer corridaId;
protected String empresa;
protected Date dia;
protected Integer coche;
protected String origem;
protected String destino;
protected String hora;
protected Integer kmts;
public Date getDia() {
return dia;
}
public void setDia(Date dia) {
this.dia = dia;
}
public Integer getCoche() {
return coche;
}
public void setCoche(Integer coche) {
this.coche = coche;
}
public String getOrigem() {
return origem;
}
public void setOrigem(String origem) {
this.origem = origem;
}
public String getDestino() {
return destino;
}
public void setDestino(String destino) {
this.destino = destino;
}
public String getHora() {
return hora;
}
public void setHora(String hora) {
this.hora = hora;
}
public Integer getKmts() {
return kmts;
}
public void setKmts(Integer kmts) {
this.kmts = kmts;
}
protected String linea;
protected BigDecimal boletos;
protected BigDecimal abonos;
protected Integer kmOnibusProprio;
protected Integer kmOnibusArrendados;
protected Integer kmTotal;
protected Integer pasajerosTransportados;
public String getEmpresa() {
return empresa;
}
public void setEmpresa(String empresa) {
this.empresa = empresa;
}
public Integer getCorridaId() {
return corridaId;
public String getLinea() {
return linea;
}
public void setCorridaId(Integer corridaId) {
this.corridaId = corridaId;
public void setLinea(String linea) {
this.linea = linea;
}
public BigDecimal getBoletos() {
return boletos;
}
public void setBoletos(BigDecimal boletos) {
this.boletos = boletos;
}
public BigDecimal getAbonos() {
return abonos;
}
public void setAbonos(BigDecimal abonos) {
this.abonos = abonos;
}
public Integer getKmOnibusProprio() {
return kmOnibusProprio;
}
public void setKmOnibusProprio(Integer kmOnibusProprio) {
this.kmOnibusProprio = kmOnibusProprio;
}
public Integer getKmOnibusArrendados() {
return kmOnibusArrendados;
}
public void setKmOnibusArrendados(Integer kmOnibusArrendados) {
this.kmOnibusArrendados = kmOnibusArrendados;
}
public Integer getKmTotal() {
return kmTotal;
}
public void setKmTotal(Integer kmTotal) {
this.kmTotal = kmTotal;
}
public Integer getPasajerosTransportados() {
return pasajerosTransportados;
}
public void setPasajerosTransportados(Integer pasajerosTransportados) {
this.pasajerosTransportados = pasajerosTransportados;
}
}

View File

@ -0,0 +1,62 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.util.Date;
public class RelatorioEmpresaOnibusBean {
protected Integer corridaId;
protected String empresa;
protected Date dia;
protected Integer coche;
protected String origem;
protected String destino;
protected String hora;
protected Integer kmts;
public Date getDia() {
return dia;
}
public void setDia(Date dia) {
this.dia = dia;
}
public Integer getCoche() {
return coche;
}
public void setCoche(Integer coche) {
this.coche = coche;
}
public String getOrigem() {
return origem;
}
public void setOrigem(String origem) {
this.origem = origem;
}
public String getDestino() {
return destino;
}
public void setDestino(String destino) {
this.destino = destino;
}
public String getHora() {
return hora;
}
public void setHora(String hora) {
this.hora = hora;
}
public Integer getKmts() {
return kmts;
}
public void setKmts(Integer kmts) {
this.kmts = kmts;
}
public String getEmpresa() {
return empresa;
}
public void setEmpresa(String empresa) {
this.empresa = empresa;
}
public Integer getCorridaId() {
return corridaId;
}
public void setCorridaId(Integer corridaId) {
this.corridaId = corridaId;
}
}

View File

@ -15,6 +15,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaOnibus;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaCorrida;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -40,7 +41,7 @@ public class RelatorioEmpresaCorridaController extends MyGenericForwardComposer
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaCorridaController.window.title"));
Relatorio relatorio = new RelatorioEmpresaCorrida(parametros, dataSource.getConnection(), true);
Relatorio relatorio = new RelatorioEmpresaCorrida(parametros, dataSource.getConnection());
Map<String, Object> args = new HashMap<String, Object>();
args.put("relatorio", relatorio);

View File

@ -15,7 +15,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Datebox;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaCorrida;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaOnibus;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@ -23,7 +23,7 @@ import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Scope("prototype")
public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
private static Logger log = Logger.getLogger(RelatorioEmpresaCorridaController.class);
private static Logger log = Logger.getLogger(RelatorioEmpresaOnibusController.class);
@Autowired
private DataSource dataSource;
@ -40,7 +40,7 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer {
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusController.window.title"));
Relatorio relatorio = new RelatorioEmpresaCorrida(parametros, dataSource.getConnection(), false);
Relatorio relatorio = new RelatorioEmpresaOnibus(parametros, dataSource.getConnection());
Map<String, Object> args = new HashMap<String, Object>();
args.put("relatorio", relatorio);