diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java index 59af10078..12667b097 100644 --- a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java +++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java @@ -240,12 +240,13 @@ public class Totalbus { 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("LEFT JOIN PTOVTA_EMPRESA pve ON PVE.EMPRESA_ID = e.empresa_id AND PVE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID AND PVE.activo = 1 "); - strFechamentos.append("left join empresa_contabancaria ec on EC.EMPRESA_ID = PVE.EMPRESA_ID AND EC.EMPRESACONTABANCARIA_ID = PVE.EMPRESACONTABANCARIA_ID AND EC.ACTIVO = 1 "); - strFechamentos.append("left join INSTI_FINANCEIRA if on EC.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID and if.ACTIVO = 1 "); + strFechamentos.append("inner join INSTI_FINANCEIRA if on fdep.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID "); + strFechamentos.append("inner join empresa_contabancaria ec on EC.EMPRESA_ID = fc.EMPRESA_ID AND EC.INSTIFINANCEIRA_ID = if.INSTIFINANCEIRA_ID AND EC.ACTIVO = 1 "); + strFechamentos.append("inner 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("where fd.fechamentodeposito_id = :fechamentodepositoId and fd.activo <> 0 and fc.activo <> 0 "); if (puntoventaId != null && !puntoventaId.equals(-1)){