diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueAnalitico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueAnalitico.java new file mode 100644 index 000000000..2f7c7da2e --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueAnalitico.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioW2IBean; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioW2ITaxaEmbarqueAnalitico extends Relatorio { + + private List lsDadosRelatorio; + + public RelatorioW2ITaxaEmbarqueAnalitico(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(); + String puntosVentaIds = (String) parametros.get("NUMPUNTOVENTA"); + puntosVentaIds = StringUtils.replace(puntosVentaIds, ",", "','"); + lsDadosRelatorio = new ArrayList(); + + String sql = getSql(puntosVentaIds); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + + ResultSet rset = null; + + stmt.setInt("TIPO_DATA", (Integer) parametros.get("TIPO_DATA")); + stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); + stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); + + if (parametros.get("EMPRESA_ID") != null) + stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID")); + else + stmt.setNull("EMPRESA_ID", java.sql.Types.INTEGER); + + if (parametros.get("ORIGEN_ID") != null && parametros.get("ORIGEN_ID") != "" && ((Integer) parametros.get("ORIGEN_ID") != -1)) + stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID")); + else + stmt.setNull("ORIGEN_ID", java.sql.Types.INTEGER); + + if (parametros.get("DESTINO_ID") != null && parametros.get("DESTINO_ID") != "" && ((Integer) parametros.get("DESTINO_ID") != -1)) + stmt.setInt("DESTINO_ID", (Integer) parametros.get("DESTINO_ID")); + else + stmt.setNull("DESTINO_ID", java.sql.Types.INTEGER); + + rset = stmt.executeQuery(); + + RelatorioW2IBean relatorioW2IBean = null; + while (rset.next()) { + relatorioW2IBean = new RelatorioW2IBean(); + relatorioW2IBean.setEmpresaId(rset.getInt("empresaId")); + relatorioW2IBean.setEmpresa(rset.getString("empresa")); + relatorioW2IBean.setPuntoVentaId(rset.getInt("puntoVentaId")); + relatorioW2IBean.setAgencia(rset.getString("agencia")); + relatorioW2IBean.setNumBilhete(rset.getLong("numBilhete")); + relatorioW2IBean.setOrigem(rset.getString("origem")); + relatorioW2IBean.setDestino(rset.getString("destino")); + relatorioW2IBean.setDataVenda(rset.getDate("dataVenda")); + relatorioW2IBean.setDataViaje(rset.getDate("dataViaje")); + relatorioW2IBean.setPoltrona(rset.getString("poltrona")); + relatorioW2IBean.setStatus(rset.getString("status")); + relatorioW2IBean.setValorTaxa(rset.getBigDecimal("valorTaxa") == null ? BigDecimal.ZERO : rset.getBigDecimal("valorTaxa")); + + lsDadosRelatorio.add(relatorioW2IBean); + } + + 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 { + // TODO Auto-generated method stub + + } + + private String getSql(String puntosVentaIds) { + StringBuilder sql = new StringBuilder(); + sql.append("SELECT DISTINCT "); + sql.append("em.empresa_id AS empresaId, "); + sql.append("em.nombempresa AS empresa, "); + sql.append("pv.puntoventa_id AS puntoVentaId, "); + sql.append("pv.nombpuntoventa As agencia, "); + sql.append("b.numfoliosistema AS numBilhete, "); + sql.append("po.descparada AS origem, "); + sql.append("pd.descparada AS destino, "); + sql.append("b.fechorviaje dataViaje, "); + sql.append("b.fechorventa dataVenda, "); + sql.append("b.numasiento AS poltrona, "); + sql.append("sx.valortaxa AS valorTaxa, "); + sql.append("CASE WHEN sx.indcancelado =0 THEN 'V' ELSE 'C' END status "); + sql.append("FROM taxpolv sx "); + sql.append("INNER JOIN boleto b on b.boleto_id=sx.boleto_id "); + sql.append("INNER JOIN punto_venta pv ON pv.PUNTOVENTA_ID = b.PUNTOVENTA_ID "); + sql.append("INNER JOIN empresa em ON em.empresa_id=b.empresacorrida_id "); + sql.append("INNER JOIN parada po ON po.parada_id=b.origen_id "); + sql.append("INNER JOIN parada pd ON pd.parada_id=b.destino_id "); + sql.append("INNER JOIN CIUDAD co ON co.ciudad_id=po.ciudad_id "); + sql.append("INNER JOIN CIUDAD cd ON cd.ciudad_id=pd.ciudad_id "); + sql.append("WHERE DECODE(:TIPO_DATA, 1, b.FECHORVENTA, 2, b.FECCORRIDA) BETWEEN :DATA_INICIAL AND :DATA_FINAL "); + sql.append("AND sx.ACTIVO = 1 "); + sql.append("AND em.empresa_id = COALESCE(:EMPRESA_ID, em.empresa_id) "); + sql.append("AND po.parada_id = COALESCE(:ORIGEN_ID, po.parada_id) "); + sql.append("AND pd.parada_id = COALESCE(:DESTINO_ID, pd.parada_id) "); + + if (!puntosVentaIds.contains("-1")) { + sql.append(" AND pv.puntoventa_id IN ('" + puntosVentaIds + "') "); + } + + sql.append("ORDER BY b.fechorventa ASC "); + + return sql.toString(); + }; + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueSintetico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueSintetico.java new file mode 100644 index 000000000..1583dbc07 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioW2ITaxaEmbarqueSintetico.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.relatorios.impl; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioW2ISinteticoBean; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; + +public class RelatorioW2ITaxaEmbarqueSintetico extends Relatorio { + + private List lsDadosRelatorio; + + public RelatorioW2ITaxaEmbarqueSintetico(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(); + + lsDadosRelatorio = new ArrayList(); + + String sql = getSql(parametros); + + NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql); + ResultSet rset = null; + + stmt.setInt("TIPO_DATA", (Integer) parametros.get("TIPO_DATA")); + stmt.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime())); + stmt.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.fimFecha((Date) parametros.get("DATA_FINAL")).getTime())); + + if (parametros.get("EMPRESA_ID") != null) + stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID")); + + if (parametros.get("ORIGEN_ID") != null && parametros.get("ORIGEN_ID") != "" && ((Integer) parametros.get("ORIGEN_ID") != -1)) + stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID")); + + if (parametros.get("DESTINO_ID") != null && parametros.get("DESTINO_ID") != "" && ((Integer) parametros.get("DESTINO_ID") != -1)) + stmt.setInt("DESTINO_ID", (Integer) parametros.get("DESTINO_ID")); + + rset = stmt.executeQuery(); + + RelatorioW2ISinteticoBean relatorioW2ISinteticoBean = null; + while (rset.next()) { + relatorioW2ISinteticoBean = new RelatorioW2ISinteticoBean(); + relatorioW2ISinteticoBean.setEmpresaId(rset.getInt("empresaId")); + relatorioW2ISinteticoBean.setEmpresa(rset.getString("empresa")); + relatorioW2ISinteticoBean.setPuntoVentaId(rset.getInt("puntoVentaId")); + relatorioW2ISinteticoBean.setAgencia(rset.getString("agencia")); + relatorioW2ISinteticoBean.setQtdSeguroOpcionalCancelado(rset.getBigDecimal("qtdSeguroOpcionalCancelado") == null ? BigDecimal.ZERO : rset.getBigDecimal("qtdSeguroOpcionalCancelado")); + relatorioW2ISinteticoBean.setTotalValorSeguroOpcionalCancelado(rset.getBigDecimal("totalValorSeguroOpcionalCancelado") == null ? BigDecimal.ZERO : rset.getBigDecimal("totalValorSeguroOpcionalCancelado")); + relatorioW2ISinteticoBean.setQtdSeguroOpcionalVendidos(rset.getBigDecimal("qtdSeguroOpcionalVendidos") == null ? BigDecimal.ZERO : rset.getBigDecimal("qtdSeguroOpcionalVendidos")); + relatorioW2ISinteticoBean.setTotalValorseguroOpcionalVendido(rset.getBigDecimal("totalValorSeguroOpcionalVendido") == null ? BigDecimal.ZERO : rset.getBigDecimal("totalValorSeguroOpcionalVendido")); + lsDadosRelatorio.add(relatorioW2ISinteticoBean); + + } + + 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(Map parametros) { + String puntosVentaIds = (String) parametros.get("NUMPUNTOVENTA"); + puntosVentaIds = StringUtils.replace(puntosVentaIds, "," , "','"); + StringBuilder sql = new StringBuilder(); + sql.append("SELECT DISTINCT "); + sql.append("em.empresa_id AS empresaId, "); + sql.append("em.nombempresa AS empresa, "); + sql.append("pv.puntoventa_id AS puntoVentaId, "); + sql.append("pv.nombpuntoventa As agencia, "); + sql.append(" SUM( (case when sx.indcancelado =1 then 1 else 0.0 end)) qtdSeguroOpcionalCancelado, "); + sql.append(" SUM( (case when sx.indcancelado =1 then sx.valortaxa else 0.0 end )) totalValorSeguroOpcionalCancelado, "); + sql.append(" SUM( (case when sx.indcancelado =0 then 1 else 0.0 end )) qtdSeguroOpcionalVendidos, "); + sql.append(" SUM( (case when sx.indcancelado =0 then sx.valortaxa else 0.0 end )) totalValorSeguroOpcionalVendido "); + sql.append("FROM taxpolv sx "); + sql.append("INNER JOIN boleto b on b.boleto_id=sx.boleto_id "); + sql.append("INNER JOIN punto_venta pv ON pv.PUNTOVENTA_ID = b.PUNTOVENTA_ID "); + sql.append("INNER JOIN empresa em ON em.empresa_id=b.empresacorrida_id "); + sql.append("INNER JOIN parada po ON po.parada_id=b.origen_id "); + sql.append("INNER JOIN parada pd ON pd.parada_id=b.destino_id "); + sql.append("INNER JOIN CIUDAD co ON co.ciudad_id=po.ciudad_id "); + sql.append("INNER JOIN CIUDAD cd ON cd.ciudad_id=pd.ciudad_id "); + + sql.append("WHERE DECODE(:TIPO_DATA, 1, b.FECHORVENTA, 2, b.FECCORRIDA) BETWEEN :DATA_INICIAL AND :DATA_FINAL "); + if (parametros.get("EMPRESA_ID") != null) { + sql.append("AND em.empresa_id = COALESCE(:EMPRESA_ID, em.empresa_id) "); + } + if (parametros.get("ORIGEN_ID") != null && parametros.get("ORIGEN_ID") != "" && ((Integer) parametros.get("ORIGEN_ID") != -1)) { + sql.append("AND po.parada_id = COALESCE(:ORIGEN_ID, po.parada_id) "); + } + if (parametros.get("DESTINO_ID") != null && parametros.get("DESTINO_ID") != "" && ((Integer) parametros.get("DESTINO_ID") != -1)) { + sql.append("AND pd.parada_id = COALESCE(:DESTINO_ID, pd.parada_id) "); + } + if (!puntosVentaIds.contains("-1")) { + sql.append(" AND pv.puntoventa_id IN (").append(puntosVentaIds).append(") "); + } + sql.append("GROUP BY em.empresa_id, em.nombempresa,pv.puntoventa_id,pv.nombpuntoventa "); + + return sql.toString(); + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueAnalitico_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueAnalitico_pt_BR.properties new file mode 100644 index 000000000..01f6ecc2b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueAnalitico_pt_BR.properties @@ -0,0 +1,13 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + + +#Labels cabeçalho +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueSintetico_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueSintetico_pt_BR.properties new file mode 100644 index 000000000..01f6ecc2b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioW2ITaxaEmbarqueSintetico_pt_BR.properties @@ -0,0 +1,13 @@ +#geral +msg.noData=Não foi possivel obter dados com os parâmetros informados. + + +#Labels cabeçalho +cabecalho.relatorio=Relatório: +cabecalho.periodo=Período: +cabecalho.periodoA=à +cabecalho.dataHora=Data/Hora: +cabecalho.impressorPor=Impressor por: +cabecalho.pagina=Página +cabecalho.de=de +cabecalho.filtros=Filtros: \ No newline at end of file diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jasper new file mode 100644 index 000000000..4b26cb76f Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jrxml new file mode 100644 index 000000000..95a4a6c9f --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueAnalitico.jrxml @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jasper new file mode 100644 index 000000000..8361c5044 Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jasper differ diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jrxml new file mode 100644 index 000000000..f39f05b0b --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioW2ITaxaEmbarqueSintetico.jrxml @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioW2ITaxaEmbarqueController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioW2ITaxaEmbarqueController.java new file mode 100644 index 000000000..bcf62d796 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioW2ITaxaEmbarqueController.java @@ -0,0 +1,275 @@ +package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios; + +import java.sql.Connection; +import java.util.ArrayList; +import java.util.Arrays; +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.Bandbox; +import org.zkoss.zul.Comboitem; +import org.zkoss.zul.ComboitemRenderer; +import org.zkoss.zul.Paging; +import org.zkoss.zul.Radiogroup; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioW2ITaxaEmbarqueAnalitico; +import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioW2ITaxaEmbarqueSintetico; +import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada; +import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve; +import com.rjconsultores.ventaboletos.web.utilerias.MyDatebox; +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.RenderRelatorioTaxasLinhaPuntoVenta; +import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRelatorioTaxasLinhaPuntoVentaSelecionados; + +@Controller("relatorioW2ITaxaEmbarqueController") +@Scope("prototype") +public class RelatorioW2ITaxaEmbarqueController extends MyGenericForwardComposer { + + private static final long serialVersionUID = 1L; + @Autowired + private transient PagedListWrapper plwPuntoVenta; + @Autowired + private DataSource dataSourceRead; + @Autowired + private EmpresaService empresaService; + private List lsEmpresa; + private MyComboboxParada cmbParadaOrigem; + private MyComboboxParadaCve cmbParadaOrigemCve; + private MyComboboxParada cmbParadaDestino; + private MyComboboxParadaCve cmbParadaDestinoCve; + private MyDatebox datInicial; + private MyDatebox datFinal; + private MyTextbox txtNombrePuntoVenta; + private Radiogroup rdGroupTipoData; + private Radiogroup rdGroupTipoRelatorio; + private MyComboboxEstandar cmbEmpresa; + private Bandbox bbPesquisaPuntoVenta; + private MyListbox puntoVentaList; + private MyListbox puntoVentaSelList; + private Paging pagingPuntoVenta; + + @Override + public void doAfterCompose(Component comp) throws Exception { + lsEmpresa = empresaService.obtenerTodos(); + + super.doAfterCompose(comp); + + cmbParadaOrigemCve.setItemRenderer(new ComboitemRenderer() { + @Override + public void render(Comboitem cmbtm, Object o) throws Exception { + Parada parada = (Parada) o; + + cmbtm.setLabel(parada.getCveparada()); + cmbtm.setValue(parada); + } + }); + + cmbParadaDestinoCve.setItemRenderer(new ComboitemRenderer() { + @Override + public void render(Comboitem cmbtm, Object o) throws Exception { + Parada parada = (Parada) o; + + cmbtm.setLabel(parada.getCveparada()); + cmbtm.setValue(parada); + } + }); + + puntoVentaList.setItemRenderer(new RenderRelatorioTaxasLinhaPuntoVenta()); + puntoVentaSelList.setItemRenderer(new RenderRelatorioTaxasLinhaPuntoVentaSelecionados()); + } + + private void executarPesquisa() { + HibernateSearchObject puntoVentaBusqueda = new HibernateSearchObject(PuntoVenta.class, pagingPuntoVenta.getPageSize()); + + puntoVentaBusqueda.addFilterILike("nombpuntoventa", "%" + txtNombrePuntoVenta.getValue() + "%"); + puntoVentaBusqueda.addFilterEqual("activo", Boolean.TRUE); + + 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("relatorioW2IController.window.title"), + Messagebox.OK, Messagebox.INFORMATION); + } catch (InterruptedException ex) { + } + } + } + + public void onClick$btnPesquisa(Event ev) { + executarPesquisa(); + } + + public void onDoubleClick$puntoVentaSelList(Event ev) { + PuntoVenta puntoVenta = (PuntoVenta) puntoVentaSelList.getSelected(); + puntoVentaSelList.removeItem(puntoVenta); + } + + public void onDoubleClick$puntoVentaList(Event ev) { + PuntoVenta puntoVenta = (PuntoVenta) puntoVentaList.getSelected(); + puntoVentaSelList.addItemNovo(puntoVenta); + } + + public void onClick$btnLimpar(Event ev) { + puntoVentaList.setData(new ArrayList()); + + bbPesquisaPuntoVenta.setText(""); + } + + public void onClick$btnExecutarRelatorio(Event ev) throws Exception { + executarRelatorio(); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void executarRelatorio() throws Exception { + Relatorio relatorio; + Map parametros = new HashMap(); + StringBuilder filtro = new StringBuilder(); + + filtro.append("Agência: "); + String puntoVentaIds = ""; + String puntoVentas = ""; + List lsPuntoVentaSelecionados = new ArrayList(Arrays.asList(puntoVentaSelList.getData())); + if (lsPuntoVentaSelecionados.isEmpty()) { + puntoVentas = "Todas"; + puntoVentaIds = "-1"; + } else { + for (int i = 0; i < lsPuntoVentaSelecionados.size(); i++) { + PuntoVenta puntoVenta = lsPuntoVentaSelecionados.get(i); + puntoVentas = puntoVentas + puntoVenta.getNombpuntoventa() + ","; + + puntoVentaIds = puntoVentaIds + puntoVenta.getPuntoventaId() + ","; + } + + // removendo ultima virgula + puntoVentaIds = puntoVentaIds.substring(0, puntoVentaIds.length() - 1); + puntoVentas = puntoVentas.substring(0, puntoVentas.length() - 1); + } + filtro.append(puntoVentas).append(";"); + + parametros.put("DATA_INICIAL", (java.util.Date) this.datInicial.getValue()); + parametros.put("DATA_FINAL", (java.util.Date) this.datFinal.getValue()); + parametros.put("NOME_RELATORIO", Labels.getLabel("indexController.mniRelatorioTxEmbW2I.label")); + parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString()); + parametros.put("TIPO_DATA", Integer.parseInt(rdGroupTipoData.getSelectedItem().getValue())); + parametros.put("NUMPUNTOVENTA", puntoVentaIds); + filtro.append(" Tipo de Data: " + (rdGroupTipoData.getSelectedItem().getValue().equals(1) ? " Origem;" : "Destino;")); + filtro.append(" Empresa: "); + + Comboitem itemEmpresa = cmbEmpresa.getSelectedItem(); + if (itemEmpresa != null) { + Empresa empresa = (Empresa) itemEmpresa.getValue(); + parametros.put("EMPRESA_ID", empresa.getEmpresaId()); + parametros.put("EMPRESA", empresa.getNombempresa()); + filtro.append(empresa.getNombempresa() + ";"); + } else { + filtro.append("Todas;"); + } + + filtro.append(" Origem: "); + Comboitem cbiOrigem = cmbParadaOrigem.getSelectedItem(); + if (cbiOrigem != null) { + Parada origem = (Parada) cbiOrigem.getValue(); + parametros.put("ORIGEN_ID", origem.getParadaId()); + filtro.append(origem.getCveparada() + ";"); + } else { + filtro.append("Todas;"); + } + + filtro.append(" Destino: "); + Comboitem cbiDestino = cmbParadaDestino.getSelectedItem(); + if (cbiDestino != null) { + Parada destino = (Parada) cbiDestino.getValue(); + parametros.put("DESTINO_ID", destino.getParadaId()); + filtro.append(destino.getCveparada() + ";"); + } else { + filtro.append("Todos;"); + } + + Connection connection = dataSourceRead.getConnection(); + try { + + parametros.put("FILTROS", filtro.toString()); + if (Integer.parseInt(rdGroupTipoRelatorio.getSelectedItem().getValue()) == 1) { + relatorio = new RelatorioW2ITaxaEmbarqueAnalitico(parametros, connection); + } else { + relatorio = new RelatorioW2ITaxaEmbarqueSintetico(parametros, connection); + } + + Map args = new HashMap(); + args.put("relatorio", relatorio); + + openWindow("/component/reportView.zul", + Labels.getLabel("indexController.mniRelatorioTxEmbW2I.label"), args, MODAL); + } finally { + if ((connection != null) && !connection.isClosed()) { + connection.close(); + } + } + } + + public void onSelect$cmbParadaOrigemCve(Event ev) { + if (cmbParadaOrigemCve.getSelectedItem() != null) { + cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue()); + } + } + + public void onSelect$cmbParadaOrigem(Event ev) { + if (cmbParadaOrigem.getSelectedItem() != null) + cmbParadaOrigemCve.setComboItemByParada((Parada) cmbParadaOrigem.getSelectedItem().getValue()); + } + + public void onSelect$cmbParadaDestinoCve(Event ev) { + if (cmbParadaDestinoCve.getSelectedItem() != null) { + cmbParadaDestino.setComboItemByParada((Parada) cmbParadaDestinoCve.getSelectedItem().getValue()); + } + } + + public void onSelect$cmbParadaDestino(Event ev) { + if (cmbParadaDestino.getSelectedItem() != null) { + cmbParadaDestinoCve.setComboItemByParada((Parada) cmbParadaDestino.getSelectedItem().getValue()); + } + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + public Radiogroup getRdGroupTipoRelatorio() { + return rdGroupTipoRelatorio; + } + + public void setRdGroupTipoRelatorio(Radiogroup rdGroupTipoRelatorio) { + this.rdGroupTipoRelatorio = rdGroupTipoRelatorio; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/analitico/gerenciais/financeiro/SubMenuRelatorioFinanceiroW2i.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/analitico/gerenciais/financeiro/SubMenuRelatorioFinanceiroW2i.java new file mode 100644 index 000000000..c57ec21ff --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/analitico/gerenciais/financeiro/SubMenuRelatorioFinanceiroW2i.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.financeiro; + +import com.rjconsultores.ventaboletos.web.utilerias.menu.DefaultItemMenuSistema; + +public class SubMenuRelatorioFinanceiroW2i extends DefaultItemMenuSistema { + + public SubMenuRelatorioFinanceiroW2i() { + super("indexController.mniRelatoriosFinanceiroW2i.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS"; + } + +} diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTaxaEmbarqueW2I.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTaxaEmbarqueW2I.java new file mode 100644 index 000000000..a74aa88f2 --- /dev/null +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioTaxaEmbarqueW2I.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 ItemMenuRelatorioTaxaEmbarqueW2I extends DefaultItemMenuSistema { + + public ItemMenuRelatorioTaxaEmbarqueW2I() { + super("indexController.mniRelatorioTxEmbW2I.label"); + } + + @Override + public String getClaveMenu() { + return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOW2I"; + } + + @Override + public void ejecutar() { + PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioTaxaEmbarqueW2I.zul", + Labels.getLabel("indexController.mniRelatorioTxEmbW2I.label"), getArgs() ,desktop); + } +} \ No newline at end of file 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 b25a71576..420b0861c 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 @@ -163,6 +163,9 @@ analitico.gerenciais.tabPreco=com.rjconsultores.ventaboletos.web.utilerias.menu. analitico.gerenciais.trip=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemRelatorioTripulacao analitico.gerenciais.relatorioImpressaoPosterior=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioImpressaoPosterior analitico.gerenciais.relatorioHistoricoCompras=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioPosicaoVendaBilheteIdoso +analitico.gerenciais.w2i=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.financeiro.SubMenuRelatorioFinanceiroW2i +analitico.gerenciais.w2i.relatorioW2I=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioFinanceiroW2I +analitico.gerenciais.w2i.relatorioTxEmbW2I=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioTaxaEmbarqueW2I analitico.gerenciais.relatoriobpe=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.bpe.SubMenuRelatorioBpe analitico.gerenciais.relatoriobpe.relatorioBPe=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioBPe analitico.gerenciais.relatoriobpe.BPeSubstituido=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioBPeSubstituido @@ -234,7 +237,6 @@ analitico.gerenciais.financeiro.vendasRequisicao=com.rjconsultores.ventaboletos. analitico.gerenciais.financeiro.aproveitamentoFinanceiro=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioAproveitamentoFinanceiro analitico.gerenciais.financeiro.relatorioOperacionalFinanceiro=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioCaixaOrgaoConcedente analitico.gerenciais.financeiro.relatorioResumoVendaOrgaoConcedente=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioResumoVendaOrgaoConcedente -analitico.gerenciais.financeiro.relatorioW2I=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioFinanceiroW2I analitico.gerenciais.financeiro.relatorioVendasConexaoRuta=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasConexaoRuta analitico.gerenciais.pacote=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.pacote.SubMenuRelatorioPacote analitico.gerenciais.pacote.boletos=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasPacotesBoletos diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label index deb26ffa3..06c771bcd 100644 --- a/web/WEB-INF/i3-label_en.label +++ b/web/WEB-INF/i3-label_en.label @@ -287,7 +287,9 @@ indexController.mniRelatorioEmbarqueLocalidade.label=Boarding by Places indexController.mniIntegracion.cashmonitor.label=Cash Monitor indexController.mniIntegracion.cashmonitor.relatoriovendacartaocashmonitor=Card Sale indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label=Passenger Demonstration Board - + +indexController.mniRelatoriosFinanceiroW2i.label = Reports W2i + indexController.mniRelatorios.label=Reports indexController.mniRelatorioAproveitamento.label=Utilizationi indexController.mniRelatorioArquivoBGM.label=Arquivo BGM @@ -373,7 +375,8 @@ indexController.mniRelatorioHistoricoCompras.label=Relatório Histórico de indexController.mniRelatorioPosicaoVendaBilheteIdoso.label=Relatório Posição de Venda do Bilhete Idoso indexController.mniRelatorioVendaEmbarcada.label=Onboard Sales indexController.mniRelatorioCaixaOrgaoConcedente.label = Relatório Caixa por Órgão Concedente -indexController.mniRelatorioW2I.label = Relatório W2I +indexController.mniRelatorioW2I.label = Relatório Seguro W2I +indexController.mniRelatorioTxEmbW2I.label = Relatório Taxa Embarque W2I indexController.mnSubMenuImpressaoFiscal.label=Impressão Fiscal indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importação Fiscal diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label index d0831e270..c893c0210 100644 --- a/web/WEB-INF/i3-label_es_MX.label +++ b/web/WEB-INF/i3-label_es_MX.label @@ -296,6 +296,8 @@ indexController.mniIntegracion.cashmonitor.label = Cash Monitor indexController.mniIntegracion.cashmonitor.relatoriovendacartaocashmonitor = Venda de cartão indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label = Quadro Demonstrativo Movimento Passageiros +indexController.mniRelatoriosFinanceiroW2i.label = Reportes W2i + indexController.mniRelatorios.label = Reportes indexController.mniRelatorioAproveitamento.label = Aprovechamiento indexController.mniRelatorioArquivoBGM.label = Arquivo BGM @@ -378,7 +380,8 @@ indexController.mniRelatorioVendaEmbarcada.label = Venda Embarcada indexController.mniRelatorioRemessaCNAB.label = Remessa de Lote (CNAB 400) indexController.mniRelatorioCaixaOrgaoConcedente.label = Relatório Caixa por Órgão Concedente indexController.mniRelatorioVendaConexaoLinha.label = Relatório Vendas de Conexão por Linha -indexController.mniRelatorioW2I.label = Relatório W2I +indexController.mniRelatorioW2I.label = Relatório Seguro W2I +indexController.mniRelatorioTxEmbW2I.label = Relatório Taxa Embarque W2I indexController.mnSubMenuImpressaoFiscal.label=Impresión fiscal indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importación fiscal diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index 461900f8f..65fb6b979 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -309,6 +309,8 @@ indexController.mniIntegracion.cashmonitor.label = Cash Monitor indexController.mniIntegracion.cashmonitor.relatoriovendacartaocashmonitor = Venda de cartão indexController.mniRelatorioQuadroDemonstrativoMovimentoPassageiros.label = Quadro Demonstrativo Movimento Passageiros +indexController.mniRelatoriosFinanceiroW2i.label = Relatórios W2i + indexController.mniRelatorios.label = Relatórios indexController.mniRelatorioAproveitamento.label = Aproveitamento indexController.mniRelatorioArquivoBGM.label = Arquivo BGM @@ -402,6 +404,7 @@ indexController.mniRelatorioPosicaoVendaBilheteIdoso.label = Relatório Posiçã indexController.mniRelatorioVendaEmbarcada.label = Venda Embarcada indexController.mniRelatorioCaixaOrgaoConcedente.label = Relatório Caixa por Órgão Concedente indexController.mniRelatorioW2I.label = Relatório Seguro W2I +indexController.mniRelatorioTxEmbW2I.label = Relatório Taxa Embarque W2I indexController.mnSubMenuImpressaoFiscal.label=Impressão Fiscal indexController.mnSubMenuRelatorioImpressaoFiscal.label=Importação Fiscal diff --git a/web/gui/relatorios/filtroRelatorioTaxaEmbarqueW2I.zul b/web/gui/relatorios/filtroRelatorioTaxaEmbarqueW2I.zul new file mode 100644 index 000000000..b1fd13b6c --- /dev/null +++ b/web/gui/relatorios/filtroRelatorioTaxaEmbarqueW2I.zul @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +