/* Funcions per als camps numèrics */ function format2(num){ var redondeo = aproximaDecimals(num,2); var format; if(isNaN(redondeo)){ format = redondeo; }else{ format = new String(redondeo); } var posDecimal = format.indexOf('.'); if(posDecimal == -1){ format = format + '.00'; }else{ var enter = format.substring(0,posDecimal); var decimals = format.substr(posDecimal + 1) + '00'; decimals = decimals.substring(0,2); format = enter + '.' + decimals; } return format; } function format3(num){ var redondeo = aproximaDecimals(num,3); var format; if(isNaN(redondeo)){ format = redondeo; }else{ format = new String(redondeo); } var posDecimal = format.indexOf('.'); if(posDecimal == -1){ format = format + '.000'; }else{ var enter = format.substring(0,posDecimal); var decimals = format.substr(posDecimal + 1) + '000'; decimals = decimals.substring(0,3); format = enter + '.' + decimals; } return format; } function zeros(num) { var i; var res = ""; for (i=0;i=0;i--, inc++) { c = s1.charAt(i); if ((inc!=0) && ((inc%3)==0) && (IsNumber(c))) res = c + '.' + res; else res = c+res; } } else { res = '0'; } if (dec=='') { if (s2.length != 0) { res = res + ',' + s2; } } else { if (dec>0) res = res + ',' + xDecimals(s2,dec); } return res; } /* Finestra */ function maximizar(){ // Función que maximiza la ventana window.moveTo(0,0); window.resizeTo(screen.width,screen.height); } /* Validar el NIF/CIF introduit */ function checkValueNIFCIF(valor, size){ if( selected != 1 && selected != 3 && selected != '' ) return true; valor = valor.toUpperCase(); if (valor.length != size) { // alert('Atenci\xF3n: El Documento no es un NIF/NIE/CIF v\xE1lido'); alert(traducir(47)); return false; } var toWork = new String(valor.substring(0,9)); // El primer caracter indica el tipo de CIF / NIF o NIE var first = toWork.substring(0,1); //var letraCIF = new String ("ABCDEFGHPQS"); var letraCIF = new String ("ABCDEFGHJNPQRSUVW"); if (letraCIF.indexOf (first) >=0) { var letraOrg = new String("PQS"); var isOrg = (letraOrg.indexOf (first) >=0); if(!verificaCIF(toWork, isOrg)) { // alert("Atenci\xF3n: El CIF no es v\xE1lido"); alert(traducir(68)); return false; }else{ return true; } } else if(!verificaNIF(toWork)){ alert(traducir(69)); return false; }else{ return true; } } function verificaCIF(toWork, isOrg) { var ultimaLetra = new Array ("J","A","B","C","D","E","F","G","H","I"); var ultimoNumero = new Array ("0","1","2","3","4","5","6","7","8","9"); var numValue = new String(toWork.substring(1,8)); // Suma de Pares var sumaPar = 0; for(i=1; i 9) val = val - 9; stVal = new String(val); for (j=0; j