Professional Documents
Culture Documents
Code À Barre Crystal Report
Code À Barre Crystal Report
******
'
' You may embed this font encoder formula within your report if you own a valid
' and this entire section and copyright notice is not modified or removed.
'
' Distribution of this formula within your organization requires multi-user or site
license.
'
'**********************************************************************************
******
'DataToEncode = ({Table.Field})
DataToEncode = {Entete.numbon}
ApplyTilde = True
ReturnType = 0
Dim I As Number
Dim J As Number
Dim F As Number
DataToFormat = ""
DataToFormat = DataToEncode
DataToEncode = ""
CID = 0 'Character ID
If ApplyTilde Then
'DataToFormat = ProcessTilde(DataToFormat)
StringLength = Len(DataToFormat)
For I = 1 To StringLength
For J = I To 1 Step -1
CharsAdded = CharsAdded + 1
End If
Exit For
End If
Next J
'CheckDigitValue = MOD10(StrReverse(StringToCheck))
RevStringToCheck = StrReverse(StringToCheck)
'***********************************************************************
' This is a general MOD10 function compatible with EAN and UPC
standards
'***********************************************************************
Dim M10StringLength As Number
M10OnlyCorrectData = ""
M10StringLength = Len(RevStringToCheck)
Next M10I
M10Factor = 3
M10WeightedTotal = 0
M10StringLength = Len(RevStringToCheck)
'CurrentCharNum = Mid(RevStringToCheck, I, 1)
M10WeightedTotal = M10WeightedTotal +
(Val(Mid(RevStringToCheck, M10I, 1)) * M10Factor)
M10Factor = 4 - M10Factor
Next M10I
'Find the CheckDigit by finding the smallest number that = a
multiple of 10
Else
M10CheckDigit = 0
End If
CheckDigitValue = M10CheckDigit
I = I + 3
I = I + 3
Else
End If
Next I
DataToFormat = OutString
End If
'by the addition of the FID. The SetAry records the character set
SetAry = Array("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",
"0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0")
CurrentChar = Left(DataToFormat, 1)
CurrentCharNum = AscW(CurrentChar)
StringLength = Len(DataToFormat)
J = 0
For I = 1 To StringLength
J = J + 1
'Check for FNC1 in any set which is ASCII 202 and ASCII 212-217
'Change SetAry(J) to B so the number 99 does not show up for the set
switch
SetAry(J) = "B"
J = J + 1
CurrentEncoding = "C"
End If
SetAry(J) = "B"
End If
CurrentEncoding = "B"
End If
CurrentEncoding = "B"
End If
CurrentEncoding = "B"
End If
CurrentEncoding = "B"
End If
CurrentEncoding = "B"
End If
'if so stay in current set for 1 number and then switch to save space
F = I
Factor = 3
Factor = 4 - Factor
F = F + 1
Loop
If Factor = 1 Then
I = I + 1
J = J + 1
End If
End If
CurrentEncoding = "C"
CurrentValue = Val(CurrentChar)
I = I + 1
CurrentEncoding = "A"
If CurrentCharNum = 32 Then
End If
'The next line was added to support ReturnTypes 6-9
'J = J + 1
CurrentEncoding = "B"
If CurrentCharNum = 32 Then
Else
End If
End If
Next I
End If
If ReturnType = 1 Then
HumanReadableText = ""
StringLength = Len(DataToFormat)
For I = 1 To StringLength
CorrectFNC = 0
'2005.12 BDA updated the next if/else to eliminate errors from text after
the AI
'Get the value of the next 2 digits to try to determine the length of the
AI, if text is used here
CurrentChar = Mid(DataToFormat, I + 1, 2)
CurrentCharNum = Val(CurrentChar)
Else
CurrentCharNum = 81
End If
I = I + 2
CorrectFNC = 1
I = I + 3
CorrectFNC = 1
'Is 4 digit AI by entering ASCII 214?
I = I + 4
CorrectFNC = 1
I = I + 5
CorrectFNC = 1
I = I + 6
CorrectFNC = 1
I = I + 7
CorrectFNC = 1
I = I + 8
CorrectFNC = 1
I = I + 4
CorrectFNC = 1
I = I + 3
CorrectFNC = 1
I = I + 2
CorrectFNC = 1
I = I + 4
CorrectFNC = 1
End If
End If
Next I
End If
HumanReadableText = ""
StringLength = Len(DataToFormat)
J = 0
For I = 1 To StringLength
J = J + 1
End If
Next I
End If
DataToFormat = ""
StringLength = Len(DataToEncode)
For I = 1 To StringLength
CurrentValue = CurrentValue * I
Else
End If
Next I
End If
DataToEncode = ""