- Refatoração calculo de imposto

- Relatório de Taxas por Linha

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@29667 d1611594-4594-4d17-8e1d-87c2c4800839
master
bruno 2013-08-01 22:58:27 +00:00
parent d9721c30f3
commit 225418ac61
12 changed files with 1269 additions and 171 deletions

View File

@ -14,7 +14,9 @@ import java.util.HashMap;
import java.util.Map;
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
import com.rjconsultores.ventaboletos.relatorios.negocio.CalculoImposto;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ArrayDataSource;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ExceptionConfiguracao;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
@ -24,14 +26,12 @@ import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
*/
public class RelatorioReceitaDiariaAgencia extends Relatorio {
private Map<String, HashMap<String, Object>> mapCacheConfigImposto;
private Map<String, HashMap<String, Object>> mapCacheConfigComissao;
public RelatorioReceitaDiariaAgencia(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
this.mapCacheConfigImposto = new HashMap<String, HashMap<String, Object>>();
this.mapCacheConfigComissao = new HashMap<String, HashMap<String, Object>>();
this.setCustomDataSource(new ArrayDataSource(this) {
@ -265,18 +265,18 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
if (motivoCancelacionId == null) {
row.put("RECEITA_TARIFA", ((BigDecimal) row.get("RECEITA_TARIFA")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) ? this.resultSet.getBigDecimal("PRECIOPAGADO") : BigDecimal.ZERO));
row.put("RECEITA_TARIFA_GAP", ((BigDecimal) row.get("RECEITA_TARIFA_GAP")).add( (tipoVentaId.equals(18) || tipoVentaId.equals(39))? this.resultSet.getBigDecimal("PRECIOPAGADO") : BigDecimal.ZERO));
row.put("RECEITA_TARIFA_GAP", ((BigDecimal) row.get("RECEITA_TARIFA_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) ? this.resultSet.getBigDecimal("PRECIOPAGADO") : BigDecimal.ZERO));
row.put("RECEITA_SEGURO", ((BigDecimal) row.get("RECEITA_SEGURO")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTESEGURO") != null ? this.resultSet.getBigDecimal("IMPORTESEGURO") : BigDecimal.ZERO));
row.put("RECEITA_SEGURO_GAP", ((BigDecimal) row.get("RECEITA_SEGURO_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) ? this.resultSet.getBigDecimal("IMPORTESEGURO") : BigDecimal.ZERO));
row.put("RECEITA_SEGURO_GAP", ((BigDecimal) row.get("RECEITA_SEGURO_GAP")).add(((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTESEGURO") != null) ? this.resultSet.getBigDecimal("IMPORTESEGURO") : BigDecimal.ZERO));
row.put("RECEITA_EMBARQUE", ((BigDecimal) row.get("RECEITA_EMBARQUE")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null ? this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") : BigDecimal.ZERO));
row.put("RECEITA_EMBARQUE_GAP", ((BigDecimal) row.get("RECEITA_EMBARQUE_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null ? this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") : BigDecimal.ZERO));
row.put("RECEITA_EMBARQUE_GAP", ((BigDecimal) row.get("RECEITA_EMBARQUE_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null ? this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") : BigDecimal.ZERO));
row.put("RECEITA_OUTROS", ((BigDecimal) row.get("RECEITA_OUTROS")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTEOUTROS") != null ? this.resultSet.getBigDecimal("IMPORTEOUTROS") : BigDecimal.ZERO));
row.put("RECEITA_OUTROS_GAP", ((BigDecimal) row.get("RECEITA_OUTROS_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEOUTROS") != null ? this.resultSet.getBigDecimal("IMPORTEOUTROS") : BigDecimal.ZERO));
row.put("RECEITA_OUTROS_GAP", ((BigDecimal) row.get("RECEITA_OUTROS_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEOUTROS") != null ? this.resultSet.getBigDecimal("IMPORTEOUTROS") : BigDecimal.ZERO));
row.put("RECEITA_PEDAGIO", ((BigDecimal) row.get("RECEITA_PEDAGIO")).add(!tipoVentaId.equals(18) && !tipoVentaId.equals(39) && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null ? this.resultSet.getBigDecimal("IMPORTEPEDAGIO") : BigDecimal.ZERO));
row.put("RECEITA_PEDAGIO_GAP", ((BigDecimal) row.get("RECEITA_PEDAGIO_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null ? this.resultSet.getBigDecimal("IMPORTEPEDAGIO") : BigDecimal.ZERO));
row.put("RECEITA_PEDAGIO_GAP", ((BigDecimal) row.get("RECEITA_PEDAGIO_GAP")).add((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null ? this.resultSet.getBigDecimal("IMPORTEPEDAGIO") : BigDecimal.ZERO));
row.put("IMPOSTOS", ((BigDecimal) row.get("IMPOSTOS")).add(!tipoVentaId.equals(18) || (tipoVentaId.equals(18) && (Boolean) this.relatorio.getParametros().get("B_CONTEMPLAR_GAP")) ? getValorImposto(puntoVentaId, this.resultSet.getString("INTERESTADUAL"), this.resultSet.getBigDecimal("PRECIOPAGADO"), this.resultSet.getBigDecimal("IMPORTESEGURO"), this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE"), this.resultSet.getBigDecimal("IMPORTEPEDAGIO")) : BigDecimal.ZERO));
// Realiza os calculos de comissão se o tipo de venda não for "EM ABERTO" e se for venda normal, ou se for GAP e o check estiver marcado
if (!tipoVentaId.equals(9) && ((!tipoVentaId.equals(18) && !tipoVentaId.equals(39) ) || ((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && (Boolean) this.relatorio.getParametros().get("B_CONTEMPLAR_GAP"))))
if (!tipoVentaId.equals(9) && ((!tipoVentaId.equals(18) && !tipoVentaId.equals(39)) || ((tipoVentaId.equals(18) || tipoVentaId.equals(39)) && (Boolean) this.relatorio.getParametros().get("B_CONTEMPLAR_GAP"))))
this.setRowComissao(row);
}
else {
@ -370,8 +370,6 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
mapCacheConfigComissao.put(puntoVentaId.toString() + "_" + empresaId.toString(), cacheConfig);
}
else {
StringBuilder sqlParam = new StringBuilder();
@ -394,7 +392,7 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
rsParam.close();
stmtParam.close();
}
rs.close();
stmt.close();
@ -409,173 +407,28 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
public HashMap<String, Object> getConfigImposto(Integer puntoVentaId) throws Exception {
HashMap<String, Object> cacheConfig = null;
// Verifica se já existe configuração na memoria, caso não exista, realiza busca no banco
if (!mapCacheConfigImposto.containsKey(puntoVentaId.toString())) {
StringBuilder sql = new StringBuilder();
sql.append("SELECT EI.*, ES.NOMBESTADO, EM.NOMBEMPRESA ");
sql.append(" FROM PUNTO_VENTA PV, PARADA PR, CIUDAD CD, EMPRESA_IMPOSTO EI, ESTADO ES, EMPRESA EM ");
sql.append("WHERE PV.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
sql.append(" AND PV.PARADA_ID = PR.PARADA_ID ");
sql.append(" AND PR.CIUDAD_ID = CD.CIUDAD_ID ");
sql.append(" AND CD.ESTADO_ID = EI.ESTADO_ID (+) ");
sql.append(" AND PV.EMPRESA_ID = NVL(EI.EMPRESA_ID, PV.EMPRESA_ID) ");
sql.append(" AND CD.ESTADO_ID = ES.ESTADO_ID ");
sql.append(" AND PV.EMPRESA_ID = EM.EMPRESA_ID ");
sql.append(" AND NVL(EI.ACTIVO, 1) = 1 ");
NamedParameterStatement stmt = new NamedParameterStatement(this.getConexao(), sql.toString());
stmt.setInt("PUNTOVENTA_ID", puntoVentaId);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
if (rs.getBigDecimal("ICMS") != null) {
cacheConfig = new HashMap<String, Object>();
cacheConfig.put("PORCREDBASEICMS", rs.getBigDecimal("PORCREDBASEICMS"));
cacheConfig.put("PORCREDESTADUAL", rs.getBigDecimal("PORCREDESTADUAL"));
cacheConfig.put("INDTARIFAESTADUAL", rs.getBoolean("INDTARIFAESTADUAL"));
cacheConfig.put("INDSEGUROESTADUAL", rs.getBoolean("INDSEGUROESTADUAL"));
cacheConfig.put("INDTXEMBARQUEESTADUAL", rs.getBoolean("INDTXEMBARQUEESTADUAL"));
cacheConfig.put("INDPEDAGIOESTDUAL", rs.getBoolean("INDPEDAGIOESTDUAL"));
cacheConfig.put("PORCREDMUNICIPAL", rs.getBigDecimal("PORCREDMUNICIPAL"));
cacheConfig.put("INDTARIFAMUNICIPAL", rs.getBoolean("INDTARIFAMUNICIPAL"));
cacheConfig.put("INDSEGUROMUNICIPAL", rs.getBoolean("INDSEGUROMUNICIPAL"));
cacheConfig.put("INDTXEMBARQUEMUNICIPAL", rs.getBoolean("INDTXEMBARQUEMUNICIPAL"));
cacheConfig.put("INDPEDAGIOMUNICIPAL", rs.getBoolean("INDPEDAGIOMUNICIPAL"));
cacheConfig.put("INDJANEIRO", rs.getBoolean("INDJANEIRO"));
cacheConfig.put("INDFEVEREIRO", rs.getBoolean("INDFEVEREIRO"));
cacheConfig.put("INDMARCO", rs.getBoolean("INDMARCO"));
cacheConfig.put("INDABRIL", rs.getBoolean("INDABRIL"));
cacheConfig.put("INDMAIO", rs.getBoolean("INDMAIO"));
cacheConfig.put("INDJUNHO", rs.getBoolean("INDJUNHO"));
cacheConfig.put("INDJULHO", rs.getBoolean("INDJULHO"));
cacheConfig.put("INDAGOSTO", rs.getBoolean("INDAGOSTO"));
cacheConfig.put("INDSETEMBRO", rs.getBoolean("INDSETEMBRO"));
cacheConfig.put("INDOUTUBRO", rs.getBoolean("INDOUTUBRO"));
cacheConfig.put("INDNOVEMBRO", rs.getBoolean("INDNOVEMBRO"));
cacheConfig.put("INDDEZEMBRO", rs.getBoolean("INDDEZEMBRO"));
cacheConfig.put("ICMS", rs.getBigDecimal("ICMS"));
cacheConfig.put("PORCREDBASEICMS", rs.getBigDecimal("PORCREDBASEICMS"));
this.mapCacheConfigImposto.put(puntoVentaId.toString(), cacheConfig);
}
else
{
this.addInfoMsg("Não foi possivel obter a configuração de imposto para o estado: " + rs.getString("NOMBESTADO") + " empresa: " + rs.getString("NOMBEMPRESA"));
}
};
rs.close();
stmt.close();
try {
cacheConfig = (HashMap<String, Object>) CalculoImposto.getConfigImpostoByPuntoVenta(this.getConexao(), puntoVentaId);
} catch (Exception e) {
if (e instanceof ExceptionConfiguracao)
this.addInfoMsg(e.getMessage());
else
throw e;
}
else
cacheConfig = mapCacheConfigImposto.get(puntoVentaId.toString());
return cacheConfig;
}
public BigDecimal getValorImposto(Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio) throws Exception {
HashMap<String, Object> configImposto = new HashMap<String, Object>();
BigDecimal baseCalculo = BigDecimal.ZERO;
BigDecimal icms;
BigDecimal porcRedEstadual;
BigDecimal porcRedMunicipal;
BigDecimal porcRedBaseIcms;
BigDecimal valorIcms = BigDecimal.ZERO;
Boolean indTarifaMunicipal;
Boolean indSeguroMunicipal;
Boolean indTxEmbarqueMunicipal;
Boolean indPedagioMunicipal;
Boolean indTarifaEstadual;
Boolean indSeguroEstadual;
Boolean indTxEmbarqueEstadual;
Boolean indPedagioEstadual;
configImposto = this.getConfigImposto(puntoVentaId);
if (configImposto == null)
return BigDecimal.ZERO;
icms = (BigDecimal) configImposto.get("ICMS");
porcRedBaseIcms = (BigDecimal) configImposto.get("PORCREDBASEICMS");
if (indInterestadual.equals("S")) {
porcRedEstadual = (BigDecimal) configImposto.get("PORCREDESTADUAL");
indTarifaEstadual = (Boolean) configImposto.get("INDTARIFAESTADUAL");
indSeguroEstadual = (Boolean) configImposto.get("INDSEGUROESTADUAL");
indTxEmbarqueEstadual = (Boolean) configImposto.get("INDTXEMBARQUEESTADUAL");
indPedagioEstadual = (Boolean) configImposto.get("INDPEDAGIOESTDUAL");
// System.out.println(" Tarifa: "+ tarifa +" seguro: "+ seguro +" embarque: "+ embarque +" pedagio: "+ pedagio);
// Criação da base de calculo
baseCalculo = indTarifaEstadual && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indSeguroEstadual && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indTxEmbarqueEstadual && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioEstadual && pedagio != null ? baseCalculo.add(pedagio) : BigDecimal.ZERO;
// Redução da base de calculo
if (porcRedBaseIcms != null && porcRedBaseIcms.equals(BigDecimal.ZERO))
// BASE DE CALCULO = BASE DE CALCULO - ((PERCENTUAL DE REDUÇÃO / 100) * BASE DE CALCULO ))
baseCalculo = baseCalculo.subtract(porcRedBaseIcms.divide(BigDecimal.valueOf(100)).multiply(baseCalculo));
// Calcula o valor do ICMS
valorIcms = baseCalculo.multiply(icms.divide(BigDecimal.valueOf(100)));
// Redução estadual
if (porcRedEstadual != null && porcRedEstadual.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedEstadual.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
// System.out.println("INTER BASE DE CALCULO: "+baseCalculo+" VALOR ICMS: "+ valorIcms);
try {
return CalculoImposto.getValorImposto(this.getConexao(), puntoVentaId, indInterestadual, tarifa, seguro, embarque, pedagio);
} catch (Exception e) {
if (e instanceof ExceptionConfiguracao)
this.addInfoMsg(e.getMessage());
else
throw e;
}
else {
porcRedMunicipal = (BigDecimal) configImposto.get("PORCREDMUNICIPAL");
indTarifaMunicipal = (Boolean) configImposto.get("INDTARIFAMUNICIPAL");
indSeguroMunicipal = (Boolean) configImposto.get("INDSEGUROMUNICIPAL");
indTxEmbarqueMunicipal = (Boolean) configImposto.get("INDTXEMBARQUEMUNICIPAL");
indPedagioMunicipal = (Boolean) configImposto.get("INDPEDAGIOMUNICIPAL");
baseCalculo = indTarifaMunicipal && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indSeguroMunicipal && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indTxEmbarqueMunicipal && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioMunicipal && pedagio != null ? baseCalculo.add(pedagio) : BigDecimal.ZERO;
// Redução da base de calculo
if (porcRedBaseIcms != null && porcRedBaseIcms.equals(BigDecimal.ZERO))
// BASE DE CALCULO = BASE DE CALCULO - ((PERCENTUAL DE REDUÇÃO / 100) * BASE DE CALCULO ))
baseCalculo = baseCalculo.subtract(porcRedBaseIcms.divide(BigDecimal.valueOf(100)).multiply(baseCalculo));
// Calcula o valor do ICMS
valorIcms = baseCalculo.multiply(icms.divide(BigDecimal.valueOf(100)));
// Redução estadual
if (porcRedMunicipal != null && porcRedMunicipal.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedMunicipal.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
// System.out.println("MUN BASE DE CALCULO: "+baseCalculo+" VALOR ICMS: "+ valorIcms);
}
return valorIcms;
return BigDecimal.ZERO;
}
public BigDecimal getValorReceitaBagagem(Integer puntoVentaId) throws SQLException {

View File

@ -0,0 +1,209 @@
/**
*
*/
package com.rjconsultores.ventaboletos.relatorios.impl;
import java.math.BigDecimal;
import java.sql.Connection;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
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.web.utilerias.NamedParameterStatement;
/**
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
*
*/
public class RelatorioTaxasLinha extends Relatorio {
/**
* @param parametros
* @param conexao
* @throws Exception
*/
public RelatorioTaxasLinha(Map<String, Object> parametros, Connection conexao) throws Exception {
super(parametros, conexao);
// TODO Auto-generated constructor stub
this.setCustomDataSource(new DataSource(this) {
public void initDados() throws Exception {
Connection conexao = this.relatorio.getConexao();
Map<String, Object> parametros = this.relatorio.getParametros();
String sql = getSql();
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql);
stmt.setInt("TIPO_DATA", (Integer) parametros.get("TIPO_DATA"));
stmt.setDate("DATA_INICIAL", new java.sql.Date(((Date) parametros.get("DATA_INICIAL")).getTime()));
stmt.setDate("DATA_FINAL", new java.sql.Date(((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("NUMPUNTOVENTA") != null)
stmt.setString("NUMPUNTOVENTA", (String) parametros.get("NUMPUNTOVENTA"));
else
stmt.setNull("NUMPUNTOVENTA", java.sql.Types.VARCHAR);
if (parametros.get("ORIGEN_ID") != null)
stmt.setInt("ORIGEN_ID", (Integer) parametros.get("ORIGEN_ID"));
else
stmt.setNull("ORIGEN_ID", java.sql.Types.INTEGER);
if (parametros.get("DESTINO_ID") != null)
stmt.setInt("DESTINO_ID", (Integer) parametros.get("DESTINO_ID"));
else
stmt.setNull("DESTINO_ID", java.sql.Types.INTEGER);
this.resultSet = stmt.executeQuery();
}
public Object valueCustomFields(String fieldName) throws Exception {
// Se não for pra subtrair o ICMS, realiza o calculo e adiciona o mesmo
if (!(Boolean) this.relatorio.getParametros().get("B_SUBTRAIR_ICMS")) {
BigDecimal valorIcms = BigDecimal.ZERO;
String indInterestadual = this.resultSet.getString("INTERESTADUAL");
Integer puntoVentaId = this.resultSet.getInt("PUNTOVENTA_ID");
try {
if (fieldName.equals("IMPORTETAXAEMBARQUE") && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null && !this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE"), BigDecimal.ZERO);
return this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").add(valorIcms);
}
else if (fieldName.equals("IMPORTEPEDAGIO") && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null && !this.resultSet.getBigDecimal("IMPORTEPEDAGIO").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTEPEDAGIO"));
return this.resultSet.getBigDecimal("IMPORTEPEDAGIO").add(valorIcms);
}
else if (fieldName.equals("IMPORTESEGURO") && this.resultSet.getBigDecimal("IMPORTESEGURO") != null && !this.resultSet.getBigDecimal("IMPORTESEGURO").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTESEGURO"), BigDecimal.ZERO, BigDecimal.ZERO);
return this.resultSet.getBigDecimal("IMPORTESEGURO").add(valorIcms);
}
else if (fieldName.equals("TOTAL_EMBARQUE") && !this.resultSet.getBigDecimal("TOTAL_EMBARQUE").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_EMBARQUE"), BigDecimal.ZERO, BigDecimal.ZERO);
return this.resultSet.getBigDecimal("TOTAL_EMBARQUE").add(valorIcms);
}
else if (fieldName.equals("TOTAL_PEDAGIO") && !this.resultSet.getBigDecimal("TOTAL_PEDAGIO").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_PEDAGIO"));
return this.resultSet.getBigDecimal("TOTAL_PEDAGIO").add(valorIcms);
}
else if (fieldName.equals("TOTAL_SEGURO") && !this.resultSet.getBigDecimal("TOTAL_SEGURO").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), puntoVentaId, indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_SEGURO"), BigDecimal.ZERO, BigDecimal.ZERO);
return this.resultSet.getBigDecimal("TOTAL_SEGURO").add(valorIcms);
}
} catch (Exception e) {
if (e instanceof ExceptionConfiguracao)
this.relatorio.addInfoMsg(e.getMessage());
else
throw e;
}
}
return null;
}
});
}
/*
* (non-Javadoc)
*
* @see com.rjconsultores.ventaboletos.relatorios.utilitarios.Relatorio#processaParametros()
*/
@Override
protected void processaParametros() throws Exception {
// TODO Auto-generated method stub
}
public HashMap<String, Object> getConfigImposto(Integer puntoVentaId) throws Exception {
HashMap<String, Object> cacheConfig = null;
try {
cacheConfig = (HashMap<String, Object>) CalculoImposto.getConfigImpostoByPuntoVenta(this.getConexao(), puntoVentaId);
} catch (Exception e) {
if (e instanceof ExceptionConfiguracao)
this.addInfoMsg(e.getMessage());
else
throw e;
}
return cacheConfig;
}
private String getSql() {
StringBuilder sql = new StringBuilder();
sql.append(" SELECT RT.PREFIXO, ");
sql.append(" PO.DESCPARADA CIDADE_ORIGEM, ");
sql.append(" PD.DESCPARADA CIDADE_DESTINO, ");
sql.append(" CJ.IMPORTETAXAEMBARQUE, ");
sql.append(" CJ.IMPORTEPEDAGIO, ");
sql.append(" CJ.IMPORTESEGURO, ");
sql.append(" EM.NOMBEMPRESA, ");
sql.append(" CJ.PUNTOVENTA_ID, ");
sql.append(" PV.NOMBPUNTOVENTA, ");
sql.append(" CASE ");
sql.append(" WHEN CO.ESTADO_ID <> CD.ESTADO_ID THEN ");
sql.append(" 'S' ");
sql.append(" ELSE ");
sql.append(" 'N' ");
sql.append(" END INTERESTADUAL, ");
sql.append(" COUNT(1) TOTAL_VENDIDOS, ");
sql.append(" SUM(CJ.IMPORTETAXAEMBARQUE) TOTAL_EMBARQUE, ");
sql.append(" SUM(CJ.IMPORTEPEDAGIO) TOTAL_PEDAGIO, ");
sql.append(" SUM(CJ.IMPORTESEGURO) TOTAL_SEGURO ");
sql.append(" FROM CORRIDA CR, ");
sql.append(" RUTA RT, ");
sql.append(" PUNTO_VENTA PV, ");
sql.append(" CAJA CJ, ");
sql.append(" PARADA PO, ");
sql.append(" PARADA PD, ");
sql.append(" CIUDAD CO, ");
sql.append(" CIUDAD CD, ");
sql.append(" EMPRESA EM ");
sql.append(" WHERE CR.RUTA_ID = RT.RUTA_ID ");
sql.append(" AND CJ.CORRIDA_ID = CR.CORRIDA_ID ");
sql.append(" AND CJ.FECCORRIDA = CR.FECCORRIDA ");
sql.append(" AND PO.PARADA_ID = CJ.ORIGEN_ID ");
sql.append(" AND PD.PARADA_ID = CJ.DESTINO_ID ");
sql.append(" AND PV.PUNTOVENTA_ID = CJ.PUNTOVENTA_ID ");
sql.append(" AND EM.EMPRESA_ID = CJ.EMPRESACORRIDA_ID ");
sql.append(" AND CO.CIUDAD_ID = PO.CIUDAD_ID ");
sql.append(" AND CD.CIUDAD_ID = PD.CIUDAD_ID ");
sql.append(" AND CJ.INDSTATUSOPERACION = 'F' ");
sql.append(" AND CJ.INDREIMPRESION = 0 ");
sql.append(" AND CJ.INDCANCELACION = 0 ");
sql.append(" AND DECODE(:TIPO_DATA, 1, CJ.FECCORRIDA, 2, CJ.FECHORVENTA) BETWEEN ");
sql.append(" :DATA_INICIAL AND :DATA_FINAL ");
sql.append(" AND EM.EMPRESA_ID = NVL(:EMPRESA_ID, EM.EMPRESA_ID) ");
sql.append(" AND PV.NUMPUNTOVENTA = NVL(:NUMPUNTOVENTA, PV.NUMPUNTOVENTA) ");
sql.append(" AND PO.PARADA_ID = NVL(:ORIGEN_ID, PO.PARADA_ID) ");
sql.append(" AND PD.PARADA_ID = NVL(:DESTINO_ID, PD.PARADA_ID) ");
sql.append(" GROUP BY RT.PREFIXO, ");
sql.append(" PO.DESCPARADA, ");
sql.append(" PD.DESCPARADA, ");
sql.append(" CJ.IMPORTETAXAEMBARQUE, ");
sql.append(" CJ.IMPORTEPEDAGIO, ");
sql.append(" CJ.IMPORTESEGURO, ");
sql.append(" CO.ESTADO_ID, ");
sql.append(" CD.ESTADO_ID, ");
sql.append(" EM.NOMBEMPRESA, ");
sql.append(" CJ.PUNTOVENTA_ID, ");
sql.append(" PV.NOMBPUNTOVENTA ");
sql.append(" ORDER BY EM.NOMBEMPRESA, PO.DESCPARADA ");
return sql.toString();
}
}

View File

@ -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:

View File

@ -0,0 +1,207 @@
/**
*
*/
package com.rjconsultores.ventaboletos.relatorios.negocio;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import com.rjconsultores.ventaboletos.relatorios.utilitarios.ExceptionConfiguracao;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
/**
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
*
*/
public class CalculoImposto {
static Map<String, HashMap<String, Object>> mapCacheConfigImposto = new HashMap<String, HashMap<String, Object>>();
public static Map<String, Object> getConfigImpostoByPuntoVenta(Connection conexao, Integer puntoVentaId) throws SQLException, ExceptionConfiguracao {
HashMap<String, Object> cacheConfig = null;
// Verifica se já existe configuração na memoria, caso não exista, realiza busca no banco
if (!mapCacheConfigImposto.containsKey(puntoVentaId.toString())) {
Boolean isBuscouConfig = false;
StringBuilder sql = new StringBuilder();
sql.append("SELECT EI.*, ES.NOMBESTADO, EM.NOMBEMPRESA ");
sql.append(" FROM PUNTO_VENTA PV, PARADA PR, CIUDAD CD, EMPRESA_IMPOSTO EI, ESTADO ES, EMPRESA EM ");
sql.append("WHERE PV.PUNTOVENTA_ID = :PUNTOVENTA_ID ");
sql.append(" AND PV.PARADA_ID = PR.PARADA_ID ");
sql.append(" AND PR.CIUDAD_ID = CD.CIUDAD_ID ");
sql.append(" AND CD.ESTADO_ID = EI.ESTADO_ID (+) ");
sql.append(" AND PV.EMPRESA_ID = NVL(EI.EMPRESA_ID, PV.EMPRESA_ID) ");
sql.append(" AND CD.ESTADO_ID = ES.ESTADO_ID ");
sql.append(" AND PV.EMPRESA_ID = EM.EMPRESA_ID ");
sql.append(" AND NVL(EI.ACTIVO, 1) = 1 ");
NamedParameterStatement stmt = new NamedParameterStatement(conexao, sql.toString());
stmt.setInt("PUNTOVENTA_ID", puntoVentaId);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
if (rs.getBigDecimal("ICMS") != null) {
isBuscouConfig = true;
cacheConfig = new HashMap<String, Object>();
cacheConfig.put("PORCREDBASEICMS", rs.getBigDecimal("PORCREDBASEICMS"));
cacheConfig.put("PORCREDESTADUAL", rs.getBigDecimal("PORCREDESTADUAL"));
cacheConfig.put("INDTARIFAESTADUAL", rs.getBoolean("INDTARIFAESTADUAL"));
cacheConfig.put("INDSEGUROESTADUAL", rs.getBoolean("INDSEGUROESTADUAL"));
cacheConfig.put("INDTXEMBARQUEESTADUAL", rs.getBoolean("INDTXEMBARQUEESTADUAL"));
cacheConfig.put("INDPEDAGIOESTDUAL", rs.getBoolean("INDPEDAGIOESTDUAL"));
cacheConfig.put("PORCREDMUNICIPAL", rs.getBigDecimal("PORCREDMUNICIPAL"));
cacheConfig.put("INDTARIFAMUNICIPAL", rs.getBoolean("INDTARIFAMUNICIPAL"));
cacheConfig.put("INDSEGUROMUNICIPAL", rs.getBoolean("INDSEGUROMUNICIPAL"));
cacheConfig.put("INDTXEMBARQUEMUNICIPAL", rs.getBoolean("INDTXEMBARQUEMUNICIPAL"));
cacheConfig.put("INDPEDAGIOMUNICIPAL", rs.getBoolean("INDPEDAGIOMUNICIPAL"));
cacheConfig.put("INDJANEIRO", rs.getBoolean("INDJANEIRO"));
cacheConfig.put("INDFEVEREIRO", rs.getBoolean("INDFEVEREIRO"));
cacheConfig.put("INDMARCO", rs.getBoolean("INDMARCO"));
cacheConfig.put("INDABRIL", rs.getBoolean("INDABRIL"));
cacheConfig.put("INDMAIO", rs.getBoolean("INDMAIO"));
cacheConfig.put("INDJUNHO", rs.getBoolean("INDJUNHO"));
cacheConfig.put("INDJULHO", rs.getBoolean("INDJULHO"));
cacheConfig.put("INDAGOSTO", rs.getBoolean("INDAGOSTO"));
cacheConfig.put("INDSETEMBRO", rs.getBoolean("INDSETEMBRO"));
cacheConfig.put("INDOUTUBRO", rs.getBoolean("INDOUTUBRO"));
cacheConfig.put("INDNOVEMBRO", rs.getBoolean("INDNOVEMBRO"));
cacheConfig.put("INDDEZEMBRO", rs.getBoolean("INDDEZEMBRO"));
cacheConfig.put("ICMS", rs.getBigDecimal("ICMS"));
cacheConfig.put("PORCREDBASEICMS", rs.getBigDecimal("PORCREDBASEICMS"));
}
String estado = rs.getString("NOMBESTADO");
String empresa = rs.getString("NOMBEMPRESA");
if(!rs.isClosed())
rs.close();
if(!stmt.isClosed())
stmt.close();
if (!isBuscouConfig)
throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para o estado: " + estado + " empresa: " + empresa);
};
if (!isBuscouConfig)
throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para agência "+puntoVentaId);
mapCacheConfigImposto.put(puntoVentaId.toString(), cacheConfig);
}
else
cacheConfig = mapCacheConfigImposto.get(puntoVentaId.toString());
return cacheConfig;
}
public static BigDecimal getValorImposto(Connection conexao, Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio) throws Exception {
HashMap<String, Object> configImposto = new HashMap<String, Object>();
BigDecimal baseCalculo = BigDecimal.ZERO;
BigDecimal icms;
BigDecimal porcRedEstadual;
BigDecimal porcRedMunicipal;
BigDecimal porcRedBaseIcms;
BigDecimal valorIcms = BigDecimal.ZERO;
Boolean indTarifaMunicipal;
Boolean indSeguroMunicipal;
Boolean indTxEmbarqueMunicipal;
Boolean indPedagioMunicipal;
Boolean indTarifaEstadual;
Boolean indSeguroEstadual;
Boolean indTxEmbarqueEstadual;
Boolean indPedagioEstadual;
configImposto = (HashMap<String, Object>) getConfigImpostoByPuntoVenta(conexao,puntoVentaId);
if (configImposto == null)
return BigDecimal.ZERO;
icms = (BigDecimal) configImposto.get("ICMS");
porcRedBaseIcms = (BigDecimal) configImposto.get("PORCREDBASEICMS");
if (indInterestadual.equals("S")) {
porcRedEstadual = (BigDecimal) configImposto.get("PORCREDESTADUAL");
indTarifaEstadual = (Boolean) configImposto.get("INDTARIFAESTADUAL");
indSeguroEstadual = (Boolean) configImposto.get("INDSEGUROESTADUAL");
indTxEmbarqueEstadual = (Boolean) configImposto.get("INDTXEMBARQUEESTADUAL");
indPedagioEstadual = (Boolean) configImposto.get("INDPEDAGIOESTDUAL");
// System.out.println(" Tarifa: "+ tarifa +" seguro: "+ seguro +" embarque: "+ embarque +" pedagio: "+ pedagio);
// Criação da base de calculo
baseCalculo = indTarifaEstadual && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indSeguroEstadual && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indTxEmbarqueEstadual && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioEstadual && pedagio != null ? baseCalculo.add(pedagio) : BigDecimal.ZERO;
// Redução da base de calculo
if (porcRedBaseIcms != null && porcRedBaseIcms.equals(BigDecimal.ZERO))
// BASE DE CALCULO = BASE DE CALCULO - ((PERCENTUAL DE REDUÇÃO / 100) * BASE DE CALCULO ))
baseCalculo = baseCalculo.subtract(porcRedBaseIcms.divide(BigDecimal.valueOf(100)).multiply(baseCalculo));
// Calcula o valor do ICMS
valorIcms = baseCalculo.multiply(icms.divide(BigDecimal.valueOf(100)));
// Redução estadual
if (porcRedEstadual != null && porcRedEstadual.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedEstadual.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
// System.out.println("INTER BASE DE CALCULO: "+baseCalculo+" VALOR ICMS: "+ valorIcms);
}
else {
porcRedMunicipal = (BigDecimal) configImposto.get("PORCREDMUNICIPAL");
indTarifaMunicipal = (Boolean) configImposto.get("INDTARIFAMUNICIPAL");
indSeguroMunicipal = (Boolean) configImposto.get("INDSEGUROMUNICIPAL");
indTxEmbarqueMunicipal = (Boolean) configImposto.get("INDTXEMBARQUEMUNICIPAL");
indPedagioMunicipal = (Boolean) configImposto.get("INDPEDAGIOMUNICIPAL");
baseCalculo = indTarifaMunicipal && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indSeguroMunicipal && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indTxEmbarqueMunicipal && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioMunicipal && pedagio != null ? baseCalculo.add(pedagio) : BigDecimal.ZERO;
// Redução da base de calculo
if (porcRedBaseIcms != null && porcRedBaseIcms.equals(BigDecimal.ZERO))
// BASE DE CALCULO = BASE DE CALCULO - ((PERCENTUAL DE REDUÇÃO / 100) * BASE DE CALCULO ))
baseCalculo = baseCalculo.subtract(porcRedBaseIcms.divide(BigDecimal.valueOf(100)).multiply(baseCalculo));
// Calcula o valor do ICMS
valorIcms = baseCalculo.multiply(icms.divide(BigDecimal.valueOf(100)));
// Redução estadual
if (porcRedMunicipal != null && porcRedMunicipal.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedMunicipal.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
// System.out.println("MUN BASE DE CALCULO: "+baseCalculo+" VALOR ICMS: "+ valorIcms);
}
return valorIcms;
}
}

View File

@ -0,0 +1,438 @@
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RelatorioTaxasLinha" pageWidth="595" pageHeight="842" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="efbc89d4-6f08-4ea5-802f-d4f48ed208e2">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="22"/>
<property name="ireport.y" value="0"/>
<style name="textStyle" isDefault="true" fontSize="6" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<parameter name="DATA_INICIAL" class="java.util.Date"/>
<parameter name="DATA_FINAL" class="java.util.Date"/>
<parameter name="EMPRESA" class="java.lang.String"/>
<parameter name="NOME_RELATORIO" class="java.lang.String"/>
<parameter name="EMPRESA_ID" class="java.lang.Integer"/>
<parameter name="USUARIO" class="java.lang.String"/>
<parameter name="FILTROS" class="java.lang.String"/>
<parameter name="TIPO_DATA" class="java.lang.Integer"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="PREFIXO" class="java.lang.String"/>
<field name="CIDADE_ORIGEM" class="java.lang.String"/>
<field name="CIDADE_DESTINO" class="java.lang.String"/>
<field name="IMPORTETAXAEMBARQUE" class="java.math.BigDecimal"/>
<field name="IMPORTEPEDAGIO" class="java.math.BigDecimal"/>
<field name="IMPORTESEGURO" class="java.math.BigDecimal"/>
<field name="TOTAL_VENDIDOS" class="java.math.BigDecimal"/>
<field name="TOTAL_EMBARQUE" class="java.math.BigDecimal"/>
<field name="TOTAL_PEDAGIO" class="java.math.BigDecimal"/>
<field name="TOTAL_SEGURO" class="java.math.BigDecimal"/>
<field name="NOMBEMPRESA" class="java.lang.String"/>
<field name="NOMBPUNTOVENTA" class="java.lang.String"/>
<variable name="TOTAL_VENDIDOS_1" class="java.math.BigDecimal" resetType="Group" resetGroup="grpEmpresa" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_VENDIDOS}]]></variableExpression>
</variable>
<variable name="TOTAL_EMBARQUE_1" class="java.math.BigDecimal" resetType="Group" resetGroup="grpEmpresa" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_EMBARQUE}]]></variableExpression>
</variable>
<variable name="TOTAL_PEDAGIO_1" class="java.math.BigDecimal" resetType="Group" resetGroup="grpEmpresa" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_PEDAGIO}]]></variableExpression>
</variable>
<variable name="TOTAL_SEGURO_1" class="java.math.BigDecimal" resetType="Group" resetGroup="grpEmpresa" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_SEGURO}]]></variableExpression>
</variable>
<variable name="TOTAL_VENDIDOS_2" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_VENDIDOS}]]></variableExpression>
</variable>
<variable name="TOTAL_EMBARQUE_2" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_EMBARQUE}]]></variableExpression>
</variable>
<variable name="TOTAL_PEDAGIO_2" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_PEDAGIO}]]></variableExpression>
</variable>
<variable name="TOTAL_SEGURO_2" class="java.math.BigDecimal" calculation="Sum">
<variableExpression><![CDATA[$F{TOTAL_SEGURO}]]></variableExpression>
</variable>
<group name="grpEmpresa">
<groupExpression><![CDATA[$F{NOMBEMPRESA}]]></groupExpression>
<groupHeader>
<band height="14">
<textField>
<reportElement uuid="95e0028f-60d8-4bbf-afea-a2f3d40b2deb" x="0" y="0" width="187" height="14"/>
<textElement verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Empresa: "+$F{NOMBEMPRESA}]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="11">
<staticText>
<reportElement uuid="2a963103-78f6-46c6-ac37-29ed4654df56" x="0" y="0" width="51" height="11"/>
<textElement/>
<text><![CDATA[Total Empresa: ]]></text>
</staticText>
<textField>
<reportElement uuid="3fcf21e1-b360-4146-ae72-864f9ed007de" x="307" y="0" width="48" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_VENDIDOS_1}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="0617c1e5-cd2f-4b67-ba79-d68c6604275e" x="354" y="0" width="64" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_EMBARQUE_1}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="64e6d5bd-b475-479b-a12b-c4c28025fd57" x="418" y="0" width="68" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_PEDAGIO_1}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="2cf7fe63-7c91-47d0-9ccb-71e1f669579f" x="486" y="0" width="68" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_SEGURO_1}]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="7fc66df3-edd7-4149-847e-1375a3621e80" x="0" y="10" width="554" height="1" forecolor="#666666"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement uuid="c4a77336-68c6-4e8e-8cd0-ee9c5cdcea51" x="0" y="0" width="554" height="1" forecolor="#666666"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<pageHeader>
<band height="59" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="2ed4524d-5c06-487c-a8f1-abc59a8ef7fc" mode="Transparent" x="1" y="1" width="257" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{NOME_RELATORIO}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="fc199edd-4f2f-4b5f-9397-44f4af50a920" mode="Transparent" x="1" y="16" width="44" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodo}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="f64c2e3c-d936-4072-a0b1-d914f408bbbb" mode="Transparent" x="46" y="16" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA_INICIAL}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="false">
<reportElement uuid="00093c35-d3a5-4b0e-8a7a-26a86912dd25" mode="Transparent" x="107" y="16" width="51" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{DATA_FINAL}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="def1b81c-a286-4749-9ef7-f90984a3a5eb" mode="Transparent" x="97" y="16" width="10" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.periodoA}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy HH:mm" isBlankWhenNull="false">
<reportElement uuid="ea4dfc22-27b5-4600-8e8b-7d74460ed744" mode="Transparent" x="461" y="0" width="89" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<line>
<reportElement uuid="d9b398e6-2fe9-4a3d-bceb-f9db7a06e5a9" x="-4" y="43" width="554" height="1"/>
</line>
<textField>
<reportElement uuid="a46c91f5-fb60-48d8-93c1-3814ce0160dd" x="379" y="0" width="80" height="15"/>
<textElement textAlignment="Right">
<font size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.dataHora}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="623b5d82-e7b3-4439-96c5-f44833fb8864" mode="Transparent" x="450" y="31" width="100" height="12" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.impressorPor}+" "+$P{USUARIO}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="ccec8b66-ed79-418b-b66d-15d9ed3bf2ce" mode="Transparent" x="1" y="44" width="45" height="14" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.filtros}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="98fc1c7e-3fee-4c70-924f-2cbb17fd243f" x="47" y="44" width="717" height="14"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression><![CDATA[$P{FILTROS}]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement uuid="6aae4c9b-2e2a-4fd5-9115-760449d3c263" mode="Transparent" x="430" y="16" width="105" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$R{cabecalho.pagina}+" "+$V{PAGE_NUMBER}+" "+$R{cabecalho.de}]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
<reportElement uuid="5a57c3a1-ed8e-46fb-836f-d250116a238a" mode="Transparent" x="535" y="16" width="15" height="15" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="9" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="13">
<line>
<reportElement uuid="04a75f17-3686-484b-be43-7b7e22e9def7" x="0" y="0" width="554" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<line>
<reportElement uuid="d9f712d0-01a8-4241-a1e6-dc096b4ee773" x="0" y="12" width="554" height="1"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
<staticText>
<reportElement uuid="9c579f27-ee14-4804-b73d-64994a6e41ec" x="0" y="1" width="50" height="11"/>
<textElement>
<font size="7"/>
</textElement>
<text><![CDATA[Prefixo]]></text>
</staticText>
<staticText>
<reportElement uuid="7b8a8f38-e513-4a8c-a82b-a9c6ffd21f6f" x="50" y="1" width="55" height="11"/>
<textElement>
<font size="7"/>
</textElement>
<text><![CDATA[Origem]]></text>
</staticText>
<staticText>
<reportElement uuid="4f8fcbb3-73e7-4b15-9687-30ff12bb1526" x="105" y="1" width="55" height="11"/>
<textElement>
<font size="7"/>
</textElement>
<text><![CDATA[Destino]]></text>
</staticText>
<staticText>
<reportElement uuid="7b817589-f754-49f1-bf53-856be52946fb" mode="Transparent" x="211" y="1" width="32" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Tx. Emb.]]></text>
</staticText>
<staticText>
<reportElement uuid="93a5880a-7547-4e53-85f4-09a6c22d5699" mode="Transparent" x="243" y="1" width="32" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Tx. Ped.]]></text>
</staticText>
<staticText>
<reportElement uuid="1d4f5650-a014-468d-a9b2-c58887492ace" mode="Transparent" x="275" y="1" width="32" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Tx. Seg.]]></text>
</staticText>
<staticText>
<reportElement uuid="9b724ccc-0e90-4271-9e51-54128161d074" mode="Transparent" x="355" y="1" width="63" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Total Tx. Embarque]]></text>
</staticText>
<staticText>
<reportElement uuid="88be8133-60fd-45a5-9c81-363647bb3002" mode="Transparent" x="418" y="1" width="68" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Total Tx. Pedagio]]></text>
</staticText>
<staticText>
<reportElement uuid="bb5f610e-adc6-4f73-ba16-11ce1ec169a3" mode="Transparent" x="486" y="1" width="68" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Total Tx. Seguro]]></text>
</staticText>
<staticText>
<reportElement uuid="c41834a6-5ca0-4bba-a5ac-0cc2dd7a35b5" mode="Transparent" x="307" y="1" width="48" height="11" forecolor="#000000" backcolor="#FFFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" markup="none">
<font fontName="SansSerif" size="7" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Vendidos]]></text>
</staticText>
<staticText>
<reportElement uuid="32c20a27-414c-41be-86b2-0d23645acd18" x="160" y="1" width="51" height="11"/>
<textElement>
<font size="7"/>
</textElement>
<text><![CDATA[Agência]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="11">
<textField>
<reportElement uuid="b12cbc2b-3eac-4c2c-b94c-cac2e746b2c2" x="0" y="0" width="49" height="11"/>
<textElement/>
<textFieldExpression><![CDATA[$F{PREFIXO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="d19cff45-ad13-4a6b-b6f3-3e871a6d8d58" x="51" y="0" width="54" height="11"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CIDADE_ORIGEM}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="f868a599-c0bb-4187-97b6-7681b753abbf" x="105" y="0" width="55" height="11"/>
<textElement/>
<textFieldExpression><![CDATA[$F{CIDADE_DESTINO}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="6454beed-fb72-4aa5-8bff-7eb4ea6c26ba" x="211" y="0" width="32" height="11"/>
<textElement textAlignment="Right" markup="none"/>
<textFieldExpression><![CDATA[$F{IMPORTETAXAEMBARQUE}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="1242bccb-ce44-47d6-ac13-6f4df97f707e" x="243" y="0" width="32" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{IMPORTEPEDAGIO}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="2184d556-1501-4525-8d09-510f9d798b86" x="275" y="0" width="32" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{IMPORTESEGURO}]]></textFieldExpression>
</textField>
<textField pattern="">
<reportElement uuid="49969921-90d5-4873-9b56-9b6e6be548c5" x="307" y="0" width="48" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{TOTAL_VENDIDOS}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="58c1e14e-9c44-4e34-8b57-fbb6af384ce3" x="355" y="0" width="63" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{TOTAL_EMBARQUE}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="05426ccc-ff54-4381-8406-ae0c4290a54b" x="418" y="0" width="68" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{TOTAL_PEDAGIO}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00">
<reportElement uuid="8a365def-0ad3-48e8-b942-5d00f5d74a21" x="486" y="0" width="68" height="11"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{TOTAL_SEGURO}]]></textFieldExpression>
</textField>
<textField>
<reportElement uuid="b2a45c9f-3da0-4273-9941-c9e31ee61723" x="160" y="0" width="51" height="11"/>
<textElement/>
<textFieldExpression><![CDATA[$F{NOMBPUNTOVENTA}]]></textFieldExpression>
</textField>
</band>
</detail>
<lastPageFooter>
<band height="11">
<textField evaluationTime="Auto">
<reportElement uuid="f0b0773e-5235-4ee8-84d3-8741ecce0dae" x="307" y="-1" width="48" height="12"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_VENDIDOS_2}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" pattern="#,##0.00">
<reportElement uuid="1d265368-d216-4cec-a824-a0c0b5536a43" x="355" y="-1" width="63" height="12"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_EMBARQUE_2}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" pattern="#,##0.00">
<reportElement uuid="adfa3eb3-6ab0-4141-aced-e3d231e4f433" x="418" y="-1" width="68" height="12"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_PEDAGIO_2}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" pattern="#,##0.00">
<reportElement uuid="a4f4cff0-6b6e-42f0-9f07-7cbd06f5a545" x="486" y="-1" width="68" height="12"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$V{TOTAL_SEGURO_2}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="f7ac3bf7-ac60-405e-b2a3-60c9150421a0" x="0" y="0" width="51" height="11"/>
<textElement/>
<text><![CDATA[Total Geral: ]]></text>
</staticText>
<line>
<reportElement uuid="06fb8df2-dbea-44e7-9e45-21f8aa82f939" x="0" y="10" width="554" height="1" forecolor="#666666"/>
<graphicElement>
<pen lineWidth="0.5"/>
</graphicElement>
</line>
</band>
</lastPageFooter>
<noData>
<band height="39">
<textField>
<reportElement uuid="a640c0eb-ead8-4a2a-bda4-675165e8bc7d" x="148" y="8" width="530" height="20"/>
<textElement markup="none">
<font size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$R{msg.noData}]]></textFieldExpression>
</textField>
</band>
</noData>
</jasperReport>

View File

@ -32,7 +32,9 @@ public class DataSource implements IDataSource {
return (valueCustomField != null) ? valueCustomField : this.resultSet.getObject(field.getName());
} catch (Exception e) {
e.printStackTrace();
throw new JRException(e);
}
}

View File

@ -0,0 +1,14 @@
/**
*
*/
package com.rjconsultores.ventaboletos.relatorios.utilitarios;
/**
* @author Bruno H. G. Gouvêa <bruno@rjconsultores.com.br>
*
*/
public class ExceptionConfiguracao extends Exception {
public ExceptionConfiguracao(String msg){
super(msg);
}
}

View File

@ -0,0 +1,216 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.web.gui.controladores.relatorios;
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.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Radiogroup;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioAcompanhamentoEquivalentes;
import com.rjconsultores.ventaboletos.relatorios.impl.RelatorioTaxasLinha;
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.MyGenericForwardComposer;
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
/**
*
* @author Administrador
*/
@Controller("relatorioTaxasLinhaController")
@Scope("prototype")
public class RelatorioTaxasLinhaController extends MyGenericForwardComposer {
@Autowired
private DataSource dataSource;
@Autowired
private EmpresaService empresaService;
private List<Empresa> lsEmpresa;
private MyComboboxParada cmbParadaOrigem;
private MyComboboxParadaCve cmbParadaOrigemCve;
private MyComboboxParada cmbParadaDestino;
private MyComboboxParadaCve cmbParadaDestinoCve;
private Datebox datInicial;
private Datebox datFinal;
private MyTextbox txtNumPuntoVenta;
private Radiogroup rdGroupTipoData;
private Checkbox chkSubtrairIcms;
private MyComboboxEstandar cmbEmpresa;
public void onClick$btnExecutarRelatorio(Event ev) throws Exception {
executarRelatorio();
}
/**
* @throws Exception
*
*/
private void executarRelatorio() throws Exception {
Relatorio relatorio;
Map<String, Object> parametros = new HashMap<String, Object>();
StringBuilder filtro = new StringBuilder();
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("relatorioTaxasLinhaController.window.title"));
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
parametros.put("TIPO_DATA", Integer.parseInt(rdGroupTipoData.getSelectedItem().getValue()));
parametros.put("NUMPUNTOVENTA", txtNumPuntoVenta.getValue());
parametros.put("B_SUBTRAIR_ICMS", chkSubtrairIcms.isChecked());
filtro.append("Agência: ");
if( txtNumPuntoVenta.getValue().equals(""))
filtro.append("Todas; ");
else
filtro.append(txtNumPuntoVenta.getValue()+"; ");
filtro.append(" Tipo de Data: "+( rdGroupTipoData.getSelectedItem().getValue().equals(1)?" Origem;":"Destino;"));
filtro.append(" Subtrair ICMS: "+( chkSubtrairIcms.isChecked()?" Sim;":"Não;"));
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;");
parametros.put("FILTROS", filtro.toString());
relatorio = new RelatorioTaxasLinha(parametros, dataSource.getConnection());
Map args = new HashMap();
args.put("relatorio", relatorio);
openWindow("/component/reportView.zul",
Labels.getLabel("relatorioTaxasLinhaController.window.title"), args, MODAL);
}
@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);
}
});
}
public List<Empresa> getLsEmpresa() {
return lsEmpresa;
}
public void setLsEmpresa(List<Empresa> lsEmpresa) {
this.lsEmpresa = lsEmpresa;
}
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());
}
}

View File

@ -307,6 +307,10 @@ public class NamedParameterStatement {
public void close() throws SQLException {
statement.close();
}
public Boolean isClosed() throws SQLException {
return statement.isClosed();
}
/**
* Adds the current set of parameters as a batch entry.

View File

@ -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 ItemMenuRelatorioTaxasLinha extends DefaultItemMenuSistema {
public ItemMenuRelatorioTaxasLinha() {
super("indexController.mniRelatorioTaxasLinha.label");
}
@Override
public String getClaveMenu() {
return "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOTAXASLINHA";
}
@Override
public void ejecutar() {
PantallaUtileria.openWindow("/gui/relatorios/filtroRelatorioTaxasLinha.zul",
Labels.getLabel("relatorioTaxasLinhaController.window.title"), null,desktop);
}
}

View File

@ -221,6 +221,7 @@ indexController.mniRelatorioPassageirosViajar.label = Passageiros a Viajar
indexController.mniRelatorioResumoLinhas.label = Relatório Resumo de Linhas
indexController.mniRelatorioAcompanhamentoEquivalentes.label = Relatório Acompanhamento Equivalentes
indexController.mniRelatorioLinhasHorario.label = Relatório de Linhas por Horário
indexController.mniRelatorioTaxasLinha.label = Relatório de Taxas por Linha
#PARTE REALIZADA POR MANUEL
indexController.mnCortesias.label = Cortesias Para Funcionários
@ -356,6 +357,20 @@ relatorioAcompanhamentoEquivalentesController.lbTipoServico.extraordinarios.valu
relatorioAcompanhamentoEquivalentesController.lbTipoServico.todos.value = Todos
relatorioAcompanhamentoEquivalentesController.lbEmpresa.value = Empresa
#Relatório de Taxas por Linha
relatorioTaxasLinhaController.window.title = Relatório de Taxas por Linha
relatorioTaxasLinhaController.lbEmpresa.value = Empresa
relatorioTaxasLinhaController.lbAte.value = até
relatorioTaxasLinhaController.lbDatInicial.value = Data Inicial
relatorioTaxasLinhaController.lbDatFinal.value = Data Final
relatorioTaxasLinhaController.lbTipoData.value = Tipo de Data
relatorioTaxasLinhaController.lbTipoData.venda.value = Venda
relatorioTaxasLinhaController.lbTipoData.servico.value = Serviço
relatorioTaxasLinhaController.lbChkSubtrairIcms.value = Subtrair ICMS
relatorioTaxasLinhaController.lbPuntoVenta.value = N. Agência
relatorioTaxasLinhaController.lbCidadaOrigem.value = Localidade Origem
relatorioTaxasLinhaController.lbCidadeDestino.value = Localidade Destino
relatorioTaxasLinhaController.lbPuntoVenta.value = Agência

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<?page contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="winFiltroRelatorioTaxasLinha"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioTaxasLinha"
apply="${relatorioTaxasLinhaController}" contentStyle="overflow:auto"
height="200px" width="600px" border="normal">
<grid fixedLayout="true">
<columns>
<column width="15%" />
<column width="35%" />
<column width="15%" />
<column width="35%" />
</columns>
<rows>
<row>
<label
value="${c:l('relatorioTaxasLinhaController.lbDatInicial.value')}" />
<datebox id="datInicial" format="dd/MM/yyyy"
lenient="false" constraint="no empty" maxlength="10" />
<label
value="${c:l('relatorioTaxasLinhaController.lbDatFinal.value')}" />
<datebox id="datFinal" format="dd/MM/yyyy"
lenient="false" constraint="no empty" maxlength="10" />
</row>
<row>
<label
value="${c:l('relatorioTaxasLinhaController.lbCidadaOrigem.value')}" />
<cell>
<combobox id="cmbParadaOrigemCve"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve"
mold="rounded" buttonVisible="true" width="25%" />
<combobox id="cmbParadaOrigem"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"
mold="rounded" buttonVisible="true" width="70%" />
</cell>
<label
value="${c:l('relatorioTaxasLinhaController.lbCidadeDestino.value')}" />
<cell>
<combobox id="cmbParadaDestinoCve"
autodrop="false"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParadaCve"
mold="rounded" buttonVisible="true" width="25%" />
<combobox id="cmbParadaDestino" autodrop="false"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada"
mold="rounded" buttonVisible="true" width="70%" />
</cell>
</row>
<row>
<label
value="${c:l('relatorioTaxasLinhaController.lbEmpresa.value')}" />
<combobox id="cmbEmpresa" mold="rounded"
buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioTaxasLinha$composer.lsEmpresa}"
width="180px" />
<label
value="${c:l('relatorioTaxasLinhaController.lbPuntoVenta.value')}" />
<textbox id="txtNumPuntoVenta"
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextbox"
maxlength="7" width="180px" />
</row>
<row>
<label
value="${c:l('relatorioTaxasLinhaController.lbTipoData.value')}" />
<cell>
<radiogroup id="rdGroupTipoData">
<radio radiogroup="rdGroupTipoData"
value="1" checked="true"
label="${c:l('relatorioTaxasLinhaController.lbTipoData.venda.value')}" />
<radio radiogroup="rdGroupTipoData"
value="2"
label="${c:l('relatorioTaxasLinhaController.lbTipoData.servico.value')}" />
</radiogroup>
</cell>
<cell colspan="2">
<checkbox id="chkSubtrairIcms"
label="${c:l('relatorioTaxasLinhaController.lbChkSubtrairIcms.value')}" />
</cell>
</row>
</rows>
</grid>
<toolbar>
<button id="btnExecutarRelatorio" image="/gui/img/find.png"
label="${c:l('relatorio.lb.btnExecutarRelatorio')}" />
</toolbar>
</window>
</zk>