diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java index 247b7154c..dd77bd2b4 100644 --- a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java +++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java @@ -217,9 +217,9 @@ public class Totalbus { receita.setDataLancamento(rs.getDate(10)); receita.setDataMovimento(rs.getDate(10)); receita.setLocalArrecadacao(rs.getString(7)); - if (rs.getBigDecimal(1).signum() == -1) { + if (rs.getBigDecimal(1).signum() == 1) { receita.setIdentificadorReceitaDespesa("D"); - receita.setValorLancamento(df.format(rs.getBigDecimal(1).multiply(new BigDecimal(-1)))); + receita.setValorLancamento(df.format(rs.getBigDecimal(1))); } else { receita.setIdentificadorReceitaDespesa("R"); receita.setValorLancamento(df.format(rs.getBigDecimal(1))); @@ -289,7 +289,7 @@ public class Totalbus { StringBuilder sb = new StringBuilder(); - SimpleDateFormat sf = new SimpleDateFormat("dd/MM/yyy"); + SimpleDateFormat sf = new SimpleDateFormat("dd/MM/yyyy"); String fechaStr = sf.format(fechaParam); if (fechaParam == null) { fechaStr = sf.format(getData()); @@ -339,8 +339,6 @@ public class Totalbus { rs = stmt.executeQuery(); - BigDecimal valorAcumulado = BigDecimal.ZERO; - while (rs.next()) { DespesaReceita receita = new DespesaReceita(); receita.setCodigoEmpresa(rs.getInt(4)); @@ -348,21 +346,27 @@ public class Totalbus { receita.setDataLancamento(rs.getDate(7)); receita.setDataMovimento(rs.getDate(7)); receita.setLocalArrecadacao(rs.getString(6)); - if (rs.getBigDecimal(1).signum() == -1) { - receita.setIdentificadorReceitaDespesa("R"); - valorAcumulado = valorAcumulado.add((rs.getBigDecimal(4).multiply(new BigDecimal(-1)))); - receita.setValorLancamento(df.format(valorAcumulado)); - } else { - receita.setIdentificadorReceitaDespesa("D"); - receita.setValorLancamento(df.format(rs.getBigDecimal(1))); + if(rs.getString(3) != null) { + if(rs.getString(3).equalsIgnoreCase("COMISSAO")) { + if (rs.getBigDecimal(1).signum() == 1) { + receita.setIdentificadorReceitaDespesa("D"); + } else { + receita.setIdentificadorReceitaDespesa("R"); + } + }else if(rs.getString(3).equalsIgnoreCase("LQ")) { + if (rs.getBigDecimal(1).signum() == 1) { + receita.setIdentificadorReceitaDespesa("D"); + } else { + receita.setIdentificadorReceitaDespesa("R"); + } + } } - - + receita.setValorLancamento(df.format(rs.getBigDecimal(1))); receita.setDescricaoDetalhada(""); if (incluiTipoPagamentoTurismoBGM) { receita.setTipoPagamentoTurismo(rs.getString("tipoeventoextra_id")); } - receita.setFormaPagamentoId(rs.getString(2).equals("CREDITO") ? "2" : "3"); + receita.setFormaPagamentoId("1"); despesas.add(receita); } } catch (Exception e) {