fixed bug #7659: Modificação na tela Vigências Tarifa
mel.: O formato da data nos períodos de vigência nas telas de busca e criação não apresentam mais hora git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@57689 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
3a7451cfa2
commit
ceda3d09fa
|
@ -21,6 +21,7 @@ import org.zkoss.zul.Paging;
|
|||
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||
|
@ -119,24 +120,14 @@ public class BusquedaVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
}
|
||||
|
||||
private void refreshLista() {
|
||||
Date inicio = fecInicio.getValue();
|
||||
Date fim = fecFinal.getValue();
|
||||
Date inicio = forceInitialDateLimit(fecInicio.getValue());
|
||||
Date fim = forceEndDateLimit(fecFinal.getValue());
|
||||
|
||||
if (inicio != null) {
|
||||
inicio.setSeconds(0);
|
||||
inicio.setMinutes(0);
|
||||
inicio.setHours(0);
|
||||
}
|
||||
if (fim != null) {
|
||||
fim.setSeconds(0);
|
||||
fim.setMinutes(59);
|
||||
fim.setHours(23);
|
||||
}
|
||||
HibernateSearchObject<VigenciaTarifa> vigenciaTarifaBusqueda = new HibernateSearchObject<VigenciaTarifa>(VigenciaTarifa.class, pagingVigencia.getPageSize());
|
||||
vigenciaTarifaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||
|
||||
vigenciaTarifaBusqueda.addFilterGreaterOrEqual("feciniciovigencia", fecInicio.getValue());
|
||||
vigenciaTarifaBusqueda.addFilterLessOrEqual("fecfinvigencia", fecFinal.getValue());
|
||||
vigenciaTarifaBusqueda.addFilterGreaterOrEqual("feciniciovigencia", inicio);
|
||||
vigenciaTarifaBusqueda.addFilterLessOrEqual("fecfinvigencia", fim);
|
||||
|
||||
vigenciaTarifaBusqueda.addSortAsc("feciniciovigencia");
|
||||
|
||||
|
@ -147,8 +138,17 @@ public class BusquedaVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||
Labels.getLabel("busquedaVigenciaTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Date forceInitialDateLimit(Date date) {
|
||||
return date == null ? null : DateUtil.inicioFecha(date);
|
||||
}
|
||||
|
||||
private Date forceEndDateLimit(Date date) {
|
||||
return date == null ? null : DateUtil.fimFecha(date);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.rjconsultores.ventaboletos.entidad.Tarifa;
|
|||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaService;
|
||||
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||
|
@ -114,27 +115,21 @@ public class EditarVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
Date inicio = fecInicio.getValue();
|
||||
Date fim = fecFinal.getValue();
|
||||
|
||||
inicio.setSeconds(0);
|
||||
inicio.setMinutes(0);
|
||||
inicio.setHours(0);
|
||||
fim.setSeconds(0);
|
||||
fim.setMinutes(59);
|
||||
fim.setHours(23);
|
||||
|
||||
List<VigenciaTarifa> lsVT1 = vigenciaTarifaService.buscarVigenciasIntervalo(vigenciaTarifa);
|
||||
|
||||
// checando se o fim da vigencia eh menor que o inicio:
|
||||
if (!fim.before(inicio)) {
|
||||
vigenciaTarifa.setFeciniciovigencia(DateUtil.inicioFecha(inicio));
|
||||
vigenciaTarifa.setFecfinvigencia(DateUtil.fimFecha(fim));
|
||||
|
||||
// checando se a vigencia pode ser salva. A data de inicio de uma
|
||||
// nova vigencia tem q ser maior que a da fim da vigencia anterior
|
||||
// para que não tenha tarifas com duas vigencias:
|
||||
|
||||
Boolean podeSalvar = lsVT1.isEmpty() ? true : false;
|
||||
// para que não tenha tarifas com duas vigencias:
|
||||
List<VigenciaTarifa> lsVigencias = vigenciaTarifaService.buscarVigenciasIntervalo(vigenciaTarifa);
|
||||
Boolean podeSalvar = lsVigencias.isEmpty() ? true : false;
|
||||
// Se for ele mesmo pode salvar.
|
||||
if (lsVT1.size() == 1) {
|
||||
// Somente edição
|
||||
if (lsVigencias.size() == 1) {
|
||||
// Somente eição
|
||||
if (vigenciaTarifa.getVigenciatarifaId() != null) {
|
||||
if (vigenciaTarifa.getVigenciatarifaId().equals(lsVT1.get(0).getVigenciatarifaId())) {
|
||||
if (vigenciaTarifa.getVigenciatarifaId().equals(lsVigencias.get(0).getVigenciatarifaId())) {
|
||||
podeSalvar = true;
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +137,7 @@ public class EditarVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
|
||||
if (podeSalvar) {
|
||||
if (vigenciaTarifa.getVigenciatarifaId() == null) {
|
||||
if (lsVT1.isEmpty()) {
|
||||
if (lsVigencias.isEmpty()) {
|
||||
vigenciaTarifaService.suscribir(vigenciaTarifa);
|
||||
vigenciaList.addItem(vigenciaTarifa);
|
||||
|
||||
|
@ -152,13 +147,15 @@ public class EditarVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
closeWindow();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("MSG.Registro.Existe"),
|
||||
Labels.getLabel("editarVigenciaTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
vigenciaTarifaService.actualizacion(vigenciaTarifa);
|
||||
vigenciaList.updateItem(vigenciaTarifa);
|
||||
|
||||
|
@ -170,13 +167,15 @@ public class EditarVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
closeWindow();
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarVigenciaTarifaController.MSG.conflitoVigencias"),
|
||||
Labels.getLabel("editarVigenciaTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarVigenciaTarifaController.MSG.FimMenorInicio"),
|
||||
Labels.getLabel("editarVigenciaTarifaController.window.title"),
|
||||
|
@ -196,14 +195,15 @@ public class EditarVigenciaTarifaController extends MyGenericForwardComposer {
|
|||
|
||||
if (opcao == Messagebox.YES) {
|
||||
|
||||
// Não posso eliminar uma vigencia se existir tarifa!!!
|
||||
// Não posso eliminar uma vigencia se existir tarifa!!!
|
||||
List<Tarifa> tarifa = tarifaService.buscarExisteVigencia(vigenciaTarifa);
|
||||
if (!tarifa.isEmpty()) {
|
||||
Messagebox.show(
|
||||
Labels.getLabel("editarVigenciaTarifaController.MSG.podeApagar"),
|
||||
Labels.getLabel("editarVigenciaTarifaController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
vigenciaTarifaService.borrar(vigenciaTarifa);
|
||||
vigenciaList.removeItem(vigenciaTarifa);
|
||||
|
||||
|
|
Loading…
Reference in New Issue