diff --git a/.classpath b/.classpath index 56fe1eb18..c86aa943a 100644 --- a/.classpath +++ b/.classpath @@ -92,18 +92,18 @@ - + + + + - + - - - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 043bd75ea..42b813043 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,6 +1,6 @@ - + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java new file mode 100644 index 000000000..f2558ee72 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioTrechoVendido.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; + +public class RelatorioTrechoVendido extends Relatorio { + + public RelatorioTrechoVendido(Map parametros, Connection conexao) { + super(parametros, conexao); + } + + @Override + protected void processaParametros() throws Exception { + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties new file mode 100644 index 000000000..87ab58c2e --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioTrechoVendido_pt_BR.properties @@ -0,0 +1,20 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. +msg.a=à + +#Labels header +header.titulo.relatorio=Trecho Vendido Por Agência +header.periodo=Período: +header.data.hora=Data/Hora: +header.pagina=Página: +header.filtro.agencia=Filtros: Agência: + +#Labels group + +group.trecho=Trecho +group.horario=Horário +group.venda=Venda +group.poltronas.livres=P. Livre +group.total=Total +group.valor.total=Vr. Total + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper new file mode 100644 index 000000000..f05291c7b Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml new file mode 100644 index 000000000..3e2494d3d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioTrechoVendido.jrxml @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + 0 + THEN 1 + ELSE NULL + END) AS VENDA +FROM + CAJA c +LEFT JOIN PARADA origem +ON + ( + c.ORIGEN_ID = origem.PARADA_ID + ) +LEFT JOIN PARADA destino +ON + ( + c.DESTINO_ID = destino.PARADA_ID + ) +LEFT JOIN CORRIDA cor +ON + ( + c.CORRIDA_ID = cor.CORRIDA_ID + AND c.FECCORRIDA = cor.FECCORRIDA + ) +LEFT JOIN EMPRESA e +ON + ( + e.EMPRESA_ID = c.EMPRESAPUNTOVENTA_ID + ) +WHERE + c.FECCORRIDA BETWEEN $P{DATA_INICIO} AND $P{DATA_FINAL} +AND c.PUNTOVENTA_ID = $P{PUNTOVENTA_ID} +AND e.NOMBEMPRESA LIKE $P{NOMBEMPRESA_SEARCH} +GROUP BY + c.CORRIDA_ID, + c.FECCORRIDA, + origem.DESCPARADA, + destino.DESCPARADA, + cor.FECHORSALIDA, + e.NOMBEMPRESA +ORDER BY + origem.DESCPARADA, + destino.DESCPARADA]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <band height="1" splitType="Stretch"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java new file mode 100644 index 000000000..68d6f3eef --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioTrechoVendidoController.java @@ -0,0 +1,214 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +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.zhtml.Messagebox; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Bandbox; +import org.zkoss.zul.Combobox; +import org.zkoss.zul.Datebox; +import org.zkoss.zul.Paging; +import org.zkoss.zul.Textbox; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTrechoVendido; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVentaSimple; +import com.trg.search.Filter; + +@Controller("relatorioTrechoVendidoController") +@Scope("prototype") +public class RelatorioTrechoVendidoController extends MyGenericForwardComposer { + + private static final long serialVersionUID = 1L; + + private static Logger log = Logger.getLogger(RelatorioTrechoVendidoController.class); + + @Autowired + private DataSource dataSource; + + @Autowired + private EmpresaService empresaService; + + private ArrayList lsNumPuntoVenta = new ArrayList(); + private ArrayList lsNumEmpresa = new ArrayList(); + + @Autowired + private transient PagedListWrapper plwPuntoVenta; + private MyListbox puntoVentaList; + private Paging pagingPuntoVenta; + private Bandbox bbPesquisaPuntoVenta; + private Textbox txtPalavraPesquisa; + private Datebox datInicial; + private Datebox datFinal; + + private Combobox cmbEmpresa; + private List lsEmpresa; + + private void executarRelatorio() throws Exception { + + if (lsNumPuntoVenta.size() > 0) { + Map parametros = new HashMap(); + parametros.put("DATA_INICIO", new java.sql.Date(((java.util.Date) this.datInicial.getValue()).getTime())); + parametros.put("DATA_FINAL", new java.sql.Date(((java.util.Date) this.datFinal.getValue()).getTime())); + + if (lsNumPuntoVenta.size() > 0) { + Integer puntuVentaId = null; + try { + puntuVentaId = Integer.parseInt(lsNumPuntoVenta.iterator().next()); + } catch (Exception e) { + log.error(e.getStackTrace()); + } + parametros.put("PUNTOVENTA_ID", puntuVentaId); + } + + String empresa = ""; + try { + empresa = cmbEmpresa.getValue(); + + } catch (Exception e) { + log.error(e.getStackTrace()); + } + parametros.put("NOMBEMPRESA", empresa); + + String empresaSearch = ""; + if (!empresa.equals(null)) { + empresaSearch = "%" + empresa + "%"; + } else { + empresaSearch = "%%"; + } + parametros.put("NOMBEMPRESA_SEARCH", empresaSearch); + + Date now = new Date(); + parametros.put("NOW", now); + + Relatorio relatorio = new RelatorioTrechoVendido(parametros, dataSource.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioTrechoVendidoController.window.title"), args, MODAL); + } else { + try { + Messagebox.show(Labels.getLabel("relatorioTrechoVendidoController.no.agencia"), + Labels.getLabel("relatorioTrechoVendidoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } + + public void onSelect$puntoVentaList(Event ev) { + + String strListPuntoVenta = new String(); + ArrayList lsSelecionados = (ArrayList) puntoVentaList.getSelectedsItens(); + + lsNumPuntoVenta.clear(); + for (Object objPuntoVenta : lsSelecionados) { + strListPuntoVenta = ((PuntoVenta) objPuntoVenta).getNombpuntoventa() + " " + strListPuntoVenta; + lsNumPuntoVenta.add(((PuntoVenta) objPuntoVenta).getPuntoventaId().toString()); + } + this.bbPesquisaPuntoVenta.setValue(strListPuntoVenta); + } + + public void onClick$btnLimpar(Event ev) { + limparPesquisaAgencia(); + } + + public void onClick$btnPesquisa(Event ev) { + executarPesquisa(); + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + private void limparPesquisaAgencia() { + puntoVentaList.clearSelection(); + + lsNumPuntoVenta.clear(); + this.bbPesquisaPuntoVenta.setValue(""); + } + + private void executarPesquisa() { + HibernateSearchObject puntoVentaBusqueda = + new HibernateSearchObject(PuntoVenta.class, + pagingPuntoVenta.getPageSize()); + + puntoVentaBusqueda.addFilterOr(Filter.like("nombpuntoventa", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")), Filter.like("numPuntoVenta", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%"))); + + puntoVentaBusqueda.addSortAsc("nombpuntoventa"); + + puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE); + + plwPuntoVenta.init(puntoVentaBusqueda, puntoVentaList, pagingPuntoVenta); + + if (puntoVentaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("relatorioTrechoVendidoController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + puntoVentaList.setItemRenderer(new RenderPuntoVentaSimple()); + lsEmpresa = empresaService.obtenerTodos(); + } + + public DataSource getDataSource() { + return dataSource; + } + + public void setDataSource(DataSource dataSource) { + this.dataSource = dataSource; + } + + public ArrayList getLsNumPuntoVenta() { + return lsNumPuntoVenta; + } + + public void setLsNumPuntoVenta(ArrayList lsNumPuntoVenta) { + this.lsNumPuntoVenta = lsNumPuntoVenta; + } + + public ArrayList getLsNumEmpresa() { + return lsNumEmpresa; + } + + public void setLsNumEmpresa(ArrayList lsNumEmpresa) { + this.lsNumEmpresa = lsNumEmpresa; + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTrechoVendido.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTrechoVendido.java new file mode 100644 index 000000000..d0b9ff4b6 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTrechoVendido.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 ItemMenuRelatorioTrechoVendido extends DefaultItemMenuSistema { + + public ItemMenuRelatorioTrechoVendido() { + super("indexController.mniRelatorioTrechoVendido.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOTRECHOVENDIDO"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioTrechoVedido.zul", + Labels.getLabel("relatorioTrechoVendidoController.window.title"), null, desktop); + + } +} diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 49066403d..2af274ace 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -214,6 +214,7 @@ indexController.mniRelatorios.label = Relatórios indexController.mniRelatorioAproveitamento.label = Relatório de Aproveitamento indexController.mniRelatorioReceitaDiariaAgencia.label = Relatório de Receita Diária por Agência indexController.mniRelatorioLinhaOperacional.label = Relatório de Linha Operacional +indexController.mniRelatorioTrechoVendido.label = Relatório de Trecho Vendido Por Agência #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias Para Funcionários @@ -254,6 +255,15 @@ relatorioAproveitamentoController.HoraServico.label = Hora Serviço relatorioAproveitamentoController.Classe.label = Classe relatorioAproveitamentoController.btnBuscarServico.label = Buscar Serviço +#Relatorio Trecho Vendido +relatorioTrechoVendidoController.lbDataIni.value = Data Inicial +relatorioTrechoVendidoController.lbDataFin.value = Data Final +relatorioTrechoVendidoController.lbPuntoVenta.value = Agência +relatorioTrechoVendidoController.btnPesquisa.label = Pesquisar +relatorioTrechoVendidoController.btnLimpar.label = Limpar Seleção +relatorioTrechoVendidoController.lbEmpresa.label = Empresa +relatorioTrechoVendidoController.window.title = Relatório de Trecho Vendido Por Agência +relatorioTrechoVendidoController.no.agencia = Selecione uma agência #Receita Diária por Agência relatorioReceitaDiariaAgenciaController.window.title = Relatório de Receita Diária por Agência diff --git a/web/gui/relatorios/filtroRelatorioTrechoVedido.zul b/web/gui/relatorios/filtroRelatorioTrechoVedido.zul new file mode 100644 index 000000000..a2009f93e --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioTrechoVedido.zul @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + +