diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java index 47f048d1d..e2c82b697 100644 --- a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java +++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java @@ -201,7 +201,7 @@ public class Totalbus { sb.append(" and e.empresa_id = " + empresaId); } sb.append(" and cd.activo = 1 "); - sb.append(" and tee.indtipo = 1 "); + sb.append(" and tee.indtipo = 1 "); //sb.append(" and cd.usuario_id=7061 "); sb.append(" group by "); sb.append(" cd.feccorte, "); @@ -231,8 +231,13 @@ public class Totalbus { receita.setDataLancamento(rs.getDate(1)); receita.setDataMovimento(rs.getDate(1)); receita.setLocalArrecadação(rs.getInt(6)); - receita.setValorLancamento(df.format(rs.getBigDecimal(4))); - receita.setIdentificadorReceitaDespesa("R"); + if (rs.getBigDecimal(4).signum() == -1){ + receita.setIdentificadorReceitaDespesa("D"); + receita.setValorLancamento(df.format(rs.getBigDecimal(4).multiply(new BigDecimal(-1)))); + } else { + receita.setIdentificadorReceitaDespesa("R"); + receita.setValorLancamento(df.format(rs.getBigDecimal(4))); + } despesas.add(receita); } } catch (Exception e){ @@ -263,7 +268,7 @@ public class Totalbus { sb.append(" left join ptovta_integra pi on e.empresa_id = pi.empresa_id and pi.puntoventa_id = pv.puntoventa_id "); sb.append(" where "); sb.append(" cd.feccorte = ? "); - sb.append(" and tee.indtipo = 0 "); + sb.append(" and tee.indtipo = 0 "); if (puntoventaId != null && !puntoventaId.equals(-1)){ sb.append(" and cd.puntoventa_id = " + puntoventaId); }