diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioPassageirosViajar.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioPassageirosViajar.java new file mode 100644 index 000000000..8c8d89fb2 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioPassageirosViajar.java @@ -0,0 +1,26 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.sql.Connection; +import java.util.Map; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; + +/** + * @author Padovani + * + */ +public class RelatorioPassageirosViajar extends Relatorio { + + public RelatorioPassageirosViajar(Map parametros, Connection conexao) throws Exception { + super(parametros, conexao); + } + + @Override + protected void processaParametros() throws Exception { + // TODO Auto-generated method stub + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jasper new file mode 100644 index 000000000..a79a0e3d7 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jrxml new file mode 100644 index 000000000..597d8321c --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioPassageirosViajar.jrxml @@ -0,0 +1,240 @@ + + + + + + + + + + + + + + + + + + + 0 + and cj.empresacorrida_id = $P{EMPRESA_ID} + and cj.empresacorrida_id = em.empresa_id + and cj.puntoventa_id = pv.puntoventa_id + and pv.parada_id = pa.parada_id + and pa.ciudad_id = ci.ciudad_id + and ci.estado_id = es.estado_id + and cj.feccorrida between $P{DATA_INICIO} and $P{DATA_FINAL} + and ((to_char(cj.tipoventa_id) = $P{EMPRESA_ID}) or ($P{PASSAGEM_ABERTA} = 'T')) + order by em.nombempresa, es.cveestado, cj.fechorventa]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioPassageirosViajarController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioPassageirosViajarController.java new file mode 100644 index 000000000..5b7f202a9 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioPassageirosViajarController.java @@ -0,0 +1,275 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +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.zhtml.Messagebox; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Checkbox; +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.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioPassageirosViajar; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.CategoriaService; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +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.RenderCategoriaSimple; +import com.trg.search.Filter; + +/** + * + * @author Administrador + */ +@Controller("relatorioPassageirosViajarController") +@Scope("prototype") +public class RelatorioPassageirosViajarController extends MyGenericForwardComposer { + + @Autowired + private EmpresaService empresaService; + @Autowired + private CategoriaService categoriaService; + @Autowired + private DataSource dataSource; + private List lsEmpresa; + private ArrayList lsNumCategoria = new ArrayList(); + @Autowired + private transient PagedListWrapper plwCategoria; + private MyListbox categoriaList; + private MyListbox categoriaSelList; + private Paging pagingCategoria; + private Textbox txtPalavraPesquisa; + private Combobox cmbEmpresa; + private Combobox cmbCategoria; + private Datebox datInicial; + private Datebox datFinal; + private Checkbox chkPassageiroAberto; + + public Datebox getDatInicial() { + return datInicial; + } + + public void setDatInicial(Datebox datInicial) { + this.datInicial = datInicial; + } + + public Datebox getDatFinal() { + return datFinal; + } + + public void setDatFinal(Datebox datFinal) { + this.datFinal = datFinal; + } + + public Paging getPagingCategoria() { + return pagingCategoria; + } + + public void setPagingCategoria(Paging pagingCategoria) { + this.pagingCategoria = pagingCategoria; + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + public ArrayList getLsNumCategoria() { + return lsNumCategoria; + } + + public void setLsNumCategoria(ArrayList lsNumCategoria) { + this.lsNumCategoria = lsNumCategoria; + } + + public MyListbox getCategoriaList() { + return categoriaList; + } + + public void setCategoriaList(MyListbox categoriaList) { + this.categoriaList = categoriaList; + } + + public MyListbox getCategoriaSelList() { + return categoriaSelList; + } + + public void setCategoriaSelList(MyListbox categoriaSelList) { + this.categoriaSelList = categoriaSelList; + } + + public Combobox getCmbEmpresa() { + return cmbEmpresa; + } + + public void setCmbEmpresa(Combobox cmbEmpresa) { + this.cmbEmpresa = cmbEmpresa; + } + + public Combobox getCmbCategoria() { + return cmbCategoria; + } + + public void setCmbCategoria(Combobox cmbCategoria) { + this.cmbCategoria = cmbCategoria; + } + + public Checkbox getChkPassageiroAberto() { + return chkPassageiroAberto; + } + + public void setChkPassageiroAberto(Checkbox chkPassageiroAberto) { + this.chkPassageiroAberto = chkPassageiroAberto; + } + + public Textbox getTxtPalavraPesquisa() { + return txtPalavraPesquisa; + } + + public void setTxtPalavraPesquisa(Textbox txtPalavraPesquisa) { + this.txtPalavraPesquisa = txtPalavraPesquisa; + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + public void onDoubleClick$categoriaList(Event ev) { + + Categoria categoriaSel = (Categoria) categoriaList.getSelected(); + Boolean bExiste = false; + + for (Categoria objCategoria : lsNumCategoria) { + if (objCategoria.equals(categoriaSel)) + bExiste = true; + } + + if (!bExiste) { + lsNumCategoria.add(categoriaSel); + categoriaSelList.setData(lsNumCategoria); + } + + } + + public void onSelect$categoriaList(Event ev) { + + } + + public void onClick$btnLimpar(Event ev) { + limparPesquisa(); + } + + public void onClick$btnPesquisa(Event ev) { + executarPesquisa(); + } + + /** + * + */ + private void limparPesquisa() { + lsNumCategoria.clear(); + categoriaSelList.setData(lsNumCategoria); + + } + + /** + * + */ + private void executarPesquisa() { + HibernateSearchObject categoriaBusqueda = + new HibernateSearchObject(Categoria.class, + pagingCategoria.getPageSize()); + + categoriaBusqueda.addFilterOr(Filter.like("desccategoria", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%")), + Filter.like("desccategoria", "%" + txtPalavraPesquisa.getText().trim().toUpperCase().concat("%"))); + + categoriaBusqueda.addSortAsc("desccategoria"); + + categoriaBusqueda.addFilterEqual("activo", Boolean.TRUE); + + plwCategoria.init(categoriaBusqueda, categoriaList, pagingCategoria); + + if (categoriaList.getData().length == 0) { + try { + Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), + Labels.getLabel("relatorioPassageirosViajarController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } + + /** + * @throws Exception + * + */ + private void executarRelatorio() throws Exception { + + Map parametros = new HashMap(); + SimpleDateFormat fd = new SimpleDateFormat("dd/MM/yyyy"); + + parametros.put("DATA_INICIO", fd.format(datInicial.getValue())); + parametros.put("DATA_FINAL", fd.format(datFinal.getValue())); + String passagemAberta = ""; + if (chkPassageiroAberto.isChecked()) { + passagemAberta = "9"; + } else { + passagemAberta = "T"; + } + parametros.put("PASSAGEM_ABERTA", passagemAberta); + Empresa e = (Empresa) cmbEmpresa.getSelectedItem().getValue(); + parametros.put("EMPRESA_ID", e.getEmpresaId().toString()); + + StringBuilder strNumCategoria = new StringBuilder(); + for (Categoria c : lsNumCategoria){ + strNumCategoria.append(' ' + c.getCategoriaId().toString() + ','); + } + parametros.put("LS_CATEGORIA", strNumCategoria.toString()); + parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + Relatorio relatorio = new RelatorioPassageirosViajar(parametros, dataSource.getConnection()); + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("relatorioPassageirosViajarController.window.title"), args, MODAL); + + } + + @Override + public void doAfterCompose(Component comp) throws Exception { + lsEmpresa = empresaService.obtenerTodos(); + super.doAfterCompose(comp); + + categoriaList.setItemRenderer(new RenderCategoriaSimple()); + categoriaSelList.setItemRenderer(new RenderCategoriaSimple()); + + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioPassageirosViajar.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioPassageirosViajar.java new file mode 100644 index 000000000..d984f835a --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioPassageirosViajar.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 ItemMenuRelatorioPassageirosViajar extends DefaultItemMenuSistema { + + public ItemMenuRelatorioPassageirosViajar() { + super("indexController.mniRelatorioPassageirosViajar.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOPASSAGEIROSVIAJAR"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioPassageirosViajar.zul", + Labels.getLabel("relatorioPassageirosViajarController.window.title"), null,desktop); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderCategoriaSimple.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderCategoriaSimple.java new file mode 100644 index 000000000..956222cfd --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderCategoriaSimple.java @@ -0,0 +1,31 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.utilerias.render; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; + +/** + * + * @author Administrador + */ +public class RenderCategoriaSimple implements ListitemRenderer { + + public void render(Listitem lstm, Object o) throws Exception { + Categoria categoria = (Categoria) o; + + Listcell lc = new Listcell(); + + lc = new Listcell(categoria.getCategoriaId().toString()); + lc.setParent(lstm); + + lc = new Listcell(categoria.getDesccategoria()); + lc.setParent(lstm); + + lstm.setAttribute("data", categoria); + } +} diff --git a/src/java/spring-config.xml b/src/java/spring-config.xml index baf8662a8..9372980f6 100644 --- a/src/java/spring-config.xml +++ b/src/java/spring-config.xml @@ -329,13 +329,13 @@ - - - - - - - + + + + + + + diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index e1fbb5acf..bbd172dde 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -7,7 +7,7 @@ # . . = XXX #Versao do VentaBoleto: -versao = ADM_20130715_1RC175 +versao = ADM_20130716_1RC176 # MSG Defaut: MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100 @@ -215,6 +215,7 @@ 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 +indexController.mniRelatorioPassageirosViajar.label = Passageiros a Viajar #PARTE REALIZADA POR MANUEL indexController.mnCortesias.label = Cortesias Para Funcionários @@ -4301,4 +4302,16 @@ relatorioLinhaOperacionalController.chkAgruparAno.value = Ano relatorioLinhaOperacionalController.MSG.selecionarlinha = Selecione alguma linha para gerar o relatório. relatorioLinhaOperacionalController.MSG.datainvalida = Data de inicio não pode ser maior que final. relatorioLinhaOperacionalController.lblEmpresa.value = Empresa -relatorioLinhaOperacionalController.lblEspecie.value = Espécie \ No newline at end of file +relatorioLinhaOperacionalController.lblEspecie.value = Espécie + +#Relatorio Pasajeiros Viajar +relatorioPassageirosViajarController.window.title = Pasajeiros a viajar +relatorioPassageirosViajarController.lbDataIni.value = Data Inicial +relatorioPassageirosViajarController.lbDataFin.value = Data Final +relatorioPassageirosViajarController.lbEmpresa.value = Empresa +relatorioPassageirosViajarController.lbCategoria.value = Categoria +relatorioPassageirosViajarController.btnPesquisa.label = Pesquisa +relatorioPassageirosViajarController.btnLimpar.label = Limpar +relatorioPassageirosViajarController.lbPassagemAberto.label = Somente passagens em aberto +relatorioPassageirosViajarController.lhCodigo.label = Código +relatorioPassageirosViajarController.lhDescricao.label = Descrição diff --git a/web/gui/relatorios/filtroRelatorioPassageirosViajar.zul b/web/gui/relatorios/filtroRelatorioPassageirosViajar.zul new file mode 100644 index 000000000..dc91302cf --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioPassageirosViajar.zul @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + +