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;
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -145,7 +146,7 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
||||||
if(excepcionPeaje.getExcepcionPeajeId() != null){
|
if(excepcionPeaje.getExcepcionPeajeId() != null){
|
||||||
excepcionPeaje = excepcionPeajeService.obtenerID(excepcionPeaje.getExcepcionPeajeId());
|
excepcionPeaje = excepcionPeajeService.obtenerID(excepcionPeaje.getExcepcionPeajeId());
|
||||||
}
|
}
|
||||||
lsExcepcionPeajeVigencia = excepcionPeaje.getLsExcepcionPeajeVigencia();
|
lsExcepcionPeajeVigencia = getExcepcionPeajeVigenciaActivo(excepcionPeaje.getLsExcepcionPeajeVigencia());
|
||||||
if(lsExcepcionPeajeVigencia != null){
|
if(lsExcepcionPeajeVigencia != null){
|
||||||
Collections.sort(lsExcepcionPeajeVigencia);
|
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]?)?/");
|
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) {
|
public void onSelect$cmbParadaOrigemCve(Event ev) {
|
||||||
if (cmbParadaOrigemCve.getSelectedItem() != null) {
|
if (cmbParadaOrigemCve.getSelectedItem() != null) {
|
||||||
cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue());
|
cmbParadaOrigem.setComboItemByParada((Parada) cmbParadaOrigemCve.getSelectedItem().getValue());
|
||||||
|
@ -529,6 +541,9 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
||||||
private boolean isExcepcionPeajeVigenciaValida(ExcepcionPeajeVigencia novaExcepcionPeajeVigencia){
|
private boolean isExcepcionPeajeVigenciaValida(ExcepcionPeajeVigencia novaExcepcionPeajeVigencia){
|
||||||
|
|
||||||
for(ExcepcionPeajeVigencia epv : lsExcepcionPeajeVigencia){
|
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)
|
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)
|
&& (DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).before(DateUtil.fimFecha((epv.getFecVentaFin())))) || DateUtil.inicioFecha((novaExcepcionPeajeVigencia.getFecVentaIni())).compareTo(DateUtil.fimFecha((epv.getFecVentaFin()))) == 0)
|
||||||
||
|
||
|
||||||
|
@ -547,8 +562,8 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
||||||
calNovaHoraFin.set(2000, 10, 10);
|
calNovaHoraFin.set(2000, 10, 10);
|
||||||
calEpvHoraIni.set(2000, 10, 10);
|
calEpvHoraIni.set(2000, 10, 10);
|
||||||
calEpvHoraFin.set(2000, 10, 10);
|
calEpvHoraFin.set(2000, 10, 10);
|
||||||
if(calNovaHoraIni.getTime().after(calEpvHoraIni.getTime()) && calNovaHoraIni.getTime().before(calEpvHoraFin.getTime())
|
if (isWithinRange(calNovaHoraIni.getTime(), calEpvHoraIni.getTime(), calEpvHoraFin.getTime())
|
||||||
|| calNovaHoraFin.getTime().before(calEpvHoraFin.getTime()) && calNovaHoraFin.getTime().after(calEpvHoraIni.getTime())){
|
|| isWithinRange(calNovaHoraFin.getTime(), calEpvHoraIni.getTime(), calEpvHoraFin.getTime())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,6 +572,11 @@ public class EditarExcepcionPeajeController extends MyGenericForwardComposer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isWithinRange(Date testDate, Date startDate, Date endDate) {
|
||||||
|
return testDate.getTime() >= startDate.getTime() &&
|
||||||
|
testDate.getTime() <= endDate.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
private void limparInput() {
|
private void limparInput() {
|
||||||
fecInicio.setConstraint("");
|
fecInicio.setConstraint("");
|
||||||
fecInicio.setValue(null);
|
fecInicio.setValue(null);
|
||||||
|
|
|
@ -14,9 +14,6 @@ public class RenderExcepcionPeajeVigencia implements ListitemRenderer {
|
||||||
|
|
||||||
public void render(Listitem lstm, Object o) throws Exception {
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
ExcepcionPeajeVigencia excepcionPeajeVigencia = (ExcepcionPeajeVigencia) o;
|
ExcepcionPeajeVigencia excepcionPeajeVigencia = (ExcepcionPeajeVigencia) o;
|
||||||
if(!excepcionPeajeVigencia.getActivo()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Listcell lc;
|
Listcell lc;
|
||||||
if(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId() != null ){
|
if(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId() != null ){
|
||||||
lc = new Listcell(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId().toString());
|
lc = new Listcell(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId().toString());
|
||||||
|
|
Loading…
Reference in New Issue