function valFechaExisteymdOld(fechaExiste) { var dExisteFecha = new Date(); /* la función tiene como entrada: año, mes, día */ dExisteFecha.setFullYear(fechaExiste.substring(0,4), fechaExiste.substring(6,7), fechaExiste.substring(9,10)) if(dExisteFecha == 'Nan')return 'aaaa/mm/dd'; return fechaExiste; } function valFechaExisteymd(fechaExistes) { //alert('Ojo1'); var fechaExiste = fechaExistes.value+""; // alert(fechaExiste); var dExisteFecha = new Date(); dExisteFecha.setFullYear(fechaExiste.substring(0,4), ( (1*fechaExiste.substring(5,7) )-1)+'', fechaExiste.substring(8,10)) // alert((1*fechaExiste.substring(0,4)) +"--"+ (1*dExisteFecha.getFullYear()) +"--"+ (1*fechaExiste.substring(5,7)) +"--"+ (1*dExisteFecha.getMonth()) +"--"+ (1*fechaExiste.substring(8,10)) +"--"+ (1*dExisteFecha.getDate()) ); if( (1*fechaExiste.substring(0,4)) != (1*dExisteFecha.getFullYear()) || (1*fechaExiste.substring(5,7)) != (1*dExisteFecha.getMonth())+1 || (1*fechaExiste.substring(8,10)) != (1*dExisteFecha.getDate()) ) { alert("Fecha ingresada errada"); return 'aaaa-mm-dd'; } return fechaExiste; } function validaFechasymd(fechaExistes) { //alert('Ojo0'); var fechaExiste = fechaExistes.value+""; // alert(fechaExiste); var dExisteFecha = new Date(); dExisteFecha.setFullYear(fechaExiste.substring(0,4), ( (1*fechaExiste.substring(5,7) )-1)+'', fechaExiste.substring(8,10)) //alert((1*fechaExiste.substring(0,4)) +"--"+ (1*dExisteFecha.getFullYear()) +"--"+ (1*fechaExiste.substring(5,7)) +"--"+ (1*dExisteFecha.getMonth()) +"--"+ (1*fechaExiste.substring(8,10)) +"--"+ (1*dExisteFecha.getDate()) ); if( (1*fechaExiste.substring(0,4)) != (1*dExisteFecha.getFullYear()) || (1*fechaExiste.substring(5,7)) != (1*dExisteFecha.getMonth())+1 || (1*fechaExiste.substring(8,10)) != (1*dExisteFecha.getDate()) ) { alert("Fecha ingresada errada"); return 'aaaa-mm-dd'; } return fechaExiste; } function valEmail(valor){ re=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if(!re.exec(valors.toLowerCase())) { alert("Formato errado de correo, corrija por favor.") return ''; }else{ return valor; } } function validaDecimal(nroVal) { var vlrNan; var vLrs; vLrs = 'c'; vlrNan = vLrs*1; var nmmm = nroVal; var nm = ""; var nmx = "'"; var cuantasveces; cuantasveces = 0; for(ixe=0;ixe <= nmmm.length;ixe++) { if (nmmm.charAt(ixe) == '.' || nmmm.charAt(ixe) == ',') { cuantasveces = cuantasveces + 1; } if(cuantasveces > 1) { alert('Solo se admiten décimal de formato 999999999,9999'); return 0; } if(nmmm.charAt(ixe)*1 == vlrNan && nmmm.charAt(ixe) != '.' && nmmm.charAt(ixe) != ',' ) { alert('Solo se admiten décimal de formato 999999999,9999'); return 0; } } return nroVal; } function validaNumero(nroVal) { var vlrNan; var vLrs; vLrs = 'c'; vlrNan = vLrs*1; var vlrReal = nroVal*1; vlrReal = vlrReal+''; if(vlrNan+'' == vlrReal+'') { alert('Solo se admiten dígitos'); return 0; } else { return nroVal; } } function dhard() { var fso = new ActiveXObject("Scripting.FileSystemObject"); var Enum = new Enumerator(fso.Drives); var driveInfo; for(Enum.moveFirst(); !Enum.atEnd(); Enum.moveNext()) { driveInfo = Enum.item().SerialNumber; document.write(driveInfo + "
"); } } function pantalla() { if ((screen.width>=1024) && (screen.height>=768)) { } else { alert('Esta aplicación esta diseña, para pantallas 1024 Y mínimo 768, caso contrario no verás optimamente las vista'); } } function cambioTextos(texto) { var nmmm = texto; var nm = ""; var nmx = "'"; for(i=0;i<=10000;i++) { nmmm= nmmm.replace(nmx,nm) ; } return nmmm.toUpperCase(); } function cambioTextosn(texto) { var nmmm = texto; var nm = ""; var nmx = "'"; for(i=0;i<=10000;i++) { nmmm= nmmm.replace(nmx,nm) ; } return nmmm; } function cambioTextosL(texto) { var nmmm = texto+''; var nm = ""; var nmx = "'" for(i=0;i<=10000;i++) { nmmm= nmmm.replace(nmx,nm) ; } return nmmm.toUpperCase(); } function validaFechas(objeto) { var dia,mes,ano,v1,v2,vSw,vActual,vAno; var fecha = objeto.value; dia = (fecha.charAt(0)+''+fecha.charAt(1))*1; mes = (fecha.charAt(3)+''+fecha.charAt(4))*1; ano = (fecha.charAt(6)+''+fecha.charAt(7)+''+fecha.charAt(8)+''+fecha.charAt(9))*1; v1 = fecha.charAt(2); v2 = fecha.charAt(5); vSw = 0; if(fecha.length != 10) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); } else { if(dia-dia!= 0) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); vSw = 1; } if(dia > 31 && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('No se admite Día mayor que 31'); vSw = 1; } if(mes-mes != 0 && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); vSw = 1; } if(mes > 12 && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('No se admite Mes mayor que 12'); vSw = 1; } if(ano-ano != 0 && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); vSw = 1; } else { } if(v1 != '/' && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); vSw = 1; } if(v2 != '/' && vSw == 0) { objeto.value = 'dd/mm/aaaa'; alert('Sólo se admite fecha con formato dd/mm/aaaa'); vSw = 1; } if(mes == 2&& dia > 29) { objeto.value = 'dd/mm/aaaa'; alert('No se admite día mayor que 29 del mes 02'); vSw = 1; } } } function validaFechasymdOld(objeto) { var dia,mes,ano,v1,v2,vSw,vActual,vAno; var fecha = objeto.value; dia = (fecha.charAt(8)+''+fecha.charAt(9))*1; mes = (fecha.charAt(5)+''+fecha.charAt(6))*1; ano = (fecha.charAt(0)+''+fecha.charAt(1)+''+fecha.charAt(2)+''+fecha.charAt(3))*1; v1 = fecha.charAt(4); v2 = fecha.charAt(7); vSw = 0; if(fecha.length != 10) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); return 'aaaa/mm/dd'; } else { if(dia-dia!= 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; return 'aaaa/mm/dd'; } if(dia > 31 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('No se admite Día mayor que 31'); vSw = 1; return 'aaaa/mm/dd'; } if(mes-mes != 0 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; return 'aaaa/mm/dd'; } if(mes > 12 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('No se admite Mes mayor que 12'); vSw = 1; return 'aaaa/mm/dd'; } if(ano-ano != 0 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; return 'aaaa/mm/dd'; } else { } if(v1 != '/' && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; return 'aaaa/mm/dd'; } if(v2 != '/' && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; return 'aaaa/mm/dd'; } if(mes == 2&& dia > 29) { objeto.value = 'aaaa/mm/dd'; alert('No se admite día mayor que 29 del mes 02'); vSw = 1; return 'aaaa/mm/dd'; } } var fechaExiste = objeto.value; var dExisteFecha = new Date(); dExisteFecha.setFullYear(fechaExiste.substring(0,4),fechaExiste.substring(6,7),fechaExiste.substring(9,10)) if(dExisteFecha.getDate() < 10) vDiaxx = '0'+dExisteFecha.getDate(); else vDiaxx = dExisteFecha.getDate(); if(dExisteFecha.getMonth()+1 < 10) vMesxx = '0'+(dExisteFecha.getMonth()+1); else vMesxx = (dExisteFecha.getMonth()+1); if(dExisteFecha.getYear() < 10) vAnoxxx = '0'+dExisteFecha.getYear(); else vAnoxxx = dExisteFecha.getYear(); vFechaxxx = vAnoxxx+"/"+vMesxx+"/"+vDiaxx; if(vSw == 0 && dExisteFecha != 'Nan')return vFechaxxx; else return 'aaaa/mm/dd'; } function dvalidaFechasymd(objeto) { var dia,mes,ano,v1,v2,vSw,vActual,vAno; var fecha = objeto.value; dia = (fecha.charAt(8)+''+fecha.charAt(9))*1; mes = (fecha.charAt(5)+''+fecha.charAt(6))*1; ano = (fecha.charAt(0)+''+fecha.charAt(1)+''+fecha.charAt(2)+''+fecha.charAt(3))*1; v1 = fecha.charAt(4); v2 = fecha.charAt(7); vSw = 0; if(fecha.length != 10) { objeto.value = 'aaaa-mm-dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); } else { if(dia-dia!= 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); vSw = 1; } if(dia > 31 && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('No se admite Día mayor que 31'); vSw = 1; } if(mes-mes != 0 && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); vSw = 1; } if(mes > 12 && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('No se admite Mes mayor que 12'); vSw = 1; } if(ano-ano != 0 && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); vSw = 1; } else { } if(v1 != '-' && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); vSw = 1; } if(v2 != '-' && vSw == 0) { objeto.value = 'aaaa-mm-dd'; alert('Sólo se admite fecha con formato aaaa-mm-dd'); vSw = 1; } if(mes == 2&& dia > 29) { objeto.value = 'aaaa-mm-dd'; alert('No se admite día mayor que 29 del mes 02'); vSw = 1; } } var fechaExiste = objeto.value; var dExisteFecha = new Date(); dExisteFecha.setFullYear(fechaExiste.substring(0,4),((fechaExiste.substring(6,7)*1)-1),fechaExiste.substring(8,10)) var dias = (fecha.charAt(8)+''+fecha.charAt(9))*1; // alert(dExisteFecha); if(vSw == 0 && dExisteFecha.getDate() == dias )return objeto.value; else{ alert("Fecha no existe"); return 'aaaa-mm-dd';} } function validaFechasymds(objeto) { var dia,mes,ano,v1,v2,vSw,vActual,vAno; var fecha = objeto.value; dia = (fecha.charAt(8)+''+fecha.charAt(9))*1; mes = (fecha.charAt(5)+''+fecha.charAt(6))*1; ano = (fecha.charAt(0)+''+fecha.charAt(1)+''+fecha.charAt(2)+''+fecha.charAt(3))*1; v1 = fecha.charAt(4); v2 = fecha.charAt(7); vSw = 0; if(fecha.length != 10) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); } else { if(dia-dia!= 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; } if(dia > 31 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('No se admite Día mayor que 31'); vSw = 1; } if(mes-mes != 0 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; } if(mes > 12 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('No se admite Mes mayor que 12'); vSw = 1; } if(ano-ano != 0 && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; } else { } if(v1 != '-' && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; } if(v2 != '-' && vSw == 0) { objeto.value = 'aaaa/mm/dd'; alert('Sólo se admite fecha con formato aaaa/mm/dd'); vSw = 1; } if(mes == 2&& dia > 29) { objeto.value = 'aaaa/mm/dd'; alert('No se admite día mayor que 29 del mes 02'); vSw = 1; } } }