Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11287

Re: Code128 with font [solved]

From Stefan Dietl <info@sdsoft.it>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Code128 with font [solved]
Date 2018-01-12 07:47 +0100
Message-ID <fbr3vkF1hiuU1@mid.individual.net> (permalink)
References <fbhgfcFif6U1@mid.individual.net> <fbjajiFd92aU1@mid.individual.net> <0d323ceb-f2c6-47e5-83fe-b721e62c1935@googlegroups.com>

Show all headers | View raw


Am 11.01.2018 um 13:05 schrieb jorge.dextrasistemas@gmail.com:

> 
> Please Stefan
> Paste your code for EAN13
> 
> Thanks in advance !
> Jorge Accinelli
> buenos aires
> 

Hi Jorge, here the code

(A) Build the String for printing with a Barcode Font:
FUNCTION Ean13String( ccode AS STRING ) AS STRING PASCAL
LOCAL aZSatz AS ARRAY
LOCAL cBarcode AS STRING
LOCAL cChar AS STRING
LOCAL i AS DWORD
LOCAL nErstesZeichen AS DWORD

	nErstesZeichen := Val(SubStr3( cCode, 1, 1 ))

	// Nutzzeichen...
	cChar := SubStr3( cCode, 1, 1 )
	cBarCode := CHR(Val(cChar)+35)

	//Randzeichen
	cBarCode += "!"

	//Zeichen + Prüfziffer
	aZSatz := 	{;
					{ 1,1,1,1,1,1,3,3,3,3,3,3 },;
					{ 1,1,2,1,2,2,3,3,3,3,3,3 },;
					{ 1,1,2,2,1,2,3,3,3,3,3,3 },;
					{ 1,1,2,2,2,1,3,3,3,3,3,3 },;
					{ 1,2,1,1,2,2,3,3,3,3,3,3 },;
					{ 1,2,2,1,1,2,3,3,3,3,3,3 },;
					{ 1,2,2,2,1,1,3,3,3,3,3,3 },;
					{ 1,2,1,2,1,2,3,3,3,3,3,3 },;
					{ 1,2,1,2,2,1,3,3,3,3,3,3 },;
					{ 1,2,2,1,2,1,3,3,3,3,3,3 };
				}
	FOR i := 1 UPTO 12

		// Trennzeichen...
		IF i == 7
			cBarCode += "-"
		END

		cChar := SubStr3( cCode, i+1, 1 )
		IF aZSatz[nErstesZeichen+1][i] == 1
			cBarcode += cChar
		ELSEIF aZSatz[nErstesZeichen+1][i] == 2
			cBarcode += CHR(65+Val(cChar))
		ELSE
			cBarcode += CHR(97+Val(cChar))
		END
	NEXT

	//Randzeichen
	cBarCode += "!"

RETURN cBarcode

(B) Build a EAN13-number with checksum:
FUNC BuildEan13( ccode AS STRING ) AS STRING PASCAL

	ccode := PadR( ccode, 12, "0" )

	ccode += NTrim(Ean13Pruefziffer( ccode ))

RETURN ccode

FUNC Ean13Pruefziffer( cCode AS STRING ) AS DWORD PASCAL
LOCAL i AS DWORD
LOCAL nSumme AS DWORD
LOCAL nRest AS DWORD
LOCAL nPruefziffer AS DWORD
LOCAL arr AS ARRAY

	arr := {1,3,1,3,1,3,1,3,1,3,1,3}
	FOR i := 1 UPTO 12
		nSumme += Val(SubStr3(cCode,i,1)) * arr[i]
	NEXT

	nRest := nSumme % 10

	nPruefZiffer := 10 - nRest

RETURN IIF( nPruefZiffer == 10, 0, nPruefZiffer )

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Code128 with font Stefan Dietl <info@sdsoft.it> - 2018-01-08 16:19 +0100
  Re: Code128 with font [solved] Stefan Dietl <info@sdsoft.it> - 2018-01-09 08:51 +0100
    Re: Code128 with font [solved] jorge.dextrasistemas@gmail.com - 2018-01-11 04:05 -0800
      Re: Code128 with font [solved] Stefan Dietl <info@sdsoft.it> - 2018-01-12 07:47 +0100

csiph-web