diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/ConferenciaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/ConferenciaController.java index 34e57cf6e..162126897 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/ConferenciaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/comissao/ConferenciaController.java @@ -28,6 +28,7 @@ import org.zkoss.zul.Radio; import org.zkoss.zul.Tab; import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; import com.rjconsultores.ventaboletos.entidad.Conferencia; import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia; import com.rjconsultores.ventaboletos.entidad.Empresa; @@ -583,12 +584,12 @@ public class ConferenciaController extends MyGenericForwardComposer { private void carregarDados() { try { - List boletosComissaos = conferenciaComissaoService.carregarBilhetesComissao(null, getConferencia(), null); + List boletosComissaos = conferenciaComissaoService.carregarBilhetesComissao(null, getConferencia(), null, false); carregarBilhetesManual(boletosComissaos); - carregarBilhetesVendidos(boletosComissaos); - carregarBilhetesCancelados(boletosComissaos); - carregarBilhetesDevolvidos(boletosComissaos); + carregarBilhetesVendidos(boletosComissaos, false); + carregarBilhetesCancelados(boletosComissaos, false); + carregarBilhetesDevolvidos(boletosComissaos, false); carregarBilhetesGap(boletosComissaos); carregarBilhetesGapCancelados(boletosComissaos); carregarBilhetesGapDevolvidos(boletosComissaos); @@ -632,39 +633,41 @@ public class ConferenciaController extends MyGenericForwardComposer { if (b.isMotivocancelacionDevolvido()){ this.lsBilhetesDevolvidos.add(b); devolvidoAtualizado = true; - }else{ + }else{ this.lsBilhetesCancelados.add(b); canceladoAtualizado = true; } - }else{ + }else{ this.lsBilhetes.add(b); vendidosAtualizado = true; } } + + //recarrega as informações if (vendidosAtualizado){ - this.carregarBilhetesVendidos(); + this.carregarBilhetesVendidos(this.lsBilhetes,true); } //recarrega as informações if (canceladoAtualizado){ - this.carregarBilhetesCancelados(); + this.carregarBilhetesCancelados(this.lsBilhetesCancelados,true); } //recarrega as informações if (devolvidoAtualizado){ - this.carregarBilhetesDevolvidos(); + this.carregarBilhetesDevolvidos(this.lsBilhetesDevolvidos,true); } } - + private void carregarResumo(List boletosComissaos) throws BusinessException { resumo = conferenciaComissaoService.gerarResumo(conferencia, boletosComissaos, lsEventosFinanceiros, totalBilhetesManual, totalBilhetesVendidos, totalBilhetesCancelados, totalBilhetesDevolvidos, totalBilhetesGap, totalBilhetesGapCancelados, totalBilhetesGapDevolvidos, totalCreditosEventoFinanceiros, totalDebitosEventoFinanceiros, ocdTotal); formapagosList.setData(resumo.getTotalFormapago()); } private void carregarBilhetesManual(List boletosComissaos) throws BusinessException { - lsBilhetesManual = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL); + lsBilhetesManual = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL, false); totalBilhetesManual = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesManual, IndStatusBoleto.V); txtTotalBilhetesManual.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesManual, LocaleUtil.getLocale())); txtQtdeTotalBilhetesManual.setValue(String.valueOf(lsBilhetesManual.size())); @@ -673,11 +676,8 @@ public class ConferenciaController extends MyGenericForwardComposer { verificarBilhetesSemConferencia(lsBilhetesManual, tabBilhetesManual); } - private void carregarBilhetesVendidos(List boletosComissaos) throws BusinessException { - - if (boletosComissaos != null){ - lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS); - } + private void carregarBilhetesVendidos(List boletosComissaos, boolean carregarDadosFaltantes) throws BusinessException { + lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS, carregarDadosFaltantes); totalBilhetesVendidos = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetes, IndStatusBoleto.V, IndStatusBoleto.T); txtTotalBilhetes.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesVendidos, LocaleUtil.getLocale())); @@ -686,18 +686,11 @@ public class ConferenciaController extends MyGenericForwardComposer { verificarBilhetesSemConferencia(lsBilhetes, tabBilhetesVenda); } - - private void carregarBilhetesVendidos() throws BusinessException { - this.carregarBilhetesVendidos(null); - } - private void carregarBilhetesCancelados() throws BusinessException { - this.carregarBilhetesCancelados(null); - } - private void carregarBilhetesCancelados(List boletosComissaos) throws BusinessException { - if (boletosComissaos != null){ - lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO); - } + private void carregarBilhetesCancelados(List boletosComissaos, boolean carregarDadosFaltantes) throws BusinessException { + + lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO, carregarDadosFaltantes); + totalBilhetesCancelados = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesCancelados); txtTotalBilhetesCancelados.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesCancelados, LocaleUtil.getLocale())); @@ -707,15 +700,11 @@ public class ConferenciaController extends MyGenericForwardComposer { verificarBilhetesSemConferencia(lsBilhetesCancelados, tabBilhetesCancelados); } - private void carregarBilhetesDevolvidos() throws BusinessException { - this.carregarBilhetesDevolvidos(null); - } - private void carregarBilhetesDevolvidos(List boletosComissaos) throws BusinessException { + + private void carregarBilhetesDevolvidos(List boletosComissaos, boolean carregarDadosFaltantes) throws BusinessException { totalBilhetesDevolvidos = BigDecimal.ZERO; - if (boletosComissaos != null){ - lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO); - } + lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO, carregarDadosFaltantes); Map totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos); @@ -734,7 +723,7 @@ public class ConferenciaController extends MyGenericForwardComposer { } private void carregarBilhetesGap(List boletosComissaos) throws BusinessException { - lsBilhetesGap = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS); + lsBilhetesGap = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS, false); totalBilhetesGap = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesGap, IndStatusBoleto.V, IndStatusBoleto.T); txtTotalBilhetesGap.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesGap, LocaleUtil.getLocale())); txtQtdeTotalBilhetesGap.setValue(String.valueOf(lsBilhetesGap.size())); @@ -744,7 +733,7 @@ public class ConferenciaController extends MyGenericForwardComposer { } private void carregarBilhetesGapCancelados(List boletosComissaos) throws BusinessException { - lsBilhetesGapCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO); + lsBilhetesGapCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO, false); totalBilhetesGapCancelados = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesGapCancelados); txtTotalBilhetesGapCancelados.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesGapCancelados, LocaleUtil.getLocale())); txtQtdeTotalBilhetesGapCancelados.setValue(String.valueOf(lsBilhetesGapCancelados.size())); @@ -754,7 +743,7 @@ public class ConferenciaController extends MyGenericForwardComposer { } private void carregarBilhetesGapDevolvidos(List boletosComissaos) throws BusinessException { - lsBilhetesGapDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO); + lsBilhetesGapDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO, false); Map totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesGapDevolvidos); @@ -1146,7 +1135,7 @@ public class ConferenciaController extends MyGenericForwardComposer { /* * if((empresa.getIndcarboletosdevolvidosconf() == null || !empresa.getIndcarboletosdevolvidosconf()) && StringUtils.isBlank(conferencia.getNumfoliosistema())) { Messagebox.show(Labels.getLabel("conferenciaController.msg.numfoliosistemaNaoInformado"), Labels.getLabel("conferenciaController.window.title"), Messagebox.OK,Messagebox.INFORMATION); return; } */ - lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(null, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO); + lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(null, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO, false); Map totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos); totalBilhetesDevolvidos = totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO);