bruno 2013-08-16 13:59:12 +00:00
parent 681c20d1d0
commit e5643095a0
5 changed files with 173 additions and 110 deletions

View File

@ -41,14 +41,7 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
@Override @Override
public Object valueCustomFields(String fieldName) throws Exception { public Object valueCustomFields(String fieldName) throws Exception {
if (fieldName.equals("RECEITA_TOTAL")) {
if (fieldName.equals("RECEITA_BAGAGEM")) {
if (!(Boolean) this.relatorio.getParametros().get("B_EXCLUI_BAGAGEM"))
return getValorReceitaBagagem((Integer) this.getByName("PUNTOVENTA_ID"));
else
return BigDecimal.ZERO;
}
else if (fieldName.equals("RECEITA_TOTAL")) {
return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).add((BigDecimal) this.getByName("RECEITA_EMBARQUE")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL")); return ((BigDecimal) this.getByName("RECEITA_TARIFA")).add((BigDecimal) this.getByName("RECEITA_SEGURO")).add((BigDecimal) this.getByName("RECEITA_BAGAGEM")).add((BigDecimal) this.getByName("RECEITA_EMBARQUE")).subtract((BigDecimal) this.getByName("TOTAL_DEVOL"));
} }
else if (fieldName.equals("RECEITA_LIQUIDA")) { else if (fieldName.equals("RECEITA_LIQUIDA")) {
@ -79,23 +72,22 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
else else
stmt.setString("NUMPUNTOVENTA", null); stmt.setString("NUMPUNTOVENTA", null);
if (parametros.get("ESTADO_ID") != null){ if (parametros.get("ESTADO_ID") != null) {
StringBuilder strEstadoList = new StringBuilder(); StringBuilder strEstadoList = new StringBuilder();
for (Estado s : (ArrayList<Estado>) parametros.get("ESTADO_ID")) { for (Estado s : (ArrayList<Estado>) parametros.get("ESTADO_ID")) {
strEstadoList.append("," + s.getEstadoId() + ","); strEstadoList.append("," + s.getEstadoId() + ",");
} }
stmt.setString("ESTADO_ID", strEstadoList.toString()); stmt.setString("ESTADO_ID", strEstadoList.toString());
stmt.setString("ISESTADOTODOS", "N"); stmt.setString("ISESTADOTODOS", "N");
} }
else{ else {
stmt.setNull("ESTADO_ID", java.sql.Types.INTEGER); stmt.setNull("ESTADO_ID", java.sql.Types.INTEGER);
stmt.setString("ISESTADOTODOS", "S"); stmt.setString("ISESTADOTODOS", "S");
} }
if (parametros.get("EMPRESA_ID") != null) if (parametros.get("EMPRESA_ID") != null)
stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID")); stmt.setInt("EMPRESA_ID", (Integer) parametros.get("EMPRESA_ID"));
else else
@ -234,11 +226,13 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
row.put("RECEITA_OUTROS_GAP", BigDecimal.ZERO); row.put("RECEITA_OUTROS_GAP", BigDecimal.ZERO);
row.put("RECEITA_PEDAGIO", BigDecimal.ZERO); row.put("RECEITA_PEDAGIO", BigDecimal.ZERO);
row.put("RECEITA_PEDAGIO_GAP", BigDecimal.ZERO); row.put("RECEITA_PEDAGIO_GAP", BigDecimal.ZERO);
row.put("RECEITA_BAGAGEM", BigDecimal.ZERO); row.put("IMPOSTOS", BigDecimal.ZERO);
row.put("TOTAL_DEVOL", BigDecimal.ZERO); row.put("TOTAL_DEVOL", BigDecimal.ZERO);
row.put("TOTAL_DEVOL_GAP", BigDecimal.ZERO); row.put("TOTAL_DEVOL_GAP", BigDecimal.ZERO);
row.put("IMPOSTOS", BigDecimal.ZERO);
row.put("VALOR_COMISSAO", BigDecimal.ZERO); row.put("VALOR_COMISSAO", BigDecimal.ZERO);
row.put("RECEITA_BAGAGEM", BigDecimal.ZERO);
row.put("ANTECIPACAO", getValorAntecipacaoComissao(puntoVentaId)); row.put("ANTECIPACAO", getValorAntecipacaoComissao(puntoVentaId));
@ -250,6 +244,20 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
row.put("EMPRESAPUNTOVENTA_ID", rs.getInt("EMPRESAPUNTOVENTA_ID")); row.put("EMPRESAPUNTOVENTA_ID", rs.getInt("EMPRESAPUNTOVENTA_ID"));
row.put("ESTADO_ID", rs.getBigDecimal("ESTADO_ID")); row.put("ESTADO_ID", rs.getBigDecimal("ESTADO_ID"));
row.put("TIPO_AGENCIA", rs.getString("TIPO_AGENCIA")); row.put("TIPO_AGENCIA", rs.getString("TIPO_AGENCIA"));
//Como a receita de bagagem é obtida por agencia, já calcula o valor
if (!(Boolean) this.relatorio.getParametros().get("B_EXCLUI_BAGAGEM"))
{
BigDecimal receitaBagagem = getValorReceitaBagagem(puntoVentaId);
try {
row.put("IMPOSTOS", getValorImposto(puntoVentaId, rs.getString("INTERESTADUAL"), BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, receitaBagagem));
} catch (Exception e) {
//Este erro não é tratado pois existem demais pontos no relatorio que fazem esta chamada com os mesmos parametros e fazer o tratamento correto.
}
row.put("RECEITA_BAGAGEM", receitaBagagem);
}
} }
} }
@ -290,8 +298,8 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
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("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", ((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("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)); 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) : 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 // 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); this.setRowComissao(row);
@ -436,9 +444,15 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
return cacheConfig; return cacheConfig;
} }
public BigDecimal getValorImposto(Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio) throws Exception { public BigDecimal getValorImposto(Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio, BigDecimal bagagem) throws Exception {
try { try {
return CalculoImposto.getValorImposto(this.getConexao(), puntoVentaId, indInterestadual, tarifa, seguro, embarque, pedagio); Integer tipoBaseCalculo = (Integer) this.getParametros().get("BASE_CALCULO_IMPOSTO");
Boolean indBaseTarifa = (tipoBaseCalculo == 1 || tipoBaseCalculo == 2 ? true : false);
Boolean indBaseSeguro = (tipoBaseCalculo == 1 || tipoBaseCalculo == 3 ? true : false);
Boolean indBaseEmbarque = (tipoBaseCalculo == 1 || tipoBaseCalculo == 4 ? true : false);
Boolean indBasePedagio = (tipoBaseCalculo == 1 || tipoBaseCalculo == 5 ? true : false);
Boolean indBaseBagagem = (tipoBaseCalculo == 1 || tipoBaseCalculo == 6 ? true : false);
return CalculoImposto.getValorImpostoRelatorioReceitaDiaria(this.getConexao(), puntoVentaId, indInterestadual, tarifa, seguro, embarque, pedagio, bagagem, indBaseTarifa, indBaseSeguro, indBaseEmbarque, indBasePedagio, indBaseBagagem);
} catch (Exception e) { } catch (Exception e) {
if (e instanceof ExceptionConfiguracao) if (e instanceof ExceptionConfiguracao)
this.addInfoMsg(e.getMessage()); this.addInfoMsg(e.getMessage());
@ -467,6 +481,7 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
ResultSet rs = stmt.executeQuery(); ResultSet rs = stmt.executeQuery();
if (rs.next()) { if (rs.next()) {
BigDecimal receitaBagagem = rs.getBigDecimal("RECEITA_BAGAGEM"); BigDecimal receitaBagagem = rs.getBigDecimal("RECEITA_BAGAGEM");
rs.close(); rs.close();
stmt.close(); stmt.close();
return receitaBagagem; return receitaBagagem;
@ -574,7 +589,7 @@ public class RelatorioReceitaDiariaAgencia extends Relatorio {
sql.append(" AND PV.TIPOPTOVTA_ID = NVL(:TIPOPTOVTA_ID, PV.TIPOPTOVTA_ID) "); sql.append(" AND PV.TIPOPTOVTA_ID = NVL(:TIPOPTOVTA_ID, PV.TIPOPTOVTA_ID) ");
sql.append(" AND TP.TIPOPTOVTA_ID = PV.TIPOPTOVTA_ID "); sql.append(" AND TP.TIPOPTOVTA_ID = PV.TIPOPTOVTA_ID ");
sql.append(" AND CJ.EMPRESACORRIDA_ID = NVL(:EMPRESA_ID, CJ.EMPRESACORRIDA_ID) "); sql.append(" AND CJ.EMPRESACORRIDA_ID = NVL(:EMPRESA_ID, CJ.EMPRESACORRIDA_ID) ");
//sql.append(" AND ES.ESTADO_ID = NVL(:ESTADO_ID, ES.ESTADO_ID) "); // sql.append(" AND ES.ESTADO_ID = NVL(:ESTADO_ID, ES.ESTADO_ID) ");
sql.append(" AND ((INSTR(:NUMPUNTOVENTA, ',' || TRIM(PV.NUMPUNTOVENTA) || ',') > 0 AND "); sql.append(" AND ((INSTR(:NUMPUNTOVENTA, ',' || TRIM(PV.NUMPUNTOVENTA) || ',') > 0 AND ");
sql.append(" :ISNUMPUNTOVENTATODOS = 'N') OR (:ISNUMPUNTOVENTATODOS = 'S')) "); sql.append(" :ISNUMPUNTOVENTATODOS = 'N') OR (:ISNUMPUNTOVENTATODOS = 'S')) ");
sql.append(" AND ((INSTR(:ESTADO_ID, ',' || TRIM(ES.ESTADO_ID) || ',') > 0 AND "); sql.append(" AND ((INSTR(:ESTADO_ID, ',' || TRIM(ES.ESTADO_ID) || ',') > 0 AND ");

View File

@ -21,7 +21,7 @@ public class CalculoImposto {
static Map<String, HashMap<String, Object>> mapCacheConfigImposto = new HashMap<String, HashMap<String, Object>>(); 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 { public static Map<String, Object> getConfigImpostoByPuntoVenta(Connection conexao, Integer puntoVentaId) throws SQLException, ExceptionConfiguracao {
HashMap<String, Object> cacheConfig = null; HashMap<String, Object> cacheConfig = null;
@ -85,22 +85,20 @@ public class CalculoImposto {
} }
String estado = rs.getString("NOMBESTADO"); String estado = rs.getString("NOMBESTADO");
String empresa = rs.getString("NOMBEMPRESA"); String empresa = rs.getString("NOMBEMPRESA");
if (!isBuscouConfig) if (!isBuscouConfig)
throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para o estado: " + estado + " empresa: " + empresa); throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para o estado: " + estado + " empresa: " + empresa);
}
;
}; if (!rs.isClosed())
if(!rs.isClosed())
rs.close(); rs.close();
if(!stmt.isClosed()) if (!stmt.isClosed())
stmt.close(); stmt.close();
if (!isBuscouConfig) if (!isBuscouConfig)
throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para agência "+puntoVentaId); throw new ExceptionConfiguracao("Não foi possivel obter a configuração de imposto para agência " + puntoVentaId);
mapCacheConfigImposto.put(puntoVentaId.toString(), cacheConfig); mapCacheConfigImposto.put(puntoVentaId.toString(), cacheConfig);
@ -111,16 +109,61 @@ public class CalculoImposto {
return cacheConfig; return cacheConfig;
} }
public static BigDecimal getValorImpostoRelatorioReceitaDiaria(Connection conexao, Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio, BigDecimal bagagem, Boolean indBaseTarifa, Boolean indBaseSeguro, Boolean indBaseEmbarque, Boolean indBasePedagio, Boolean indBaseBagagem) throws Exception {
HashMap<String, Object> configImposto = new HashMap<String, Object>();
BigDecimal baseCalculo = BigDecimal.ZERO;
BigDecimal icms;
BigDecimal porcRedEstadualMunicipal;
BigDecimal porcRedBaseIcms;
BigDecimal valorIcms = BigDecimal.ZERO;
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"))
porcRedEstadualMunicipal = (BigDecimal) configImposto.get("PORCREDESTADUAL");
else
porcRedEstadualMunicipal = (BigDecimal) configImposto.get("PORCREDMUNICIPAL");
// Criação da base de calculo
baseCalculo = indBaseTarifa && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indBaseSeguro && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indBaseEmbarque && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indBasePedagio && pedagio != null ? baseCalculo.add(pedagio) : BigDecimal.ZERO;
baseCalculo = indBaseBagagem && bagagem != null ? baseCalculo.add(bagagem) : 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 (porcRedEstadualMunicipal != null && porcRedEstadualMunicipal.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedEstadualMunicipal.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
return valorIcms;
}
public static BigDecimal getValorImposto(Connection conexao, Integer puntoVentaId, String indInterestadual, BigDecimal tarifa, BigDecimal seguro, BigDecimal embarque, BigDecimal pedagio) throws Exception { 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>(); HashMap<String, Object> configImposto = new HashMap<String, Object>();
BigDecimal baseCalculo = BigDecimal.ZERO; BigDecimal baseCalculo = BigDecimal.ZERO;
BigDecimal icms; BigDecimal icms;
BigDecimal porcRedEstadual; BigDecimal porcRedEstadualMunicipal;
BigDecimal porcRedMunicipal;
BigDecimal porcRedBaseIcms; BigDecimal porcRedBaseIcms;
BigDecimal valorIcms = BigDecimal.ZERO; BigDecimal valorIcms = BigDecimal.ZERO;
@ -134,7 +177,7 @@ public class CalculoImposto {
Boolean indTxEmbarqueEstadual; Boolean indTxEmbarqueEstadual;
Boolean indPedagioEstadual; Boolean indPedagioEstadual;
configImposto = (HashMap<String, Object>) getConfigImpostoByPuntoVenta(conexao,puntoVentaId); configImposto = (HashMap<String, Object>) getConfigImpostoByPuntoVenta(conexao, puntoVentaId);
if (configImposto == null) if (configImposto == null)
return BigDecimal.ZERO; return BigDecimal.ZERO;
@ -143,38 +186,22 @@ public class CalculoImposto {
porcRedBaseIcms = (BigDecimal) configImposto.get("PORCREDBASEICMS"); porcRedBaseIcms = (BigDecimal) configImposto.get("PORCREDBASEICMS");
if (indInterestadual.equals("S")) { if (indInterestadual.equals("S")) {
porcRedEstadual = (BigDecimal) configImposto.get("PORCREDESTADUAL"); porcRedEstadualMunicipal = (BigDecimal) configImposto.get("PORCREDESTADUAL");
indTarifaEstadual = (Boolean) configImposto.get("INDTARIFAESTADUAL"); indTarifaEstadual = (Boolean) configImposto.get("INDTARIFAESTADUAL");
indSeguroEstadual = (Boolean) configImposto.get("INDSEGUROESTADUAL"); indSeguroEstadual = (Boolean) configImposto.get("INDSEGUROESTADUAL");
indTxEmbarqueEstadual = (Boolean) configImposto.get("INDTXEMBARQUEESTADUAL"); indTxEmbarqueEstadual = (Boolean) configImposto.get("INDTXEMBARQUEESTADUAL");
indPedagioEstadual = (Boolean) configImposto.get("INDPEDAGIOESTDUAL"); indPedagioEstadual = (Boolean) configImposto.get("INDPEDAGIOESTDUAL");
// System.out.println(" Tarifa: "+ tarifa +" seguro: "+ seguro +" embarque: "+ embarque +" pedagio: "+ pedagio);
// Criação da base de calculo // Criação da base de calculo
baseCalculo = indTarifaEstadual && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO; baseCalculo = indTarifaEstadual && tarifa != null ? baseCalculo.add(tarifa) : BigDecimal.ZERO;
baseCalculo = indSeguroEstadual && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO; baseCalculo = indSeguroEstadual && seguro != null ? baseCalculo.add(seguro) : BigDecimal.ZERO;
baseCalculo = indTxEmbarqueEstadual && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO; baseCalculo = indTxEmbarqueEstadual && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioEstadual && pedagio != null ? baseCalculo.add(pedagio) : 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 { else {
porcRedMunicipal = (BigDecimal) configImposto.get("PORCREDMUNICIPAL"); porcRedEstadualMunicipal = (BigDecimal) configImposto.get("PORCREDMUNICIPAL");
indTarifaMunicipal = (Boolean) configImposto.get("INDTARIFAMUNICIPAL"); indTarifaMunicipal = (Boolean) configImposto.get("INDTARIFAMUNICIPAL");
indSeguroMunicipal = (Boolean) configImposto.get("INDSEGUROMUNICIPAL"); indSeguroMunicipal = (Boolean) configImposto.get("INDSEGUROMUNICIPAL");
@ -186,22 +213,21 @@ public class CalculoImposto {
baseCalculo = indTxEmbarqueMunicipal && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO; baseCalculo = indTxEmbarqueMunicipal && embarque != null ? baseCalculo.add(embarque) : BigDecimal.ZERO;
baseCalculo = indPedagioMunicipal && pedagio != null ? baseCalculo.add(pedagio) : 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);
} }
// 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 (porcRedEstadualMunicipal != null && porcRedEstadualMunicipal.equals(BigDecimal.ZERO))
valorIcms = valorIcms.subtract(porcRedEstadualMunicipal.divide(BigDecimal.valueOf(100)).multiply(valorIcms));
return valorIcms; return valorIcms;
} }

View File

@ -87,6 +87,7 @@ public class RelatorioReceitaDiariaAgenciaController extends MyGenericForwardCom
private Combobox cmbEmpresa; private Combobox cmbEmpresa;
private Combobox cmbPuntoVenta; private Combobox cmbPuntoVenta;
private Combobox cmbTipoPuntoVenta; private Combobox cmbTipoPuntoVenta;
private Combobox cmbReceitaImposto;
private Datebox datInicial; private Datebox datInicial;
private Datebox datFinal; private Datebox datFinal;
private Checkbox chkExcessoBagagem; private Checkbox chkExcessoBagagem;
@ -282,6 +283,8 @@ public class RelatorioReceitaDiariaAgenciaController extends MyGenericForwardCom
parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioReceitaDiariaAgenciaController.window.title")); parametros.put("NOME_RELATORIO", Labels.getLabel("relatorioReceitaDiariaAgenciaController.window.title"));
parametros.put("ISDEVOLUCAODESTINO", rd1.isChecked() ? 0 : 1); parametros.put("ISDEVOLUCAODESTINO", rd1.isChecked() ? 0 : 1);
parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString()); parametros.put("USUARIO", UsuarioLogado.getUsuarioLogado().getUsuarioId().toString());
parametros.put("BASE_CALCULO_IMPOSTO", Integer.valueOf(cmbReceitaImposto.getSelectedItem().getValue().toString()));
lsNumPuntoVenta = new ArrayList(Arrays.asList(puntoVentaSelList.getData())); lsNumPuntoVenta = new ArrayList(Arrays.asList(puntoVentaSelList.getData()));

View File

@ -7,7 +7,7 @@
# <controler>. <id>. <propiedade> = XXX # <controler>. <id>. <propiedade> = XXX
#Versao do VentaBoleto: #Versao do VentaBoleto:
versao = ADM_20130814_1RC198 versao = ADM_20130816_1RC199
# MSG Defaut: # MSG Defaut:
MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100 MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100
@ -339,6 +339,13 @@ relatorioReceitaDiariaAgenciaController.lbTipoPuntoVenta.value = Tipo Agência
relatorioReceitaDiariaAgenciaController.lbDevolucao.value = Devolução baseadas na ag. de relatorioReceitaDiariaAgenciaController.lbDevolucao.value = Devolução baseadas na ag. de
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.rd1.label = Origem relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.rd1.label = Origem
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.rd2.label = Destino relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.rd2.label = Destino
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.label = Base de Cálculo Impostos
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitas = Receitas
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaPassagem = Receita de Passagem
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaSeguro = Receita de Seguro
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaEmbarque = Receita de Embarque
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaPedagio = Receita de Pedagio
relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaBagagem = Receita de Bagagem
#Relatório Acompanhamento Equivalentes #Relatório Acompanhamento Equivalentes
relatorioAcompanhamentoEquivalentesController.window.title = Relatório de Acompanhamento de Equivalentes relatorioAcompanhamentoEquivalentesController.window.title = Relatório de Acompanhamento de Equivalentes

View File

@ -7,7 +7,7 @@
<zk xmlns="http://www.zkoss.org/2005/zul"> <zk xmlns="http://www.zkoss.org/2005/zul">
<window id="winFiltroRelatorioReceitaDiariaAgencia" <window id="winFiltroRelatorioReceitaDiariaAgencia"
apply="${relatorioReceitaDiariaAgenciaController}" apply="${relatorioReceitaDiariaAgenciaController}"
contentStyle="overflow:auto" height="320px" width="550px" contentStyle="overflow:auto" height="370px" width="550px"
border="normal"> border="normal">
<grid fixedLayout="true"> <grid fixedLayout="true">
<columns> <columns>
@ -31,28 +31,7 @@
</row> </row>
<row> <row>
<label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbEstado.value')}" />
<listbox id="estadoList" mold="select" rows="3"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" width="90%">
<listhead>
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.lbEstado.value')}" />
</listhead>
</listbox>
<label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbTipoPuntoVenta.value')}" />
<combobox id="cmbTipoPuntoVenta" width="90%"
mold="rounded" buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioReceitaDiariaAgencia$composer.lsTipoPuntoVenta}" />
</row>
<row>
<label <label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbEmpresa.value')}" /> value="${c:l('relatorioReceitaDiariaAgenciaController.lbEmpresa.value')}" />
<combobox id="cmbEmpresa" width="90%" mold="rounded" <combobox id="cmbEmpresa" width="90%" mold="rounded"
@ -61,6 +40,28 @@
model="@{winFiltroRelatorioReceitaDiariaAgencia$composer.lsEmpresa}" model="@{winFiltroRelatorioReceitaDiariaAgencia$composer.lsEmpresa}"
constraint="no empty" /> constraint="no empty" />
<label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbTipoPuntoVenta.value')}" />
<combobox id="cmbTipoPuntoVenta" width="90%"
mold="rounded" buttonVisible="true"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
model="@{winFiltroRelatorioReceitaDiariaAgencia$composer.lsTipoPuntoVenta}" />
</row>
<row>
<label value="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.label')}" />
<combobox id="cmbReceitaImposto" width="90%"
use="com.rjconsultores.ventaboletos.web.utilerias.MyComboboxEstandar"
mold="rounded" constraint="no empty">
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitas')}" value="1" />
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaPassagem')}"
value="2" />
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaSeguro')}" value="3" />
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaEmbarque')}"
value="4" />
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaPedagio')}" value="5" />
<comboitem label="${c:l('relatorioReceitaDiariaAgenciaController.rdIndAgenciaDevol.cmbReceitaImposto.cmbItemReceitaBagagem')}" value="6" />
</combobox>
<label <label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbPuntoVenta.value')}" /> value="${c:l('relatorioReceitaDiariaAgenciaController.lbPuntoVenta.value')}" />
<bandbox id="bbPesquisaPuntoVenta" width="90%" <bandbox id="bbPesquisaPuntoVenta" width="90%"
@ -93,8 +94,38 @@
</vbox> </vbox>
</bandpopup> </bandpopup>
</bandbox> </bandbox>
</row>
<row>
<label
value="${c:l('relatorioReceitaDiariaAgenciaController.lbEstado.value')}" />
<listbox id="estadoList" mold="select" rows="3"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" width="90%">
<listhead>
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.lbEstado.value')}" />
</listhead>
</listbox>
<cell colspan="2" rowspan="2">
<borderlayout height="100px">
<center border="0">
<listbox id="puntoVentaSelList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" height="60%" width="100%">
<listhead>
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.puntoVentaSelList.codigo')}" />
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.puntoVentaSelList.nome')}" />
<listheader width="35px" />
</listhead>
</listbox>
</center>
</borderlayout>
</cell>
</row> </row>
<row> <row>
<label <label
@ -109,33 +140,14 @@
radiogroup="rdIndAgenciaDevol" /> radiogroup="rdIndAgenciaDevol" />
</cell> </cell>
<cell colspan="2" rowspan="2">
<borderlayout height="100px">
<center border="0">
<listbox id="puntoVentaSelList"
mold="paging"
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
vflex="true" multiple="true" height="60%" width="100%">
<listhead>
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.puntoVentaSelList.codigo')}" />
<listheader
label="${c:l('relatorioReceitaDiariaAgenciaController.puntoVentaSelList.nome')}" />
<listheader width="35px" />
</listhead>
</listbox>
</center>
</borderlayout>
</cell>
</row> </row>
<row> <row>
<cell colspan="2"> <cell colspan="2">
<checkbox id="chkExcessoBagagem" <checkbox id="chkExcessoBagagem"
label="${c:l('relatorioReceitaDiariaAgenciaController.chkExcessoBagagem.label')}" /> label="${c:l('relatorioReceitaDiariaAgenciaController.chkExcessoBagagem.label')}" />
<separator /> </cell>
<cell colspan="2">
<checkbox id="chkContemplarGap" <checkbox id="chkContemplarGap"
label="${c:l('relatorioReceitaDiariaAgenciaController.chkContemplarGap.label')}" /> label="${c:l('relatorioReceitaDiariaAgenciaController.chkContemplarGap.label')}" />
</cell> </cell>