diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioEmpresaCorrida.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioEmpresaCorrida.java new file mode 100644 index 000000000..9917c1312 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioEmpresaCorrida.java @@ -0,0 +1,97 @@ +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.RelatorioLinhasHorarioBean; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +public class RelatorioEmpresaCorrida extends Relatorio { + + private List lsDadosRelatorio; + + public RelatorioEmpresaCorrida(Map 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 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); + + System.out.println(sql); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + ResultSet rset = null; + + rset = stmt.executeQuery(); + + lsDadosRelatorio = new ArrayList(); + + 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")); + + lsDadosRelatorio.add(empresaCorridaBean); + } + + if (lsDadosRelatorio.size() > 0) { + + setLsDadosRelatorio(lsDadosRelatorio); + } + } + }); + } + + public void setLsDadosRelatorio(List 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(" left join empresa e on e.empresa_id = c.empresacorrida_id "); + sql.append(" inner join autobus a on a.autobus_id = c.autobus_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(); + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioEmpresaCorrida_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioEmpresaCorrida_pt_BR.properties new file mode 100644 index 000000000..91e11dd4d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioEmpresaCorrida_pt_BR.properties @@ -0,0 +1,27 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. +msg.a=à + +#Labels header +header.titulo.relatorio=Relatório por Empresa Corrida +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=PASSAGEIROS +detail.destino=PARÂMETROS OPERACIONAIS +detail.hora=Hora +detail.kmts=Kmts +detail.corridaId=Corrida + +linhas=Linhas + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jasper new file mode 100644 index 000000000..6056f324e Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jrxml new file mode 100644 index 000000000..b4b5b0f7b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioEmpresaCorrida.jrxml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioEmpresaCorridaBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioEmpresaCorridaBean.java new file mode 100644 index 000000000..ab8ef112a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioEmpresaCorridaBean.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.relatorios.utilitarios; + +import java.util.Date; + +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; + } + 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; + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaCorridaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaCorridaController.java new file mode 100644 index 000000000..4aecd750a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioEmpresaCorridaController.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +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.Datebox; + +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioEmpresaCorrida; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; + +@Controller("relatorioEmpresaCorridaController") +@Scope("prototype") +public class RelatorioEmpresaCorridaController extends MyGenericForwardComposer { + private static final long serialVersionUID = 1L; + private static Logger log = Logger.getLogger(RelatorioEmpresaCorridaController.class); + + @Autowired + private DataSource dataSource; + + private Datebox datInicial; + private Datebox datFinal; + + private void executarRelatorio() throws Exception { + + Map parametros = new HashMap(); + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + parametros.put("fecInicio", sdf.format(this.datInicial.getValue())); + parametros.put("fecFinal", sdf.format(this.datFinal.getValue())); + + Relatorio relatorio = new RelatorioEmpresaCorrida(parametros, dataSource.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioEmpresaCorridaController.window.title"), args, MODAL); + + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioEmpresaCorrida.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioEmpresaCorrida.java new file mode 100644 index 000000000..4c4d25c30 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioEmpresaCorrida.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 ItemMenuRelatorioEmpresaCorrida extends DefaultItemMenuSistema { + + public ItemMenuRelatorioEmpresaCorrida() { + super("indexController.mniRelatorioEmpresaCorrida.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOEMPRESACORRIDA"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioEmpresaCorrida.zul", + Labels.getLabel("relatorioEmpresaCorridaController.window.title"), null, desktop); + } + +} diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 34c2cdf0f..1371f196b 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -223,6 +223,7 @@ indexController.mniRelatorioAcompanhamentoEquivalentes.label = Reporte acompaña indexController.mniRelatorioLinhasHorario.label = Reporte de rutas por horário indexController.mniRelatorioTaxasLinha.label = Reporte de tasas por linea indexController.mniRelatorioSisdap.label=SISDAP +indexController.mniRelatorioEmpresaCorrida.label = Reporte de la Empresa Corrida #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias para empleados @@ -292,6 +293,11 @@ relatorioAproveitamentoController.HoraServico.label = Hora servicio relatorioAproveitamentoController.Classe.label = Clase relatorioAproveitamentoController.btnBuscarServico.label = Buscar servicio +# Relatorio Empresa Corrida +relatorioEmpresaCorridaController.window.title=Reporte Empresa Corrida +relatorioEmpresaCorridaController.lbDataIni.value=Fecha Inicio +relatorioEmpresaCorridaController.lbDataFin.value=Fecha Final + #Relatorio rutas Horario relatorioLinhasHorarioController.window.title = Reporte de rutas por horário relatorioLinhasHorarioController.lbDataIni.value = Fecha inicial @@ -302,6 +308,7 @@ relatorioLinhasHorarioController.lbLote.label = Lote relatorioLinhasHorarioController.lbLinha.label = Linea relatorioLinhasHorarioController.lbServico.label = Clase + relatorioLinhasHorarioController.lbNumRuta.label = Num. linea relatorioLinhasHorarioController.lbPrefixo.label = Prefijo diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 9543999b8..e58c854b4 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -227,6 +227,7 @@ indexController.mniRelatorioLinhasHorario.label = Relatório de Linhas por Horá indexController.mniRelatorioTaxasLinha.label = Relatório de Taxas por Linha indexController.mniRelatorioDevolucaoBilhetes.label = Relatório de Devolução de Bilhetes indexController.mniRelatorioSisdap.label=SISDAP +indexController.mniRelatorioEmpresaCorrida.label = Relatório por Empresa Corrida #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias Para Funcionários @@ -298,6 +299,11 @@ relatorioAproveitamentoController.HoraServico.label = Hora Serviço relatorioAproveitamentoController.Classe.label = Classe relatorioAproveitamentoController.btnBuscarServico.label = Buscar Serviço +# Relatorio Empresa Corrida +relatorioEmpresaCorridaController.window.title=Relatório Empresa Corrida +relatorioEmpresaCorridaController.lbDataIni.value=Data Inicial +relatorioEmpresaCorridaController.lbDataFin.value=Data Final + #Relatorio Linhas Horario relatorioLinhasHorarioController.window.title = Relatório de Linhas por Horário relatorioLinhasHorarioController.lbDataIni.value = Data Inicial diff --git a/web/gui/relatorios/filtroRelatorioEmpresaCorrida.zul b/web/gui/relatorios/filtroRelatorioEmpresaCorrida.zul new file mode 100644 index 000000000..7997586da --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioEmpresaCorrida.zul @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + +