Relatório por Empresa de ônibus - Continuação (fixed bug #5460)
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@36521 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
63f12b09b7
commit
11419c9911
|
@ -31,8 +31,10 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
||||||
|
|
||||||
String fecInicio = parametros.get("fecInicio").toString() + " 00:00:00";
|
String fecInicio = parametros.get("fecInicio").toString() + " 00:00:00";
|
||||||
String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59";
|
String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59";
|
||||||
|
String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : "";
|
||||||
|
String autobus = parametros.get("autobus") != null ? parametros.get("autobus").toString() : "";
|
||||||
|
|
||||||
String sql = getSql();
|
String sql = getSql(empresa, autobus);
|
||||||
|
|
||||||
System.out.println(sql);
|
System.out.println(sql);
|
||||||
|
|
||||||
|
@ -40,6 +42,13 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
||||||
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||||
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
||||||
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
||||||
|
if (empresa != null && !empresa.equals("")){
|
||||||
|
stmt.setInt("empresa_id", Integer.parseInt(empresa));
|
||||||
|
}
|
||||||
|
if (autobus != null && !autobus.equals("")){
|
||||||
|
stmt.setInt("autobus_id", Integer.parseInt(autobus));
|
||||||
|
}
|
||||||
|
|
||||||
ResultSet rset = null;
|
ResultSet rset = null;
|
||||||
|
|
||||||
rset = stmt.executeQuery();
|
rset = stmt.executeQuery();
|
||||||
|
@ -61,7 +70,6 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lsDadosRelatorio.size() > 0) {
|
if (lsDadosRelatorio.size() > 0) {
|
||||||
|
|
||||||
setLsDadosRelatorio(lsDadosRelatorio);
|
setLsDadosRelatorio(lsDadosRelatorio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +85,7 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
||||||
protected void processaParametros() throws Exception {
|
protected void processaParametros() throws Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSql() {
|
private String getSql(String empresa, String autobus) {
|
||||||
StringBuffer sql = new StringBuffer();
|
StringBuffer sql = new StringBuffer();
|
||||||
|
|
||||||
sql.append(" select c.corrida_Id corridaId, e.nombempresa empresa, c.feccorrida dia, a.numautobus coche, ");
|
sql.append(" select c.corrida_Id corridaId, e.nombempresa empresa, c.feccorrida dia, a.numautobus coche, ");
|
||||||
|
@ -90,9 +98,15 @@ public class RelatorioEmpresaOnibus extends Relatorio {
|
||||||
sql.append(" left join tramo t on t.origen_id = c.origen_id and t.destino_id = c.destino_id and t.tramo_id = rc.tramo_id ");
|
sql.append(" left join tramo t on t.origen_id = c.origen_id and t.destino_id = c.destino_id and t.tramo_id = rc.tramo_id ");
|
||||||
sql.append(" inner join autobus a on a.autobus_id = c.autobus_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(" left join empresa e on e.empresa_id = a.empresa_id ");
|
||||||
sql.append(" where extract(month from c.feccorrida) = 6 ");
|
sql.append(" where c.activo = 1 ");
|
||||||
sql.append(" and c.activo = 1 and rc.activo = 1 and c.feccorrida between :fecInicio and :fecFinal ");
|
if (!empresa.isEmpty()){
|
||||||
sql.append(" order by e.nombempresa, c.feccorrida ");
|
sql.append(" and e.empresa_id = :empresa_id ");
|
||||||
|
}
|
||||||
|
if (!autobus.isEmpty()){
|
||||||
|
sql.append(" and a.autobus_id = :autobus_id ");
|
||||||
|
}
|
||||||
|
sql.append(" and rc.activo = 1 and c.feccorrida between :fecInicio and :fecFinal ");
|
||||||
|
sql.append(" order by e.nombempresa, a.numautobus, c.feccorrida ");
|
||||||
|
|
||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
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.RelatorioEmpresaOnibusBean;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
|
||||||
|
|
||||||
|
public class RelatorioEmpresaOnibusResumo extends Relatorio {
|
||||||
|
|
||||||
|
private List<RelatorioEmpresaOnibusBean> lsDadosRelatorio;
|
||||||
|
|
||||||
|
public RelatorioEmpresaOnibusResumo(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() + " 00:00:00";
|
||||||
|
String fecFinal = parametros.get("fecFinal").toString() + " 23:59:59";
|
||||||
|
String empresa = parametros.get("empresa") != null ? parametros.get("empresa").toString() : "";
|
||||||
|
String autobus = parametros.get("autobus") != null ? parametros.get("autobus").toString() : "";
|
||||||
|
|
||||||
|
String sql = getSql(empresa, autobus);
|
||||||
|
|
||||||
|
System.out.println(sql);
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
|
||||||
|
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
|
||||||
|
stmt.setTimestamp("fecInicio", new java.sql.Timestamp(sdf.parse(fecInicio).getTime()));
|
||||||
|
stmt.setTimestamp("fecFinal", new java.sql.Timestamp(sdf.parse(fecFinal).getTime()));
|
||||||
|
if (empresa != null && !empresa.equals("")){
|
||||||
|
stmt.setInt("empresa_id", Integer.parseInt(empresa));
|
||||||
|
}
|
||||||
|
if (autobus != null && !autobus.equals("")){
|
||||||
|
stmt.setInt("autobus_id", Integer.parseInt(autobus));
|
||||||
|
}
|
||||||
|
|
||||||
|
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 empresa, String autobus) {
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql.append("SELECT e.nombempresa empresa, ");
|
||||||
|
sql.append(" a.numautobus coche, ");
|
||||||
|
sql.append(" Sum(t.cantkmreal) KMTS ");
|
||||||
|
sql.append("FROM corrida c, ");
|
||||||
|
sql.append(" ruta_combinacion rc, ");
|
||||||
|
sql.append(" tramo t, ");
|
||||||
|
sql.append(" autobus a, ");
|
||||||
|
sql.append(" empresa e, ");
|
||||||
|
sql.append(" parada o, ");
|
||||||
|
sql.append(" parada d ");
|
||||||
|
sql.append("WHERE c.activo = 1 ");
|
||||||
|
sql.append(" AND rc.ruta_id = c.ruta_id ");
|
||||||
|
sql.append(" AND t.origen_id = c.origen_id ");
|
||||||
|
sql.append(" AND t.destino_id = c.destino_id ");
|
||||||
|
sql.append(" AND t.tramo_id = rc.tramo_id ");
|
||||||
|
sql.append(" AND rc.activo = 1 ");
|
||||||
|
sql.append(" AND c.feccorrida BETWEEN :fecInicio and :fecFinal ");
|
||||||
|
sql.append(" AND a.autobus_id = c.autobus_id ");
|
||||||
|
sql.append(" AND e.empresa_id = a.empresa_id ");
|
||||||
|
sql.append(" AND o.parada_id = c.origen_id ");
|
||||||
|
sql.append(" AND d.parada_id = c.destino_id ");
|
||||||
|
if (!empresa.isEmpty()){
|
||||||
|
sql.append(" AND e.empresa_id = :empresa_id ");
|
||||||
|
}
|
||||||
|
if (!autobus.isEmpty()){
|
||||||
|
sql.append(" AND a.autobus_id = :autobus_id ");
|
||||||
|
}
|
||||||
|
sql.append("GROUP BY e.nombempresa, ");
|
||||||
|
sql.append(" a.numautobus ");
|
||||||
|
sql.append("ORDER BY e.nombempresa, ");
|
||||||
|
sql.append(" a.numautobus ");
|
||||||
|
|
||||||
|
return sql.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#geral
|
||||||
|
msg.noData=Não foi possivel obter dados com os parâmetros informados.
|
||||||
|
msg.a=à
|
||||||
|
|
||||||
|
#Labels header
|
||||||
|
header.periodo=Período:
|
||||||
|
header.data.hora=Data/Hora\:
|
||||||
|
header.pagina=Página\:
|
||||||
|
header.filtro=Filtro\:
|
||||||
|
header.filtro.servico=Serviço\:
|
||||||
|
header.filtro.linha=Linha\:
|
||||||
|
header.filtro.grupo=Grupo de Linhas\:
|
||||||
|
|
||||||
|
#Labels detail
|
||||||
|
|
||||||
|
detail.dia=Dia
|
||||||
|
detail.coche=Carro
|
||||||
|
detail.origen=Origem
|
||||||
|
detail.destino=Destino
|
||||||
|
detail.hora=Hora
|
||||||
|
detail.kmts=Kmts
|
||||||
|
detail.corridaId=Corrida
|
||||||
|
|
||||||
|
linhas=Linhas
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
<?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="RelatorioEmpresaOnibus" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="RelatorioEmpresaOnibus" 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="coche" class="java.lang.Integer"/>
|
||||||
|
<field name="kmts" class="java.lang.Integer"/>
|
||||||
|
<field name="empresa" class="java.lang.String"/>
|
||||||
|
<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="0" y="53" width="56" height="15"/>
|
||||||
|
<textElement markup="none">
|
||||||
|
<font size="10"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$R{detail.coche}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField>
|
||||||
|
<reportElement uuid="73c02335-4bbe-44ba-9c73-1201ed6b3967" x="56" y="53" width="60" height="15"/>
|
||||||
|
<textElement markup="none">
|
||||||
|
<font size="10"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$R{detail.kmts}]]></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>
|
||||||
|
</band>
|
||||||
|
</groupHeader>
|
||||||
|
<groupFooter>
|
||||||
|
<band height="19">
|
||||||
|
<textField isBlankWhenNull="true">
|
||||||
|
<reportElement uuid="96095298-1c13-4089-8a8b-fd324b377e45" x="56" y="1" width="60" height="16"/>
|
||||||
|
<textElement textAlignment="Right">
|
||||||
|
<font size="10"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$V{sum.kmts}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<staticText>
|
||||||
|
<reportElement uuid="1b8e90f1-09d3-4419-8d8b-a917b3b1f414" x="19" y="1" 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="3343aea7-212b-4bd5-a29c-8dcab3cb7568" x="0" y="0" width="56" height="16"/>
|
||||||
|
<textElement textAlignment="Left">
|
||||||
|
<font size="10"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$F{coche}]]></textFieldExpression>
|
||||||
|
</textField>
|
||||||
|
<textField isBlankWhenNull="true">
|
||||||
|
<reportElement uuid="4a68f71a-7be1-467a-b3eb-641a0c1f9a48" x="56" y="0" width="60" height="16"/>
|
||||||
|
<textElement textAlignment="Right">
|
||||||
|
<font size="10"/>
|
||||||
|
</textElement>
|
||||||
|
<textFieldExpression><![CDATA[$F{kmts}]]></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>
|
|
@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
@ -13,10 +14,17 @@ import org.springframework.stereotype.Controller;
|
||||||
import org.zkoss.util.resource.Labels;
|
import org.zkoss.util.resource.Labels;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
import org.zkoss.zul.Datebox;
|
import org.zkoss.zul.Datebox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Autobus;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaOnibus;
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaOnibus;
|
||||||
|
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaOnibusResumo;
|
||||||
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.AutobusService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
|
||||||
@Controller("relatorioEmpresaOnibusController")
|
@Controller("relatorioEmpresaOnibusController")
|
||||||
|
@ -27,20 +35,48 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DataSource dataSource;
|
private DataSource dataSource;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
@Autowired
|
||||||
|
private AutobusService autobusService;
|
||||||
|
|
||||||
private Datebox datInicial;
|
private Datebox datInicial;
|
||||||
private Datebox datFinal;
|
private Datebox datFinal;
|
||||||
|
private MyComboboxEstandar cmbEmpresa;
|
||||||
|
private MyComboboxEstandar cmbAutobus;
|
||||||
|
private Checkbox chkResumo;
|
||||||
|
|
||||||
|
private List<Empresa> lsEmpresas;
|
||||||
|
private List<Autobus> lsAutobus;
|
||||||
|
|
||||||
private void executarRelatorio() throws Exception {
|
private void executarRelatorio() throws Exception {
|
||||||
|
|
||||||
Map<String, Object> parametros = new HashMap<String, Object>();
|
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
Empresa empresa = cmbEmpresa.getSelectedItem() != null ? (Empresa)cmbEmpresa.getSelectedItem().getValue() : null;
|
||||||
|
Autobus autobus = cmbAutobus.getSelectedItem() != null ? (Autobus)cmbAutobus.getSelectedItem().getValue() : null;
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
parametros.put("fecInicio", sdf.format(this.datInicial.getValue()));
|
parametros.put("fecInicio", sdf.format(this.datInicial.getValue()));
|
||||||
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
|
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
|
||||||
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusController.window.title"));
|
|
||||||
|
|
||||||
Relatorio relatorio = new RelatorioEmpresaOnibus(parametros, dataSource.getConnection());
|
if (empresa != null){
|
||||||
|
parametros.put("empresa", empresa.getEmpresaId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autobus != null){
|
||||||
|
parametros.put("autobus", autobus.getAutobusId());
|
||||||
|
}
|
||||||
|
|
||||||
|
Relatorio relatorio;
|
||||||
|
|
||||||
|
if (chkResumo.isChecked()){
|
||||||
|
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusResumoController.window.title"));
|
||||||
|
relatorio = new RelatorioEmpresaOnibusResumo(parametros, dataSource.getConnection());
|
||||||
|
} else {
|
||||||
|
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusController.window.title"));
|
||||||
|
relatorio = new RelatorioEmpresaOnibus(parametros, dataSource.getConnection());
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, Object> args = new HashMap<String, Object>();
|
Map<String, Object> args = new HashMap<String, Object>();
|
||||||
args.put("relatorio", relatorio);
|
args.put("relatorio", relatorio);
|
||||||
|
@ -56,7 +92,34 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsEmpresas = empresaService.obtenerTodos();
|
||||||
|
lsAutobus = autobusService.obtenerTodos();
|
||||||
|
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MyComboboxEstandar getCmbEmpresa() {
|
||||||
|
return cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEmpresa(MyComboboxEstandar cmbEmpresa) {
|
||||||
|
this.cmbEmpresa = cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresas() {
|
||||||
|
return lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresas(List<Empresa> lsEmpresas) {
|
||||||
|
this.lsEmpresas = lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Autobus> getLsAutobus() {
|
||||||
|
return lsAutobus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsAutobus(List<Autobus> lsAutobus) {
|
||||||
|
this.lsAutobus = lsAutobus;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,9 +301,12 @@ relatorioEmpresaCorridaController.window.title=Reporte Empresa Corrida
|
||||||
relatorioEmpresaCorridaController.lbDataIni.value=Fecha Inicio
|
relatorioEmpresaCorridaController.lbDataIni.value=Fecha Inicio
|
||||||
relatorioEmpresaCorridaController.lbDataFin.value=Fecha Final
|
relatorioEmpresaCorridaController.lbDataFin.value=Fecha Final
|
||||||
relatorioEmpresaCorridaController.lbEmpresa.value=Empresa
|
relatorioEmpresaCorridaController.lbEmpresa.value=Empresa
|
||||||
|
relatorioEmpresaCorridaController.lbOnibus.value=Onibus
|
||||||
|
relatorioEmpresaCorridaController.lbResumo.value=Resumen
|
||||||
|
|
||||||
# Relatorio Empresa Onibus
|
# Relatorio Empresa Onibus
|
||||||
relatorioEmpresaOnibusController.window.title=Reporte Empresa Onibus
|
relatorioEmpresaOnibusController.window.title=Reporte Empresa Onibus
|
||||||
|
relatorioEmpresaOnibusResumoController.window.title=Reporte Empresa Onibus - Resumen
|
||||||
relatorioEmpresaOnibusController.lbDataIni.value=Fecha Inicio
|
relatorioEmpresaOnibusController.lbDataIni.value=Fecha Inicio
|
||||||
relatorioEmpresaOnibusController.lbDataFin.value=Fecha Final
|
relatorioEmpresaOnibusController.lbDataFin.value=Fecha Final
|
||||||
|
|
||||||
|
|
|
@ -306,9 +306,12 @@ relatorioEmpresaCorridaController.window.title=Relatório Empresa Corrida
|
||||||
relatorioEmpresaCorridaController.lbDataIni.value=Data Inicial
|
relatorioEmpresaCorridaController.lbDataIni.value=Data Inicial
|
||||||
relatorioEmpresaCorridaController.lbDataFin.value=Data Final
|
relatorioEmpresaCorridaController.lbDataFin.value=Data Final
|
||||||
relatorioEmpresaCorridaController.lbEmpresa.value=Empresa
|
relatorioEmpresaCorridaController.lbEmpresa.value=Empresa
|
||||||
|
relatorioEmpresaCorridaController.lbOnibus.value=Ônibus
|
||||||
|
relatorioEmpresaCorridaController.lbResumo.value=Resumo
|
||||||
|
|
||||||
# Relatorio Empresa Onibus
|
# Relatorio Empresa Onibus
|
||||||
relatorioEmpresaOnibusController.window.title=Relatório Empresa Ônibus
|
relatorioEmpresaOnibusController.window.title=Relatório Empresa Ônibus
|
||||||
|
relatorioEmpresaOnibusResumoController.window.title=Relatório Empresa Ônibus - Resumo
|
||||||
relatorioEmpresaOnibusController.lbDataIni.value=Data Inicial
|
relatorioEmpresaOnibusController.lbDataIni.value=Data Inicial
|
||||||
relatorioEmpresaOnibusController.lbDataFin.value=Data Final
|
relatorioEmpresaOnibusController.lbDataFin.value=Data Final
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,25 @@
|
||||||
format="dd/MM/yyyy" lenient="false" constraint="no empty"
|
format="dd/MM/yyyy" lenient="false" constraint="no empty"
|
||||||
maxlength="10" />
|
maxlength="10" />
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('relatorioEmpresaCorridaController.lbEmpresa.value')}" />
|
||||||
|
<combobox id="cmbEmpresa"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||||
|
mold="rounded" buttonVisible="true"
|
||||||
|
width="70%" model="@{winFiltroRelatorioEmpresaOnibus$composer.lsEmpresas}" />
|
||||||
|
<label
|
||||||
|
value="${c:l('relatorioEmpresaCorridaController.lbOnibus.value')}" />
|
||||||
|
<combobox id="cmbAutobus"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
|
||||||
|
mold="rounded" buttonVisible="true"
|
||||||
|
width="70%" model="@{winFiltroRelatorioEmpresaOnibus$composer.lsAutobus}" />
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('relatorioEmpresaCorridaController.lbResumo.value')}" />
|
||||||
|
<checkbox id="chkResumo" />
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
<toolbar>
|
<toolbar>
|
||||||
|
|
Loading…
Reference in New Issue