fixes bug #7588
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@58654 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
77d9f97f34
commit
1d65e29f0d
|
@ -1,6 +1,12 @@
|
||||||
package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
|
package com.rjconsultores.ventaboletos.web.gui.controladores.tarifas;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -10,14 +16,24 @@ import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zul.Button;
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Timebox;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeaje;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CasetaPeajeExcepcionService;
|
||||||
import com.rjconsultores.ventaboletos.service.CasetaPeajeService;
|
import com.rjconsultores.ventaboletos.service.CasetaPeajeService;
|
||||||
|
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.MyGenericForwardComposer;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.menu.item.tarifas.constantes.ConstantesGenericas;
|
import com.rjconsultores.ventaboletos.web.utilerias.menu.item.tarifas.constantes.ConstantesGenericas;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCasetaPeaje;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCasetaPeajeExcepcion;
|
||||||
|
|
||||||
@Controller("editarCasetaPeajeController")
|
@Controller("editarCasetaPeajeController")
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
|
@ -26,21 +42,46 @@ public class EditarCasetaPeajeController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CasetaPeajeService casetaPeajeService;
|
private CasetaPeajeService casetaPeajeService;
|
||||||
|
@Autowired
|
||||||
|
private CasetaPeajeExcepcionService casetaPeajeExcepcionService;
|
||||||
private CasetaPeaje casetaPeaje;
|
private CasetaPeaje casetaPeaje;
|
||||||
private MyListbox casetaPeajeList;
|
private MyListbox casetaPeajeList;
|
||||||
|
private MyListbox casetaPeajeExcepcionList;
|
||||||
private Button btnApagar;
|
private Button btnApagar;
|
||||||
private MyTextbox descricaoPracaPedagio;
|
private MyTextbox descricaoPracaPedagio;
|
||||||
private MyTextboxDecimal quantiaIda;
|
private MyTextboxDecimal quantiaIda;
|
||||||
private MyTextboxDecimal quantiaVolta;
|
private MyTextboxDecimal quantiaVolta;
|
||||||
private Logger logger = Logger.getLogger(this.getClass());
|
private Logger logger = Logger.getLogger(this.getClass());
|
||||||
|
private List<CasetaPeajeExcepcion> lsCasetaPeajeExcepcion;
|
||||||
|
private List<CasetaPeajeExcepcion> casetaPeajeExcepcionToDelete = new ArrayList<CasetaPeajeExcepcion>();
|
||||||
|
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFin;
|
||||||
|
private Checkbox chkINDLUNES;
|
||||||
|
private Checkbox chkINDMARTES;
|
||||||
|
private Checkbox chkINDMIERCOLES;
|
||||||
|
private Checkbox chkINDJUEVES;
|
||||||
|
private Checkbox chkINDVIERNES;
|
||||||
|
private Checkbox chkINDSABADO;
|
||||||
|
private Checkbox chkINDDOMINGO;
|
||||||
|
private Timebox horaIni;
|
||||||
|
private Timebox horaFin;
|
||||||
|
private MyTextboxDecimal txtPreco;
|
||||||
|
|
||||||
|
private CasetaPeajeExcepcion casetaPeajeExcepcion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doAfterCompose(Component comp) throws Exception {
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
super.doAfterCompose(comp);
|
|
||||||
|
|
||||||
casetaPeaje = (CasetaPeaje) Executions.getCurrent().getArg().get("casetaPeaje");
|
casetaPeaje = (CasetaPeaje) Executions.getCurrent().getArg().get("casetaPeaje");
|
||||||
casetaPeajeList = (MyListbox) Executions.getCurrent().getArg().get("casetaPeajeList");
|
casetaPeajeList = (MyListbox) Executions.getCurrent().getArg().get("casetaPeajeList");
|
||||||
|
|
||||||
|
lsCasetaPeajeExcepcion = casetaPeajeExcepcionService.buscarPorCasetaPeaje(casetaPeaje);
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
casetaPeajeExcepcionList.setItemRenderer(new RenderCasetaPeajeExcepcion());
|
||||||
|
casetaPeajeExcepcionList.setData(lsCasetaPeajeExcepcion);
|
||||||
|
|
||||||
if(casetaPeaje.getCasetaPeajeId() == null) {
|
if(casetaPeaje.getCasetaPeajeId() == null) {
|
||||||
btnApagar.setVisible(Boolean.FALSE);
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +117,10 @@ public class EditarCasetaPeajeController extends MyGenericForwardComposer {
|
||||||
casetaPeajeList.updateItem(casetaPeaje);
|
casetaPeajeList.updateItem(casetaPeaje);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!casetaPeajeExcepcionToDelete.isEmpty()) {
|
||||||
|
casetaPeajeService.deletarVigencias(casetaPeajeExcepcionToDelete);
|
||||||
|
}
|
||||||
|
|
||||||
Messagebox.show(
|
Messagebox.show(
|
||||||
Labels.getLabel("editarPracaPedagioController.MSG.suscribirOK"),
|
Labels.getLabel("editarPracaPedagioController.MSG.suscribirOK"),
|
||||||
Labels.getLabel("editarPracaPedagioController.window.title"),
|
Labels.getLabel("editarPracaPedagioController.window.title"),
|
||||||
|
@ -117,6 +162,222 @@ public class EditarCasetaPeajeController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
closeWindow();
|
closeWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarCasetaPeajeExcepcion(Event ev) throws InterruptedException{
|
||||||
|
txtPreco.getValue();
|
||||||
|
casetaPeajeExcepcion = new CasetaPeajeExcepcion();
|
||||||
|
casetaPeajeExcepcion.setFecVentaIni(fecInicio.getValue());
|
||||||
|
casetaPeajeExcepcion.setFecVentaFin(fecFin.getValue());
|
||||||
|
casetaPeajeExcepcion.setINDDOMINGO(chkINDDOMINGO.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDLUNES(chkINDLUNES.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDMARTES(chkINDMARTES.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDMIERCOLES(chkINDMIERCOLES.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDVIERNES(chkINDVIERNES.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDJUEVES(chkINDJUEVES.isChecked());
|
||||||
|
casetaPeajeExcepcion.setINDSABADO(chkINDSABADO.isChecked());
|
||||||
|
if(horaIni.getValue() == null){
|
||||||
|
Calendar horaI=Calendar.getInstance();
|
||||||
|
horaI.set(Calendar.getInstance().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DATE), 0, 0, 0);
|
||||||
|
horaIni.setValue(horaI.getTime());
|
||||||
|
casetaPeajeExcepcion.setHoraIni(horaIni.getValue());
|
||||||
|
}else{
|
||||||
|
casetaPeajeExcepcion.setHoraIni(horaIni.getValue());
|
||||||
|
}
|
||||||
|
if(horaFin.getValue() == null){
|
||||||
|
Calendar horaF=Calendar.getInstance();
|
||||||
|
horaF.set(Calendar.getInstance().get(Calendar.YEAR), Calendar.getInstance().get(Calendar.MONTH), Calendar.getInstance().get(Calendar.DATE), 23, 59, 59);
|
||||||
|
horaFin.setValue(horaF.getTime());
|
||||||
|
casetaPeajeExcepcion.setHoraFin(horaFin.getValue());
|
||||||
|
}else{
|
||||||
|
casetaPeajeExcepcion.setHoraFin(horaFin.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isDataValida(casetaPeajeExcepcion)){
|
||||||
|
try {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.MSG.datasInconsistentes.value"),
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!validaHoraFinal(casetaPeajeExcepcion)){
|
||||||
|
try {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.MSG.horaInvalida.value"),
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!validaHoras(casetaPeajeExcepcion)){
|
||||||
|
try {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.MSG.horasInconsistentes.value"),
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
casetaPeajeExcepcion.setPrecio(txtPreco.getValueDecimal());
|
||||||
|
|
||||||
|
if(lsCasetaPeajeExcepcion == null){
|
||||||
|
lsCasetaPeajeExcepcion = new ArrayList<CasetaPeajeExcepcion>();
|
||||||
|
}
|
||||||
|
casetaPeajeExcepcion.setActivo(Boolean.TRUE);
|
||||||
|
casetaPeajeExcepcion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
casetaPeajeExcepcion.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
|
if(!isCasetaPeajeExcepcionValida(casetaPeajeExcepcion)){
|
||||||
|
try {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.MSG.conflitoVigencia.value"),
|
||||||
|
Labels.getLabel("editarExcepcionPeajeController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lsCasetaPeajeExcepcion.add(casetaPeajeExcepcion);
|
||||||
|
if(null != lsCasetaPeajeExcepcion){
|
||||||
|
Collections.sort(lsCasetaPeajeExcepcion);
|
||||||
|
}
|
||||||
|
casetaPeajeExcepcion.setCasetaPeaje(casetaPeaje);
|
||||||
|
casetaPeajeExcepcionList.setData(lsCasetaPeajeExcepcion);
|
||||||
|
casetaPeajeExcepcionService.suscribir(casetaPeajeExcepcion);
|
||||||
|
limparInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverCasetaPeajeExcepcion(Event ev) throws InterruptedException {
|
||||||
|
CasetaPeajeExcepcion cpe = (CasetaPeajeExcepcion) casetaPeajeExcepcionList.getSelected();
|
||||||
|
if(cpe != null){
|
||||||
|
cpe.setActivo(Boolean.FALSE);
|
||||||
|
cpe.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cpe.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
lsCasetaPeajeExcepcion.remove(cpe);
|
||||||
|
Collections.sort(lsCasetaPeajeExcepcion);
|
||||||
|
casetaPeajeExcepcionList.setData(lsCasetaPeajeExcepcion);
|
||||||
|
casetaPeajeExcepcionService.borrar(cpe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDataValida(CasetaPeajeExcepcion cpe){
|
||||||
|
if( cpe.getFecVentaIni().after(cpe.getFecVentaFin())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean validaHoraFinal(CasetaPeajeExcepcion cpe){
|
||||||
|
if( cpe.getHoraFin().getHours() == 0 && cpe.getHoraFin().getMinutes() == 0 && cpe.getHoraFin().getSeconds() == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean validaHoras(CasetaPeajeExcepcion cpe){
|
||||||
|
if( cpe.getHoraIni().after(cpe.getHoraFin()) || ( cpe.getHoraIni().compareTo(cpe.getHoraFin()) == 0 ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDiasCasetaPeajeExcepcionCoincidencia(CasetaPeajeExcepcion novaCasetaPeajeExcepcion, CasetaPeajeExcepcion cpe){
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDDOMINGO() && cpe.getINDDOMINGO()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDLUNES() && cpe.getINDLUNES()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDMARTES() && cpe.getINDMARTES()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDMIERCOLES() && cpe.getINDMIERCOLES()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDJUEVES() && cpe.getINDJUEVES()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDVIERNES() && cpe.getINDVIERNES()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if(novaCasetaPeajeExcepcion.getINDSABADO() && cpe.getINDSABADO()){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCasetaPeajeExcepcionValida(CasetaPeajeExcepcion novaCasetaPeajeExcepcion){
|
||||||
|
|
||||||
|
for(CasetaPeajeExcepcion cpe : lsCasetaPeajeExcepcion){
|
||||||
|
if(!cpe.getActivo()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(((DateUtil.inicioFecha((novaCasetaPeajeExcepcion.getFecVentaIni())).after(DateUtil.inicioFecha((cpe.getFecVentaIni()))) || DateUtil.inicioFecha((novaCasetaPeajeExcepcion.getFecVentaIni())).compareTo(DateUtil.inicioFecha((cpe.getFecVentaIni()))) == 0)
|
||||||
|
&& (DateUtil.inicioFecha((novaCasetaPeajeExcepcion.getFecVentaIni())).before(DateUtil.fimFecha((cpe.getFecVentaFin())))) || DateUtil.inicioFecha((novaCasetaPeajeExcepcion.getFecVentaIni())).compareTo(DateUtil.fimFecha((cpe.getFecVentaFin()))) == 0)
|
||||||
|
||
|
||||||
|
((DateUtil.fimFecha((novaCasetaPeajeExcepcion.getFecVentaFin())).before(DateUtil.fimFecha((cpe.getFecVentaFin()))) || DateUtil.fimFecha((novaCasetaPeajeExcepcion.getFecVentaFin())).compareTo(DateUtil.fimFecha((cpe.getFecVentaFin()))) == 0)
|
||||||
|
&& (DateUtil.fimFecha((novaCasetaPeajeExcepcion.getFecVentaFin())).after(DateUtil.inicioFecha((cpe.getFecVentaIni()))))) || DateUtil.fimFecha((novaCasetaPeajeExcepcion.getFecVentaFin())).compareTo(DateUtil.inicioFecha((cpe.getFecVentaIni()))) == 0 ){
|
||||||
|
if(isDiasCasetaPeajeExcepcionCoincidencia(novaCasetaPeajeExcepcion,cpe)){
|
||||||
|
Calendar calNovaHoraIni = Calendar.getInstance();
|
||||||
|
Calendar calNovaHoraFin = Calendar.getInstance();
|
||||||
|
Calendar calEpvHoraIni = Calendar.getInstance();
|
||||||
|
Calendar calEpvHoraFin = Calendar.getInstance();
|
||||||
|
calNovaHoraIni.setTime(novaCasetaPeajeExcepcion.getHoraIni());
|
||||||
|
calNovaHoraFin.setTime(novaCasetaPeajeExcepcion.getHoraFin());
|
||||||
|
calEpvHoraIni.setTime(cpe.getHoraIni());
|
||||||
|
calEpvHoraFin.setTime(cpe.getHoraFin());
|
||||||
|
calNovaHoraIni.set(2000, 10, 10);
|
||||||
|
calNovaHoraFin.set(2000, 10, 10);
|
||||||
|
calEpvHoraIni.set(2000, 10, 10);
|
||||||
|
calEpvHoraFin.set(2000, 10, 10);
|
||||||
|
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() {
|
||||||
|
fecInicio.setConstraint("");
|
||||||
|
fecInicio.setValue(null);
|
||||||
|
fecInicio.setConstraint("no empty");
|
||||||
|
|
||||||
|
fecFin.setConstraint("");
|
||||||
|
fecFin.setValue(null);
|
||||||
|
fecFin.setConstraint("no empty");
|
||||||
|
|
||||||
|
chkINDDOMINGO.setChecked(false);
|
||||||
|
chkINDLUNES.setChecked(false);
|
||||||
|
chkINDMARTES.setChecked(false);
|
||||||
|
chkINDMIERCOLES.setChecked(false);
|
||||||
|
chkINDVIERNES.setChecked(false);
|
||||||
|
chkINDJUEVES.setChecked(false);
|
||||||
|
chkINDSABADO.setChecked(false);
|
||||||
|
horaIni.setText("");
|
||||||
|
horaFin.setText("");
|
||||||
|
txtPreco.setConstraint("");
|
||||||
|
txtPreco.setValue("");
|
||||||
|
txtPreco.setConstraint("no empty, no zero, no negative, /[0-9]+(\\,[0-9][0-9]?)?/");
|
||||||
}
|
}
|
||||||
|
|
||||||
public MyTextbox getDescricaoPracaPedagio() {
|
public MyTextbox getDescricaoPracaPedagio() {
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.render;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion;
|
||||||
|
|
||||||
|
public class RenderCasetaPeajeExcepcion implements ListitemRenderer {
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
CasetaPeajeExcepcion casetaPeajeExcepcion = (CasetaPeajeExcepcion) o;
|
||||||
|
Listcell lc;
|
||||||
|
if(casetaPeajeExcepcion.getCasetaPeajeExcepcionId() != null ){
|
||||||
|
lc = new Listcell(casetaPeajeExcepcion.getCasetaPeajeExcepcionId().toString());
|
||||||
|
}else{
|
||||||
|
lc = new Listcell("-");
|
||||||
|
}
|
||||||
|
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
|
|
||||||
|
if (casetaPeajeExcepcion.getFecVentaIni() != null) {
|
||||||
|
lc = new Listcell(sdf.format(casetaPeajeExcepcion.getFecVentaIni()));
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (casetaPeajeExcepcion.getFecVentaFin() != null) {
|
||||||
|
lc = new Listcell(sdf.format(casetaPeajeExcepcion.getFecVentaFin()));
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (casetaPeajeExcepcion.getHoraIni() != null) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(casetaPeajeExcepcion.getHoraIni());
|
||||||
|
int hour = cal.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = cal.get(Calendar.MINUTE);
|
||||||
|
int second = cal.get(Calendar.SECOND);
|
||||||
|
|
||||||
|
lc = new Listcell(String.format("%02d",hour)+":"+String.format("%02d",minute)+":"+String.format("%02d",second));
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (casetaPeajeExcepcion.getHoraFin() != null) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(casetaPeajeExcepcion.getHoraFin());
|
||||||
|
int hour = cal.get(Calendar.HOUR_OF_DAY);
|
||||||
|
int minute = cal.get(Calendar.MINUTE);
|
||||||
|
int second = cal.get(Calendar.SECOND);
|
||||||
|
|
||||||
|
lc = new Listcell(String.format("%02d",hour)+":"+String.format("%02d",minute)+":"+String.format("%02d",second));
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lc = new Listcell(getDias(casetaPeajeExcepcion));
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (casetaPeajeExcepcion.getPrecio() != null) {
|
||||||
|
double x = casetaPeajeExcepcion.getPrecio().doubleValue();
|
||||||
|
lc = new Listcell(String.format("%.02f",x));
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
|
||||||
|
lstm.setAttribute("data", casetaPeajeExcepcion);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDias(CasetaPeajeExcepcion casetaPeajeExcepcion) {
|
||||||
|
String retorno = "";
|
||||||
|
if (casetaPeajeExcepcion.getINDDOMINGO()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.domingo")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDLUNES()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.lunes")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDMARTES()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.martes")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDMIERCOLES()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.miercoles")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDJUEVES()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.jueves")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDVIERNES()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.viernes")+", ";
|
||||||
|
}
|
||||||
|
if (casetaPeajeExcepcion.getINDSABADO()) {
|
||||||
|
retorno = retorno + Labels.getLabel("editarExcepcionPeajeController.msg.sabado")+", ";
|
||||||
|
}
|
||||||
|
if (retorno.length() > 1) {
|
||||||
|
retorno = retorno.substring(0, retorno.length() - 2);
|
||||||
|
}
|
||||||
|
return retorno;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
CREATE TABLE
|
||||||
|
CASETA_PEAJE_EXCEPCION
|
||||||
|
(
|
||||||
|
CASETAPEAJEEXCEPCION_ID NUMBER(7) NOT NULL,
|
||||||
|
CASETAPEAJE_ID NUMBER(7) NOT NULL,
|
||||||
|
FECHAVENTAINI DATE,
|
||||||
|
FECHAVENTAFIN DATE,
|
||||||
|
FECHORINICIO DATE,
|
||||||
|
FECHORFINAL DATE,
|
||||||
|
INDLUNES NUMBER(1),
|
||||||
|
INDMARTES NUMBER(1),
|
||||||
|
INDMIERCOLES NUMBER(1),
|
||||||
|
INDJUEVES NUMBER(1),
|
||||||
|
INDVIERNES NUMBER(1),
|
||||||
|
INDSABADO NUMBER(1),
|
||||||
|
INDDOMINGO NUMBER(1),
|
||||||
|
ACTIVO NUMBER(1),
|
||||||
|
FECMODIF DATE,
|
||||||
|
USUARIO_ID NUMBER(7),
|
||||||
|
PRECIO NUMBER(7,2),
|
||||||
|
CONSTRAINT CASETA_PEAJE_EXCEPCION_PK PRIMARY KEY (CASETAPEAJEEXCEPCION_ID),
|
||||||
|
CONSTRAINT CASETAPEXCEPCION_CASETA_FK FOREIGN KEY (CASETAPEAJE_ID) REFERENCES
|
||||||
|
CASETA_PEAJE (CASETAPEAJE_ID),
|
||||||
|
CONSTRAINT NNC_CASETAPEAJEEXCEPCION_ID CHECK ("CASETAPEAJEEXCEPCION_ID" IS NOT NULL),
|
||||||
|
CONSTRAINT NNC_CASETAPEAJE_ID CHECK ("CASETAPEAJE_ID" IS NOT NULL)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE SEQUENCE "VTABOL"."CASETA_PEAJE_EXCEPCION_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ;
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE
|
||||||
|
VTABOL.EXCEPCION_PEAJE_VIGENCIA ADD (CASETAPEAJE_ID NUMBER(7));
|
||||||
|
ALTER TABLE
|
||||||
|
VTABOL.EXCEPCION_PEAJE_VIGENCIA ADD CONSTRAINT EXCPEAJEVIGENCIA_CASETA_FK FOREIGN KEY
|
||||||
|
(CASETAPEAJE_ID) REFERENCES VTABOL.CASETA_PEAJE (CASETAPEAJE_ID)
|
|
@ -58,6 +58,7 @@
|
||||||
</value>
|
</value>
|
||||||
<value>com.rjconsultores.ventaboletos.entidad.CancelacionCargo
|
<value>com.rjconsultores.ventaboletos.entidad.CancelacionCargo
|
||||||
</value>
|
</value>
|
||||||
|
<value>com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion</value>
|
||||||
<value>com.rjconsultores.ventaboletos.entidad.Categoria</value>
|
<value>com.rjconsultores.ventaboletos.entidad.Categoria</value>
|
||||||
<value>com.rjconsultores.ventaboletos.entidad.CategoriaClase</value>
|
<value>com.rjconsultores.ventaboletos.entidad.CategoriaClase</value>
|
||||||
<value>com.rjconsultores.ventaboletos.entidad.CategoriaCorrida
|
<value>com.rjconsultores.ventaboletos.entidad.CategoriaCorrida
|
||||||
|
|
|
@ -169,11 +169,11 @@
|
||||||
</grid>
|
</grid>
|
||||||
|
|
||||||
<toolbar>
|
<toolbar>
|
||||||
<button id="btnAdicionarExcepcionPeajeVigencia" height="20"
|
<button id="btnAdicionarCasetaPeajeExcepcion" height="20"
|
||||||
image="/gui/img/add.png" width="35px"
|
image="/gui/img/add.png" width="35px" visible="false"
|
||||||
tooltiptext="${c:l('editarExcepcionPeajeController.btnAddConvenioDet.tooltiptext')}" />
|
tooltiptext="${c:l('editarExcepcionPeajeController.btnAddConvenioDet.tooltiptext')}" />
|
||||||
<button id="btnRemoverExcepcionPeajeVigencia" height="20"
|
<button id="btnRemoverCasetaPeajeExcepcion" height="20"
|
||||||
image="/gui/img/remove.png" width="35px"
|
image="/gui/img/remove.png" width="35px" visible="false"
|
||||||
tooltiptext="${c:l('editarExcepcionPeajeController.btnBorrarConvenioDet.tooltiptext')}" />
|
tooltiptext="${c:l('editarExcepcionPeajeController.btnBorrarConvenioDet.tooltiptext')}" />
|
||||||
</toolbar>
|
</toolbar>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
|
||||||
|
|
||||||
<zk xmlns="http://www.zkoss.org/2005/zul">
|
<zk xmlns="http://www.zkoss.org/2005/zul">
|
||||||
<window id="winEditarPracaPedagio" border="normal" apply="${editarCasetaPeajeController}" width="400px" height="457x"
|
<window id="winEditarPracaPedagio" border="normal" apply="${editarCasetaPeajeController}" width="800px"
|
||||||
|
height="600px" xmlns:h="http://www.w3.org/1999/xhtml"
|
||||||
contentStyle="overflow:auto" title="${c:l('editarPracaPedagioController.window.title')}">
|
contentStyle="overflow:auto" title="${c:l('editarPracaPedagioController.window.title')}">
|
||||||
|
|
||||||
<toolbar>
|
<toolbar>
|
||||||
|
@ -40,5 +41,136 @@
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
|
<toolbar>
|
||||||
|
<separator bar="true" />
|
||||||
|
</toolbar>
|
||||||
|
<grid fixedLayout="true">
|
||||||
|
<columns>
|
||||||
|
<column width="26%" />
|
||||||
|
<column width="37%" />
|
||||||
|
<column width="37%" />
|
||||||
|
</columns>
|
||||||
|
<rows>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbVigenciaVenta.value')}" />
|
||||||
|
<hbox>
|
||||||
|
<h:table border="0">
|
||||||
|
<h:tr>
|
||||||
|
<h:td>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbDe.value')}" />
|
||||||
|
|
||||||
|
<datebox id="fecInicio" width="70x" constraint="no empty"
|
||||||
|
mold="rounded" lenient="false" />
|
||||||
|
</h:td>
|
||||||
|
</h:tr>
|
||||||
|
</h:table>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<h:table border="0">
|
||||||
|
<h:tr>
|
||||||
|
<h:td>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbHasta.value')}" />
|
||||||
|
|
||||||
|
<datebox id="fecFin" width="70x" constraint="no empty"
|
||||||
|
mold="rounded" lenient="false" />
|
||||||
|
</h:td>
|
||||||
|
</h:tr>
|
||||||
|
</h:table>
|
||||||
|
</hbox>
|
||||||
|
</row>
|
||||||
|
<row spans="1,2">
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbDias.value')}" />
|
||||||
|
<hbox>
|
||||||
|
<checkbox id="chkINDLUNES"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbLun.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDLUNES}" />
|
||||||
|
<checkbox id="chkINDMARTES"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbMar.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDMARTES}" />
|
||||||
|
<checkbox id="chkINDMIERCOLES"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbMie.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDMIERCOLES}" />
|
||||||
|
<checkbox id="chkINDJUEVES"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbJue.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDJUEVES}" />
|
||||||
|
<checkbox id="chkINDVIERNES"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbVie.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDVIERNES}" />
|
||||||
|
<checkbox id="chkINDSABADO"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbSab.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDSABADO}" />
|
||||||
|
<checkbox id="chkINDDOMINGO"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.lbDom.value')}"
|
||||||
|
checked="@{winEditarCliente$composer.boolINDDOMINGO}" />
|
||||||
|
</hbox>
|
||||||
|
</row><row>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbPeriodoVenta.value')}" />
|
||||||
|
<hbox>
|
||||||
|
<h:table border="0">
|
||||||
|
<h:tr>
|
||||||
|
<h:td>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbHorInical.value')}" />
|
||||||
|
|
||||||
|
<timebox id="horaIni" mold="rounded" />
|
||||||
|
</h:td>
|
||||||
|
</h:tr>
|
||||||
|
</h:table>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<h:table border="0">
|
||||||
|
<h:tr>
|
||||||
|
<h:td>
|
||||||
|
<label
|
||||||
|
value="${c:l('editarExcepcionPeajeController.lbHorFinal.value')}" />
|
||||||
|
|
||||||
|
<timebox id="horaFin" mold="rounded" />
|
||||||
|
</h:td>
|
||||||
|
</h:tr>
|
||||||
|
</h:table>
|
||||||
|
</hbox>
|
||||||
|
</row>
|
||||||
|
<row spans="1,2">
|
||||||
|
|
||||||
|
<label value="${c:l('editarExcepcionPeajeController.lbPrecio.value')}"/>
|
||||||
|
<textbox id="txtPreco" mold="rounded" constraint="no empty, no zero, no negative, /[0-9]+(\,[0-9][0-9]?)?/ "
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal" precision="6" scale="2"/>
|
||||||
|
|
||||||
|
</row>
|
||||||
|
</rows>
|
||||||
|
</grid>
|
||||||
|
<toolbar>
|
||||||
|
<button id="btnAdicionarCasetaPeajeExcepcion" height="20"
|
||||||
|
image="/gui/img/add.png" width="35px"
|
||||||
|
tooltiptext="${c:l('editarExcepcionPeajeController.btnAddConvenioDet.tooltiptext')}" />
|
||||||
|
<button id="btnRemoverCasetaPeajeExcepcion" height="20"
|
||||||
|
image="/gui/img/remove.png" width="35px"
|
||||||
|
tooltiptext="${c:l('editarExcepcionPeajeController.btnBorrarConvenioDet.tooltiptext')}" />
|
||||||
|
</toolbar>
|
||||||
|
<listbox id="casetaPeajeExcepcionList"
|
||||||
|
use="com.rjconsultores.ventaboletos.web.utilerias.MyListbox"
|
||||||
|
multiple="false">
|
||||||
|
<listhead sizable="true">
|
||||||
|
<listheader width="50px"
|
||||||
|
image="/gui/img/builder.gif" label="${c:l('editarExcepcionPeajeController.msg.RenderId')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderInicioVigencia')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderFinVigencia')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderHoraInicio')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderHoraFin')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderDias')}" />
|
||||||
|
<listheader image="/gui/img/builder.gif"
|
||||||
|
label="${c:l('editarExcepcionPeajeController.msg.RenderPrecio')}" />
|
||||||
|
</listhead>
|
||||||
|
</listbox>
|
||||||
</window>
|
</window>
|
||||||
</zk>
|
</zk>
|
Loading…
Reference in New Issue