function openlov(pagina) { var lTop=screen.height-500, lLeft=screen.width-480; var w = window.open(pagina, "LOV" + pagina.substring(0,15).replace(".",""), "Scrollbars=1, resizable=1, width=480, height=500, top=" + lTop + ", left=" + lLeft + " "); } function Ubicar() { document.body.onmousemove = mousemove; document.body.onbeforeprint = BeforePrint; document.body.onafterprint = AfterPrint; for(var i=0; i=0; i--) if(fnum.charAt(i) == " ") fnum = fnum.substring(0,i); else break; return fnum; } function AsignarFoco(ObjI, bShift){ var IndO = ObjI.sourceIndex, bTclShift = false, iSum = 1; if(bShift){ iSum = -1; bTclShift = true; } IndO += iSum; ObjN = document.all[IndO]; while(true){ if(ObjN.tagName == "INPUT" || ObjN.tagName == "TEXTAREA" || ObjN.tagName == "SELECT" || ObjN.tagName == "OBJECT"){ if(!ObjN.disabled && !ObjN.readOnly && ObjN.style.display != "none" && ObjN.type!="hidden"){ ObjN.focus(); return; } } IndO += iSum; ObjN = document.all[IndO]; } } function salto() { var IkeyCode = event.keyCode; if(IkeyCode==9 || IkeyCode!=13){ return; } event.cancelBubble = true; event.keyCode = 9; return; } function mousemove() { if(CMenu>0 && FocMenu==0) HideM(); } function imprimir() { window.print(); } function show_help() { var HPage = document.F.action; pos = HPage.lastIndexOf("?"); if(pos>0) HPage = HPage.substr(0,pos); pos = HPage.lastIndexOf("/"); HPage = HPage.substr(pos+1); pos = HPage.lastIndexOf("."); Page = HPage.substr(pos+1); HPage = HPage.substr(0,pos) + ".ayuda?pforma=" + Page; var nWin=window.open(HPage, "help"); } function MoveMenu() { if(document.getElementById("MenuPane")) document.getElementById("MenuPane").style.top = document.body.scrollTop + 10; } function validar(Objeto, Titulo, TipoDato, Decimales, Obliga, Ver, ValorMinimo, ValorMaximo) { var Valor = desblancos(Objeto.value); Objeto.value = Valor; if(Obliga=="OBL") { if (Valor.length < 1) { alert("Debe ingresar el valor para el campo " + Titulo + "."); if(Ver!="OCULTO") if(Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") if(Objeto.focus()!=null){ Objeto.focus(); } return false; } } if(TipoDato=="ENT"||TipoDato=="FLT") { if (Valor.length > 0) { Valor = desformatnum(Valor) if (isNaN(parseFloat(Valor,10))) { alert("El campo " + Titulo + "( " + Valor + " ) debe ser numerico."); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } if (parseFloat(Valor,10) < ValorMinimo) { alert("El campo " + Titulo + "( " + Valor + " ) debe ser mayor o igual a " + ValorMinimo.toString()); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } if (parseFloat(Valor,10) > ValorMaximo) { alert("El Campo " + Titulo + "( " + Valor + " ) debe ser menor o igual a " + ValorMaximo.toString()); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } var intPos = Valor.indexOf("."); if(TipoDato=="FLT") { if(intPos > 0) { if(Decimales > 0) { Objeto.value = Valor.substring(intPos + 1, Valor.length); if(!validar(Objeto, "El numero de decimales de " + Titulo, "ENT", 0, "OBL", Ver, 0, Math.pow(10, Decimales) - 1)) { Objeto.value = Valor; return false; } Objeto.value = Valor; } else { if(intPos > 0) { alert("El campo " + Titulo + " no debe tener decimales "); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } } } } else { if(intPos > 0) { alert("El campo " + Titulo + " no debe tener decimales "); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } } } } if(TipoDato=="FCH"){ if (Valor.length > 0){ if (!jesfecha(Valor)){ alert("El campo " + Titulo + " debe tener una fecha valida (" + formatofecha + ") "); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } var Fecha = AsigFecha(Valor, "N"); var HoraMin = AsigFecha(ValorMinimo, "N"); var HoraMax = AsigFecha(ValorMaximo, "N"); if (jesfecha(ValorMinimo, null, null, "N") && jesfecha(ValorMaximo, null, null, "N")){ if ((FechaHoraMax)){ alert("El campo " + Titulo + " debe estar entre " + ValorMinimo + " y " + ValorMaximo); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } } } } if(TipoDato=="HOR"){ if (Valor.length > 0){ var Hora = new Date("01/01/01 " + Valor); var HoraMin = new Date("01/01/01 " + ValorMinimo); var HoraMax = new Date("01/01/01 " + ValorMaximo); if (isNaN(Hora)){ alert("El campo " + Titulo + " debe tener una hora valida (HH24:MI) "); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } if ((HoraHoraMax)){ alert("El campo " + Titulo + " debe estar entre " + HoraMin.getHours() + ":" + HoraMin.getMinutes() + " y " + HoraMax.getHours() + ":" + HoraMax.getMinutes()); if(Ver!="OCULTO" && Objeto.getAttribute("TYPE")!="hidden" && !Objeto.readOnly && !Objeto.disabled && Objeto.style.display != "none") Objeto.focus(); return false; } } } return true; } function AsigFecha(fstring, Mensaje){ var ano, mes, dia, lFecha = new Date(); if(fstring.length != 10){ if(Mensaje==null){alert("la Fecha "+fstring+" debe tener el formato " + formatofecha);} return false; } if(formatofecha == "DD/MM/YYYY") { ano = parseInt(fstring.substring(6,10),10); mes = parseInt(fstring.substring(3,5),10); dia = parseInt(fstring.substring(0,2),10); } else { ano = parseInt(fstring.substring(6,10),10); dia = parseInt(fstring.substring(3,5),10); mes = parseInt(fstring.substring(0,2),10); } lFecha.setDate(dia); lFecha.setMonth(mes - 1); lFecha.setFullYear(ano); return lFecha; } function validarTecla(event,li_tipo) { var li_kc=event.keyCode; switch(li_tipo) { case "AL": if(li_kc==39||li_kc==34) event.returnValue=false; break; case "FE": if(li_kc<47||li_kc>57) event.returnValue=false; break; case "EN": if(li_kc<48||li_kc>57) event.returnValue=false; break; case "DE": if(li_kc!=46 && (li_kc<48||li_kc>57)) event.returnValue=false; break; case "NO": if((li_kc<97||li_kc>122)&&(li_kc<65||li_kc>90)&&(li_kc<48||li_kc>57)) event.returnValue=false; break; case "EM": if(li_kc == 39 || li_kc == 34 || li_kc <= 32 || li_kc == 38 || li_kc == 37 || li_kc == 63) event.returnValue = false; break; } } function TeclaUp(){ var li_kc=event.keyCode, bShiftKey = event.shiftKey; if(li_kc==9 || li_kc==13 || li_kc==16 || bShiftKey){ return; } ObjI = event.srcElement; if(ObjI.value.length == ObjI.maxLength){ ObjI.fireEvent("onchange"); var ObjI = event.srcElement; AsignarFoco(ObjI, bShiftKey); } } function jesfecha(fstring, anoini, anofin, Mensaje) { var ano; var mes; var dia; if(fstring.length != 10){ if(Mensaje==null){alert("la Fecha "+fstring+" debe tener el formato " + formatofecha);} return false; } if(formatofecha == "DD/MM/YYYY") { ano = parseInt(fstring.substring(6,10),10); mes = parseInt(fstring.substring(3,5),10); dia = parseInt(fstring.substring(0,2),10); } else { ano = parseInt(fstring.substring(6,10),10); dia = parseInt(fstring.substring(3,5),10); mes = parseInt(fstring.substring(0,2),10); } var vanoini=1870; var vanofin=2020; if(isNaN(parseInt(anoini,10)) == false) vanoini = parseInt(anoini,10); if(isNaN(parseInt(anofin,10)) == false) vanofin = parseInt(anofin,10); if(fstring.length != 10) { if(Mensaje==null){alert("la Fecha "+fstring+" debe tener el formato " + formatofecha);} return false; } if(isNaN(dia) == true) { if(Mensaje==null){alert("El Dia "+fstring.substring(0,2)+" no es valido.");} return false; } if(isNaN(mes) == true) { if(Mensaje==null){alert("El Mes "+fstring.substring(3,5)+" no es valido.");} return false; } if(isNaN(ano) == true) { if(Mensaje==null){alert("El A?o "+fstring.substring(6,10)+" no es Valido.");} return false; } if((anovanofin)) { if(Mensaje==null){alert("El a?o debe estar entre " + vanoini + " y " + vanofin + " y el a?o ingresado es " + ano);} return false; } if((mes<1) || (mes>12)) { if(Mensaje==null){alert("El mes " + mes + " es invalido.");} return false; } if((dia<1) || (dia>31)) { if(Mensaje==null){alert("El dia " + dia + " es invalido.");} return false; } if(((mes==2) || (mes==4) || (mes==6) || (mes==9) || (mes==11)) && (dia==31)) { if(Mensaje==null){alert("El dia " + dia + " es invalido con respecto al mes.");} return false; } if(dia<29) return true; if(mes!=2) return true; var bisiesto = (Math.floor(ano/4) * 4 ) - ano; if((bisiesto==0) && (dia>29)) { if(Mensaje==null){alert("El dia " + dia + " es invalido con respecto al mes.");} return false; } if((bisiesto!=0) && (dia>28)) { {alert("El dia " + dia + " es invalido con respecto al mes.");} return false; } return true; } function AbrirCalendario(sObj, sTopLeft){ var wCalendario=false; if(wCalendario!=null){ wCalendario.close(); } wCalendario = window.open('../AeroExport/Calendario.html?txtObj=' + sObj, 'wCalendario', sTopLeft + ', width=168; height=171px; status=no, resizable=no, scrollbars=no'); CentrarVentana(wCalendario, 168, 200); wCalendario.focus(); } function formatoFecha(event , objetoFecha){ var longitudFecha=parseInt(objetoFecha.value.length); if(event.keyCode != 47 && event.keyCode >= 48 && event.keyCode <= 57 ) { if((longitudFecha+1)==2||(longitudFecha+1)==5){ objetoFecha.value=objetoFecha.value+(event.keyCode-48)+'/'; event.returnValue=false; } } } function checkMail(email) { var ind1, ind2, ind3,p=0 ind1 = email.indexOf("@"); ind2 = email.lastIndexOf("."); ind3 = email.lastIndexOf("@"); if ((ind1<=0) || (ind2= 3 ; punto -= 3 ) fnum = "," + fstring.substring(punto - 2,punto+1)+ fnum; punto += 1; fnum = fstring.substring(0,punto) + fnum; return fnum; } function desformatnum ( fstring ) { var fnum = ""; if(sepmiles == ","){ fnum = fstring.replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", "").replace(".", ""); fnum = fnum.replace(/,/gi, "."); }else{ fnum = fstring.replace(/,/gi, ""); } if ( isNaN(fnum) ) fnum = ""; return fnum; var i = 0; for ( i=0; i < fstring.length; i++ ) { if ( fstring.charAt(i) == "." && sepmiles == ".") fnum += "," ; else if ( fstring.charAt(i) != "," && fstring.charAt(i) != " ") fnum += fstring.charAt(i) ; if ( fstring == "2,280.00"){ alert( fstring.charAt(i)); alert( sepmiles); alert( fnum); } } if ( isNaN(fnum) ) fnum = ""; return fnum; } function validarEmail(email) { var objRegExp = /(^[a-z]([a-z_\.0-9]*)@([a-z][a-z_\.0-9]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.0-9]*)@([a-z][a-z_\.0-9]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i; return objRegExp.test(email); }