diff --git a/pom.xml b/pom.xml index 60aa728f8..43fdfbc9e 100644 --- a/pom.xml +++ b/pom.xml @@ -115,7 +115,7 @@ slf4j-reload4j - + br.com.rjconsultores diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java index 1ebda65de..50350c5fe 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/catalogos/EditarPuntoVentaController.java @@ -19,6 +19,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -592,11 +593,15 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { private Checkbox checkIndBloqueioDescontoWEB; private Checkbox checkIndTaxaConvenienciaOrgaoConcedente; + private final String constanteIndMotivoBloqueio= "IND_MOTIVO_BLOQUEIO"; + @Autowired private CobrancaAdcPuntoVentaService cobrancaAdcService; private List lsOrgaoConcedentes; + private boolean indMotivoBloqueio; + public Button getBtnApagar() { return btnApagar; } @@ -610,7 +615,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { "jQuery('#" + txtNumFax.getUuid() + "').mask('(999)9999-9999?9');" + "jQuery('#" + numtelefonodos.getUuid() + "').mask('(999)9999-9999?9');" + "jQuery('#" + numtelefonouno.getUuid() + "').mask('(999)9999-9999?9');"); - } + } private List getLogFiles() { List files = new ArrayList(); @@ -773,7 +778,17 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { ptovtaPtoVtaSeguroList.setData(puntoVenta.getPtovtaSeguroList()); ptovtaCatIndList.setData(puntoVenta.getPtovtaCatIndList()); ptovtaCatIndListTemp.addAll(puntoVenta.getPtovtaCatIndList()); - ptovtaHistoricoList.setData(puntoVenta.getHistoricoPuntoVentaList()); + List lsHistoricoPuntoVentaOrdenada =puntoVenta.getHistoricoPuntoVentaList(); + + Collections.sort(lsHistoricoPuntoVentaOrdenada, new Comparator() { + public int compare(Object o1, Object o2) { + HistoricoPuntoVenta c1 = (HistoricoPuntoVenta) o1; + HistoricoPuntoVenta c2 = (HistoricoPuntoVenta) o2; + return c1.getFecBloqueio().compareTo( c2.getFecBloqueio()); + + } + }); + ptovtaHistoricoList.setData(lsHistoricoPuntoVentaOrdenada); ptovtaHistoricoFormaPagoList.setData(puntoVenta.getHistoricoFormaPagoPuntoVentaList()); categoriasBloqImpPosteriorList.setData(puntoVenta.getCategoriaBloqImpPosteriorList()); cobrancaAdicionalList.setData(puntoVenta.getCobrancaAdicionalList()); @@ -864,9 +879,17 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } statusAprobacionInicial = radAprobacionAutorizado.isChecked() ? "A" : "L"; - motivoBloqueio.setValue(puntoVenta.getMotivoBloqueio()); + + obterOValorConstanteIndMotivoBloqueio(); + if (indMotivoBloqueio) { + rowMotivoBloqueio.setVisible(true); + } + if (puntoVenta.getPuntoventaId() != null) { + + motivoBloqueio.setValue(puntoVenta.getMotivoBloqueio()); + if (puntoVenta.getAgenciaId() != null) { if (puntoVenta.getAgenciaId().getInstiFinanceiraId() != null) { @@ -894,13 +917,11 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } if (puntoVenta.getDateAbertura() != null) { dateAbertura.setValue(puntoVenta.getDateAbertura()); - } + } + if (radAprobacionLatente.isChecked()) { dateFechamento.setValue(puntoVenta.getDateFechamento()); rowDateFechamento.setVisible(true); - motivoBloqueio.setValue(puntoVenta.getMotivoBloqueio()); - rowMotivoBloqueio.setVisible(true); - } } else { dateAbertura.setValue(new Date()); @@ -1147,7 +1168,10 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } } - }); + }); + + + } /** @@ -1920,7 +1944,19 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { txtAntecipPercentual.getValue(); numtelefonodos.getValue(); numtelefonouno.getValue(); - + if (indMotivoBloqueio) { + if (puntoVenta.getPuntoventaId() != null) { + String statusAprobacionAtual = radAprobacionAutorizado.isChecked() ? "A" : "L"; + if (!statusAprobacionAtual.equals(statusAprobacionInicial)) { + motivoBloqueio.setConstraint("no empty"); + motivoBloqueio.getValue(); + } + } else { + motivoBloqueio.setConstraint("no empty"); + motivoBloqueio.getValue(); + } + } + getTxtTaxaConvenienciaPorc().getValue(); if (getTxtTaxaConvenienciaPorc().getValue() != null && getTxtTaxaConvenienciaPorc().getValue().compareTo(BigDecimal.ZERO) == 1) { @@ -2152,7 +2188,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } puntoVenta.setDateFechamento(dateFechamento.getValue()); - puntoVenta.setMotivoBloqueio(motivoBloqueio.getValue()); + String getString = null; puntoVenta.setNumfax(null); @@ -2245,6 +2281,16 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { puntoVenta.setStatusaprobacion("L"); } + if (indMotivoBloqueio) { + if (puntoVenta.getPuntoventaId() != null) { + if (!puntoVenta.getStatusaprobacion().equals(statusAprobacionInicial)) { + puntoVenta.setMotivoBloqueio(motivoBloqueio.getValue()); + } + } else { + puntoVenta.setMotivoBloqueio(motivoBloqueio.getValue()); + } + } + if(!puntoVenta.getStatusaprobacion().equals(statusAprobacionInicial)){ HistoricoPuntoVenta h = new HistoricoPuntoVenta(); h.setPuntoVenta(puntoVenta); @@ -4167,8 +4213,7 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { public void onClick$radAprobacionLatente(Event event) { if (radAprobacionLatente.isChecked()) { - rowDateFechamento.setVisible(Boolean.TRUE); - rowMotivoBloqueio.setVisible(Boolean.TRUE); + rowDateFechamento.setVisible(Boolean.TRUE); } } @@ -4176,8 +4221,6 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { if (!radAprobacionLatente.isChecked()) { dateFechamento.setValue(puntoVenta.getDateFechamento()); rowDateFechamento.setVisible(Boolean.FALSE); - motivoBloqueio.setValue(null); - rowMotivoBloqueio.setVisible(Boolean.FALSE); } } @@ -4861,4 +4904,14 @@ public class EditarPuntoVentaController extends MyGenericForwardComposer { } return false; } + + + private void obterOValorConstanteIndMotivoBloqueio() { + Constante constante = constanteService.buscarPorNomeConstante(constanteIndMotivoBloqueio); + if (constante != null && StringUtils.isNotBlank(constante.getValorconstante()) + && constante.getValorconstante().equalsIgnoreCase("true")) { + indMotivoBloqueio = true; + } + + } } \ No newline at end of file diff --git a/web/gui/catalogos/editarPuntoVenta.zul b/web/gui/catalogos/editarPuntoVenta.zul index 41a030d8d..eb03e7cd9 100644 --- a/web/gui/catalogos/editarPuntoVenta.zul +++ b/web/gui/catalogos/editarPuntoVenta.zul @@ -265,7 +265,7 @@