From 1c28184b38551927ebae327306bc841c3bc5decd Mon Sep 17 00:00:00 2001 From: "gleison.cruz" Date: Mon, 19 Dec 2022 10:43:12 -0300 Subject: [PATCH] fixes bug#AL-1626 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Novo relatório Sie (Deter) --- pom.xml | 6 +- .../relatorios/RelatorioSieController.java | 555 ++++++++++++++++++ .../item/relatorios/ItemMenuRelatorioSie.java | 25 + .../utilerias/menu/menu_original.properties | 1 + .../render/RenderGratuidadeEstudante.java | 27 + .../render/RenderGratuidadeProfessor.java | 27 + web/WEB-INF/i3-label_en.label | 29 + web/WEB-INF/i3-label_es_MX.label | 29 + web/WEB-INF/i3-label_pt_BR.label | 30 + web/gui/relatorios/filtroRelatorioSie.zul | 291 +++++++++ web/gui/seguridad/editarEstacion.zul | 12 + 11 files changed, 1029 insertions(+), 3 deletions(-) create mode 100644 src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioSieController.java create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioSie.java create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeEstudante.java create mode 100644 src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeProfessor.java create mode 100644 web/gui/relatorios/filtroRelatorioSie.zul diff --git a/pom.xml b/pom.xml index cc0ae07a9..76a6021db 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ventaboletosadm - 1.0.12 + 1.0.14 war @@ -55,13 +55,13 @@ br.com.rjconsultores ModelWeb - 1.0.9 + 1.0.12 br.com.rjconsultores Flyway - 1.0.2 + 1.0.5 diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioSieController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioSieController.java new file mode 100644 index 000000000..0fa309d0d --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioSieController.java @@ -0,0 +1,555 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.zip.Deflater; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +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.Filedownload; +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.Messagebox; +import org.zkoss.zul.Paging; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; +import com.rjconsultores.ventaboletos.enums.TipoIdentificacionDoc; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.SisdapService; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.TimeZoneUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO; +import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; +import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; +import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject; +import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderDescontoGratuidade; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderGratuidadeEstudante; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderGratuidadeProfessor; + +@Controller("relatorioSieController") +@Scope("prototype") +public class RelatorioSieController extends MyGenericForwardComposer { + + private static final long serialVersionUID = 1L; + private static Logger log = Logger.getLogger(RelatorioSieController.class); + + private Integer MAX_BUFFER_ZIP = Integer.valueOf(18024); + + @Autowired + private transient PagedListWrapper plwCategoriaGratuidade; + + @Autowired + private transient PagedListWrapper plwCategoriaDescontoIdoso; + + @Autowired + private transient PagedListWrapper plwCategoriaDescontoJovem; + + @Autowired + private transient PagedListWrapper plwCategoriaGratuidadeIdoso; + + @Autowired + private transient PagedListWrapper plwCategoriaGratuidadeJovem; + + @Autowired + private transient PagedListWrapper plwCategoriaGratuidadeEstudante; + + @Autowired + private transient PagedListWrapper plwCategoriaGratuidadeProfessor; + + private Datebox datInicio; + private Datebox datFinal; + private Empresa empresa; + private Combobox cmbEmpresa; + + private MyTextbox txtGratuidade; + private Bandbox bbGratuidade; + private MyListbox pesquisaGratuidade; + private MyListbox pesquisaGratuidadeList; + private Paging pagingGratuidade; + + private MyTextbox txtDescontoIdoso; + private Bandbox bbDescontoIdoso; + private MyListbox pesquisaDescontoIdoso; + private MyListbox pesquisaDescontoIdosoList; + private Paging pagingDescontoIdoso; + + private MyTextbox txtDescontoJovem; + private Bandbox bbDescontoJovem; + private MyListbox pesquisaDescontoJovem; + private MyListbox pesquisaDescontoJovemList; + private Paging pagingDescontoJovem; + + private MyTextbox txtGratuidadeIdoso; + private Bandbox bbGratuidadeIdoso; + private MyListbox pesquisaGratuidadeIdoso; + private MyListbox pesquisaGratuidadeIdosoList; + private Paging pagingGratuidadeIdoso; + + private MyTextbox txtGratuidadeJovem; + private Bandbox bbGratuidadeJovem; + private MyListbox pesquisaGratuidadeJovem; + private MyListbox pesquisaGratuidadeJovemList; + private Paging pagingGratuidadeJovem; + + private MyTextbox txtGratuidadeEstudante; + private Bandbox bbGratuidadeEstudante; + private MyListbox pesquisaGratuidadeEstudante; + private MyListbox pesquisaGratuidadeEstudanteList; + private Paging pagingGratuidadeEstudante; + + + private MyTextbox txtGratuidadeProfessor; + private Bandbox bbGratuidadeProfessor; + private MyListbox pesquisaGratuidadeProfessor; + private MyListbox pesquisaGratuidadeProfessorList; + private Paging pagingGratuidadeProfessor; + + + @Autowired + private EmpresaService empresaService; + + @Autowired + private SisdapService sieService; + + private List lsEmpresa; + + @Override + public void doAfterCompose(Component comp) throws Exception { + lsEmpresa = empresaService.obtenerTodos(); + + super.doAfterCompose(comp); + + pesquisaGratuidadeList.setItemRenderer(new RenderDescontoGratuidade()); + pesquisaDescontoIdosoList.setItemRenderer(new RenderDescontoGratuidade()); + pesquisaGratuidadeIdosoList.setItemRenderer(new RenderDescontoGratuidade()); + pesquisaDescontoJovemList.setItemRenderer(new RenderDescontoGratuidade()); + pesquisaGratuidadeJovemList.setItemRenderer(new RenderDescontoGratuidade()); + pesquisaGratuidadeEstudanteList.setItemRenderer(new RenderGratuidadeEstudante()); + pesquisaGratuidadeProfessorList.setItemRenderer(new RenderGratuidadeProfessor()); + } + + public void onClick$btnPesquisaGratuidadeProfessor(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingGratuidadeProfessor.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtGratuidadeProfessor.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaGratuidadeProfessor.init(categoria, pesquisaGratuidadeProfessorList, pagingGratuidadeProfessor); + } + + public void onClick$btnPesquisaGratuidadeEstudante(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingGratuidadeEstudante.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtGratuidadeEstudante.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaGratuidadeEstudante.init(categoria, pesquisaGratuidadeEstudanteList, pagingGratuidadeEstudante); + } + + public void onClick$btnPesquisaGratuidade(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingGratuidade.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtGratuidade.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaGratuidade.init(categoria, pesquisaGratuidadeList, pagingGratuidade); + } + + public void onClick$btnPesquisaDescontoIdoso(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingDescontoIdoso.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtDescontoIdoso.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaDescontoIdoso.init(categoria, pesquisaDescontoIdosoList, pagingDescontoIdoso); + } + + public void onClick$btnPesquisaDescontoJovem(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingDescontoJovem.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtDescontoJovem.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaDescontoJovem.init(categoria, pesquisaDescontoJovemList, pagingDescontoJovem); + } + + public void onClick$btnPesquisaGratuidadeIdoso(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingGratuidadeIdoso.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtGratuidadeIdoso.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaGratuidadeIdoso.init(categoria, pesquisaGratuidadeIdosoList, pagingGratuidadeIdoso); + } + + public void onClick$btnPesquisaGratuidadeJovem(Event ev) { + HibernateSearchObject categoria = new HibernateSearchObject(Categoria.class, pagingGratuidadeJovem.getPageSize()); + categoria.addFilterILike("desccategoria", "%" + txtGratuidadeJovem.getValue() + "%"); + categoria.addSortAsc("desccategoria"); + categoria.addFilterEqual("activo", Boolean.TRUE); + plwCategoriaGratuidadeJovem.init(categoria, pesquisaGratuidadeJovemList, pagingGratuidadeJovem); + } + + public void onDoubleClick$pesquisaGratuidade(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidade.getSelected(); + pesquisaGratuidade.removeItem(categoria); + } + + public void onDoubleClick$pesquisaDescontoIdoso(Event ev) { + Categoria categoria = (Categoria) pesquisaDescontoIdoso.getSelected(); + pesquisaDescontoIdoso.removeItem(categoria); + } + + public void onDoubleClick$pesquisaDescontoJovem(Event ev) { + Categoria categoria = (Categoria) pesquisaDescontoJovem.getSelected(); + pesquisaDescontoJovem.removeItem(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeIdoso(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeIdoso.getSelected(); + pesquisaGratuidadeIdoso.removeItem(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeJovem(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeJovem.getSelected(); + pesquisaGratuidadeJovem.removeItem(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeList(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeList.getSelected(); + pesquisaGratuidade.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaDescontoIdosoList(Event ev) { + Categoria categoria = (Categoria) pesquisaDescontoIdosoList.getSelected(); + pesquisaDescontoIdoso.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaDescontoJovemList(Event ev) { + Categoria categoria = (Categoria) pesquisaDescontoJovemList.getSelected(); + pesquisaDescontoJovem.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeIdosoList(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeIdosoList.getSelected(); + pesquisaGratuidadeIdoso.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeJovemList(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeJovemList.getSelected(); + pesquisaGratuidadeJovem.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeProfessorList(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeProfessorList.getSelected(); + pesquisaGratuidadeProfessor.addItemNovo(categoria); + } + + public void onDoubleClick$pesquisaGratuidadeEstudanteList(Event ev) { + Categoria categoria = (Categoria) pesquisaGratuidadeEstudanteList.getSelected(); + pesquisaGratuidadeEstudante.addItemNovo(categoria); + } + + public void onClick$btnLimparGratuidade(Event ev) { + pesquisaGratuidadeList.setData(new ArrayList()); + bbGratuidade.setText(""); + } + + public void onClick$btnLimparDescontoIdoso(Event ev) { + pesquisaDescontoIdosoList.setData(new ArrayList()); + bbDescontoIdoso.setText(""); + } + + public void onClick$btnLimparDescontoJovem(Event ev) { + pesquisaDescontoJovemList.setData(new ArrayList()); + bbDescontoJovem.setText(""); + } + + public void onClick$btnLimparGratuidadeIdoso(Event ev) { + pesquisaGratuidadeIdosoList.setData(new ArrayList()); + bbGratuidadeIdoso.setText(""); + } + + public void onClick$btnLimparGratuidadeJovem(Event ev) { + pesquisaGratuidadeJovemList.setData(new ArrayList()); + bbGratuidadeJovem.setText(""); + } + + public void onClick$btnLimparGratuidadeEstudante(Event ev) { + pesquisaGratuidadeEstudante.setData(new ArrayList()); + bbGratuidadeEstudante.setText(""); + } + + public void onClick$btnLimparGratuidadeProfessor(Event ev) { + pesquisaGratuidadeProfessor.setData(new ArrayList()); + bbGratuidadeProfessor.setText(""); + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + if (pesquisaGratuidade.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.gratuidade.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + if (pesquisaDescontoIdoso.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.desconto.idoso.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + if (pesquisaGratuidadeIdoso.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.gratuidade.idoso.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + if (pesquisaDescontoJovem.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.desconto.jovem.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + if (pesquisaGratuidadeJovem.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.gratuidade.jovem.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + + if (cmbEmpresa.getSelectedIndex() < 0) { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.empresaErro"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + return; + } + + if (pesquisaGratuidadeEstudante.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.gratuidade.estudante.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + + if (pesquisaGratuidadeProfessor.getListData().size() == 0) { + try { + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.gratuidade.professor.obrigatorio"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + processarRelatorioSie(datInicio.getValue(), datFinal.getValue(), pesquisaGratuidade, pesquisaDescontoIdoso, pesquisaGratuidadeIdoso, pesquisaDescontoJovem, pesquisaGratuidadeJovem, pesquisaGratuidadeProfessor, pesquisaGratuidadeEstudante); + } + + private void zipFiles(String[] filesToZip, String fileOutputName) { + byte[] buffer = new byte[MAX_BUFFER_ZIP]; + + try { + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(fileOutputName)); + + // Ajusta modo de compress�o + out.setLevel(Deflater.DEFAULT_COMPRESSION); + + // faz a itera��o sobre os arquivos, adicionando-os ao arquivo ZIP + for (int i = 0; i < filesToZip.length; i++) { + + FileInputStream in = new FileInputStream(filesToZip[i]); + + // Add ZIP entry to output stream. + out.putNextEntry(new ZipEntry(filesToZip[i])); + + // Transfer bytes from the current file to the ZIP file + int len; + while ((len = in.read(buffer)) > 0) { + out.write(buffer, 0, len); + } + + // Close the current entry + out.closeEntry(); + + // Close the current file input stream + in.close(); + } + + // Close the ZipOutPutStream + out.close(); + + } catch (IllegalArgumentException iae) { + log.error("", iae); + } catch (FileNotFoundException fnfe) { + log.error("", fnfe); + } catch (IOException ioe) { + log.error("", ioe); + } + } + + private void processarRelatorioSie(Date fecInicio, Date fecFinal, MyListbox gratuidade, MyListbox pesquisaDescontoIdoso, MyListbox pesquisaGratuidadeIdoso, MyListbox pesquisaDescontoJovem, MyListbox pesquisaGratuidadeJovem, MyListbox pesquisaGratuidadeProfessor, MyListbox pesquisaGratuidadeEstudante) { + + List movimentoLinhas = sieService.getMovimentoLinhas(fecInicio, fecFinal, empresa.getEmpresaId()); + @SuppressWarnings("unchecked") + List movimentoSecoes = sieService.getMovimentoSecoes(fecInicio, fecFinal, empresa.getEmpresaId(), gratuidade.getListData(), pesquisaDescontoIdoso.getListData(), pesquisaGratuidadeIdoso.getListData(), pesquisaDescontoJovem.getListData(), pesquisaGratuidadeJovem.getListData(), pesquisaGratuidadeProfessor.getListData(), pesquisaGratuidadeEstudante.getListData()); + + + if (movimentoLinhas.size() <= 1 && movimentoSecoes.size() <= 1) { + // N�o retornou dados + try { + + Messagebox.show(Labels.getLabel("relatorioSieController.MSG.nenhumRegistro"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException e) { + log.error("", e); + } + return; + } + + + try { + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + + "_" + Calendar.getInstance().getTime().getTime() + + "_" + "Sie.xls"; + InputStream arquivo = gerarArquivoExcel(movimentoLinhas); + Filedownload.save(arquivo, "application/xls", nomeArquivo); + Messagebox.show( nomeArquivo + " " + Labels.getLabel("relatorioSieController.MSG.arquivogerado"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (Exception e) { + log.error(e.getMessage(), e); + + } + + try { + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + + "_" + Calendar.getInstance().getTime().getTime() + + "_" + "Sie.xls"; + InputStream arquivo = gerarArquivoExcel(movimentoSecoes); + Filedownload.save(arquivo, "application/xls", nomeArquivo); + Messagebox.show( nomeArquivo + " " + Labels.getLabel("relatorioSieController.MSG.arquivogerado"), + Labels.getLabel("filtroRelatorioSie.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (Exception e) { + log.error(e.getMessage(), e); + + } + + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + private void criarRow(int numRow, HSSFSheet sheet, String[] dados) { + int numColumn = 0; + HSSFRow row = sheet.createRow(numRow); + for (String dado : dados) { + HSSFCell cell = row.createCell(numColumn++); + cell.setCellValue(dado); + } + } + + private void criarArquivoExcel(HSSFWorkbook wb, List movimento) { + HSSFSheet sheet = wb.createSheet("Sie"); + int contRow = 0; + + String cabecalhoStr = movimento.get(0); + String[] arrOfcabecalhoStr = cabecalhoStr.split(";", -2); //transforma a linha em array para se transforma na coluna do excel + criarRow(contRow++, sheet, arrOfcabecalhoStr); + + for (int i = 1; i < movimento.size(); i++) { + String str = movimento.get(i); + String[] strArray = str.split(";", -2); //transforma a linha em array para se transforma na coluna do excel + criarRow(contRow++, sheet, strArray); + } + + for (int i = 0; i < arrOfcabecalhoStr.length; i++) { + sheet.autoSizeColumn(i); + } + } + + private InputStream gerarArquivoExcel(List movimento) throws IOException { + HSSFWorkbook wb = new HSSFWorkbook(); //cria a planilha do excel + + criarArquivoExcel(wb, movimento); + + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + + "_" + Calendar.getInstance().getTime().getTime() + + "_" + "Sie"; + + File fNomeArquivo = File.createTempFile(nomeArquivo, ".tmp"); + + FileOutputStream stream = new FileOutputStream(fNomeArquivo); + stream.flush(); + wb.write(stream); + stream.close(); + + InputStream is = new FileInputStream(fNomeArquivo); + + return is; + } + + + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioSie.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioSie.java new file mode 100644 index 000000000..e6c923027 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioSie.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 ItemMenuRelatorioSie extends DefaultItemMenuSistema { + + public ItemMenuRelatorioSie() { + super("indexController.mniRelatorioSie.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOSIE"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioSie.zul", + Labels.getLabel("relatorioSieController.window.title"), getArgs(), desktop); + + } +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties index c06f8f5e0..e34122da6 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/menu_original.properties @@ -250,6 +250,7 @@ analitico.gerenciais.pacote.resumido=com.rjconsultores.ventaboletos.web.utileria analitico.gerenciais.relatorioRemessaCNAB=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioRemessaCNAB analitico.integracion=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.integracion.SubMenuIntegracion analitico.integracion.sisdap=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioSisdap +analitico.integracion.sie=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioSie analitico.integracion.sap=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioSap analitico.integracion.derpr=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioDERPR analitico.integracion.aidf=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioAidf diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeEstudante.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeEstudante.java new file mode 100644 index 000000000..8f6d1b1d9 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeEstudante.java @@ -0,0 +1,27 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.web.utilerias.render; + +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; + +import com.rjconsultores.ventaboletos.entidad.Categoria; + +/** + * @author Thiago + * + */ +public class RenderGratuidadeEstudante implements ListitemRenderer { + + @Override + public void render(Listitem lstm, Object o) throws Exception { + Categoria categoria = (Categoria) o; + Listcell lc = new Listcell(categoria.getDesccategoria()); + lc.setParent(lstm); + + lstm.setAttribute("Categoria", categoria); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeProfessor.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeProfessor.java new file mode 100644 index 000000000..53cf7bec4 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderGratuidadeProfessor.java @@ -0,0 +1,27 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.web.utilerias.render; + +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; + +import com.rjconsultores.ventaboletos.entidad.Categoria; + +/** + * @author Thiago + * + */ +public class RenderGratuidadeProfessor implements ListitemRenderer { + + @Override + public void render(Listitem lstm, Object o) throws Exception { + Categoria categoria = (Categoria) o; + Listcell lc = new Listcell(categoria.getDesccategoria()); + lc.setParent(lstm); + + lstm.setAttribute("Categoria", categoria); + } + +} diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label index 9dd89679e..6b136937a 100644 --- a/web/WEB-INF/i3-label_en.label +++ b/web/WEB-INF/i3-label_en.label @@ -333,6 +333,7 @@ indexController.mniRelatorioLinhasHorario.label = Linhas por Horário indexController.mniRelatorioTaxasLinha.label = Taxas indexController.mniRelatorioDevolucaoBilhetes.label = Bilhetes Devolvidos indexController.mniRelatorioSisdap.label=SISDAP +indexController.mniRelatorioSie.label=SIE (Deter) indexController.mniRelatorioSap.label=SAP indexController.mniRelatorioDERPR.label=DERPR indexController.mniRelatorioMmphDer.label=MMPH-DER @@ -981,6 +982,34 @@ relatorioSisdapController.MSG.desconto.jovem.obrigatorio=É obrigatório informa relatorioSisdapController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem filtroRelatorioSisdap.window.title=Relatório SISDAP +# Relatorio Sie +relatorioSieController.window.title=Relatório SIE (Deter) +relatorioSieController.lbDatInicio.value=Data Inicio +relatorioSieController.lbDatFinal.value=Data Fim +relatorioSieController.lbEmpresa.value=Empresa +relatorioSieController.btnCerrar.tooltiptext=Sair +relatorioSieController.MSG.empresaErro=Deve selecionar uma empresa! +relatorioSieController.MSG.nenhumRegistro=Nenhum registro encontrado para o relatório +relatorioSieController.gratuidade.value=Gratuidade Passe Livre +relatorioSieController.desconto.value=Desconto +relatorioSieController.desconto.idoso.value=Desconto idoso +relatorioSieController.gratuidade.idoso.value=Gratuidade idoso +relatorioSieController.desconto.jovem.value=Desconto jovem +relatorioSieController.gratuidade.jovem.value=Gratuidade jovem +relatorioSieController.gratuidade.professor.value=Gratuidade professor +relatorioSieController.gratuidade.estudante.value=Gratuidade estudante +relatorioSieController.btnPesquisa.label=Pesquisar +relatorioSieController.btnLimpar.label=Limpar +relatorioSieController.MSG.gratuidade.obrigatorio=É obrigatório informar as categorias de desconto +relatorioSieController.MSG.desconto.idoso.obrigatorio=É obrigatório informar as categorias de desconto do idoso +relatorioSieController.MSG.gratuidade.idoso.obrigatorio=É obrigatório informar as categorias de gratuidade do idoso +relatorioSieController.MSG.desconto.jovem.obrigatorio=É obrigatório informar as categorias de desconto do jovem +relatorioSieController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem +relatorioSieController.MSG.gratuidade.professor.obrigatorio=É obrigatório informar as categorias de gratuidade do professor +relatorioSieController.MSG.gratuidade.estudante.obrigatorio=É obrigatório informar as categorias de gratuidade do estudante +relatorioSieController.MSG.arquivogerado=gerado com sucesso +filtroRelatorioSie.window.title=Relatório SIE (Deter) + # Relatorio Sap relatorioSapController.window.title=Integração SAP relatorioSapController.lbEmpresa.label = Empresa diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index 96074b6b9..9d939d099 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -317,6 +317,7 @@ indexController.mniRelatorioAcompanhamentoEquivalentes.label = Indicadores (Acom indexController.mniRelatorioLinhasHorario.label = Rutas por horário indexController.mniRelatorioTaxasLinha.label = Tasas indexController.mniRelatorioSisdap.label=SISDAP +indexController.mniRelatorioSie.label=SIE (Deter) indexController.mniRelatorioSap.label=SAP indexController.mniRelatorioDERPR.label=DERPR indexController.mniRelatorioMmphDer.label=MMPH-DER @@ -849,6 +850,34 @@ relatorioSisdapController.MSG.desconto.jovem.obrigatorio=É obrigatório informa relatorioSisdapController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem filtroRelatorioSisdap.window.title=Reporte SISDAP +# Relatorio Sie +relatorioSieController.window.title=Relatório SIE (Deter) +relatorioSieController.lbDatInicio.value=Data Inicio +relatorioSieController.lbDatFinal.value=Data Fim +relatorioSieController.lbEmpresa.value=Empresa +relatorioSieController.btnCerrar.tooltiptext=Sair +relatorioSieController.MSG.empresaErro=Deve selecionar uma empresa! +relatorioSieController.MSG.nenhumRegistro=Nenhum registro encontrado para o relatório +relatorioSieController.gratuidade.value=Gratuidade Passe Livre +relatorioSieController.desconto.value=Desconto +relatorioSieController.desconto.idoso.value=Desconto idoso +relatorioSieController.gratuidade.idoso.value=Gratuidade idoso +relatorioSieController.desconto.jovem.value=Desconto jovem +relatorioSieController.gratuidade.jovem.value=Gratuidade jovem +relatorioSieController.gratuidade.professor.value=Gratuidade professor +relatorioSieController.gratuidade.estudante.value=Gratuidade estudante +relatorioSieController.btnPesquisa.label=Pesquisar +relatorioSieController.btnLimpar.label=Limpar +relatorioSieController.MSG.gratuidade.obrigatorio=É obrigatório informar as categorias de desconto +relatorioSieController.MSG.desconto.idoso.obrigatorio=É obrigatório informar as categorias de desconto do idoso +relatorioSieController.MSG.gratuidade.idoso.obrigatorio=É obrigatório informar as categorias de gratuidade do idoso +relatorioSieController.MSG.desconto.jovem.obrigatorio=É obrigatório informar as categorias de desconto do jovem +relatorioSieController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem +relatorioSieController.MSG.gratuidade.professor.obrigatorio=É obrigatório informar as categorias de gratuidade do professor +relatorioSieController.MSG.gratuidade.estudante.obrigatorio=É obrigatório informar as categorias de gratuidade do estudante +relatorioSieController.MSG.arquivogerado=gerado com sucesso +filtroRelatorioSie.window.title=Relatório SIE (Deter) + # Relatorio Sap relatorioSapController.window.title=Integração SAP relatorioSapController.lbEmpresa.label = Empresa diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 9dd89679e..654eb2785 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -333,6 +333,7 @@ indexController.mniRelatorioLinhasHorario.label = Linhas por Horário indexController.mniRelatorioTaxasLinha.label = Taxas indexController.mniRelatorioDevolucaoBilhetes.label = Bilhetes Devolvidos indexController.mniRelatorioSisdap.label=SISDAP +indexController.mniRelatorioSie.label=SIE (Deter) indexController.mniRelatorioSap.label=SAP indexController.mniRelatorioDERPR.label=DERPR indexController.mniRelatorioMmphDer.label=MMPH-DER @@ -981,6 +982,35 @@ relatorioSisdapController.MSG.desconto.jovem.obrigatorio=É obrigatório informa relatorioSisdapController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem filtroRelatorioSisdap.window.title=Relatório SISDAP +# Relatorio Sie +relatorioSieController.window.title=Relatório SIE (Deter) +relatorioSieController.lbDatInicio.value=Data Inicio +relatorioSieController.lbDatFinal.value=Data Fim +relatorioSieController.lbEmpresa.value=Empresa +relatorioSieController.btnCerrar.tooltiptext=Sair +relatorioSieController.MSG.empresaErro=Deve selecionar uma empresa! +relatorioSieController.MSG.nenhumRegistro=Nenhum registro encontrado para o relatório +relatorioSieController.gratuidade.value=Gratuidade Passe Livre +relatorioSieController.desconto.value=Desconto +relatorioSieController.desconto.idoso.value=Desconto idoso +relatorioSieController.gratuidade.idoso.value=Gratuidade idoso +relatorioSieController.desconto.jovem.value=Desconto jovem +relatorioSieController.gratuidade.jovem.value=Gratuidade jovem +relatorioSieController.gratuidade.professor.value=Gratuidade professor +relatorioSieController.gratuidade.estudante.value=Gratuidade estudante +relatorioSieController.btnPesquisa.label=Pesquisar +relatorioSieController.btnLimpar.label=Limpar +relatorioSieController.MSG.gratuidade.obrigatorio=É obrigatório informar as categorias de desconto +relatorioSieController.MSG.desconto.idoso.obrigatorio=É obrigatório informar as categorias de desconto do idoso +relatorioSieController.MSG.gratuidade.idoso.obrigatorio=É obrigatório informar as categorias de gratuidade do idoso +relatorioSieController.MSG.desconto.jovem.obrigatorio=É obrigatório informar as categorias de desconto do jovem +relatorioSieController.MSG.gratuidade.jovem.obrigatorio=É obrigatório informar as categorias de gratuidade do jovem +relatorioSieController.MSG.gratuidade.professor.obrigatorio=É obrigatório informar as categorias de gratuidade do professor +relatorioSieController.MSG.gratuidade.estudante.obrigatorio=É obrigatório informar as categorias de gratuidade do estudante +relatorioSieController.MSG.arquivogerado=gerado com sucesso +filtroRelatorioSie.window.title=Relatório SIE (Deter) + + # Relatorio Sap relatorioSapController.window.title=Integração SAP relatorioSapController.lbEmpresa.label = Empresa diff --git a/web/gui/relatorios/filtroRelatorioSie.zul b/web/gui/relatorios/filtroRelatorioSie.zul new file mode 100644 index 000000000..70201568b --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioSie.zul @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +