fixes bug #6778
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@49530 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
9a3ea405b0
commit
934bd39286
|
@ -33,7 +33,7 @@ public class RelatorioTaxasLinha extends Relatorio {
|
||||||
super(parametros, conexao);
|
super(parametros, conexao);
|
||||||
CalculoImposto.limpaCache();
|
CalculoImposto.limpaCache();
|
||||||
|
|
||||||
this.setCustomDataSource(false,new DataSource(this) {
|
this.setCustomDataSource(false, new DataSource(this) {
|
||||||
|
|
||||||
public void initDados() throws Exception {
|
public void initDados() throws Exception {
|
||||||
Connection conexao = this.relatorio.getConexao();
|
Connection conexao = this.relatorio.getConexao();
|
||||||
|
@ -76,31 +76,41 @@ public class RelatorioTaxasLinha extends Relatorio {
|
||||||
BigDecimal valorIcms = BigDecimal.ZERO;
|
BigDecimal valorIcms = BigDecimal.ZERO;
|
||||||
String indInterestadual = this.resultSet.getString("INTERESTADUAL");
|
String indInterestadual = this.resultSet.getString("INTERESTADUAL");
|
||||||
Integer idEstado = this.resultSet.getInt("ORIGEM_ESTADO_ID");
|
Integer idEstado = this.resultSet.getInt("ORIGEM_ESTADO_ID");
|
||||||
|
Integer empresaId = this.resultSet.getInt("EMPRESA_ID");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (fieldName.equals("IMPORTETAXAEMBARQUE") && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null && !this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").equals(BigDecimal.ZERO)) {
|
BigDecimal importeTaxaEmbarque = resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTETAXAEMBARQUE");
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE"), BigDecimal.ZERO);
|
BigDecimal importePedagio = resultSet.getBigDecimal("IMPORTEPEDAGIO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTEPEDAGIO");
|
||||||
return this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").subtract(valorIcms);
|
BigDecimal importeSeguro = resultSet.getBigDecimal("IMPORTESEGURO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTESEGURO");
|
||||||
}
|
|
||||||
else if (fieldName.equals("IMPORTEPEDAGIO") && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null && !this.resultSet.getBigDecimal("IMPORTEPEDAGIO").equals(BigDecimal.ZERO)) {
|
BigDecimal totalEmbarque = resultSet.getBigDecimal("TOTAL_EMBARQUE") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_EMBARQUE");
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTEPEDAGIO"));
|
BigDecimal totalPedagio = resultSet.getBigDecimal("TOTAL_PEDAGIO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_PEDAGIO");
|
||||||
return this.resultSet.getBigDecimal("IMPORTEPEDAGIO").subtract(valorIcms);
|
BigDecimal totalSeguro = resultSet.getBigDecimal("TOTAL_SEGURO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_SEGURO");
|
||||||
}
|
|
||||||
else if (fieldName.equals("IMPORTESEGURO") && this.resultSet.getBigDecimal("IMPORTESEGURO") != null && !this.resultSet.getBigDecimal("IMPORTESEGURO").equals(BigDecimal.ZERO)) {
|
if (fieldName.equals("IMPORTETAXAEMBARQUE") && !!importeTaxaEmbarque.equals(BigDecimal.ZERO)) {
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTESEGURO"), BigDecimal.ZERO, BigDecimal.ZERO);
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, importeTaxaEmbarque, BigDecimal.ZERO);
|
||||||
return this.resultSet.getBigDecimal("IMPORTESEGURO").subtract(valorIcms);
|
return importeTaxaEmbarque.subtract(valorIcms);
|
||||||
}
|
|
||||||
else if (fieldName.equals("TOTAL_EMBARQUE") && !this.resultSet.getBigDecimal("TOTAL_EMBARQUE").equals(BigDecimal.ZERO)) {
|
} else if (fieldName.equals("IMPORTEPEDAGIO") && !importePedagio.equals(BigDecimal.ZERO)) {
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_EMBARQUE"), BigDecimal.ZERO, BigDecimal.ZERO);
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, importePedagio);
|
||||||
return this.resultSet.getBigDecimal("TOTAL_EMBARQUE").subtract(valorIcms);
|
return importePedagio.subtract(valorIcms);
|
||||||
}
|
|
||||||
else if (fieldName.equals("TOTAL_PEDAGIO") && !this.resultSet.getBigDecimal("TOTAL_PEDAGIO").equals(BigDecimal.ZERO)) {
|
} else if (fieldName.equals("IMPORTESEGURO") && !importeSeguro.equals(BigDecimal.ZERO)) {
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_PEDAGIO"));
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, importeSeguro, BigDecimal.ZERO, BigDecimal.ZERO);
|
||||||
return this.resultSet.getBigDecimal("TOTAL_PEDAGIO").subtract(valorIcms);
|
return importeSeguro.subtract(valorIcms);
|
||||||
}
|
|
||||||
else if (fieldName.equals("TOTAL_SEGURO") && !this.resultSet.getBigDecimal("TOTAL_SEGURO").equals(BigDecimal.ZERO)) {
|
} else if (fieldName.equals("TOTAL_EMBARQUE") && !totalEmbarque.equals(BigDecimal.ZERO)) {
|
||||||
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, this.resultSet.getBigDecimal("TOTAL_SEGURO"), BigDecimal.ZERO, BigDecimal.ZERO);
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, totalEmbarque, BigDecimal.ZERO, BigDecimal.ZERO);
|
||||||
return this.resultSet.getBigDecimal("TOTAL_SEGURO").subtract(valorIcms);
|
return totalEmbarque.subtract(valorIcms);
|
||||||
|
|
||||||
|
} else if (fieldName.equals("TOTAL_PEDAGIO") && !totalPedagio.equals(BigDecimal.ZERO)) {
|
||||||
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, totalPedagio);
|
||||||
|
return totalPedagio.subtract(valorIcms);
|
||||||
|
|
||||||
|
} else if (fieldName.equals("TOTAL_SEGURO") && !totalSeguro.equals(BigDecimal.ZERO)) {
|
||||||
|
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, totalSeguro, BigDecimal.ZERO, BigDecimal.ZERO);
|
||||||
|
return totalSeguro.subtract(valorIcms);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof ExceptionConfiguracao)
|
if (e instanceof ExceptionConfiguracao)
|
||||||
|
|
Loading…
Reference in New Issue