fixed bug #7557 : correcao tela de excessao de pedagio
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@57674 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d4a8590d3f
commit
5309ad9e68
|
@ -1,5 +1,6 @@
|
|||
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
|
@ -133,7 +134,7 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
|||
public void setRutaService(RutaService rutaService) {
|
||||
this.rutaService = rutaService;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
|
@ -145,7 +146,7 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
|||
if(excepcionPeaje.getExcepcionPeajeId() != null){
|
||||
excepcionPeaje = excepcionPeajeService.obtenerID(excepcionPeaje.getExcepcionPeajeId());
|
||||
}
|
||||
lsExcepcionPeajeVigencia = excepcionPeaje.getLsExcepcionPeajeVigencia();
|
||||
lsExcepcionPeajeVigencia = getExcepcionPeajeVigenciaActivo(excepcionPeaje.getLsExcepcionPeajeVigencia());
|
||||
if(lsExcepcionPeajeVigencia != null){
|
||||
Collections.sort(lsExcepcionPeajeVigencia);
|
||||
}
|
||||
|
@ -214,6 +215,17 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
|||
txtPreco.setConstraint("no empty, no zero, no negative, /[0-9]+(\\,[0-9][0-9]?)?/");
|
||||
}
|
||||
|
||||
private List<ExcepcionPeajeVigencia> getExcepcionPeajeVigenciaActivo(List<ExcepcionPeajeVigencia> excecoes){
|
||||
List<ExcepcionPeajeVigencia> result = new ArrayList<ExcepcionPeajeVigencia>();
|
||||
|
||||
for(ExcepcionPeajeVigencia e : excecoes){
|
||||
if(e.getActivo()){
|
||||
result.add(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void onSelect$cmbParadaOrigemCve(Event ev) {
|
||||
if (cmbParadaOrigemCve.getSelectedItem() != null) {
|
||||
cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue());
|
||||
|
@ -529,6 +541,9 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
|||
private boolean isExcepcionPeajeVigenciaValida(ExcepcionPeajeVigencia novaExcepcionPeajeVigencia){
|
||||
|
||||
for(ExcepcionPeajeVigencia epv : lsExcepcionPeajeVigencia){
|
||||
if(!epv.getActivo()){
|
||||
continue;
|
||||
}
|
||||
if(((DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).after(DateUtil.inicioFecha((epv.getFecVentaIni()))) || DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).compareTo(DateUtil.inicioFecha((epv.getFecVentaIni()))) == 0)
|
||||
&& (DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).before(DateUtil.fimFecha((epv.getFecVentaFin())))) || DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).compareTo(DateUtil.fimFecha((epv.getFecVentaFin()))) == 0)
|
||||
||
|
||||
|
@ -547,14 +562,19 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
|||
calNovaHoraFin.set(2000, 10, 10);
|
||||
calEpvHoraIni.set(2000, 10, 10);
|
||||
calEpvHoraFin.set(2000, 10, 10);
|
||||
if(calNovaHoraIni.getTime().after(calEpvHoraIni.getTime()) && calNovaHoraIni.getTime().before(calEpvHoraFin.getTime())
|
||||
|| calNovaHoraFin.getTime().before(calEpvHoraFin.getTime()) && calNovaHoraFin.getTime().after(calEpvHoraIni.getTime())){
|
||||
if (isWithinRange(calNovaHoraIni.getTime(), calEpvHoraIni.getTime(), calEpvHoraFin.getTime())
|
||||
|| isWithinRange(calNovaHoraFin.getTime(), calEpvHoraIni.getTime(), calEpvHoraFin.getTime())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isWithinRange(Date testDate, Date startDate, Date endDate) {
|
||||
return testDate.getTime() >= startDate.getTime() &&
|
||||
testDate.getTime() <= endDate.getTime();
|
||||
}
|
||||
|
||||
private void limparInput() {
|
||||
|
|
|
@ -14,9 +14,6 @@ public class RenderExcepcionPeajeVigencia implements ListitemRenderer {
|
|||
|
||||
public void render(Listitem lstm, Object o) throws Exception {
|
||||
ExcepcionPeajeVigencia excepcionPeajeVigencia = (ExcepcionPeajeVigencia) o;
|
||||
if(!excepcionPeajeVigencia.getActivo()){
|
||||
return;
|
||||
}
|
||||
Listcell lc;
|
||||
if(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId() != null ){
|
||||
lc = new Listcell(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId().toString());
|
||||
|
|
Loading…
Reference in New Issue