2009/3/9 Karl Lausten <[email protected]>

> I need to calculate the check digit using the Luhn Algorithm (AKA Luhn 10
> or
> Modulus 10) for a given number to oblige to format of the OCR line on the
> payment slip of Danish "FI-kort". This would allow creation of invoices
> with
> a valid payment slip identifying the debtor and payment purpose via a
> number
> automatically inserted on the bank account statement.
> I plan to use a spreadsheet with the required fields to create invoices
> using a mail-merge procedure.
> The calculation is possible using a rather complex formula. As the Luhn
> Algorithm also is used to validate Credit Card numbers and a number of
> other
> purposes I had hoped to find a function, that would easily calculate the
> required digit and perhaps a related function that would determine whether
> a
> given number is "valid" (ie check that the number passes the Luhn Algorithm
> test).
> Any suggestions on how to handle this challenge? Is there an AddOn
> somewhere, that would do this for me? (Have searched but not found)
>
> Thank you,
> Karl Lausten
>

Googling Luhn gives any number of free downloads for software that will do
what you want but, as far as I can see, nothing for OOo. If you can get hold
of the actual formula then I'm sure it would not be hard to implement it as
a macro for Calc. For example I found
http://www.tech-faq.com/luhn-check-data-algorithm-in-java.shtml which is the
Java source code for a Luhn calculator. I don't have the capabilities but
perhaps you or someone on this list could take that code and incorporate it
into a Calc macro. The hard part, for me, is the interface between a Calc
cell and the Java routine. But that's not hard for some people :-) If you
are a programmer,
http://wiki.services.openoffice.org/wiki/API/Samples/Java/CalcAddin or, more
generally, http://api.openoffice.org/ might help you.

-- 
Harold Fuchs
London, England
Please reply *only* to [email protected]

Reply via email to