Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mod-7 check digit for barcoding
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00533810
Message ID:
00533814
Vues:
27
>Does anyone have a routine for calculating mod-7 check digits for barcoding?
>
>Thanks
>
>
>Colin Northway

I have a function that create a checksum digit for customer numbers in our app, i think (not sure) the same methodology is used for bar coding.
Here it is:
FUNCTION CustNoCheckSum( cCustno ) 

	*-- Returns a 1 Char checksum for customer number
	LOCAL i, lcResult, lcString, lnResult
	lcResult = ""
	lnResult = 0 
	FOR i = 1 TO Len(Alltrim(cCustNo))
		IF ISALPHA( SubStr(cCustNo,i,1) ) 
			RETURN ""
		ENDIF
		lcResult = lcResult + IIF( MOD(i, 2) # 0, SubStr(cCustNo,i,1), ALLTRIM( STR(Val( SubStr(cCustNo,i,1)) * 2)) )
	EndFor
	FOR i = 1 TO LEN(lcResult) 
		lnResult = lnResult + VAL( Substr( lcResult,i,1 ) )
	ENDFOR

	RETURN AllTrim(Str(MOD(lnResult, 10)))

ENDFUNC
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform