Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Produce Modulus 11 Checkdigits

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

At the moment we are using Crystal reports for invoicing from an SQL 7 Database. We now require a codeline on each invoice with check digits based on modulus 11. Can these be produced using crystals standard formula features or even by way of an imported VB module?

The formula works as follows. Take a total amount 47.50.
Convert to five digits = 04750
weighting based on
reverse sequential = 65432

sum products (0*6)+(4*5)+(7*4)+(5*3)+(0*2)
= 63
Divide by 11 = 5 with 8 remaining

Subtract 8 from 11 to give a checksum of 3

with exceptions:
if the remainder = 1 the check digit = 0 , and if the remainder = 0 the check digit =1

There is also other checkdigits based on the date and customer number etc.

Any help on this would be much appreciated

Paraic Walsh



 
Here is the solution:

stringVar tx := totext({table.field}+10000,2,"","");
numbervar nx := (6*tonumber(tx[1]))+(5*tonumber(tx[2]))+(4*tonumber(tx[3]))+
(3*tonumber(tx[4]))+(2*tonumber(tx[5]));
numbervar rx := Remainder (nx,11);
numbervar cx := 11 - rx;
if cx = 1 then 0 else if rx =0 then 1 else cx
Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top