diff --git a/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java index 5e30dafd3..85bcbbc6d 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java @@ -49,8 +49,8 @@ public interface ConferenciaComissaoDAO extends GenericDAO { public boolean isEventosFinanceirosSemConferencia(Conferencia conferencia) throws BusinessException; - public BigDecimal carregarTotalFechamentoContaCorrente(Conferencia conferencia) throws BusinessException; - public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java index 5e2b1eb73..67baca724 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java @@ -593,7 +593,7 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO parametros = carregarParametros(null, conferencia.getEmpresa(), conferencia.getPuntoVenta()); - - StringBuilder sQuery = new StringBuilder(); - sQuery.append("SELECT SUM(TOTAL) AS TOTAL ") - .append("FROM FECHAMENTO_CNTCORRENTE ") - .append("WHERE ACTIVO = 1 ") - .append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO "); - - parametros.put("datamovimento", conferencia.getDatamovimento()); - - if(parametros.containsKey("empresaId")) { - sQuery.append("AND EMPRESA_ID = :empresaId "); - } - - if(parametros.containsKey("puntoventaId")) { - sQuery.append("AND PUNTOVENTA_ID = :puntoventaId "); - } - - log.info(sQuery.toString()); - - Query qr = getSession().createSQLQuery(sQuery.toString()); - setParametros(qr, parametros); - return (BigDecimal) qr.uniqueResult(); - } catch (Exception e) { - log.error(e.getMessage(), e); - throw new BusinessException(e.getMessage(), e); - } - } - @Override public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { try { @@ -976,5 +946,24 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO carregarBilhetesDevolvidos(List boletoComissaos) { + private Set carregarBilhetesDevolvidos(List boletoComissaos, boolean pesquisa) { Set boletos = new HashSet(); for (BoletoComissao boletoComissao : boletoComissaos) { if(boletoComissao.isBilheteNormalDevolvido() || @@ -233,7 +234,12 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic boletoComissao.isBilheteEntregaGapDevolvido() || boletoComissao.isBilheteEntregaGapTrocado()) { - boletos.add(boletoComissao); + boletoComissao.setExigeConferenciaDevolvido(boletoComissao.getIndcarboletosdevolvidosconf() != null && !boletoComissao.getIndcarboletosdevolvidosconf()); + + if(pesquisa || + ((boletoComissao.getIndcarboletosdevolvidosconf() != null && boletoComissao.getIndcarboletosdevolvidosconf()) || boletoComissao.getLogconferenciaId() != null)) { + boletos.add(boletoComissao); + } } } @@ -384,11 +390,11 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros); - BigDecimal totalFormapagoDinheiro = getFormapagoDinheiro(resumoComissao); + /*BigDecimal totalFormapagoDinheiro = getFormapagoDinheiro(resumoComissao); totalFormapagoDinheiro = totalFormapagoDinheiro.subtract(carregarTotalDevolvidosDinhero(boletoComissaos)); - totalFormapagoDinheiro = totalFormapagoDinheiro.subtract(totalOcd.getValorPagar()); + totalFormapagoDinheiro = totalFormapagoDinheiro.subtract(totalOcd.getValorPagar());*/ - resumoComissao.setValorDeposito(totalFormapagoDinheiro); + resumoComissao.setValorDeposito(conferenciaComissaoDAO.carregarValorDepositoContaCorrente(conferencia.getEmpresa().getEmpresaId(), conferencia.getPuntoVenta().getPuntoventaId(), conferencia.getDatamovimento())); return resumoComissao; } diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java index f5668019c..850000638 100644 --- a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java @@ -55,6 +55,9 @@ public class BoletoComissao { private Integer comempcategoriaId; private Long logconferenciaId; + private boolean exigeConferenciaDevolvido; + private Boolean indcarboletosdevolvidosconf; + private boolean conferido; public Integer getEmpresaId() { @@ -423,6 +426,10 @@ public class BoletoComissao { public boolean isExigeConferencia() { return getComempcategoriaId() != null || getComempformapagoId() != null; } + + public boolean isExigeConferenciaBoletoDevolvido() { + return exigeConferenciaDevolvido; + } public boolean isConferido() { return conferido; @@ -714,5 +721,21 @@ public class BoletoComissao { public IndStatusBoleto getIndstatusboletoEnum() { return IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); } + + public Boolean getIndcarboletosdevolvidosconf() { + return indcarboletosdevolvidosconf; + } + + public void setIndcarboletosdevolvidosconf(Boolean indcarboletosdevolvidosconf) { + this.indcarboletosdevolvidosconf = indcarboletosdevolvidosconf; + } + + public boolean getExigeConferenciaDevolvido() { + return exigeConferenciaDevolvido; + } + + public void setExigeConferenciaDevolvido(boolean exigeConferenciaDevolvido) { + this.exigeConferenciaDevolvido = exigeConferenciaDevolvido; + } } \ No newline at end of file