Solo para Perú.
? ValidRucSunat("20372706288") FUNCTION ValidRucSunat(lcNroRuc) IF LEN(ALLTRIM(lcNroRuc)) <> 11 THEN RETURN .F. ENDIF LOCAL aArrayRuc DIMENSION aArrayRuc(3,11) FOR i = 1 TO 11 aArrayRuc(1,i)=VAL(SUBS(lcNroRuc,i,1)) ENDFOR aArrayRuc(2,1)=5 aArrayRuc(2,2)=4 aArrayRuc(2,3)=3 aArrayRuc(2,4)=2 aArrayRuc(2,5)=7 aArrayRuc(2,6)=6 aArrayRuc(2,7)=5 aArrayRuc(2,8)=4 aArrayRuc(2,9)=3 aArrayRuc(2,10)=2 aArrayRuc(3,11)=0 FOR i=1 TO 10 aArrayRuc(3,i) = aArrayRuc(1,i) * aArrayRuc(2,i) aArrayRuc(3,11) = aArrayRuc(3,11) + aArrayRuc(3,i) ENDFOR lnResiduo = MOD(aArrayRuc(3,11),11) lnUltDigito = 11 - lnResiduo DO CASE CASE lnUltDigito = 11 OR lnUltDigito=1 lnUltDigito = 1 CASE lnUltDigito = 10 OR lnUltDigito=0 lnUltDigito = 0 ENDCASE IF lnUltDigito = aArrayRuc(1,11) THEN RETURN .T. ELSE RETURN .F. ENDIF ENDFUNCSaludos.....
NavaSoft S.A.C.
Aquí encontré una nueva versión
ResponderBorrarhttps://tisoft.wordpress.com/2021/02/