Visual Basic.NET - Digito verificacion de un nit

 
Vista:

Digito verificacion de un nit

Publicado por Viviana Ramirez (3 intervenciones) el 17/06/2008 18:24:14
Hola, Necesito ayuda alguien tiene la forma de calcular el dígito verificador del NIT que corresponde a Colombia, tengo que hacer un trabajo con él y no sé cómo se hace.
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Digito verificacion de un nit

Publicado por Raul Ruiz (1 intervención) el 22/06/2008 16:17:27
* Código en Visual Foxpro
********************************************************
* FUNCION : Nit_DV
* FUNCION : Devuelve el Digito de Verificacion de un Nit (COLOMBIA)
* PARAMETROS : Numero de Nit a Calcular
* RETORNO : Digito de Verificación
* AUTOR : Nelson Cortes ([email protected])
********************************************************
FUNCTION Nit_DV(_Nit)
arc_rec=SELECT()
LOCAL _TipoRet, lnRetorno, Arreglo_PA, WSuma, WDato, WDig_Ver, I
_TipoRet = VARTYPE(_Nit)
DO CASE
CASE _TipoRet == "C"
_Nit = ALLTRIM(_Nit)
CASE _TipoRet == "N" OR _TipoRet == "Y"
_Nit = ALLTRIM(STR(_Nit))
OTHERWISE
=MESSAGEBOX("El valor de entrada NIT no se ha podido procesar.",0+48,_SCREEN.cNomApp)
RETURN
ENDCASE
DIMENSION Arreglo_PA(15)
Arreglo_PA(1) = 71
Arreglo_PA(2) = 67
Arreglo_PA(3) = 59
Arreglo_PA(4) = 53
Arreglo_PA(5) = 47
Arreglo_PA(6) = 43
Arreglo_PA(7) = 41
Arreglo_PA(8) = 37
Arreglo_PA(9) = 29
Arreglo_PA(10) = 23
Arreglo_PA(11) = 19
Arreglo_PA(12) = 17
Arreglo_PA(13) = 13
Arreglo_PA(14) = 7
Arreglo_PA(15) = 3
lnRetorno = 0
WDato=RIGHT(SPACE(15)+ALLTRIM(_Nit),15)
WSuma=0
WDig_Ver=0
FOR I = 1 TO 15
WSuma=WSuma+(VAL(SUBSTR(WDato,I,1))*Arreglo_PA(I))
ENDFOR
WSuma=MOD(WSuma,11)
IF(WSuma=0 .OR. WSuma=1)
lnRetorno = WSuma
ELSE
lnRetorno = 11 - WSuma
ENDIF
SELECT(arc_rec)
IF _TipoRet == "C"
RETURN ALLTRIM(STR(lnRetorno))
ELSE
RETURN lnRetorno
ENDIF
ENDFUNC
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar