diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTripulacao.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTripulacao.java new file mode 100644 index 000000000..61aca4b42 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTripulacao.java @@ -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 lsDadosRelatorio; + + public RelatorioTripulacao(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + this.parametros = parametros; + this.lsDadosRelatorio = new ArrayList(); + 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 executeStatement(Short tipoTripulacao) throws SQLException, ParseException { + Map 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 getDataFromResultSet(ResultSet result) throws SQLException { + List lsDadosRelatorio = new ArrayList(); + 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 "; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_es.properties new file mode 100644 index 000000000..0d04e037b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_es.properties @@ -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 \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_pt.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_pt.properties new file mode 100644 index 000000000..52ba002f7 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTripulacao_pt.properties @@ -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 diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jasper index 19357bf92..4ffbcf9dc 100644 Binary files a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jasper and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jrxml index b4590786b..f451cde43 100644 --- a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jrxml +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaOnibus.jrxml @@ -1,7 +1,7 @@ - - + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jasper new file mode 100644 index 000000000..051f62f00 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jrxml new file mode 100644 index 000000000..8b04d50a1 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTripulacao.jrxml @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <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> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioTripulacaoBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioTripulacaoBean.java new file mode 100644 index 000000000..030924204 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioTripulacaoBean.java @@ -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; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaOnibusController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaOnibusController.java index 93bd282d9..4beb87562 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaOnibusController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaOnibusController.java @@ -35,49 +35,49 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer { @Autowired private DataSource dataSourceRead; - @Autowired + @Autowired private EmpresaService empresaService; - @Autowired + @Autowired private AutobusService autobusService; - + private Datebox datInicial; private Datebox datFinal; private MyComboboxEstandar cmbEmpresa; private MyComboboxEstandar cmbAutobus; private Checkbox chkResumo; - + private List lsEmpresas; private List lsAutobus; - + private void executarRelatorio() throws Exception { Map parametros = new HashMap(); - 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 { parametros.put("TITULO", Labels.getLabel("relatorioEmpresaOnibusController.window.title")); relatorio = new RelatorioEmpresaOnibus(parametros, dataSourceRead.getConnection()); } - + Map args = new HashMap(); args.put("relatorio", relatorio); @@ -85,7 +85,7 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer { Labels.getLabel("relatorioEmpresaOnibusController.window.title"), args, MODAL); } - + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { executarRelatorio(); } @@ -94,7 +94,7 @@ public class RelatorioEmpresaOnibusController extends MyGenericForwardComposer { public void doAfterCompose(Component comp) throws Exception { lsEmpresas = empresaService.obtenerTodos(); lsAutobus = autobusService.obtenerTodos(); - + super.doAfterCompose(comp); } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTripulacaoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTripulacaoController.java new file mode 100644 index 000000000..ec7bb5e4f --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTripulacaoController.java @@ -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 lsEmpresa; + private List lsEmpleado; + private List lsTipoEmpleado; + + @Autowired + private DataSource dataSourceRead; + + @Autowired + EmpresaService empresaService; + + @Autowired + EmpleadoService empleadoService; + + @Autowired + TipoEmpleadoService tipoEmpleadoService; + + public List getLsEmpresa() { + return lsEmpresa; + } + + public List getLsEmpleado() { + return lsEmpleado; + } + + public List 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 parametros = new HashMap(); + 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()); + } + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemRelatorioTripulacao.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemRelatorioTripulacao.java new file mode 100644 index 000000000..1b4cd312a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemRelatorioTripulacao.java @@ -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); + } +} diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index b0769325f..3a259a60f 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -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 diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 4b1ace5b7..8c388a53d 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -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 diff --git a/web/gui/relatorios/filtroRelatorioTripulacao.zul b/web/gui/relatorios/filtroRelatorioTripulacao.zul new file mode 100644 index 000000000..7e9c63980 --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioTripulacao.zul @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +