From f46c9cd38c58db1231554e510c1dc83283d65c84 Mon Sep 17 00:00:00 2001 From: gleimar Date: Fri, 10 Feb 2017 19:21:24 +0000 Subject: [PATCH] fixes bug#8669 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@65853 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../comissao/ConferenciaController.java | 84 ++++++++++++++++++- 1 file changed, 81 insertions(+), 3 deletions(-) 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 7c69c0cc0..34e57cf6e 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 @@ -596,11 +596,68 @@ public class ConferenciaController extends MyGenericForwardComposer { carregarOcds(); carregarLogsConferencia(); carregarResumo(boletosComissaos); + + + this.ajustarPendentes(boletosComissaos); + } catch (BusinessException e) { log.error(e.getMessage(), e); } } + /** + * Metodo criado com o objetivo de adicionar os bilhetes não classificados previamente. + * + * Ou seja, casos ainda existam bilhetes após a classificação, os mesmos serão separadas em cancelados e vendidos + * + * @param boletosComissaos + * @throws BusinessException + */ + private void ajustarPendentes(List boletosComissaos) throws BusinessException { + + boletosComissaos.removeAll(this.lsBilhetes); + boletosComissaos.removeAll(this.lsBilhetesCancelados); + boletosComissaos.removeAll(this.lsBilhetesDevolvidos); + boletosComissaos.removeAll(this.lsBilhetesGap); + boletosComissaos.removeAll(this.lsBilhetesGapCancelados); + boletosComissaos.removeAll(this.lsBilhetesGapDevolvidos); + boletosComissaos.removeAll(this.lsBilhetesManual); + + boolean vendidosAtualizado = false; + boolean canceladoAtualizado = false; + boolean devolvidoAtualizado = false; + + for (BoletoComissao b: boletosComissaos){ + if (b.getIndCancelacion()){ + if (b.isMotivocancelacionDevolvido()){ + this.lsBilhetesDevolvidos.add(b); + devolvidoAtualizado = true; + }else{ + this.lsBilhetesCancelados.add(b); + canceladoAtualizado = true; + } + }else{ + this.lsBilhetes.add(b); + vendidosAtualizado = true; + } + } + //recarrega as informações + if (vendidosAtualizado){ + this.carregarBilhetesVendidos(); + } + + //recarrega as informações + if (canceladoAtualizado){ + this.carregarBilhetesCancelados(); + } + + //recarrega as informações + if (devolvidoAtualizado){ + this.carregarBilhetesDevolvidos(); + } + + } + 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()); @@ -617,7 +674,11 @@ public class ConferenciaController extends MyGenericForwardComposer { } private void carregarBilhetesVendidos(List boletosComissaos) throws BusinessException { - lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS); + + if (boletosComissaos != null){ + lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS); + } + totalBilhetesVendidos = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetes, IndStatusBoleto.V, IndStatusBoleto.T); txtTotalBilhetes.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesVendidos, LocaleUtil.getLocale())); txtQtdeTotalBilhetes.setValue(String.valueOf(lsBilhetes.size())); @@ -625,9 +686,19 @@ 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 { - lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO); + if (boletosComissaos != null){ + lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO); + } + totalBilhetesCancelados = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesCancelados); txtTotalBilhetesCancelados.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesCancelados, LocaleUtil.getLocale())); txtQtdeTotalBilhetesCancelados.setValue(String.valueOf(lsBilhetesCancelados.size())); @@ -636,9 +707,16 @@ public class ConferenciaController extends MyGenericForwardComposer { verificarBilhetesSemConferencia(lsBilhetesCancelados, tabBilhetesCancelados); } + private void carregarBilhetesDevolvidos() throws BusinessException { + this.carregarBilhetesDevolvidos(null); + } private void carregarBilhetesDevolvidos(List boletosComissaos) throws BusinessException { totalBilhetesDevolvidos = BigDecimal.ZERO; - lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO); + + if (boletosComissaos != null){ + lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO); + } + Map totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos); totalBilhetesDevolvidos = totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO);