diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java index 867627008..5a5780f04 100644 --- a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java +++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java @@ -28,6 +28,8 @@ public class Totalbus { private List pontosVenda = new ArrayList(); private List empresas = new ArrayList(); + private DecimalFormat df = new DecimalFormat("#0.00"); + public Totalbus(Connection con){ this.conn = con; loadEmpresas(); @@ -94,7 +96,6 @@ public class Totalbus { public List getReceitas(final Integer puntoVentaId, final Integer empresaId, Date fechaParam) { List despesas = new ArrayList(); - DecimalFormat df = new DecimalFormat("#0.00"); StringBuffer sb = new StringBuffer(); sb.append(" select "); sb.append(" cd.feccorte AS fechorvta, "); @@ -150,7 +151,7 @@ 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.setValorLancamento(df.format(rs.getBigDecimal(4).toString())); receita.setIdentificadorReceitaDespesa("R"); despesas.add(receita); } @@ -165,7 +166,6 @@ public class Totalbus { public List getDespesas(Integer puntoventaId, Integer empresaId, Date fechaParam){ List despesas = new ArrayList(); - DecimalFormat df = new DecimalFormat("#0.00"); StringBuilder sb = new StringBuilder(); sb.append(" select "); sb.append(" cd.feccorte as feccorte, "); @@ -215,7 +215,7 @@ public class Totalbus { despesa.setDataLancamento(rs.getDate(1)); despesa.setDataMovimento(rs.getDate(1)); despesa.setLocalArrecadação(rs.getInt(3)); - despesa.setValorLancamento(df.format(BigDecimal.valueOf(rs.getBigDecimal(4).doubleValue() * -1))); + despesa.setValorLancamento(df.format(Double.toString(rs.getBigDecimal(4).doubleValue() * -1))); despesa.setIdentificadorReceitaDespesa("D"); despesas.add(despesa); } @@ -231,21 +231,21 @@ public class Totalbus { public List getDepositos(Integer puntoventaId, Integer empresaId, Date fechaParam){ List depositos = new ArrayList(); StringBuilder sb = new StringBuilder(); - sb.append("select fdep.fechamentodeposito_id, fdep.valor, fdep.numdeposito, fdep.FECCREACION "); + sb.append("select fdep.fechamentodeposito_id, fdep.valor, fdep.numdeposito, fdep.FECMODIF "); sb.append("from fechamento_deposito fdep "); - sb.append("where trunc(FECCREACION) = :fecha and fdep.activo = 1 "); + sb.append("where trunc(FECMODIF) = :fecha and fdep.activo = 1 "); StringBuilder strFechamentos = new StringBuilder(); strFechamentos.append("Select fc.fecfechamento, fc.empresa_id, pv.numpuntoventa, fd.valor_pago, ec.numagencia, ec.numconta, if.CODIGO, ec.numintegracion "); - strFechamentos.append("from fechamento_cct_deposito fd "); - strFechamentos.append("inner join FECHAMENTO_DEPOSITO fdep on FDEP.FECHAMENTODEPOSITO_ID = FD.FECHAMENTODEPOSITO_ID "); - strFechamentos.append("inner join fechamento_cntcorrente fc on fc.fechamentocntcorrente_id = fd.fechamentocntcorrente_id "); - strFechamentos.append("inner join PUNTO_VENTA pv on FC.PUNTOVENTA_ID = PV.PUNTOVENTA_ID "); - strFechamentos.append("JOIN EMPRESA e ON e.EMPRESA_ID = FC.EMPRESA_ID "); - strFechamentos.append("inner join INSTI_FINANCEIRA if on fdep.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID "); - strFechamentos.append("left join empresa_contabancaria ec on EC.EMPRESA_ID = fc.EMPRESA_ID AND EC.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID AND EC.ACTIVO = 1 "); - strFechamentos.append("left JOIN PTOVTA_EMPRESA pve ON PVE.EMPRESA_ID = e.empresa_id AND PVE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID and EC.EMPRESACONTABANCARIA_ID = pve.EMPRESACONTABANCARIA_ID AND PVE.activo = 1 "); + strFechamentos.append("from fechamento_deposito fdep "); + strFechamentos.append("join fechamento_cct_deposito fd on fd.fechamentodeposito_id = fdep.fechamentodeposito_id "); + strFechamentos.append("join fechamento_cntcorrente fc on fc.fechamentocntcorrente_id = fd.fechamentocntcorrente_id "); + strFechamentos.append("inner join PUNTO_VENTA pv on PV.PUNTOVENTA_ID = FC.PUNTOVENTA_ID "); + strFechamentos.append("left join PTOVTA_EMPRESA pe on pe.puntoventa_id = pv.puntoventa_id and pe.empresa_id = fc.empresa_id "); + strFechamentos.append("left join empresa_contabancaria ec on ec.EMPRESACONTABANCARIA_ID = pe.EMPRESACONTABANCARIA_ID "); + strFechamentos.append("left join INSTI_FINANCEIRA if on if.INSTIFINANCEIRA_ID = EC.INSTIFINANCEIRA_ID "); + strFechamentos.append("join EMPRESA e on e.empresa_id = fc.empresa_id "); strFechamentos.append("where fd.fechamentodeposito_id = :fechamentodepositoId and fd.activo <> 0 and fc.activo <> 0 "); if (puntoventaId != null && !puntoventaId.equals(-1)){ @@ -268,7 +268,7 @@ public class Totalbus { rs = pstmt.executeQuery(); Integer codigoReceitaDespesaGlobus = getCodigoReceitaDespesaGlobus(); - DecimalFormat df = new DecimalFormat("#0.00"); + SimpleDateFormat sdf = new SimpleDateFormat("MM/yy"); PreparedStatement pstmtFechamentos = getConnection().prepareStatement(strFechamentos.toString());