function CodeEAN13(code, encoding)
Dim leftA, leftB, rght, OutputPattern, i
if len(code) = 13 Then
LeftA = Array("0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011")
LeftB = Array("0100111", "0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001", "0010111")
Rght = Array("1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100")
OutputPattern = "101"
For i = 1 To 6
if mid(ucase(encoding), i, 1) = "A" Then
OutputPattern = OutputPattern & LeftA(cint(mid(code, i+1, 1)))
Else
OutputPattern = OutputPattern & LeftB(cint(mid(code, i+1, 1)))
End if
Next
OutputPattern = OutputPattern & "01010"
For i = 1 To 6
OutputPattern = OutputPattern & Rght(cint(mid(code, i+7, 1)))
Next
OutputPattern = OutputPattern & "101"
CodeEAN13 = OutputPattern
End if
End function
function eanflag(num)
Select Case num
Case 0: eanflag = "AAAAAA"
Case 1: eanflag = "AABABB"
Case 2: eanflag = "AABBAB"
Case 3: eanflag = "AABBBA"
Case 4: eanflag = "ABAABB"
Case 5: eanflag = "ABBAAB"
Case 6: eanflag = "ABBBAA"
Case 7: eanflag = "ABABAB"
Case 8: eanflag = "ABABBA"
Case 9: eanflag = "ABBABA"
End Select
End function
Dim dataout, i
if code <> "" Then
dataout = tstr(code, width)
response.binarywrite stb(chr(66) & chr(77) & size(62+(len(dataout)*height)) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(62) & chr(0) & chr(0) & chr(0) & chr(40) & chr(0) & chr(0) & chr(0) & size(len(code)*width) & chr(0) & chr(0) & size(height) & chr(0) & chr(0) & chr(1) & chr(0) & chr(1) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(37) & chr(14) & chr(0) & chr(0) & chr(37) & chr(14) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) & chr(255) & chr(255) & chr(255) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0))
For i = 1 To height
response.binarywrite stb(dataout)
Next
End if
%>
__________________ Miguel Padrón :cool: |