Rotina Windev Para Testgar Ean13 e Dun14
http://www.windevbrasil.com.br/index.php/topic,1738.0.html
ROCEDURE Val_EAN(NUMERO is string)
sEAN is string = RepeatString("0",14-Length(NUMERO))+NUMERO
sEAN = Left(sEAN,13)
xSoma is numeric = 0
FOR i=1 TO 13 STEP 2
Num is int = Middle(sEAN,i,1)
xSoma += Num*3
END
FOR i=2 TO 13 STEP 2
Num = Middle(sEAN,i,1)
xSoma += Num
END
nM10 is int = modulo(xSoma,10)
DV is string = 10 - nM10
IF DV=10 THEN DV=0
IF Right(NUMERO,1)=DV THEN
RESULT True
ELSE
RESULT False
END
Ela serve para qualquer EAN ate 13.
Nenhum comentário:
Postar um comentário