diff --git a/pom.xml b/pom.xml
index 76f83a6e2..5185ac70c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,12 +4,12 @@
4.0.0
br.com.rjconsultores
ventaboletosadm
- 1.6.9
+ 1.7.0
war
1.5.2
- 1.3.7
+ 1.4.0
UTF-8
UTF-8
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioComissaoSintetico.java b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioComissaoSintetico.java
new file mode 100644
index 000000000..b92e81dc7
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/impl/RelatorioComissaoSintetico.java
@@ -0,0 +1,493 @@
+/**
+ *
+ */
+package com.rjconsultores.ventaboletos.relatorios.impl;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
+import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.DataSource;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.ExceptionConfiguracao;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
+import com.rjconsultores.ventaboletos.relatorios.utilitarios.RelatorioComissaoSinteticoBean;
+import com.rjconsultores.ventaboletos.utilerias.DateUtil;
+import com.rjconsultores.ventaboletos.utilerias.MoneyHelper;
+import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
+
+import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
+
+
+public class RelatorioComissaoSintetico extends Relatorio {
+
+private List lsDadosRelatorio;
+private LinkedHashMap> mapCacheConfigComissao;
+private Set pontoVendaConfiguracao;
+
+
+ public RelatorioComissaoSintetico(Map parametros, Connection conexao) throws Exception {
+ super(parametros, conexao);
+ CalculoImposto.limpaCache();
+ this.mapCacheConfigComissao = new LinkedHashMap>();
+
+ this.setCustomDataSource(new DataSource(this) {
+
+ @Override
+ public void initDados() throws Exception {
+
+ Connection conexao = this.relatorio.getConexao();
+
+ Map parametros = this.relatorio.getParametros();
+ String empresaID = parametros.get("EMPRESA_ID") != null ? parametros.get("EMPRESA_ID").toString() : "";
+ String puntoVentaID = parametros.get("NUMPUNTOVENTA").equals("-1") ? "" : parametros.get("NUMPUNTOVENTA").toString();
+ String sqlTotaisVendas = getSqlDadosTotaisdeVenda(empresaID,puntoVentaID);
+
+ NamedParameterStatement stmt = new NamedParameterStatement(conexao, sqlTotaisVendas);
+
+
+ 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_INICIAL")).getTime()));
+
+ if(empresaID != null && !empresaID.equals("")){
+ stmt.setInt("EMPRESA_ID", Integer.parseInt(empresaID));
+ }
+ pontoVendaConfiguracao = new HashSet();
+ ResultSet rset = stmt.executeQuery();
+ lsDadosRelatorio = new ArrayList();
+
+ while (rset.next()) {
+ // Busca as configurações de comissão
+ LinkedHashMap configComissao = getConfigComissao(rset.getInt("puntoventa_id"), rset.getInt("empresa_id"));
+ Integer agenciaID = rset.getInt("puntoventa_id");
+ Integer retEmpresaID = rset.getInt("empresa_id");
+ Integer estadoId = rset.getInt("estado_id");
+ Date fecCorrida = rset.getDate("feccorrida");
+ BigDecimal totalPassgens = rset.getBigDecimal("total_passagem");
+ BigDecimal totalImpPost = rset.getBigDecimal("total_imp_posterior");
+ BigDecimal totalVendaImpPost = rset.getBigDecimal("total_venda_imp_posterior");
+ BigDecimal totalSeguro = rset.getBigDecimal("total_seguro");
+ BigDecimal totalVenda = rset.getBigDecimal("total_venda");
+ RelatorioComissaoSinteticoBean existingBean = findExistingBean(lsDadosRelatorio, agenciaID, retEmpresaID);
+ if (existingBean != null) {
+ // Registro já existe, adicionar os valores aos existentes
+ existingBean.setTotalTarifa(existingBean.getTotalTarifa().add(totalPassgens));
+ existingBean.setTotalImpPosterior(existingBean.getTotalImpPosterior().add(totalImpPost));
+ existingBean.setTotalVendaImpPosterior(existingBean.getTotalVendaImpPosterior().add(totalVendaImpPost));
+ existingBean.setTotalSeguro(existingBean.getTotalSeguro().add(totalSeguro));
+ existingBean.setTotalPagado(existingBean.getTotalPagado().add(totalVenda));
+ //aplica comissão dos totais
+ if (configComissao != null) {
+ comissaoCalc(configComissao, retEmpresaID, estadoId, fecCorrida, totalPassgens, totalImpPost, totalVendaImpPost, totalSeguro,
+ null, existingBean, false);
+ }
+ } else {
+ // Registro não existe, criar um novo objeto e adicioná-lo à lista
+ RelatorioComissaoSinteticoBean comissaoBean = new RelatorioComissaoSinteticoBean();
+
+ comissaoBean.setPontoVendaID(agenciaID);
+ comissaoBean.setEmpresaID(retEmpresaID);
+ comissaoBean.setPontoVenda(rset.getString("nombpuntoventa"));
+ comissaoBean.setTotalTarifa(totalPassgens);
+ comissaoBean.setTotalImpPosterior(totalImpPost);
+ comissaoBean.setTotalVendaImpPosterior(totalVendaImpPost);
+ comissaoBean.setTotalSeguro(totalSeguro);
+ comissaoBean.setTotalPagado(totalVenda);
+
+ //aplica comissão dos totais
+ if (configComissao != null) {
+ comissaoCalc(configComissao, retEmpresaID, estadoId, fecCorrida, totalPassgens, totalImpPost, totalVendaImpPost, totalSeguro,
+ null, comissaoBean, false);
+ }
+
+ lsDadosRelatorio.add(comissaoBean);
+ }
+ }
+
+ if (lsDadosRelatorio.size() > 0) {
+ String sqlTotaisEeventos = getSqlDadosTotaisEvento(empresaID,puntoVentaID);
+ NamedParameterStatement stmtEventos = new NamedParameterStatement(conexao, sqlTotaisEeventos);
+ stmtEventos.setTimestamp("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
+ stmtEventos.setTimestamp("DATA_FINAL", new Timestamp(DateUtil.inicioFecha((Date) parametros.get("DATA_INICIAL")).getTime()));
+ if(empresaID != null && !empresaID.equals("")){
+ stmtEventos.setInt("EMPRESA_ID", Integer.parseInt(empresaID));
+ }
+ ResultSet rsetEventos = stmtEventos.executeQuery();
+
+ while(rsetEventos.next()) {
+ LinkedHashMap configComissao = getConfigComissao(rset.getInt("puntoventa_id"), rset.getInt("empresa_id"));
+ Integer agenciaID = rsetEventos.getInt("puntoventa_id");
+ Integer retEmpresaID = rsetEventos.getInt("empresa_id");
+ if(empresaID != null && !empresaID.equals("")){
+ stmt.setInt("EMPRESA_ID", Integer.parseInt(empresaID));
+ }
+ Integer estadoId = rsetEventos.getInt("estado_id");
+ Date fecCorrida = rset.getDate("feccorrida");
+ Boolean isOutros = rsetEventos.getString("desctipoevento") == "EXCESSO BAGAGEM" ? false : true;
+ BigDecimal totalEvento = rsetEventos.getBigDecimal("total_evento");
+
+
+ RelatorioComissaoSinteticoBean existingBean = findExistingBean(lsDadosRelatorio, agenciaID, retEmpresaID);
+ if (existingBean != null) {
+ if(isOutros) {
+ existingBean.setTotalOutros(totalEvento);
+ } else {
+ existingBean.setTotalExcBagagem(totalEvento);
+ }
+ //aplica comissão dos totais
+ if (configComissao != null) {
+ comissaoCalc(configComissao, retEmpresaID, estadoId, fecCorrida, null, null, null, null, totalEvento, existingBean, isOutros);
+ }
+ }
+ }
+
+ setLsDadosRelatorio(lsDadosRelatorio);
+ }
+ }
+
+ private void comissaoCalc(LinkedHashMap configComissao, Integer retEmpresaID, Integer estadoId, Date fecCorrida,
+ BigDecimal baseCalculoTarifa, BigDecimal baseCalculoImpPost, BigDecimal baseCalculoVendaImpPost, BigDecimal baseCalculoSeguro, BigDecimal TotalEventos,
+ RelatorioComissaoSinteticoBean comissaoBean, Boolean isEventoOutros) throws Exception {
+
+ BigDecimal percComissaoTarifa = BigDecimal.ZERO;
+ BigDecimal percComissaoSeguro = BigDecimal.ZERO;
+ BigDecimal percComissaoImpPost = BigDecimal.ZERO;
+ BigDecimal percComissaoVendaImpPost = BigDecimal.ZERO;
+ BigDecimal percComissaoOutros = BigDecimal.ZERO;
+
+ BigDecimal valorComissaoSeguro = BigDecimal.ZERO;
+ BigDecimal valorComissaoTarifa = BigDecimal.ZERO;
+ BigDecimal valorComissaoImpPost = BigDecimal.ZERO;
+ BigDecimal valorComissaoVendaImpPost = BigDecimal.ZERO;
+ BigDecimal valorComissaoExcBagagem = BigDecimal.ZERO;
+ BigDecimal valorComissaoOutros = BigDecimal.ZERO;
+ Boolean isAltaTemporada = false;
+
+ if(fecCorrida != null) {
+ String mes = new SimpleDateFormat("M").format(fecCorrida);
+ HashMap configImposto = getConfigImposto((Integer) retEmpresaID, estadoId);
+ isAltaTemporada = ((mes.equals("1") && (Boolean) configImposto.get("INDJANEIRO")) || (mes.equals("2") && (Boolean) configImposto.get("INDFEVEREIRO"))
+ || (mes.equals("3") && (Boolean) configImposto.get("INDMARCO")) || (mes.equals("4") && (Boolean) configImposto.get("INDABRIL"))
+ || (mes.equals("5") && (Boolean) configImposto.get("INDMAIO")) || (mes.equals("6") && (Boolean) configImposto.get("INDJUNHO"))
+ || (mes.equals("7") && (Boolean) configImposto.get("INDJULHO")) || (mes.equals("8") && (Boolean) configImposto.get("INDAGOSTO"))
+ || (mes.equals("9") && (Boolean) configImposto.get("INDSETEMBRO")) || (mes.equals("10") && (Boolean) configImposto.get("INDOUTUBRO"))
+ || (mes.equals("11") && (Boolean) configImposto.get("INDNOVEMBRO")) || (mes.equals("12") && (Boolean) configImposto.get("INDDEZEMBRO"))) ? true : false;
+ }
+ if (!isEventoOutros) {
+ percComissaoTarifa = isAltaTemporada ? (BigDecimal) configComissao.get("PASSAGEMALTA") : (BigDecimal) configComissao.get("PASSAGEMBAIXA");
+ percComissaoSeguro = isAltaTemporada ? (BigDecimal) configComissao.get("SEGUROALTA") : (BigDecimal) configComissao.get("SEGUROBAIXA");
+ percComissaoImpPost = isAltaTemporada ? (BigDecimal) configComissao.get("VENDAIMPGAPALTA") : (BigDecimal) configComissao.get("VENDAIMPGAPBAIXA");
+ percComissaoVendaImpPost = isAltaTemporada ? (BigDecimal) configComissao.get("VENDAGAPALTA") : (BigDecimal) configComissao.get("VENDAGAPBAIXA");
+
+ if (percComissaoTarifa == null) {
+ percComissaoTarifa = BigDecimal.ZERO;
+ }
+ if (percComissaoSeguro == null) {
+ percComissaoSeguro = BigDecimal.ZERO;
+ }
+
+ if (percComissaoImpPost == null) {
+ percComissaoImpPost = BigDecimal.ZERO;
+ }
+ if (percComissaoVendaImpPost == null) {
+ percComissaoVendaImpPost = BigDecimal.ZERO;
+ }
+
+ // VALOR COMISSAO = BASE DE CALCULO * (PERCENTUAL COMISSAO / 100)
+ valorComissaoTarifa = baseCalculoTarifa.multiply(MoneyHelper.dividir(percComissaoTarifa, MoneyHelper.HUNDRED, 4));
+ valorComissaoSeguro = baseCalculoSeguro.multiply(MoneyHelper.dividir(percComissaoSeguro, MoneyHelper.HUNDRED, 4));
+ valorComissaoImpPost = baseCalculoImpPost.multiply(MoneyHelper.dividir(percComissaoImpPost, MoneyHelper.HUNDRED, 4));
+ valorComissaoVendaImpPost = baseCalculoVendaImpPost.multiply(MoneyHelper.dividir(percComissaoVendaImpPost, MoneyHelper.HUNDRED, 4));;
+
+ if(comissaoBean.getComissaoTarifa() == null) {
+ comissaoBean.setComissaoTarifa(valorComissaoTarifa);
+ } else {
+ comissaoBean.setComissaoTarifa(comissaoBean.getComissaoTarifa().add(valorComissaoTarifa));
+ }
+ if(comissaoBean.getComissaoSeguro() == null) {
+ comissaoBean.setComissaoSeguro(valorComissaoSeguro);
+ } else {
+ comissaoBean.setComissaoSeguro(comissaoBean.getComissaoSeguro().add(valorComissaoSeguro));
+ }
+ if(comissaoBean.getComissaoImpPosterior() == null) {
+ comissaoBean.setComissaoImpPosterior(valorComissaoImpPost);
+ } else {
+ comissaoBean.setComissaoImpPosterior(comissaoBean.getComissaoImpPosterior().add(valorComissaoImpPost));
+ }
+ if(comissaoBean.getComissaoVendaImpPosterior() == null) {
+ comissaoBean.setComissaoVendaImpPosterior(valorComissaoVendaImpPost);
+ } else {
+ comissaoBean.setComissaoVendaImpPosterior(comissaoBean.getComissaoVendaImpPosterior().add(valorComissaoVendaImpPost));
+ }
+
+ } else {
+ percComissaoOutros = isEventoOutros ? (isAltaTemporada ? (BigDecimal) configComissao.get("OUTROSALTA") : (BigDecimal) configComissao.get("OUTROSBAIXA") )
+ :(isAltaTemporada ? (BigDecimal) configComissao.get("EXCESSOALTA") : (BigDecimal) configComissao.get("EXCESSOBAIXA"));
+ if(percComissaoOutros == null) {
+ percComissaoOutros = BigDecimal.ZERO;
+ }
+ if(isEventoOutros) {
+ // VALOR COMISSAO = BASE DE CALCULO * (PERCENTUAL COMISSAO / 100)
+ valorComissaoOutros = comissaoBean.getTotalOutros().multiply(MoneyHelper.dividir(percComissaoSeguro, MoneyHelper.HUNDRED, 4));
+ if(comissaoBean.getComissaoOutros() == null) {
+ comissaoBean.setComissaoOutros(valorComissaoOutros);
+ } else {
+ comissaoBean.setComissaoOutros(comissaoBean.getComissaoOutros().add(valorComissaoOutros));
+ }
+ comissaoBean.setComissaoOutros(comissaoBean.getComissaoOutros().add(valorComissaoOutros));
+ } else {
+ valorComissaoExcBagagem = comissaoBean.getTotalExcBagagem().multiply(MoneyHelper.dividir(percComissaoOutros, MoneyHelper.HUNDRED, 4));
+ if(comissaoBean.getComissaoExcBagagem() == null) {
+ comissaoBean.setComissaoExcBagagem(valorComissaoExcBagagem);
+ } else {
+ comissaoBean.setComissaoExcBagagem(comissaoBean.getComissaoExcBagagem().add(valorComissaoExcBagagem));
+
+ }
+ }
+ }
+ }
+ });
+ }
+
+ public void setLsDadosRelatorio(List lsDadosRelatorio) {
+ this.setCollectionDataSource(new JRBeanCollectionDataSource(lsDadosRelatorio));
+ this.lsDadosRelatorio = lsDadosRelatorio;
+ }
+
+ public HashMap getConfigImposto(Integer empresaId, Integer estadoId) throws Exception {
+ HashMap cacheConfig = null;
+
+ try {
+ cacheConfig = (HashMap) CalculoImposto.getConfigImpostoByEstadoOrigem(this.getConexao(), estadoId, empresaId);
+ } catch (Exception e) {
+ if (e instanceof ExceptionConfiguracao)
+ this.addInfoMsg(e.getMessage());
+ else
+ throw e;
+ }
+
+ return cacheConfig;
+ }
+
+ private static RelatorioComissaoSinteticoBean findExistingBean(List list, Integer agenciaID, Integer empresaID) {
+ for (RelatorioComissaoSinteticoBean bean : list) {
+ if (Objects.equals(bean.getPontoVendaID(), agenciaID) && Objects.equals(bean.getEmpresaID(), empresaID)) {
+ return bean;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void processaParametros() throws Exception {
+ }
+
+ private String getSqlDadosTotaisdeVenda(String empresa, String agencia) {
+
+ StringBuilder sql = new StringBuilder(3400);
+
+ sql.append(" SELECT pv.nombpuntoventa, ");
+ sql.append(" b.puntoventa_id, ");
+ sql.append(" ep.empresa_id, ");
+ sql.append(" ci.estado_id, ");
+ sql.append(" b.feccorrida, ");
+ sql.append(" Count(*), ");
+ sql.append(" SUM(CASE WHEN (b.indreimpresion = 1 AND b.tipoventa_id = 18 or (b.indreimpresion = 0 AND b.tipoventa_id = 18)) ");
+ sql.append(" THEN 0 ELSE b.preciobase END) AS total_passagem, ");
+ sql.append(" SUM(CASE WHEN b.indreimpresion = 1 AND b.tipoventa_id = 18 THEN b.preciobase ELSE 0 END) AS total_imp_posterior, ");
+ sql.append(" SUM(CASE WHEN b.indreimpresion = 0 AND b.tipoventa_id = 18 THEN b.preciobase ELSE 0 END) AS total_venda_imp_posterior, ");
+ sql.append(" SUM(b.importeseguro) AS total_seguro, ");
+ sql.append(" SUM(b.importetaxaembarque) AS total_tax_emb, ");
+ sql.append(" SUM(b.importepedagio) AS total_pedagio, ");
+ sql.append(" SUM(b.importeoutros) AS total_outros, ");
+ sql.append(" SUM(b.preciopagado) AS total_venda ");
+ sql.append(" FROM boleto b ");
+ sql.append(" LEFT JOIN punto_venta pv ON (b.puntoventa_id = pv.puntoventa_id) ");
+ sql.append(" LEFT JOIN marca mc ON (b.marca_id = mc.marca_id) ");
+ sql.append(" LEFT JOIN empresa ep ON (mc.empresa_id = ep.empresa_id) ");
+ sql.append(" LEFT JOIN ciudad ci ON (ep.ciudad_id = ci.ciudad_id) ");
+ sql.append(" WHERE (b.motivocancelacion_id IS NULL or (b.motivocancelacion_id = 16 and b.tipoventa_id =18 )) ");
+ sql.append(" AND b.motivoreimpresion_id IS NULL ");
+ sql.append(" AND (b.boletooriginal_id IS NULL or ( b.indreimpresion = 1 AND b.tipoventa_id =18) ) ");
+ sql.append(" AND b.activo = 1 ");
+ sql.append(" AND b.fechorventa BETWEEN :DATA_INICIAL AND :DATA_FINAL ");
+ if (!agencia.isEmpty()) {
+ sql.append(" AND b.puntoventa_id in ("+agencia+") ");
+ }
+ if (!empresa.isEmpty()) {
+ sql.append(" AND ep.empresa_id = :EMPRESA_ID ");
+ }
+ sql.append(" GROUP BY pv.nombpuntoventa, b.puntoventa_id, ep.empresa_id, ci.estado_id, b.feccorrida ");
+ sql.append(" ORDER BY pv.nombpuntoventa, b.puntoventa_id, ci.estado_id ");
+
+ return sql.toString();
+ }
+
+ private String getSqlDadosTotaisEvento(String empresa, String agencia ) {
+
+ StringBuilder sql = new StringBuilder(3400);
+
+ sql.append("SELECT ");
+ sql.append(" tee.desctipoevento, ");
+ sql.append(" ee.puntoventa_id, ");
+ sql.append(" pv.nombpuntoventa, ");
+ sql.append(" ee.empresa_id, ");
+ sql.append(" ci.estado_id, ");
+ sql.append(" bo.fechorventa, ");
+ sql.append(" SUM(ee.impingreso) AS total_evento ");
+ sql.append("FROM ");
+ sql.append(" evento_extra ee ");
+ sql.append(" INNER JOIN tipo_evento_extra tee ON ee.tipoeventoextra_id = tee.tipoeventoextra_id ");
+ sql.append(" LEFT JOIN punto_venta pv ON ( ee.puntoventa_id = pv.puntoventa_id ) ");
+ sql.append(" LEFT JOIN empresa emp ON (emp.empresa_id = ee.empresa_id) ");
+ sql.append(" LEFT JOIN ciudad ci ON (emp.ciudad_id = ci.ciudad_id) ");
+ sql.append(" LEFT JOIN boleto bo ON (ee.boleto_id = bo.boleto_id) ");
+ sql.append("WHERE ");
+ sql.append(" ee.activo = 1 ");
+ sql.append(" AND tee.desctipoevento IN ('EXCESSO BAGAGEM', 'ANIMAL 50%' ) ");
+ sql.append(" AND ee.fechoringreso BETWEEN :DATA_INICIAL AND :DATA_FINAL ");
+
+ if (!agencia.isEmpty()) {
+ sql.append(" AND ee.puntoventa_id IN ("+agencia+") ");
+ }
+ if (!empresa.isEmpty()) {
+ sql.append(" AND ee.empresa_id = :EMPRESA_ID ");
+ }
+
+ sql.append("GROUP BY ");
+ sql.append(" tee.desctipoevento, ");
+ sql.append(" ee.puntoventa_id, ");
+ sql.append(" pv.nombpuntoventa, ");
+ sql.append(" ee.empresa_id, ");
+ sql.append(" ci.estado_id, ");
+ sql.append(" bo.fechorventa ");
+ sql.append("ORDER BY ");
+ sql.append(" tee.desctipoevento, ");
+ sql.append(" ee.puntoventa_id, ");
+ sql.append(" pv.nombpuntoventa, ");
+ sql.append(" ee.empresa_id ");
+
+ return sql.toString();
+ }
+
+
+ public LinkedHashMap getConfigComissao(Integer puntoVentaId, Integer empresaId) throws Exception {
+
+ LinkedHashMap cacheConfig = null;
+
+ // Verifica se existe configuração na memoria, caso não exista, realiza busca no banco
+ if (mapCacheConfigComissao == null || !mapCacheConfigComissao.containsKey(puntoVentaId.toString() + "_" + empresaId.toString())) {
+ StringBuilder sql = new StringBuilder();
+
+ sql.append(" SELECT PC.ISSRETIDO, PC.ROYALTIES, PC.ENVIARRECIBO, PC.RECEITA, PC.CODAG, PC.PASSAGEMALTA, PC.PASSAGEMBAIXA, ");
+ sql.append(" PC.SEGUROALTA, PC.SEGUROBAIXA, PC.OUTROSBAIXA, PC.OUTROSALTA, PC.EXCESSOALTA, PC.EXCESSOBAIXA, ");
+ sql.append(" PC.TARIFARECEITA, PC.SEGURORECEITA, PC.TAXARECEITA, PC.PEDAGIORECEITA, TP.DESCTIPO AS TIPO_AGENCIA, ");
+ sql.append(" PC.TARIFADEV, PC.SEGURO_DEV, PC.TAXADEV, PC.PEDAGIODEV, PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA, PV.NOMBPUNTOVENTA, ");
+ sql.append(" ES.CVEESTADO, ES.ESTADO_ID, PC.SEGUROOBRIGATORIOALTA, PC.SEGUROOBRIGATORIOBAIXA, ");
+ sql.append(" CASE WHEN pc.valor_imp_gap_alta_comp IS NULL THEN pc.valor_impressao_gap_alta ELSE pc.valor_imp_gap_alta_comp END AS VALOR_IMPRESSAO_ALTA, ");
+ sql.append(" CASE WHEN pc.valor_imp_gap_comp IS NULL THEN pc.valor_impressao_gap ELSE pc.valor_imp_gap_comp END AS VALOR_IMPRESSAO_BAIXA, ");
+ sql.append(" CASE WHEN pc.valor_venda_gap_alta_comp IS NULL THEN pc.passagemalta ELSE pc.valor_venda_gap_alta_comp END AS VALOR_VENDA_IMP_ALTA, ");
+ sql.append(" CASE WHEN pc.valor_venda_gap_comp IS NULL THEN pc.passagembaixa ELSE pc.valor_venda_gap_comp END AS VALOR_VENDA_IMP_BAIXA ");
+ sql.append(" FROM PTOVTA_COMISSAO PC ");
+ sql.append(" INNER JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = PC.PUNTOVENTA_ID AND PC.PTOVTADESCOMISSAO_ID = PV.PUNTOVENTA_ID ");
+ sql.append(" INNER JOIN PARADA PR ON PR.PARADA_ID = PV.PARADA_ID ");
+ sql.append(" INNER JOIN CIUDAD CD ON CD.CIUDAD_ID = PR.CIUDAD_ID ");
+ sql.append(" INNER JOIN ESTADO ES ON ES.ESTADO_ID = CD.ESTADO_ID ");
+ sql.append(" INNER JOIN TIPO_PTOVTA TP ON TP.TIPOPTOVTA_ID = PV.TIPOPTOVTA_ID");
+ sql.append(" WHERE PC.EMPRESA_ID = :EMPRESA_ID ");
+ sql.append(" AND PC.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
+ sql.append(" AND PC.ACTIVO = 1 ");
+
+ NamedParameterStatement stmt = new NamedParameterStatement(this.getConexao(), sql.toString());
+ stmt.setInt("EMPRESA_ID", empresaId);
+ stmt.setInt("PUNTOVENTA_ID", puntoVentaId);
+ ResultSet rs = stmt.executeQuery();
+
+ if (rs.next()) {
+ cacheConfig = new LinkedHashMap();
+
+ cacheConfig.put("ISSRETIDO", rs.getBigDecimal("ISSRETIDO"));
+ cacheConfig.put("ROYALTIES", rs.getBigDecimal("ROYALTIES"));
+ cacheConfig.put("PASSAGEMALTA", rs.getBigDecimal("PASSAGEMALTA"));
+ cacheConfig.put("PASSAGEMBAIXA", rs.getBigDecimal("PASSAGEMBAIXA"));
+ cacheConfig.put("SEGUROALTA", rs.getBigDecimal("SEGUROALTA"));
+ cacheConfig.put("SEGUROBAIXA", rs.getBigDecimal("SEGUROBAIXA"));
+ cacheConfig.put("OUTROSALTA", rs.getBigDecimal("OUTROSALTA"));
+ cacheConfig.put("OUTROSBAIXA", rs.getBigDecimal("OUTROSBAIXA"));
+ cacheConfig.put("EXCESSOALTA", rs.getBigDecimal("EXCESSOALTA"));
+ cacheConfig.put("EXCESSOBAIXA", rs.getBigDecimal("EXCESSOBAIXA"));
+ cacheConfig.put("SEGUROOBRIGATORIOBAIXA", rs.getBigDecimal("SEGUROOBRIGATORIOBAIXA"));
+ cacheConfig.put("SEGUROOBRIGATORIOALTA", rs.getBigDecimal("SEGUROOBRIGATORIOALTA"));
+ cacheConfig.put("VENDAIMPGAPALTA", rs.getBigDecimal("VALOR_IMPRESSAO_ALTA"));
+ cacheConfig.put("VENDAIMPGAPBAIXA", rs.getBigDecimal("VALOR_IMPRESSAO_BAIXA"));
+ cacheConfig.put("VENDAGAPALTA", rs.getBigDecimal("VALOR_VENDA_IMP_ALTA"));
+ cacheConfig.put("VENDAGAPBAIXA", rs.getBigDecimal("VALOR_VENDA_IMP_BAIXA"));
+
+ cacheConfig.put("TARIFARECEITA", rs.getBoolean("TARIFARECEITA"));
+ cacheConfig.put("SEGURORECEITA", rs.getBoolean("SEGURORECEITA"));
+ cacheConfig.put("TAXARECEITA", rs.getBoolean("TAXARECEITA"));
+ cacheConfig.put("PEDAGIORECEITA", rs.getBoolean("PEDAGIORECEITA"));
+ cacheConfig.put("TARIFADEV", rs.getBoolean("TARIFADEV"));
+ cacheConfig.put("SEGURO_DEV", rs.getBoolean("SEGURO_DEV"));
+ cacheConfig.put("TAXADEV", rs.getBoolean("TAXADEV"));
+ cacheConfig.put("PEDAGIODEV", rs.getBoolean("PEDAGIODEV"));
+
+
+
+ cacheConfig.put("RECEITA", rs.getString("RECEITA"));
+ cacheConfig.put("TIPO_AGENCIA", rs.getString("TIPO_AGENCIA"));
+ cacheConfig.put("NUMPUNTOVENTA", rs.getString("NUMPUNTOVENTA"));
+ cacheConfig.put("NOMBPUNTOVENTA", rs.getString("NOMBPUNTOVENTA"));
+ cacheConfig.put("CVEESTADO", rs.getString("CVEESTADO"));
+
+ cacheConfig.put("ESTADO_ID", rs.getInt("ESTADO_ID"));
+ cacheConfig.put("PUNTOVENTA_ID", rs.getInt("PUNTOVENTA_ID"));
+
+ mapCacheConfigComissao.put(puntoVentaId.toString() + "_" + empresaId.toString(), cacheConfig);
+
+ } else {
+ StringBuilder sqlParam = new StringBuilder();
+
+ sqlParam.append(" SELECT EM.NOMBEMPRESA, PV.NOMBPUNTOVENTA, PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA ");
+ sqlParam.append(" FROM EMPRESA EM, ");
+ sqlParam.append(" PUNTO_VENTA PV ");
+ sqlParam.append(" WHERE EM.EMPRESA_ID = :EMPRESA_ID ");
+ sqlParam.append(" AND PV.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
+
+ NamedParameterStatement stmtParam = new NamedParameterStatement(this.getConexao(), sqlParam.toString());
+ stmtParam.setInt("PUNTOVENTA_ID", puntoVentaId);
+ stmtParam.setInt("EMPRESA_ID", empresaId);
+
+ ResultSet rsParam = stmtParam.executeQuery();
+
+ if (rsParam.next()){
+ pontoVendaConfiguracao.add(new PuntoVenta(new Integer (rsParam.getString("PUNTOVENTA_ID")), rsParam.getString("NOMBPUNTOVENTA"), rsParam.getString("NUMPUNTOVENTA")));
+ }
+ rsParam.close();
+ stmtParam.close();
+ }
+
+ rs.close();
+ stmt.close();
+
+ }
+ else
+ cacheConfig = mapCacheConfigComissao.get(puntoVentaId.toString() + "_" + empresaId.toString());
+
+ return cacheConfig;
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_es.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_es.properties
new file mode 100644
index 000000000..c74a50d3a
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_es.properties
@@ -0,0 +1,32 @@
+#geral
+msg.noData=No se pudieron obtener datos con los parámetros proporcionados.
+
+#Labels cabeçalho
+header.relatorio=Informe:
+header.periodo.venda=Período:
+header.periodoA=a
+header.empresa=Empresa:
+header.data.hora=Fecha/Hora:
+header.impressorPor=Impreso por:
+header.pagina=Página
+header.de=de
+header.filtros=Filtros:
+header.filtro.pontoVenda=Agencia:
+header.titulo=Informe de Comisión Sintético
+header.pagina=Pagina:
+
+#Labels HEADER
+label.agencia=Agencia
+label.total.passagem=Total Venta de Boletos
+label.comissao.passagem=Comisión Venta de Boletos
+label.total.venda.imp=Total Venda Imp. Posterior
+label.comissao.v.imp=Comisión Venda Imp. Posterior
+label.total.imp=Total Imp. Posterior
+label.comissao.imp=Comisión Imp. Posterior
+label.total.excesso=Total Exceso de Equipaje
+label.comissao.excesso=Comisión Exceso de Equipaje
+label.total.outros=Total Otros (Animal 50%)
+label.comissao.outros=Comisión Otros
+label.faturamento.total=Facturación Total (Venta)
+label.comissão.total=Valor Total de Comisión
+label.total.geral=Total Geral
\ No newline at end of file
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_pt_BR.properties b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_pt_BR.properties
new file mode 100644
index 000000000..962ed154e
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/internacionalizacao/RelatorioComissaoSintetico_pt_BR.properties
@@ -0,0 +1,32 @@
+#geral
+msg.noData=Não foi possivel obter dados com os parâmetros informados.
+
+#Labels cabeçalho
+header.relatorio=Relatório:
+header.periodo.venda=Período:
+header.periodoA=à
+header.empresa=Empresa:
+header.data.hora=Data/Hora:
+header.impressorPor=Impressor por:
+header.pagina=Página
+header.de=de
+header.filtros=Filtros:
+header.filtro.pontoVenda=Agnecia:
+header.titulo=Relatório Comissão Sintético
+header.pagina=Pagina:
+
+#Labels HEADER
+label.agencia=Agencia
+label.total.passagem=Total Venda Passagem
+label.comissao.passagem=Comissão Venda Passagem
+label.total.venda.imp=Total Venda Imp. Posterior
+label.comissao.v.imp=Comissão Venda Imp. Posterior
+label.total.imp=Total Imp. Posterior
+label.comissao.imp=Comissão Imp. Posterior
+label.total.excesso=Total Excesso Bagagem
+label.comissao.excesso=Comissão Excesso Bagagem
+label.total.outros=Total Outros (Animal 50%)
+label.comissao.outros=Comissão Outros
+label.faturamento.total=Faturamento Total (Venda)
+label.comissão.total=Valor Total Comissão
+label.total.geral=Total Geral
\ No newline at end of file
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jasper b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jasper
new file mode 100644
index 000000000..0c0c0d235
Binary files /dev/null and b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jasper differ
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jrxml b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jrxml
new file mode 100644
index 000000000..c634df83a
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/templates/RelatorioComissaoSintetico.jrxml
@@ -0,0 +1,586 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioComissaoSinteticoBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioComissaoSinteticoBean.java
new file mode 100644
index 000000000..5e9fac826
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioComissaoSinteticoBean.java
@@ -0,0 +1,196 @@
+package com.rjconsultores.ventaboletos.relatorios.utilitarios;
+
+import java.math.BigDecimal;
+import java.util.Objects;
+
+public class RelatorioComissaoSinteticoBean {
+ private String pontoVenda;
+ private Integer pontoVendaID;
+ private Integer empresaID;
+ private BigDecimal totalTarifa;
+ private BigDecimal comissaoTarifa;
+ private BigDecimal totalImpPosterior;
+ private BigDecimal comissaoImpPosterior;
+ private BigDecimal totalVendaImpPosterior;
+ private BigDecimal comissaoVendaImpPosterior;
+ private BigDecimal totalExcBagagem;
+ private BigDecimal comissaoExcBagagem;
+ private BigDecimal totalOutros;
+ private BigDecimal comissaoOutros;
+ private BigDecimal totalPagado;
+ private BigDecimal comissaoTotal;
+ private BigDecimal totalSeguro;
+ private BigDecimal totalPedagio;
+ private BigDecimal totalTaxaEmb;
+ private BigDecimal comissaoSeguro;
+
+ public Integer getPontoVendaID() {
+ return pontoVendaID;
+ }
+
+ public void setPontoVendaID(Integer pontoVendaID) {
+ this.pontoVendaID = pontoVendaID;
+ }
+
+ public Integer getEmpresaID() {
+ return empresaID;
+ }
+
+ public void setEmpresaID(Integer empresaID) {
+ this.empresaID = empresaID;
+ }
+
+ public String getPontoVenda() {
+ return pontoVenda;
+ }
+
+ public void setPontoVenda(String pontoVenda) {
+ this.pontoVenda = pontoVenda;
+ }
+
+ public BigDecimal getTotalSeguro() {
+ return totalSeguro;
+ }
+
+ public void setTotalSeguro(BigDecimal totalSeguro) {
+ this.totalSeguro = totalSeguro;
+ }
+
+ public BigDecimal getTotalTaxaEmb() {
+ return totalTaxaEmb;
+ }
+
+ public void setTotalTaxaEmb(BigDecimal totalTaxaEmb) {
+ this.totalTaxaEmb = totalTaxaEmb;
+ }
+
+ public BigDecimal getTotalPegadio() {
+ return totalPedagio;
+ }
+
+ public void setTotalPegadio(BigDecimal totalPegadio) {
+ this.totalPedagio = totalPegadio;
+ }
+
+ public BigDecimal getTotalTarifa() {
+ return totalTarifa;
+ }
+
+ public void setTotalTarifa(BigDecimal totalTarifa) {
+ this.totalTarifa = totalTarifa;
+ }
+
+ public BigDecimal getComissaoTarifa() {
+ return comissaoTarifa;
+ }
+
+ public void setComissaoTarifa(BigDecimal comissaoTarifa) {
+ this.comissaoTarifa = comissaoTarifa;
+ }
+
+ public BigDecimal getTotalImpPosterior() {
+ return totalImpPosterior;
+ }
+
+ public void setTotalImpPosterior(BigDecimal totalImpPosterior) {
+ this.totalImpPosterior = totalImpPosterior;
+ }
+
+ public BigDecimal getComissaoImpPosterior() {
+ return comissaoImpPosterior;
+ }
+
+ public BigDecimal getTotalVendaImpPosterior() {
+ return totalVendaImpPosterior;
+ }
+
+ public void setTotalVendaImpPosterior(BigDecimal totalVendaImpPosterior) {
+ this.totalVendaImpPosterior = totalVendaImpPosterior;
+ }
+
+ public BigDecimal getComissaoVendaImpPosterior() {
+ return comissaoVendaImpPosterior;
+ }
+
+ public void setComissaoVendaImpPosterior(BigDecimal comissaoVendaImpPosterior) {
+ this.comissaoVendaImpPosterior = comissaoVendaImpPosterior;
+ }
+
+ public void setComissaoImpPosterior(BigDecimal comissaoImpPosterior) {
+ this.comissaoImpPosterior = comissaoImpPosterior;
+ }
+
+ public BigDecimal getTotalExcBagagem() {
+ return totalExcBagagem;
+ }
+
+ public void setTotalExcBagagem(BigDecimal totalExcBagagem) {
+ this.totalExcBagagem = totalExcBagagem;
+ }
+
+ public BigDecimal getComissaoExcBagagem() {
+ return comissaoExcBagagem;
+ }
+
+ public void setComissaoExcBagagem(BigDecimal comissaoExcBagagem) {
+ this.comissaoExcBagagem = comissaoExcBagagem;
+ }
+
+ public BigDecimal getTotalOutros() {
+ return totalOutros;
+ }
+
+ public void setTotalOutros(BigDecimal totalOutros) {
+ this.totalOutros = totalOutros;
+ }
+
+ public BigDecimal getComissaoOutros() {
+ return comissaoOutros;
+ }
+
+ public void setComissaoOutros(BigDecimal comissaoOutros) {
+ this.comissaoOutros = comissaoOutros;
+ }
+
+ public BigDecimal getTotalPagado() {
+ return totalPagado;
+ }
+
+ public void setTotalPagado(BigDecimal totalPagado) {
+ this.totalPagado = totalPagado;
+ }
+
+ public BigDecimal getComissaoTotal() {
+ return comissaoTotal;
+ }
+
+ public void setComissaoTotal(BigDecimal comissaoTotal) {
+ this.comissaoTotal = comissaoTotal;
+ }
+
+ public BigDecimal getComissaoSeguro() {
+ return comissaoSeguro;
+ }
+
+ public void setComissaoSeguro(BigDecimal comissaoSeguro) {
+ this.comissaoSeguro = comissaoSeguro;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(empresaID, pontoVendaID);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RelatorioComissaoSinteticoBean other = (RelatorioComissaoSinteticoBean) obj;
+ return Objects.equals(empresaID, other.empresaID) && Objects.equals(pontoVendaID, other.pontoVendaID);
+ }
+
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioDetalhamentoComissaoRelBean.java b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioDetalhamentoComissaoRelBean.java
new file mode 100644
index 000000000..aaed23800
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/relatorios/utilitarios/RelatorioDetalhamentoComissaoRelBean.java
@@ -0,0 +1,6 @@
+package com.rjconsultores.ventaboletos.relatorios.utilitarios;
+
+public class RelatorioDetalhamentoComissaoRelBean {
+
+
+}
diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioComissaoController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioComissaoController.java
new file mode 100644
index 000000000..f15dff16c
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/relatorios/RelatorioComissaoController.java
@@ -0,0 +1,194 @@
+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.Paging;
+import org.zkoss.zul.Radiogroup;
+
+import com.rjconsultores.ventaboletos.entidad.Empresa;
+import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
+import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioComissaoSintetico;
+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.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("relatorioComissaoController")
+@Scope("prototype")
+public class RelatorioComissaoController 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 MyDatebox datInicial;
+ private MyDatebox datFinal;
+ private MyTextbox txtNombrePuntoVenta;
+ 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);
+ 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("relatorioComissaoController.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 virgulaUSU
+ 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("TITULO", Labels.getLabel("relatorioComissaoController.window.title"));
+ parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
+ parametros.put("NUMPUNTOVENTA", puntoVentaIds);
+ 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;");
+ }
+
+ Connection connection = dataSourceRead.getConnection();
+ try {
+
+ parametros.put("FILTROS", filtro.toString());
+ relatorio = new RelatorioComissaoSintetico(parametros, connection);
+ Map args = new HashMap();
+ args.put("relatorio", relatorio);
+
+ openWindow("/component/reportView.zul",
+ Labels.getLabel("relatorioComissaoController.window.title"), args, MODAL);
+ } finally {
+ if ((connection != null) && !connection.isClosed()) {
+ connection.close();
+ }
+ }
+ }
+
+ 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;
+ }
+}
\ No newline at end of file
diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioComissao.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioComissao.java
new file mode 100644
index 000000000..dc4735478
--- /dev/null
+++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/menu/item/relatorios/ItemMenuRelatorioComissao.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 ItemMenuRelatorioComissao extends DefaultItemMenuSistema {
+
+ public ItemMenuRelatorioComissao() {
+ super("indexController.mniRelatorioComissao.label");
+ }
+
+ @Override
+ public String getClaveMenu() {
+ return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOCOMISSAO";
+ }
+
+ @Override
+ public void ejecutar() {
+ PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioComissao.zul",
+ Labels.getLabel("relatorioComissaoController.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 cb1782ba1..249ad5448 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
@@ -211,6 +211,7 @@ analitico.gerenciais.estatisticos.encerramentocheckin=com.rjconsultores.ventabol
analitico.gerenciais.estatisticos.mmphDERPR=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioMmphDer
analitico.gerenciais.financeiro=com.rjconsultores.ventaboletos.web.utilerias.menu.item.analitico.gerenciais.financeiro.SubMenuRelatorioFinanceiro
analitico.gerenciais.financeiro.receitaDiariaAgencia=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioReceitaDiariaAgencia
+analitico.gerenciais.financeiro.RelatorioComissao=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioComissao
analitico.gerenciais.financeiro.taxas=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioTaxasLinha
analitico.gerenciais.financeiro.ocd=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioOCD
analitico.gerenciais.financeiro.vendasBilheteiro=com.rjconsultores.ventaboletos.web.utilerias.menu.item.relatorios.ItemMenuRelatorioVendasBilheteiro
diff --git a/web/WEB-INF/i3-label_en.label b/web/WEB-INF/i3-label_en.label
index 3f6e98b20..3e050cbe3 100644
--- a/web/WEB-INF/i3-label_en.label
+++ b/web/WEB-INF/i3-label_en.label
@@ -349,6 +349,7 @@ indexController.mniRelatorioGratuidade.label = Relatório Tipo Passagem
indexController.mniRelatorioGratuidadeANTT.label = Relatório Gratuidades ANTT
indexController.mniRelatorioGratuidadeAGR.label = Relatório Gratuidades AGR
indexController.mniRelatorioPassagensAGR.label = AGR Tickets Report
+indexController.mniRelatorioComissao.label = Commission Report
indexController.mniRelatorioGratuidadeARTESP.label = Relatório Gratuidade ARTESP
indexController.mniRelatorioGratuidadeAGER.label = Relatório Gratuidade AGER
indexController.mniRelatorioPassagensAGER.label = Relatório Passagens AGER
@@ -942,6 +943,20 @@ relatorioReceitaServicoController.lbEmpresa.value = Empresa
relatorioReceitaServicoController.lbClase.value = Classe
relatorioReceitaServicoController.lbServico.value = N. Serviço
+#Relatorio Comissao
+relatorioComissaoController.window.title = Commission Report
+relatorioComissaoController.lbEmpresa.value = Company
+relatorioComissaoController.lbNumero.value = Agency Number
+relatorioComissaoController.lbAte.value = until
+relatorioComissaoController.lbDatInicial.value = Start Date
+relatorioComissaoController.lbDatFinal.value = End Date
+relatorioComissaoController.lbTipoData.value = Date Type
+relatorioComissaoController.lbTipoData.venda.value = Sales Date
+relatorioComissaoController.lbPuntoVenta.value = Agency No.
+relatorioComissaoController.lbPuntoVenta.value = Agency
+relatorioComissaoController.lbTipoRelatorio.analitico.value=Analytical
+relatorioComissaoController.lbTipoRelatorio.sintetico.value=Synthetic
+
#Relatorio de Diferencas de Transferencias
relatorioDiferencasTransferenciasController.window.title = Relatório de Diferenças em Transferências
relatorioDiferencasTransferenciasController.lbDePeriodoTransferencia.value = Data inicial
diff --git a/web/WEB-INF/i3-label_es_MX.label b/web/WEB-INF/i3-label_es_MX.label
index f1710514a..e1285a433 100644
--- a/web/WEB-INF/i3-label_es_MX.label
+++ b/web/WEB-INF/i3-label_es_MX.label
@@ -333,6 +333,7 @@ indexController.mniRelatorioGratuidade.label = Gratuidades
indexController.mniRelatorioGratuidadeANTT.label = Gratuidades ANTT
indexController.mniRelatorioGratuidadeAGR.label = Gratuidades AGR
indexController.mniRelatorioPassagensAGR.label = Relatório de Passagens AGR
+indexController.mniRelatorioComissao.label = Relatório Comissão
indexController.mniRelatorioGratuidadeAGEPAN.label = Gratuidades AGEPAN
indexController.mniRelatorioExportacaoIdosoARTESP.label = Reporte Exportación Ancianos ARTESP
indexController.mniRelatorioGratuidadeIdosoDeficiente.label = Gratuidades Idoso/Deficiente
@@ -823,6 +824,20 @@ relatorioReceitaServicoController.lbEmpresa.value = Empresa
relatorioReceitaServicoController.lbClase.value = Clase
relatorioReceitaServicoController.lbServico.value = N. Servicio
+#Relatorio Comissao
+relatorioComissaoController.window.title = Reporte de Comisión
+relatorioComissaoController.lbEmpresa.value = Empresa
+relatorioComissaoController.lbNumero.value = Número de Agencia
+relatorioComissaoController.lbAte.value = hasta
+relatorioComissaoController.lbDatInicial.value = Fecha Inicial
+relatorioComissaoController.lbDatFinal.value = Fecha Final
+relatorioComissaoController.lbTipoData.value = Tipo de Fecha
+relatorioComissaoController.lbTipoData.venda.value = Fecha de Venta
+relatorioComissaoController.lbPuntoVenta.value = N. de Agencia
+relatorioComissaoController.lbPuntoVenta.value = Agencia
+relatorioComissaoController.lbTipoRelatorio.analitico.value=AnalÃtico
+relatorioComissaoController.lbTipoRelatorio.sintetico.value=Sintético
+
#Relatorio de Diferencas de Transferencias
relatorioDiferencasTransferenciasController.window.title = Reporte de diferencias en transferencias
relatorioDiferencasTransferenciasController.lbDePeriodoTransferencia.value = Fecha inicial
diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label
index ae88f5206..126c51eb7 100644
--- a/web/WEB-INF/i3-label_pt_BR.label
+++ b/web/WEB-INF/i3-label_pt_BR.label
@@ -350,6 +350,7 @@ indexController.mniRelatorioGratuidadeANTT.label = Relatório Gratuidades ANTT
indexController.mniRelatorioGratuidadeAGR.label = Relatório Gratuidades AGR
indexController.mniRelatorioPassagensAGR.label = Relatório Passagens AGR
indexController.mnSubMenuAGR.label=Relatório AGR
+indexController.mniRelatorioComissao.label = Relatório Comissão
indexController.mniRelatorioGratuidadeARTESP.label = Relatório Gratuidade ARTESP
indexController.mniRelatorioGratuidadeAGER.label = Relatório Gratuidade AGER
indexController.mniRelatorioPassagensAGER.label = Relatório Passagens AGER
@@ -942,6 +943,20 @@ relatorioReceitaServicoController.lbEmpresa.value = Empresa
relatorioReceitaServicoController.lbClase.value = Classe
relatorioReceitaServicoController.lbServico.value = N. Serviço
+#Relatorio Comissao
+relatorioComissaoController.window.title = Relatório Comissao
+relatorioComissaoController.lbEmpresa.value = Empresa
+relatorioComissaoController.lbNumero.value = Número Agência
+relatorioComissaoController.lbAte.value = até
+relatorioComissaoController.lbDatInicial.value = Data Inicial
+relatorioComissaoController.lbDatFinal.value = Data Final
+relatorioComissaoController.lbTipoData.value = Tipo de Data
+relatorioComissaoController.lbTipoData.venda.value = Data Venda
+relatorioComissaoController.lbPuntoVenta.value = N. Agência
+relatorioComissaoController.lbPuntoVenta.value = Agência
+relatorioComissaoController.lbTipoRelatorio.analitico.value=Analitico
+relatorioComissaoController.lbTipoRelatorio.sintetico.value=Sintético
+
#Relatorio de Diferencas de Transferencias
relatorioDiferencasTransferenciasController.window.title = Relatório de Diferenças em Transferências
relatorioDiferencasTransferenciasController.lbDePeriodoTransferencia.value = Data inicial
diff --git a/web/gui/relatorios/filtroRelatorioComissao.zul b/web/gui/relatorios/filtroRelatorioComissao.zul
new file mode 100644
index 000000000..a4c04a6bc
--- /dev/null
+++ b/web/gui/relatorios/filtroRelatorioComissao.zul
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+