• #### EAN13 printing

From =?UTF-8?Q?Jos=C3=A9_Dequeker?=@21:1/5 to All on Tue Oct 20 06:37:03 2020
Hi,
Anyone has code to create the last digit from an ean13 barcode.
And also the code to convert the barcode to be able to print it with a windows ean-13 font?

Greetings,
Jos Dequeker

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Colin Reynolds@21:1/5 to jo...@telenet.be on Wed Oct 21 01:23:26 2020
On Tuesday, October 20, 2020 at 2:37:05 PM UTC+1, jo...@telenet.be wrote:
Hi,
Anyone has code to create the last digit from an ean13 barcode.
And also the code to convert the barcode to be able to print it with a windows ean-13 font?

Greetings,
Jos Dequeker
A Barcode is just a number and the last digit oof an EAN 13 code is a check digit. It sould be easy to retrieve the last (rightmost) digit from this number.
Try something like this.
xcode = int(barcode /10) !to strip out the last digit
ycode = barcode % (xcode*10) !the modulus operator should return the last digit of the barcode

There might be other (simpler, or even correct) solutions but I haven't had my coffee yet!

Printing should not be an issue. I guess that there must be a few barcode printing templates out there.

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From =?UTF-8?Q?Jos=C3=A9_Dequeker?=@21:1/5 to All on Thu Oct 22 00:26:40 2020
The solution:
Barcode = CLIP(LEFT(BarcodeString)) !209089200350
L = 12

!*******************Controlegetal berekenen

Som# = 0
J# = 0
LOOP I# = L TO 1 BY -1
J# += 1
IF (J# % 2)
Co# = 3
ELSE
Co# = 1
END
Som# += (Barcode[I#] * Co#)
END
Digit = (10 - (Som# % 10)) %10
Chaine = CLIP(Barcode) & Digit !2090892003508

!*********************tekst voor afdruk barcode berekenen

first# = barcode[1]

loop i# = 3 To 7
tableA# = 0
Case i#
of 3
Case first#
of 0 orof 1 orof 2 orof 3
tableA# = True
End
of 4
Case first#
of 0 orof 4 orof 7 orof 8
tableA# = True
End
of 5
Case first#
of 0 orof 1 orof 4 orof 5 orof 9
tableA# = True
End
of 6
Case first#
of 0 orof 2 orof 5 orof 6 orof 7
tableA# = True
End
of 7
Case first#
of 0 orof 3 orof 6 orof 8 orof 9
tableA# = True
End
End
If tableA# Then
CodeBarre = CodeBarre & Chr(65 + chaine[i#])
Else
CodeBarre = CodeBarre & Chr(75 + chaine[i#])
End
.
CodeBarre = CodeBarre & '*' !Add middle separator
loop i# = 8 To 13
CodeBarre = CodeBarre & Chr(97 + chaine[i#])
.
CodeBarre = CodeBarre & '+' !Add end mark
return(CodeBarre)

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)
• From Colin Reynolds@21:1/5 to jo...@telenet.be on Thu Oct 22 02:24:01 2020
On Thursday, October 22, 2020 at 8:26:42 AM UTC+1, jo...@telenet.be wrote:
The solution:
Barcode = CLIP(LEFT(BarcodeString)) !209089200350
L = 12

Ok, I get it now <G>
Your Barcode is extracted from a String and NOT a Long (Number), and you wanted to CREATE a checkdigit and ADD it to the end of your Barcode String.

You should have said so <G>

Also, why not make your Barcode and BarcodeString CSTRING's to do away with the "CLIP(LEFT())" stuff, then use the LEN(barcode) function to assign a value to the variable "L" ?

--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)