From: Gunter on
Hi, please help me.
To print out datamatrixcode with VPE from IDEAL Software I have to
create a string that contains hexcode in a defined manner
(PremiumAdress of Deutsche Post):
Byte 1 - 3: "DEA" (ASCII) or 44 45 41 (Hex)
Byte 4: "08" Hex
Byte 5: "16" Hex
Byte 6 -10: decimal 6007724587 ( a value like this: 00 0B 13 57 55)
Byte 11 -12: 00 37 Hex
Byte 13 -14: decimal 21010
etc. altogether 42 bytes.
The VPE-function is
VpeDataMatrix( x, y, x2, y2, lpszText).
How I have to do that.
Gunter
From: MicausL on
Hi Gunter,

here a litle bit Code for "Datamatrix Deutsche Post Presspost 52 x 52"
I do the job with List & Label.

FUNCTION MatrixCode(oAdressen AS OBJECT) AS STRING PASCAL
LOCAL cRet AS STRING
cRet :=
PadR(AllTrim(GetEnvironment("ZEBU","Unternehmen",GetGlobal(#cPath)
+"ZEBU.INI")),3)+; // Unternehmen 3 Byte
CHR(Val(GetEnvironment("ZEBU","Frankierart",GetGlobal(#cPath)
+"ZEBU.INI")))+; // Frankierart und
Version Pressepost 1 Byte
CHR(Val(GetEnvironment("ZEBU","Version",GetGlobal(#cPath)
+"ZEBU.INI")))+; // Version Pressepost
1 Byte

ConvertDezimal2Bytes(Val(GetEnvironment("ZEBU","Zeitungskennzeichen",GetGlobal(#cPath)
+"ZEBU.INI")),3)+; // Zeitungskennzeichen 3 Byte

ConvertDezimal2Bytes(Val(GetEnvironment("ZEBU","Heftnummer",GetGlobal(#cPath)
+"ZEBU.INI")),2)+; // Heftnummer 2 Byte

ConvertDezimal2Bytes(Val(GetEnvironment("ZEBU","Frankierwert",GetGlobal(#cPath)
+"ZEBU.INI")),2)+; // Frankierwert 2 Byte (Pressepost immer
0000
ConvertDezimal2Bytes(Val(PadL(Str(DoY(Today()),3),3,"0")
+SubStr(DToC(Today()),9,2)),2)+; //
Einlieferungsdatum als laufender Tag 2 Stellen+letzte beide Stellen
des Jahres 2 Byte

ConvertDezimal2Bytes(Val(GetEnvironment("ZEBU","Produktschluessel",GetGlobal(#cPath)
+"ZEBU.INI")),2)+; // Produktschhluessel aus Produktliste 2 Byte

ConvertDezimal2Bytes(Val(GetEnvironment("ZEBU","Premiumadressid",GetGlobal(#cPath)
+"ZEBU.INI")),2)+; // Premiumadress-ID (immer 1) 2 Byte
PadR(AllTrim(Str(oAdressen:FIELDGET(#ADRESSNR),20)),24," ")
+; // Abonnentennummer
ConvertDezimal2Bytes(Val(oAdressen:FIELDGET(#PLZ)),
3)+; // Postleitzahl
3 Byte
PadR(AllTrim(oAdressen:FIELDGET(#ORT)),24," ")+;
PadR(AllTrim(Strassenname(oAdressen:FIELDGET(#STRASSE))),
22," ")+;
PadR(AllTrim(Hausnummer(oAdressen:FIELDGET(#STRASSE))),10,"
")+;
PadR(AllTrim(SubStr(oAdressen:FIELDGET(#NAME1),1,30)),30," ")
+;
PadR(AllTrim(SubStr(oAdressen:FIELDGET(#NAME2),1,30)),30," ")
+;
PadR(AllTrim(SubStr(oAdressen:FIELDGET(#NAME3),1,30)),30," ")
+;

Space(11) //
Kundenindividuelle informationen

// Nicht druckbare Zeichen werden so ¸bergeben
cRet := StrTran(cRet,CHR(0),"~d000")

RETURN cRet



FUNCTION ConvertDezimal2Bytes(nValue AS INT,nBytes AS BYTE) AS STRING
PASCAL
LOCAL cRet AS STRING
LOCAL cString AS STRING
LOCAL i AS BYTE
LOCAL cTemp AS STRING
cString := Right(AsHexString(nValue),nBytes*2)
cRet := ""
// 63452 -> 00F7DC
// Jetzt die einzelnen Bytes rausfieseln
FOR i=1 UPTO nBytes
cTemp := SubStr(cString,1+(i-1)*2,2)
//1=00
//2=F7
//3=DC
// Hex2C macht aus dem Hexadezimalcode ein ASCIIZeichen
cRet := cRet+Hex2C(cTemp)
NEXT

RETURN cRet

tested an approved.

HTH

Michael