Created
December 10, 2012 14:16
-
-
Save delucas/4250800 to your computer and use it in GitHub Desktop.
Funcion para validar el numero de CUIT obtenido de la pagina de la AFIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function esCUITValida(inputValor) { | |
inputString = inputValor.toString() | |
if (inputString.length == 11) { | |
var Caracters_1_2 = inputString.charAt(0) + inputString.charAt(1) | |
if (Caracters_1_2 == "20" || Caracters_1_2 == "23" || Caracters_1_2 == "24" || Caracters_1_2 == "27" || Caracters_1_2 == "30" || Caracters_1_2 == "33" || Caracters_1_2 == "34") { | |
var Count = inputString.charAt(0) * 5 + inputString.charAt(1) * 4 + inputString.charAt(2) * 3 + inputString.charAt(3) * 2 + inputString.charAt(4) * 7 + inputString.charAt(5) * 6 + inputString.charAt(6) * 5 + inputString.charAt(7) * 4 + inputString.charAt(8) * 3 + inputString.charAt(9) * 2 + inputString.charAt(10) * 1 | |
Division = Count / 11; | |
if (Division == Math.floor(Division)) { | |
return true | |
} | |
} | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment