on 11-12-2008 11:54 AM
Una consulta alguien tiene hecho el query de validacion del campo RUT. Le agradeceria mucho si pudieran comparti conmigo.
Hola
le regalo el codigo en C#, por si le sirve como base para que lo codifiques en TSQL
Saludos,
Andres R.
public string ValidarDigitoVerificacion(string unNit)
{
string miTemp;
int miContador;
int miResiduo;
int miChequeo;
int[] miArregloPA = new int[15];
miArregloPA[0] = 3;
miArregloPA[1] = 7;
miArregloPA[2] = 13;
miArregloPA[3] = 17;
miArregloPA[4] = 19;
miArregloPA[5] = 23;
miArregloPA[6] = 29;
miArregloPA[7] = 37;
miArregloPA[8] = 41;
miArregloPA[9] = 43;
miArregloPA[10] = 47;
miArregloPA[11] = 53;
miArregloPA[12] = 59;
miArregloPA[13] = 67;
miArregloPA[14] = 71;
miChequeo = 0;
miResiduo = 0;
for(miContador = 0; miContador<unNit.Length;miContador++)
{
miTemp = unNit[(unNit.Length-1) - miContador].ToString();
miChequeo = miChequeo + (Convert.ToInt32(miTemp) * miArregloPA[miContador]);
}
miResiduo = miChequeo % 11;
if(miResiduo > 1)
return Convert.ToString(11 - miResiduo);
return miResiduo.ToString();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gracias a todos por la ayuda que me dieron.
Saludos Cordiales
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Desde el momento en que tu le asignas el RUT a tus Socios de Negocios en todos los documentos que generes sera el mismo ya que B1 los toma de ese catalogo y no veo la necesidad de validarlo, pero sino es esto porfavor describe que es lo que necesitas en si.
GRACIAS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.