edgar 2016-06-15 23:01:51 +00:00
parent 0847f99eb3
commit a98291e303
14 changed files with 871 additions and 21 deletions

View File

@ -0,0 +1,188 @@
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.sql.Connection;
import java.util.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.rjconsultores.ventaboletos.entidad.Empleado;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.TipoEmpleado;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioTripulacaoBean;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
public class RelatorioTripulacao extends Relatorio {
private static final short CONDUCTOR1 = 0;
private static final short CONDUCTOR2 = 1;
private static final short GUARDIA1 = 2;
private static final short GUARDIA2 = 3;
private Connection conexaoRelatorio;
private List<RelatorioTripulacaoBean> lsDadosRelatorio;
public RelatorioTripulacao(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.parametros = parametros;
this.lsDadosRelatorio = new ArrayList<RelatorioTripulacaoBean>();
this.conexaoRelatorio = conexao;
this.setCustomDataSource(new DataSource(this) {
@Override
public void initDados() throws Exception {
lsDadosRelatorio.addAll(executeStatement(CONDUCTOR1));
lsDadosRelatorio.addAll(executeStatement(CONDUCTOR2));
lsDadosRelatorio.addAll(executeStatement(GUARDIA1));
lsDadosRelatorio.addAll(executeStatement(GUARDIA2));
setDadosRelatorio(lsDadosRelatorio);
}
});
}
private List<RelatorioTripulacaoBean> executeStatement(Short tipoTripulacao) throws SQLException, ParseException {
Map<String, Object> parametros = this.getParametros();
Empresa empresa = (Empresa) parametros.get("empresa");
Empleado empleado = (Empleado) parametros.get("empleado");
TipoEmpleado tipoEmpleado = (TipoEmpleado) parametros.get("tipoEmpleado");
Date fecInicio = (Date) parametros.get("fecInicio");
Date fecFinal = (Date) parametros.get("fecFinal");
StringBuilder sql = new StringBuilder(getSelectClause());
switch (tipoTripulacao) {
case CONDUCTOR1:
sql.append(getSqlConductor1());
break;
case CONDUCTOR2:
sql.append(getSqlConductor2());
break;
case GUARDIA1:
sql.append(getSqlGuardian1());
break;
default:
sql.append(getSqlGuardian2());
break;
}
sql.append(getWhereClause());
NamedParameterStatement stmt = new NamedParameterStatement(conexaoRelatorio, sql.toString());
stmt.setDate("fecInicio", new java.sql.Date(fecInicio.getTime()));
stmt.setDate("fecFinal", new java.sql.Date(fecFinal.getTime()));
stmt.setString("tipoEmpleado", tipoEmpleado != null ? tipoEmpleado.getDescTipo() : null);
stmt.setLong("empleadoId", empleado != null ? empleado.getEmpleadoId() : 0);
stmt.setLong("empresaId", empresa != null ? empresa.getEmpresaId() : 0);
System.out.println(sql.toString());
return getDataFromResultSet(stmt.executeQuery());
}
private List<RelatorioTripulacaoBean> getDataFromResultSet(ResultSet result) throws SQLException {
List<RelatorioTripulacaoBean> lsDadosRelatorio = new ArrayList<RelatorioTripulacaoBean>();
RelatorioTripulacaoBean relatorioTripulacaoBean;
while (result.next()) {
relatorioTripulacaoBean = new RelatorioTripulacaoBean();
relatorioTripulacaoBean.setIdEmpleado(result.getLong("empleadoId"));
relatorioTripulacaoBean.setNomeEmpleado(result.getString("nomeEmpleado"));
relatorioTripulacaoBean.setTipoEmpleado(result.getString("tipoEmpleado"));
relatorioTripulacaoBean.setCorridaId(result.getLong("corridaId"));
relatorioTripulacaoBean.setFecha(result.getDate("fecha"));
relatorioTripulacaoBean.setNomeOrigem(result.getString("nomeOrigem"));
relatorioTripulacaoBean.setNomeDestino(result.getString("nomeDestino"));
relatorioTripulacaoBean.setDistanciaKm(result.getDouble("distanciaKm"));
relatorioTripulacaoBean.setNumSequencia(result.getLong("numSequencia"));
relatorioTripulacaoBean.setIdCorridaTramo(result.getLong("idCorridaTramo"));
relatorioTripulacaoBean.setHora(result.getString("hora"));
lsDadosRelatorio.add(relatorioTripulacaoBean);
}
return lsDadosRelatorio;
}
private void setDadosRelatorio(Collection collection) {
this.setCollectionDataSource(new JRBeanCollectionDataSource(collection));
}
@Override
protected void processaParametros() throws Exception {
}
private String getSelectClause() {
return "SELECT"
+ " emp.EMPLEADO_ID empleadoId,"
+ " emp.NOMBEMPLEADO nomeEmpleado,"
+ " tipo.DESCTIPO tipoEmpleado,"
+ " corrida.corrida_Id corridaId,"
+ " corrida.feccorrida fecha,"
+ " origem.cveparada nomeOrigem,"
+ " destino.cveparada nomeDestino,"
+ " to_char(corridaTramo.fechorsalida, 'HH24:MI') hora,"
+ " tramo.cantkmreal distanciaKm,"
+ " corridaTramo.numsecuencia numSequencia,"
+ " corridaTramo.CORRIDATRAMO_ID idCorridaTramo"
+ " FROM corrida corrida ";
}
private String getWhereClause() {
return " WHERE corrida.activo = 1"
+ " AND corrida.FECCORRIDA BETWEEN :fecInicio and :fecFinal"
+ " AND (:tipoEmpleado IS NULL OR tipo.DESCTIPO = :tipoEmpleado)"
+ " AND(:empleadoId =0 or emp.EMPLEADO_ID=:empleadoId)"
+ " AND (:empresaId =0 OR (emp.EMPLEADO_ID IS NULL OR emp.EMPRESA_ID =:empresaId))"
+ " ORDER BY NOMBEMPLEADO, corridaId, hora ";
}
private String getSqlGuardian1() {
return " INNER JOIN corrida_tramo corridaTramo"
+ " ON corridaTramo.corrida_id = corrida.corrida_id AND corrida.feccorrida = corridaTramo.feccorrida"
+ " INNER JOIN tramo tramo ON tramo.tramo_id = corridaTramo.tramo_id"
+ " INNER JOIN parada origem ON origem.parada_id = corridaTramo.origen_id"
+ " INNER JOIN parada destino ON destino.parada_id = corridaTramo.destino_id"
+ " INNER JOIN EMPLEADO emp ON emp.EMPLEADO_ID = corridaTramo.GUARDIA_ID"
+ " INNER JOIN TIPO_EMPLEADO tipo ON tipo.TIPOEMPLEADO_ID = emp.TIPOEMPLEADO_ID ";
}
private String getSqlGuardian2() {
return " INNER JOIN corrida_tramo corridaTramo"
+ " ON corridaTramo.corrida_id = corrida.corrida_id AND corrida.feccorrida = corridaTramo.feccorrida"
+ " INNER JOIN tramo tramo ON tramo.tramo_id = corridaTramo.tramo_id"
+ " INNER JOIN parada origem ON origem.parada_id = corridaTramo.origen_id"
+ " INNER JOIN parada destino ON destino.parada_id = corridaTramo.destino_id"
+ " INNER JOIN EMPLEADO emp ON emp.EMPLEADO_ID = corridaTramo.GUARDIA2_ID"
+ " INNER JOIN TIPO_EMPLEADO tipo ON tipo.TIPOEMPLEADO_ID = emp.TIPOEMPLEADO_ID ";
}
private String getSqlConductor1() {
return " INNER JOIN corrida_tramo corridaTramo"
+ " ON corridaTramo.corrida_id = corrida.corrida_id AND corrida.feccorrida = corridaTramo.feccorrida"
+ " INNER JOIN tramo tramo ON tramo.tramo_id = corridaTramo.tramo_id"
+ " INNER JOIN parada origem ON origem.parada_id = corridaTramo.origen_id"
+ " INNER JOIN parada destino ON destino.parada_id = corridaTramo.destino_id"
+ " INNER JOIN CONDUCTOR cond ON cond.CONDUCTOR_ID = corridaTramo.CONDUCTOR1_ID"
+ " INNER JOIN EMPLEADO emp ON emp.EMPLEADO_ID = cond.EMPLEADO_ID"
+ " INNER JOIN TIPO_EMPLEADO tipo ON tipo.TIPOEMPLEADO_ID = emp.TIPOEMPLEADO_ID ";
}
private String getSqlConductor2() {
return " INNER JOIN corrida_tramo corridaTramo"
+ " ON corridaTramo.corrida_id = corrida.corrida_id AND corrida.feccorrida = corridaTramo.feccorrida"
+ " INNER JOIN tramo tramo ON tramo.tramo_id = corridaTramo.tramo_id"
+ " INNER JOIN parada origem ON origem.parada_id = corridaTramo.origen_id"
+ " INNER JOIN parada destino ON destino.parada_id = corridaTramo.destino_id"
+ " INNER JOIN CONDUCTOR cond ON cond.CONDUCTOR_ID = corridaTramo.CONDUCTOR2_ID"
+ " INNER JOIN EMPLEADO emp ON emp.EMPLEADO_ID = cond.EMPLEADO_ID"
+ " INNER JOIN TIPO_EMPLEADO tipo ON tipo.TIPOEMPLEADO_ID = emp.TIPOEMPLEADO_ID ";
}
}

View File

@ -0,0 +1,17 @@
#geral
msg.noData=No se pudo obtener datos con los parámetros reportados.
msg.a=a
#Labels header
#Labels detail
detail.nomeEmpleado=Empleado
datail.tipoEmpleado=Tipo Empleado
detail.fecha=Fecha
detail.nomeOrigem=Origen
detail.nomeDestino=Destino
detail.hora=Hora
detail.distanciaKm=Kmts
detail.corridaId=Corrida
linhas=Lineas

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.pagina=Página\:
header.data.hora=Data/Hora\:
label.empleadoId=Empregado
label.empleadoNome=Nome
label.tipoEmpregado=Tipo
#Labels detail
detail.fecha=Data
detail.nomeOrigem=Origen
detail.nomeDestino=Destino
detail.hora=Hora
detail.distanciaKm=Distância Km
detail.corridaId=Corrida
#filtros
filtro.periodo=Período
filtro.empregado=Empregado
filtro.empresa=Empresa
filtro.tipoEmpregado=Tipo Empregado
linhas=Lineas

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="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="2.4157650000000044"/>
<property name="ireport.x" value="927"/>
<property name="ireport.zoom" value="1.6500000000000028"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="fecInicio" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>

View File

@ -0,0 +1,291 @@
<?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="RelatorioTripulacao" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d5ad1cbf-3b72-40fa-b0c7-0dd4a3aac974">
<property name="ireport.zoom" value="1.7715610000000075"/>
<property name="ireport.x" value="124"/>
<property name="ireport.y" value="0"/>
<parameter name="titulo" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="nomeEmpresa" class="java.lang.String"/>
<parameter name="nomeEmpleado" class="java.lang.String"/>
<parameter name="tipoEmpleadoDesc" class="java.lang.String"/>
<parameter name="fecInicio" class="java.util.Date"/>
<parameter name="fecFinal" class="java.util.Date"/>
<field name="nomeEmpleado" class="java.lang.String"/>
<field name="tipoEmpleado" class="java.lang.String"/>
<field name="fecha" class="java.util.Date"/>
<field name="nomeOrigem" class="java.lang.String"/>
<field name="nomeDestino" class="java.lang.String"/>
<field name="distanciaKm" class="java.lang.Double"/>
<field name="idEmpleado" class="java.lang.Long"/>
<field name="corridaId" class="java.lang.Long"/>
<field name="hora" class="java.lang.String"/>
<variable name="totalKM" class="java.lang.Double" resetType="Group" resetGroup="empleado" calculation="Sum">
<variableExpression><![CDATA[$F{distanciaKm}]]></variableExpression>
<initialValueExpression><![CDATA[0.0]]></initialValueExpression>
</variable>
<group name="empleado">
<groupExpression><![CDATA[$F{idEmpleado}]]></groupExpression>
<groupHeader>
<band height="49">
<textField>
<reportElement uuid="e148679a-25dc-4c96-9497-e872e126abd3" x="0" y="35" width="100" height="14"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.corridaId}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="a9bd4432-bc5f-459b-976a-d7a8f6dfd9a2" x="100" y="35" width="100" height="14"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.fecha}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="703ec7e6-40ca-4cbf-a0a1-295218e08434" x="300" y="35" width="100" height="14"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.nomeOrigem}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="3b5a4c87-70ca-4614-bf08-55847461064c" x="400" y="35" width="100" height="14"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.nomeDestino}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="24f31a18-4f1a-4371-af7f-fa2b2e5d8d96" x="200" y="35" width="100" height="14"/>
<textElement markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="6b84c912-0932-4851-aa4c-e1be076ffc6a" x="500" y="35" width="55" height="14"/>
<textElement textAlignment="Right" markup="none">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{detail.distanciaKm}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="560ecce1-2a4a-42b2-b2da-ef04ae8b2363" x="100" y="16" width="328" height="14"/>
<textElement>
<font size="10"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{nomeEmpleado}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="89628efb-c65d-4fc7-98ab-af7c1e3c9fa5" x="100" y="0" width="328" height="16"/>
<textElement markup="none">
<font size="12" isBold="true"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.empleadoNome}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cbdbd675-769a-4cac-af77-0f5876f60864" x="0" y="16" width="100" height="14"/>
<textElement>
<font size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{idEmpleado}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cf168ea7-9011-4c9f-a86c-d0dc486b0db1" x="0" y="0" width="100" height="16"/>
<textElement markup="none">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.empleadoId}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b24836bc-6214-4733-9851-243510f3eb7a" x="428" y="0" width="126" height="16"/>
<textElement markup="none">
<font size="12" isBold="true"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.tipoEmpregado}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="7581d921-a9a6-4941-a02b-aa00d47cdff2" x="428" y="16" width="126" height="14"/>
<textElement>
<font size="10"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{tipoEmpleado}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="25">
<textField pattern="###0.00;-###0.00">
<reportElement uuid="5e0eb385-d270-4f18-9d62-5eca221ec6a3" x="499" y="3" width="55" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{totalKM}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="92e7be05-350b-44fc-85da-1e7b1f583cfa" x="428" y="3" width="71" height="16"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Total Km :]]></text>
</staticText>
<line>
<reportElement uuid="28bd3ea7-625a-426b-bc9a-540ab2fc269e" x="0" y="2" width="554" height="1"/>
</line>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="36" splitType="Stretch">
<textField>
<reportElement uuid="f6832783-9c29-4cad-9f22-9720cfacf1b6" x="400" y="0" width="56" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$R{header.data.hora}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm">
<reportElement uuid="44b4f57c-9828-4cae-9e5f-b02bf81421b9" x="456" y="0" width="98" height="20"/>
<textElement textAlignment="Left"/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="8f1be949-b574-4f79-9fc3-ad18d94635c3" x="0" y="0" width="401" height="20"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{titulo}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="2617faa7-82b9-4631-b1b1-aeab2d940b8e" x="167" y="22" width="58" height="12"/>
<textElement>
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{filtro.empresa}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="f5b64932-6e93-408b-883b-6947fc45df32" x="17" y="22" width="58" height="12"/>
<textElement>
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{filtro.periodo}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="5d538a0a-bc1f-4ef2-9f31-877f2fb71ed5" x="312" y="22" width="52" height="12"/>
<textElement>
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{filtro.empregado}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="634786ed-bb56-43f4-9c17-c797a15368f2" x="439" y="22" width="60" height="12"/>
<textElement>
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{filtro.tipoEmpregado}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="9f76f840-1ff6-469e-893f-7db8b470b627" x="75" y="22" width="45" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{fecInicio}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="7c1f3629-dd0d-4dd9-8ae2-070d4ade1366" x="499" y="22" width="55" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{tipoEmpleadoDesc}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="88100b48-af1c-4b1c-b5ca-7779f5fd637d" x="364" y="22" width="75" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{nomeEmpleado}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement uuid="d8070e66-07f1-474a-b9a7-ba55740c2031" x="225" y="22" width="87" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{nomeEmpresa}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement uuid="0b606534-b607-4a38-af7f-b28bce38bcd2" x="120" y="22" width="47" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{fecFinal}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="14">
<textField>
<reportElement uuid="593bd9bd-e7d6-4e3d-82c2-a96721d36a6d" x="446" y="0" width="77" height="12"/>
<textElement textAlignment="Right">
<font size="8"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$R{header.pagina}+" "+$V{PAGE_NUMBER}+" de "]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="cff5acfb-b00b-497f-bcba-0b6b0a9790c1" x="523" y="0" width="32" height="12"/>
<textElement>
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="14">
<textField pattern="dd/MM/yyyy">
<reportElement uuid="86264348-3c96-4e1c-bfcf-6ae99678ad58" x="100" y="0" width="100" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{fecha}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="e29b00a0-9cec-4ab5-af59-7eb97369cfa2" x="300" y="0" width="100" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{nomeOrigem}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="cf818fc9-459e-4a3f-9c56-48105b3f21ef" x="200" y="0" width="100" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{hora}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="914fa266-37c9-49d2-8b33-c34c306ea8fd" x="400" y="0" width="100" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{nomeDestino}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="40b166b9-7d72-4686-8a07-439fbd452007" x="500" y="0" width="55" height="12"/>
<textElement textAlignment="Right">
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{distanciaKm}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="57fc4cf8-8a8e-4112-b017-c5a1fc388b9a" x="0" y="0" width="100" height="12"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{corridaId}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

View File

@ -0,0 +1,87 @@
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
import java.sql.Date;
public class RelatorioTripulacaoBean {
private Long idEmpleado;
private String nomeEmpleado;
private String tipoEmpleado;
private Long corridaId;
private Date fecha;
private String nomeOrigem;
private String nomeDestino;
private String hora;
private Double distanciaKm;
private Long numSequencia;
private Long idCorridaTramo;
public Long getIdEmpleado() {
return idEmpleado;
}
public void setIdEmpleado(Long idEmpleado) {
this.idEmpleado = idEmpleado;
}
public RelatorioTripulacaoBean() {
}
public String getNomeEmpleado() {
return nomeEmpleado;
}
public void setNomeEmpleado(String nomeEmpleado) {
this.nomeEmpleado = nomeEmpleado;
}
public String getTipoEmpleado() {
return tipoEmpleado;
}
public void setTipoEmpleado(String tipoEmpleado) {
this.tipoEmpleado = tipoEmpleado;
}
public Long getCorridaId() {
return corridaId;
}
public void setCorridaId(Long corridaId) {
this.corridaId = corridaId;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public String getNomeOrigem() {
return nomeOrigem;
}
public void setNomeOrigem(String nomeOrigem) {
this.nomeOrigem = nomeOrigem;
}
public String getNomeDestino() {
return nomeDestino;
}
public void setNomeDestino(String nomeDestino) {
this.nomeDestino = nomeDestino;
}
public String getHora() {
return hora;
}
public void setHora(String hora) {
this.hora = hora;
}
public Double getDistanciaKm() {
return distanciaKm;
}
public void setDistanciaKm(Double distanciaKm) {
this.distanciaKm = distanciaKm;
}
public Long getNumSequencia() {
return numSequencia;
}
public void setNumSequencia(Long numSequencia) {
this.numSequencia = numSequencia;
}
public Long getIdCorridaTramo() {
return idCorridaTramo;
}
public void setIdCorridaTramo(Long idCorridaTramo) {
this.idCorridaTramo = idCorridaTramo;
}
}

View File

@ -53,24 +53,24 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer {
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;
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");
parametros.put("fecInicio", sdf.format(this.datInicial.getValue()));
parametros.put("fecFinal", sdf.format(this.datFinal.getValue()));
if (empresa != null){
if (empresa != null) {
parametros.put("empresa", empresa.getEmpresaId());
}
if (autobus != null){
if (autobus != null) {
parametros.put("autobus", autobus.getAutobusId());
}
Relatorio relatorio;
if (chkResumo.isChecked()){
if (chkResumo.isChecked()) {
parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusResumoController.window.title"));
relatorio = new RelatorioEmpresaOnibusResumo(parametros, dataSourceRead.getConnection());
} else {

View File

@ -0,0 +1,129 @@
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.zkoss.util.resource.Labels;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.api.Datebox;
import com.rjconsultores.ventaboletos.entidad.Empleado;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.TipoEmpleado;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTripulacao;
import com.rjconsultores.ventaboletos.service.EmpleadoService;
import com.rjconsultores.ventaboletos.service.EmpresaService;
import com.rjconsultores.ventaboletos.service.TipoEmpleadoService;
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
@Controller("relatorioTripulacaoController")
@Scope("prototype")
public class RelatorioTripulacaoController extends MyGenericForwardComposer {
private static final long serialVersionUID = 1L;
// private Logger logger = Logger.getLogger(RelatorioTripulacaoController.class);
private Datebox datInicial;
private Datebox datFinal;
private Combobox cmbEmpresa;
private Combobox cmbEmpleado;
private Combobox cmbTipoEmpleado;
private Empresa empresa;
private Empleado empleado;
private List<Empresa> lsEmpresa;
private List<Empleado> lsEmpleado;
private List<TipoEmpleado> lsTipoEmpleado;
@Autowired
private DataSource dataSourceRead;
@Autowired
EmpresaService empresaService;
@Autowired
EmpleadoService empleadoService;
@Autowired
TipoEmpleadoService tipoEmpleadoService;
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
public List<Empleado> getLsEmpleado() {
return lsEmpleado;
}
public List<TipoEmpleado> getLsTipoEmpleado() {
return lsTipoEmpleado;
}
@Override
public void doAfterCompose(Component comp) throws Exception {
lsEmpresa = empresaService.obtenerTodos();
lsEmpleado = empleadoService.obtenerTodos();
lsTipoEmpleado = tipoEmpleadoService.obtenerTodos();
super.doAfterCompose(comp);
}
public void onSelect$cmbEmpresa(Event ev) throws Exception {
empresa = (Empresa) cmbEmpresa.getSelectedItem().getValue();
}
public void onSelect$cmbEmpleado(Event ev) throws Exception {
empleado = (Empleado) cmbEmpleado.getSelectedItem().getValue();
}
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
executarRelatorio();
}
public void executarRelatorio() throws Exception {
HashMap<String, Object> parametros = new HashMap<String, Object>();
TipoEmpleado tipoEmpleado = null;
if (cmbTipoEmpleado.getSelectedItem() != null) {
tipoEmpleado = (TipoEmpleado) cmbTipoEmpleado.getSelectedItem().getValue();
}
parametros.put("empresa", empresa);
parametros.put("empleado", empleado);
parametros.put("tipoEmpleado", tipoEmpleado);
parametros.put("fecInicio", datInicial.getValue());
parametros.put("fecFinal", datFinal.getValue());
parametros.put("nomeEmpresa", empresa != null ? empresa.getNombempresa() :"");
parametros.put("nomeEmpleado", empleado != null ? empleado.getNombEmpleado() : "");
parametros.put("tipoEmpleadoDesc", tipoEmpleado != null ? tipoEmpleado.getDescTipo() : "");
parametros.put("relatorio", new RelatorioTripulacao(parametros, dataSourceRead.getConnection()));
parametros.put("titulo", Labels.getLabel("relatorioTripulacao.label"));
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioTripulacao.label"), parametros, MODAL);
}
private class EmpleadoRenderer implements ComboitemRenderer {
@Override
public void render(Comboitem combo, Object object) throws Exception {
Empleado empleado = (Empleado) object;
combo.setLabel(empleado.getNombEmpleado());
}
}
}

View File

@ -0,0 +1,25 @@
package com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios;
import org.zkoss.util.resource.Labels;
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema;
public class ItemRelatorioTripulacao extends DefaultItemMenuSistema {
public ItemRelatorioTripulacao() {
super("Relatório Tripulação");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIO.MENU.TRIPULACAO";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("gui/relatorios/filtroRelatorioTripulacao.zul",
Labels.getLabel("relatorioTripulacao.label"), getArgs(), desktop);
}
}

View File

@ -576,6 +576,17 @@ relatorioAidfController.dataFinal.value = Fecha Final
relatorioAidfController.lbEmpresa.value = Empresa
relatorioAidfController.lbSerie.value = Série
#Relatorio Tripulacao
relatorioTripulacao.label=Informe Tripulación
relatorioTripulacaoController.lbDataInicial=Fecha Inicial
relatorioTripulacaoController.lbDataFinal=Fecha Final
relatorioTripulacaoController.lbCmbEmpresa=Empresa
relatorioTripulacaoController.lbCmbFuncionario=Funcionario
relatorioTripulacaoController.radioCondutor=Conductor
relatorioTripulacaoController.radioGuarda=Guarda
relatorioTripulacaoController.radioTodos=Todos
relatorioTripulacaoController.lbTipoTripulacao=Función
# Pantalla Editar clase
editarClaseServicioController.window.title = Clase de servicio
editarClaseServicioController.btnApagar.tooltiptext = Eliminar

View File

@ -1,4 +1,4 @@
# V. 1.4
# V. 1.4
# Para alterar esta planilha, selecione Ferramentas | Planilhas
# E abrir a planilha no editor.
@ -456,6 +456,17 @@ relatorioTrechoVendidoController.lbEmpresa.label = Empresa
relatorioTrechoVendidoController.window.title = Relatório de Trecho Vendido Por Agência
relatorioTrechoVendidoController.no.agencia = Selecione uma agência
#Relatorio Tripulacao
relatorioTripulacao.label=Relatório Tripulação
relatorioTripulacaoController.lbDataInicial=Data Inicial
relatorioTripulacaoController.lbDataFinal=Data Final
relatorioTripulacaoController.lbCmbEmpresa=Empresa
relatorioTripulacaoController.lbCmbFuncionario=Funcionário
relatorioTripulacaoController.radioCondutor=Condutor
relatorioTripulacaoController.radioGuarda=Guarda
relatorioTripulacaoController.radioTodos=Todos
relatorioTripulacaoController.lbTipoTripulacao=Função
#Receita Diária por Agência
relatorioReceitaDiariaAgenciaController.window.title = Relatório de Receita Diária por Agência
relatorioReceitaDiariaAgenciaController.lbDataIni.value = Data Inicial

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winFiltroRelatorioTripulacao"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioTripulacao"
apply="${relatorioTripulacaoController}" contentStyle="overflow:auto"
width="550px" border="normal">
<radiogroup id="tipoTripulante"></radiogroup>
<grid fixedLayout="true">
<columns>
<column width="16%" />
<column width="34%" />
<column width="16%" />
<column width="34%" />
</columns>
<rows>
<row>
<label
value="${c:l('relatorioTripulacaoController.lbDataInicial')}" />
<datebox id="datInicial" width="90%"
format="dd/MM/yyyy" lenient="false" constraint="no empty"
maxlength="10" />
<label
value="${c:l('relatorioTripulacaoController.lbDataFinal')}" />
<datebox id="datFinal" width="90%"
format="dd/MM/yyyy" lenient="false" constraint="no empty"
maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioTripulacaoController.lbCmbEmpresa')}" />
<combobox id="cmbEmpresa"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true"
model="@{winFiltroRelatorioTripulacao$composer.lsEmpresa}"/>
<label
value="${c:l('relatorioTripulacaoController.lbTipoTripulacao')}"/>
<combobox id="cmbTipoEmpleado"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true"
model="@{winFiltroRelatorioTripulacao$composer.lsTipoEmpleado}"/>
</row>
<row>
<label
value="${c:l('relatorioTripulacaoController.lbCmbFuncionario')}" />
<combobox id="cmbEmpleado"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" buttonVisible="true"
model="@{winFiltroRelatorioTripulacao$composer.lsEmpleado}"/>
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}"/>
</toolbar>
</window>
</zk>