julio 2015-10-28 13:40:20 +00:00
parent 9a3ea405b0
commit 934bd39286
1 changed files with 34 additions and 24 deletions

View File

@ -76,31 +76,41 @@ public class RelatorioTaxasLinha extends Relatorio {
BigDecimal valorIcms = BigDecimal.ZERO;
String indInterestadual = this.resultSet.getString("INTERESTADUAL");
Integer idEstado = this.resultSet.getInt("ORIGEM_ESTADO_ID");
Integer empresaId = this.resultSet.getInt("EMPRESA_ID");
try {
if (fieldName.equals("IMPORTETAXAEMBARQUE") && this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") != null && !this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, this.resultSet.getInt("EMPRESA_ID"), indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE"), BigDecimal.ZERO);
return this.resultSet.getBigDecimal("IMPORTETAXAEMBARQUE").subtract(valorIcms);
}
else if (fieldName.equals("IMPORTEPEDAGIO") && this.resultSet.getBigDecimal("IMPORTEPEDAGIO") != null && !this.resultSet.getBigDecimal("IMPORTEPEDAGIO").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("IMPORTEPEDAGIO"));
return this.resultSet.getBigDecimal("IMPORTEPEDAGIO").subtract(valorIcms);
}
else if (fieldName.equals("IMPORTESEGURO") && this.resultSet.getBigDecimal("IMPORTESEGURO") != null && !this.resultSet.getBigDecimal("IMPORTESEGURO").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);
return this.resultSet.getBigDecimal("IMPORTESEGURO").subtract(valorIcms);
}
else if (fieldName.equals("TOTAL_EMBARQUE") && !this.resultSet.getBigDecimal("TOTAL_EMBARQUE").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);
return this.resultSet.getBigDecimal("TOTAL_EMBARQUE").subtract(valorIcms);
}
else if (fieldName.equals("TOTAL_PEDAGIO") && !this.resultSet.getBigDecimal("TOTAL_PEDAGIO").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"));
return this.resultSet.getBigDecimal("TOTAL_PEDAGIO").subtract(valorIcms);
}
else if (fieldName.equals("TOTAL_SEGURO") && !this.resultSet.getBigDecimal("TOTAL_SEGURO").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);
return this.resultSet.getBigDecimal("TOTAL_SEGURO").subtract(valorIcms);
BigDecimal importeTaxaEmbarque = resultSet.getBigDecimal("IMPORTETAXAEMBARQUE") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTETAXAEMBARQUE");
BigDecimal importePedagio = resultSet.getBigDecimal("IMPORTEPEDAGIO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTEPEDAGIO");
BigDecimal importeSeguro = resultSet.getBigDecimal("IMPORTESEGURO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("IMPORTESEGURO");
BigDecimal totalEmbarque = resultSet.getBigDecimal("TOTAL_EMBARQUE") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_EMBARQUE");
BigDecimal totalPedagio = resultSet.getBigDecimal("TOTAL_PEDAGIO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_PEDAGIO");
BigDecimal totalSeguro = resultSet.getBigDecimal("TOTAL_SEGURO") == null ? BigDecimal.ZERO : resultSet.getBigDecimal("TOTAL_SEGURO");
if (fieldName.equals("IMPORTETAXAEMBARQUE") && !!importeTaxaEmbarque.equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, importeTaxaEmbarque, BigDecimal.ZERO);
return importeTaxaEmbarque.subtract(valorIcms);
} else if (fieldName.equals("IMPORTEPEDAGIO") && !importePedagio.equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, importePedagio);
return importePedagio.subtract(valorIcms);
} else if (fieldName.equals("IMPORTESEGURO") && !importeSeguro.equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, importeSeguro, BigDecimal.ZERO, BigDecimal.ZERO);
return importeSeguro.subtract(valorIcms);
} else if (fieldName.equals("TOTAL_EMBARQUE") && !totalEmbarque.equals(BigDecimal.ZERO)) {
valorIcms = CalculoImposto.getValorImposto(this.relatorio.getConexao(), idEstado, empresaId, indInterestadual, BigDecimal.ZERO, totalEmbarque, BigDecimal.ZERO, BigDecimal.ZERO);
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) {
if (e instanceof ExceptionConfiguracao)