Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. Dim data as string
  2. Dim chk as number
  3.  
  4. data = {Opdracht.Barcode}
  5.  
  6.  
  7. chk = 0
  8.  
  9. Dim Result As String
  10. Dim datalength as Number
  11.  
  12. Dim barcodechar As String
  13. Dim barcodevalue as Number
  14.  
  15. Dim filtereddata As String
  16. Dim filteredlength As Number
  17.  
  18.  
  19.  
  20. Dim CODE39MAP() As Number
  21. CODE39MAP = Array(Asc("0"), Asc("1"), Asc("2"), Asc("3"), Asc("4"), Asc("5"), Asc("6"), Asc("7"), Asc("8"), Asc("9"), Asc("A"), Asc("B"), Asc("C"), Asc("D"), Asc("E"), Asc("F"), Asc("G"), Asc("H"), Asc("I"), Asc("J"), Asc("K"), Asc("L"), Asc("M"), Asc("N"), Asc("O"), Asc("P"), Asc("Q"), Asc("R"), Asc("S"), Asc("T"), Asc("U"), Asc("V"), Asc("W"), Asc("X"), Asc("Y"), Asc("Z"), Asc("-"), Asc("."), Asc(" "), Asc("$"), Asc("/"), Asc("+"), Asc("%"))
  22.  
  23. Dim x as number
  24. Dim z as number
  25. Dim RVal As Number
  26. Dim getCode39Value as Number
  27.  
  28.  
  29. Result = ""
  30. datalength = Len(data)
  31.  
  32.  
  33. For x = 1 To datalength
  34. barcodechar = Mid(data, x , 1)
  35.  
  36. barcodevalue = AscW(barcodechar)
  37. RVal = -1
  38. getCode39Value = -1
  39. For z = 1 To 43
  40. If CODE39MAP(z) = barcodevalue Then
  41. RVal = (z-1)
  42. End If
  43. Next z
  44. getCode39Value = RVal
  45.  
  46. If getCode39Value <> -1 Then
  47. Result = Result + barcodechar
  48. End If
  49. Next x
  50.  
  51. filtereddata = Result
  52. filteredlength = Len(filtereddata)
  53.  
  54. If chk = 1 Then
  55.  
  56. If filteredlength > 254 Then
  57. filtereddata = Left(filtereddata, 254)
  58. End If
  59.  
  60. filteredlength = Len(filtereddata)
  61.  
  62. Dim Sumx as number
  63. Dim ResultVal as number
  64. Dim cd as string
  65.  
  66. Sumx = 0
  67. For x = 1 To filteredlength
  68. barcodechar = Mid(filtereddata, x, 1)
  69.  
  70. barcodevalue = AscW(barcodechar)
  71. RVal = -1
  72. getCode39Value = 0
  73. For z = 1 To 43
  74. If CODE39MAP(z) = barcodevalue Then
  75. RVal = (z-1)
  76. End If
  77. Next z
  78. getCode39Value = RVal
  79.  
  80. Sumx = Sumx + getCode39Value
  81.  
  82. Next x
  83.  
  84. ResultVal = Sumx Mod 43
  85.  
  86. cd = ChrW(CODE39MAP(ResultVal+1))
  87.  
  88.  
  89.  
  90. Else
  91.  
  92. If filteredlength > 255 Then
  93. filtereddata = Left(filtereddata, 255)
  94. End If
  95. cd = ""
  96. End If
  97.  
  98. Result = "*" + filtereddata + cd + "*"
  99. formula = Result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement