diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaController.java index 2abaf60ed..d1fb78868 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaController.java @@ -19,13 +19,16 @@ import org.zkoss.util.resource.Labels; import org.zkoss.zhtml.Messagebox; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Combobox; import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Intbox; import org.zkoss.zul.Radio; +import org.zkoss.zul.Row; import org.zkoss.zul.Tab; +import org.zkoss.zul.api.Timebox; import com.rjconsultores.ventaboletos.entidad.Categoria; import com.rjconsultores.ventaboletos.entidad.CategoriaClase; @@ -50,6 +53,7 @@ import com.rjconsultores.ventaboletos.service.CorridaCtrlService; import com.rjconsultores.ventaboletos.service.EmpresaService; import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.web.gui.controladores.esquemaoperacional.TiempoEstanciaEsquemaTramoController; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; import com.rjconsultores.ventaboletos.web.utilerias.MyListbox; import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionCategoriaClase; @@ -117,6 +121,12 @@ public class EditarConfiguracionCategoriaController extends MyGenericForwardComp private Intbox cantAutorizada; private Radio radioImp; private Radio radioImprimePassagem; + private Radio rdCuotaSi; + private Radio rdCuotaNo; + private Row rowTrecho;; + private Row rowTiempo;; + private Radio rdTrecho; + private Timebox timeTempoPermitir; private Radio radioNaoImprimePassagem; private Tab tabEmpresa; private Tab tabDesconto; @@ -518,59 +528,66 @@ public class EditarConfiguracionCategoriaController extends MyGenericForwardComp cmbCategorias.focus(); return; } + cmbCategorias.getValue(); cantAutorizada.getValue(); descuentoPorc.getValue(); descuentoImporte.getValue(); - try { - boolean existe = false; - for (CategoriaDescuento cd : lsCategoriaDescuento) { - if (cd.getActivo() && cd.getCategoria().equals(cmbCategorias.getSelectedItem().getValue())) { - existe = true; - } + + boolean existe = false; + for (CategoriaDescuento cd : lsCategoriaDescuento) { + if (cd.getActivo() && cd.getCategoria().equals(cmbCategorias.getSelectedItem().getValue())) { + existe = true; } - if (!existe) { - CategoriaDescuento cDescuento = new CategoriaDescuento(); - cDescuento.setCategoriaCtrl(categoriaCtrl); - cDescuento.setActivo(Boolean.TRUE); - cDescuento.setFecmodif(Calendar.getInstance().getTime()); - cDescuento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - cDescuento.setCategoria((Categoria) cmbCategorias.getSelectedItem().getValue()); - cDescuento.setCantautorizada(cantAutorizada.getValue()); - cDescuento.setDescuentoimporte(descuentoImporte.getValue()); - cDescuento.setDescuentoporc(descuentoPorc.getValue()); + } + if (!existe) { + CategoriaDescuento cDescuento = new CategoriaDescuento(); + cDescuento.setCategoriaCtrl(categoriaCtrl); + cDescuento.setActivo(Boolean.TRUE); + cDescuento.setFecmodif(Calendar.getInstance().getTime()); + cDescuento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cDescuento.setCategoria((Categoria) cmbCategorias.getSelectedItem().getValue()); + cDescuento.setCantautorizada(cantAutorizada.getValue()); + cDescuento.setDescuentoimporte(descuentoImporte.getValue()); + cDescuento.setDescuentoporc(descuentoPorc.getValue()); - if (radioImprimePassagem.isSelected()) { - cDescuento.setIndImprimeBoleto(Boolean.TRUE); - } else if (radioNaoImprimePassagem.isSelected()) { - cDescuento.setIndImprimeBoleto(Boolean.FALSE); + if (radioImprimePassagem.isSelected()) { + cDescuento.setIndImprimeBoleto(Boolean.TRUE); + } else if (radioNaoImprimePassagem.isSelected()) { + cDescuento.setIndImprimeBoleto(Boolean.FALSE); + } + + cDescuento.setIndCuota(false); + cDescuento.setIndCuotaTramo(false); + + if (rdCuotaSi.isChecked()){ + if (timeTempoPermitir.getValue() == null){ + throw new WrongValueException(timeTempoPermitir, Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBDOBLIGATORIO")); } - lsCategoriaDescuento.add(cDescuento); - categoriaDescuentoList.addItem(cDescuento); - categoriaCtrl.setCategoriaDescuentoList(lsCategoriaDescuento); - - cmbCategorias.setSelectedItem(null); - cantAutorizada.setRawValue(null); - if (radioImp.isChecked()) { - onClick$radioImp(null); - } else { - onClick$radioPor(null); - } - } else { - Messagebox.show( - Labels.getLabel("MSG.Registro.Existe"), - Labels.getLabel("editarConfiguracionCategoriaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); + cDescuento.setIndCuota(true); + cDescuento.setIndCuotaTramo(rdTrecho.isChecked()); + cDescuento.setTiempoCuota(timeTempoPermitir.getValue()); } + + lsCategoriaDescuento.add(cDescuento); + categoriaDescuentoList.addItem(cDescuento); + categoriaCtrl.setCategoriaDescuentoList(lsCategoriaDescuento); - } catch (Exception ex) { - log.error(ex); - Clients.alert( - Labels.getLabel("MSG.Error"), + cmbCategorias.setSelectedItem(null); + cantAutorizada.setRawValue(null); + if (radioImp.isChecked()) { + onClick$radioImp(null); + } else { + onClick$radioPor(null); + } + } else { + Messagebox.show( + Labels.getLabel("MSG.Registro.Existe"), Labels.getLabel("editarConfiguracionCategoriaController.window.title"), - Messagebox.ERROR); + Messagebox.OK, Messagebox.EXCLAMATION); } + } public void onClick$btnRemoverDesconto(Event ev) { @@ -978,4 +995,18 @@ public class EditarConfiguracionCategoriaController extends MyGenericForwardComp public List getLsCategorias() { return lsCategorias; } + + public void onClick$rdCuotaSi(Event ev) { + mudarCamposCuota(true); + } + + private void mudarCamposCuota(boolean visible){ + rowTrecho.setVisible(visible); + rowTiempo.setVisible(visible); + + timeTempoPermitir.setValue(null); + } + public void onClick$rdCuotaNo(Event ev) { + mudarCamposCuota(false); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaDatosCategoriaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaDatosCategoriaController.java index e83b2692e..3ee508870 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaDatosCategoriaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/configuracioneccomerciales/EditarConfiguracionCategoriaDatosCategoriaController.java @@ -8,11 +8,16 @@ import java.math.BigDecimal; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; +import org.zkoss.util.resource.Labels; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.event.Event; +import org.zkoss.zul.Checkbox; import org.zkoss.zul.Radio; +import org.zkoss.zul.Row; import org.zkoss.zul.Textbox; +import org.zkoss.zul.api.Timebox; import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer; @@ -35,6 +40,11 @@ public class EditarConfiguracionCategoriaDatosCategoriaController extends MyGene private Radio radioNaoImprimePassagem; private Textbox descuentoPorc; private Textbox descuentoImporte; + private Row rowTrecho; + private Row rowTiempo; + private Timebox timeTempoPermitir; + private Radio rdCuotaSi; + private Radio rdTrecho; @Override public void doAfterCompose(Component comp) throws Exception { @@ -58,6 +68,15 @@ public class EditarConfiguracionCategoriaDatosCategoriaController extends MyGene } else if ((categoriaDescuento.getIndImprimeBoleto() != null) && (!categoriaDescuento.getIndImprimeBoleto())) { radioNaoImprimePassagem.setSelected(Boolean.TRUE); } + + if ( (categoriaDescuento.getIndCuota() != null) && (categoriaDescuento.getIndCuota()) ){ + mudarCamposCuota(true); + timeTempoPermitir.setValue(categoriaDescuento.getTiempoCuota()); + rdCuotaSi.setChecked(true); + rdTrecho.setChecked(categoriaDescuento.getIndCuotaTramo()); + }else{ + mudarCamposCuota(false); + } } public void onClick$btnSalvar(Event ev) { @@ -66,6 +85,19 @@ public class EditarConfiguracionCategoriaDatosCategoriaController extends MyGene } else if (radioNaoImprimePassagem.isSelected()) { categoriaDescuento.setIndImprimeBoleto(Boolean.FALSE); } + + categoriaDescuento.setIndCuota(false); + categoriaDescuento.setIndCuotaTramo(false); + + if (rdCuotaSi.isChecked()){ + if (timeTempoPermitir.getValue() == null){ + throw new WrongValueException(timeTempoPermitir, Labels.getLabel("MSG.CONSTRAINT.CONSTRAINTNUMBERBDOBLIGATORIO")); + } + + categoriaDescuento.setIndCuota(true); + categoriaDescuento.setIndCuotaTramo(rdTrecho.isChecked()); + categoriaDescuento.setTiempoCuota(timeTempoPermitir.getValue()); + } categoriaDescuentoList.updateItem(categoriaDescuento); this.closeWindow(); @@ -98,4 +130,18 @@ public class EditarConfiguracionCategoriaDatosCategoriaController extends MyGene categoriaDescuento.setDescuentoimporte(BigDecimal.ZERO); descuentoPorc.setConstraint("no empty, no zero, no negative"); } + + public void onClick$rdCuotaSi(Event ev) { + mudarCamposCuota(true); + } + + private void mudarCamposCuota(boolean visible){ + rowTrecho.setVisible(visible); + rowTiempo.setVisible(visible); + + timeTempoPermitir.setValue(null); + } + public void onClick$rdCuotaNo(Event ev) { + mudarCamposCuota(false); + } } diff --git a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCatalogoDeRutaController.java b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCatalogoDeRutaController.java index 74cbaec20..aa86a758b 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCatalogoDeRutaController.java +++ b/src/java/com/rjconsultores/ventaboletos/web/gui/controladores/esquemaoperacional/EditarCatalogoDeRutaController.java @@ -607,31 +607,20 @@ public class EditarCatalogoDeRutaController extends MyGenericForwardComposer ruta.setIndNombreObligatorio(Boolean.FALSE); } - if (ruta.getRutaId() == null) { - String nomeRuta = ruta.getDescruta(); - ClaseServicio claseServicio = ruta.getClaseServicio(); - Boolean isNomeObrigatorio = ruta.getIndNombreObligatorio(); + if (ruta.getRutaId() == null) { + + ruta = rutaService.suscribir(ruta, lsParadasSequencia); + rutaList.addItem(ruta); - List lsRutas = rutaService.buscar(nomeRuta, claseServicio, isNomeObrigatorio); - - if (lsRutas.isEmpty()) { - ruta = rutaService.suscribir(ruta, lsParadasSequencia); - - rutaList.addItem(ruta); - - Messagebox.show(Labels.getLabel( - "editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: " - + ruta.getRutaId().toString()), - Labels.getLabel("editarCatalogoDeRutaController.window.title"), - Messagebox.OK, - Messagebox.INFORMATION); - - closeWindow(); - } else { - Messagebox.show(Labels.getLabel("MSG.Registro.Existe"), + Messagebox.show(Labels.getLabel( + "editarCatalogoDeRutaController.MSG.suscribirOK").concat(" ID: " + + ruta.getRutaId().toString()), Labels.getLabel("editarCatalogoDeRutaController.window.title"), - Messagebox.OK, Messagebox.EXCLAMATION); - } + Messagebox.OK, + Messagebox.INFORMATION); + + closeWindow(); + } else { // Gera Secuencia e Combinação Novamente se houve diff --git a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderConfiguracionCategoriaDecuento.java b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderConfiguracionCategoriaDecuento.java index 9218c5c4a..d63b93c6d 100644 --- a/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderConfiguracionCategoriaDecuento.java +++ b/src/java/com/rjconsultores/ventaboletos/web/utilerias/render/RenderConfiguracionCategoriaDecuento.java @@ -29,10 +29,18 @@ public class RenderConfiguracionCategoriaDecuento implements ListitemRenderer { lc = new Listcell(categoria.getDescuentoimporte() != null ? categoria.getDescuentoimporte().toString() : "0"); lc.setParent(lstm); + + lc = new Listcell(categoria.getIndImprimeBoleto() != null ? (categoria.getIndImprimeBoleto()?"Sim":"Não") : "Não"); + lc.setParent(lstm); + + lc = new Listcell(categoria.getIndCuota() != null ? (categoria.getIndCuota()?"Sim":"Não") : "Não"); + lc.setParent(lstm); lc = new Listcell(categoria.getDescuentoporc() != null ? categoria.getDescuentoporc().toString() : "0"); lc.setParent(lstm); - + + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); String vigencia = ""; List lsCategoriaPeriodo = categoria.getCategoriaPeriodoList(); diff --git a/web/WEB-INF/i3-label_pt_BR.label b/web/WEB-INF/i3-label_pt_BR.label index b89c4d362..9d3336671 100644 --- a/web/WEB-INF/i3-label_pt_BR.label +++ b/web/WEB-INF/i3-label_pt_BR.label @@ -7,7 +7,7 @@ # . . = XXX #Versao do VentaBoleto: -versao = ADM_20121218_1RC91 +versao = ADM_20121220_1RC92 # MSG Defaut: MSG.CONSTRAINT.PORCENTAGEM = Os valores devem estar entre 0 e 100 @@ -910,7 +910,15 @@ editarConfiguracionCategoriaController.lblCorrida.value = Serviço editarConfiguracionCategoriaController.lblClaseServicio.value = Tipo de Classe editarConfiguracionCategoriaController.lblOrigen.value = Origem (Início Linha) editarConfiguracionCategoriaController.lblDestino.value = Destino (Fim Linha) -editarConfiguracionCategoriaController.lblCantAutorizada.value = Quantidade Autorizada +editarConfiguracionCategoriaController.lblCantAutorizada.value = Qtd Autorizada +editarConfiguracionCategoriaController.lblGridImprime.value=Imprime +editarConfiguracionCategoriaController.lblCota.value=Cota +editarConfiguracionCategoriaController.lblCotaObli.value=Cota Obrigatória +editarConfiguracionCategoriaController.lblTipoCota.value=Tipo de Cota +editarConfiguracionCategoriaController.lblServico.value=Serviço +editarConfiguracionCategoriaController.lblTrecho.value=Trecho +editarConfiguracionCategoriaController.lblTiempoValido.value=Tempo Válido +editarConfiguracionCategoriaController.lblGridCantAutorizada.value = Qtd Aut. editarConfiguracionCategoriaController.lblDescuentoPorc.value = Porcentagem editarConfiguracionCategoriaController.lblDescuentoImporte.value = Valor editarConfiguracionCategoriaController.lblDescuento.value = Tipo Desconto @@ -954,6 +962,7 @@ editarConfiguracionCategoriaController.MSG.necesitaMercado = Necessita informar editarConfiguracionCategoriaController.MSG.necesitaClase = Necessita informar um tipo de classe. editarConfiguracionCategoriaController.lblImprimirPassagem.value = Impressão de Passagem + # Detener a pantalla de Pesquisa busquedaCatalogoDeParadaController.window.title = Localidade busquedaCatalogoDeParadaController.btnRefresh.tooltiptext = Atualizar diff --git a/web/gui/configuraciones_comerciales/editarConfiguracionCategorias.zul b/web/gui/configuraciones_comerciales/editarConfiguracionCategorias.zul index eb7a01223..ebf6427b0 100644 --- a/web/gui/configuraciones_comerciales/editarConfiguracionCategorias.zul +++ b/web/gui/configuraciones_comerciales/editarConfiguracionCategorias.zul @@ -4,7 +4,7 @@ - + + + + + + + + + + + + + +