Created
December 25, 2011 00:29
-
-
Save jwoertink/1518562 to your computer and use it in GitHub Desktop.
card number generation and mag stripe reader program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wow.... I can't believe I used to write this stuff for a living. lolz. Sorry for the poor programming. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Notes: | |
' embossing letters must be in all caps | |
' mag stripe encoding tracks end with a ? | |
' track encoding starts with a " | |
' OCR = $, AN1 = *, AN2 = ), AN3 =#, AN4 = @ | |
' records must be padded 248 to the right. | |
Imports System.IO | |
Imports System.Math | |
Imports Microsoft.VisualBasic | |
Public Class Form1 | |
Dim i As Integer | |
'Used to generate data | |
Private Sub GenerateData() | |
Dim total_sequence As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim file_number As Integer = 1 | |
Dim card_number As Long = 1234123412341234 | |
Dim check_digit As String | |
Dim full_number As String | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While card_number < 1234123412341243 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
'full_number = "0000 0000 0000 " & card_number | |
'check_digit = getMod10(full_number) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & card_number & " (G\\D01=" & card_number & "~\D02=" & sequence.ToString.PadLeft(4, "0") & "~\BD1=" & card_number & "~\\" & """" & "%B" & card_number & "?;" & card_number & "=?").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & card_number & " (G\\D01=" & card_number & "~\D02=" & sequence.ToString.PadLeft(4, "0") & "~\BD1=" & card_number & "~\\" & """" & "%B" & card_number & "?;" & card_number & "=?").PadRight(248, " ")) | |
sequence += 1 | |
card_number += 1 | |
total_sequence += 1 | |
If card_number > 1234123412341243 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
total_file.Close() | |
MsgBox("Done!") | |
End Sub | |
' Used to merge files into one | |
Private Sub FileMerger() | |
Dim line1 As String | |
Dim line2 As String | |
Dim sequence As Integer = 1 | |
Dim file1 As New StreamReader("C:\test\2036517.00\org\BlizzCon 2007 Murloc Costumes.txt") | |
Dim file2 As New StreamReader("C:\test\2036517.00\org\BlizzCon 2007 Future Beta Keys.txt") | |
Dim out_file As New StreamWriter("C:\test\2036517.00\A6517001.txt") | |
While file1.Peek <> -1 And file2.Peek <> -1 | |
line1 = file1.ReadLine | |
line2 = file2.ReadLine | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & line1.Substring(52, 7) & " (G\\D01=" & line1.Substring(0, 51) & "~\" & "D02=" & line2.Substring(0, 41) & "~\" & "D03=" & line1.Substring(52, 7) & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
End While | |
file1.Close() | |
file2.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End Sub | |
'Used on the Stop & Stor Job 2036228.00 | |
Private Sub StopStor() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim array(11) As String | |
Dim sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
'Dim out_file As New StreamWriter("C:\test\A6228001.txt") | |
Dim form_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & ".txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
If array(3).Length < 1 Then | |
'out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & (array(2) & " " & array(3)).PadRight(40, " ") & "~\" & "D02=" & array(0).PadRight(15, " ") & "~\" & "D03=" & array(10).PadRight(12, " ") & "~\\").PadRight(248, " ")) | |
form_file.WriteLine(sequence.ToString.PadLeft(6, "0") & "|" & array(0) & "|" & array(1).Trim & " " & array(2).Trim & "|" & array(4) & "||" & array(5) & ", " & array(6) & "|" & array(7)) | |
Else | |
'out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & array(4).PadRight(40, " ") & "~\" & "D02=" & array(0).PadRight(15, " ") & "~\" & "D03=" & array(10).PadRight(12, " ") & "~\\").PadRight(248, " ")) | |
form_file.WriteLine(sequence.ToString.PadLeft(6, "0") & "|" & array(0) & "|" & array(3) & "|" & array(4) & "||" & array(5) & ", " & array(6) & ", " & array(7)) | |
End If | |
sequence += 1 | |
End While | |
in_file.Close()a | |
form_file.Close() | |
'out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'Used on Capnet job 2036261.01, and grand wailea 2035601.02 | |
Private Sub Capnet() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim array(20) As String | |
Dim file_number As Integer = 1 | |
Dim name As String | |
Dim number As String | |
Dim sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
'Dim total_file As New StreamWriter("C:\test\" & prefix_text_field.Text & "TOT.txt") | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
'capnet | |
'While in_file.Peek <> -1 | |
' line = in_file.ReadLine | |
' array = Split(line, vbTab) | |
' If array(5).Length < 1 Then | |
' name = array(4) & " " & array(6) | |
' Else | |
' name = array(4) & " " & array(5) & " " & array(6) | |
' End If | |
' number = array(0).Substring(0, 4) & " " & array(0).Substring(4, 4) & " " & array(0).Substring(8, 4) & " " & array(0).Substring(12, 4) | |
' out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & number & "*" & array(1) & ")" & array(2) & "#" & name.ToUpper.PadRight(28, " ") & "@" & array(7).ToUpper.PadRight(29, " ").Substring(0, 29)).PadRight(248, " ")) | |
' 'total_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$*" & name.ToUpper.PadLeft((10 + name.Length) \ 2).PadRight(10, " ") & ") # " & array(0) & " " & array(4) & " @").PadRight(248, " ")) | |
' sequence += 1 | |
'End While | |
'grand wailea | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
If array(2).Length < 1 Then | |
name = array(1) & " " & array(3) | |
Else | |
name = array(1) & " " & array(2) & " " & array(3) | |
End If | |
number = array(0).PadRight(5, " ") | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$*" & name.PadLeft((28 + name.Length) \ 2).PadRight(28) & ") # " & number & " " & array(4) & " @").PadRight(248, " ")) | |
sequence += 1 | |
End While | |
out_file.Close() | |
'total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'Used on a lot of jobs 2036520.00, 2036522.00, 2036523.00, 2036519.00, 2036524.00, 2036525.00 | |
Private Sub BlizzConf() | |
Dim dlg As New OpenFileDialog | |
Dim line As String | |
Dim sequence As Integer = 1 | |
Dim array(3) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("C:\test\" & prefix_text_field.Text & "001.txt") | |
'Dim long_names As New StreamWriter("C:\test\over 28.txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & array(0).PadLeft(28, " ") & "~\" & "D02=" & array(1).PadLeft(28, " ") & "~\\").PadRight(248, " ")) | |
'If array(0).Length > 20 Or array(1).Length > 20 Then | |
'long_names.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & array(0).PadLeft(32, " ") & "~\" & "D02=" & array(1).PadLeft(32, " ") & "~\\").PadRight(248, " ")) | |
'End If | |
'line = line.TrimEnd(vbTab) | |
'out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & line.PadLeft(28, " ") & "~\\").PadRight(248, " ")) | |
'If line.Length > 28 Then | |
'long_names.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\D01=" & line.PadLeft(32, " ") & "~\\").PadRight(248, " ")) | |
'End If | |
sequence += 1 | |
End While | |
'long_names.Close() | |
in_file.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Used on Williams Sonoma Job 2035977.02 | |
Private Sub WilliamsSonoma() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim sequence As Integer = 1 | |
Dim array(8) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & "001.txt") | |
Dim form_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & "FRM.txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " " & array(1).PadRight(7, " ") & " " & "*)#" & array(2).ToUpper.PadRight(30, " ") & "@VALID THRU " & array(0)).PadRight(248, " ")) | |
If array(3).Length < 1 Then | |
form_file.WriteLine(array(0) & "|" & array(2) & "|" & array(4) & "|" & array(5) & ", " & array(6) & " " & array(7) & "|" & "DEAR " & array(2) & ":" & "|" & array(1) & "|" & sequence.ToString.PadLeft(6, "0")) | |
Else | |
form_file.WriteLine(array(0) & "|" & array(2) & " and " & array(3) & "|" & array(4) & "|" & array(5) & ", " & array(6) & " " & array(7) & "|" & "DEAR " & array(2) & " and " & array(3) & ":" & "|" & array(1) & "|" & sequence.ToString.PadLeft(6, "0")) | |
End If | |
sequence += 1 | |
End While | |
in_file.Close() | |
out_file.Close() | |
form_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Used on iTunes Blackhawk job 2036639.00, pottery barn 2036736.00, last job tully 2037217.01 | |
Private Sub Blackhawk() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim card_number As String | |
Dim array(3) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
Dim upc As String = "07675003509" | |
card_number = array(0).Substring(2, 16) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & card_number & " (G\\D01=" & card_number & "~\D02=" & array(2) & "~\BD1=" & upc & card_number.Replace(" ", "").PadLeft(19, "0") & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & card_number & " (G\\D01=" & card_number & "~\D02=" & array(2) & "~\BD1=" & upc & card_number.Replace(" ", "").PadLeft(19, "0") & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
sequence += 1 | |
total_sequence += 1 | |
Next | |
sequence = 1 | |
out_file.Close() | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Used on Crytal Cruises job 2035437.07 | |
Private Sub CrystalCruises() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim total_file As New StreamWriter("C:\test\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim file As New StreamWriter("C:\test\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & line.Substring(74, 8) & " (G\\D01=" & line.Substring(6, 28) & "~\D02=" & line.Substring(74, 8) & "~\\").PadRight(248, " ")) | |
total_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & line.Substring(74, 8) & " (G\\D01=" & line.Substring(6, 28) & "~\D02=" & line.Substring(74, 8) & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
file.Close() | |
file_number += 1 | |
End While | |
total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Used on the Kohls job 2036737.01, KCRW 2035651.12 | |
Private Sub KohlsIPS() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim array(15) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(1).PadRight(6, " ") & " *)" & array(3).ToUpper.PadRight(28, " ") & "#" & array(4).PadRight(22, " ") & array(2).Substring(0, 3) & array(2).Substring(5, 2) & "@").PadRight(248, " ")) | |
'total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & array(1).Replace("""", "").PadRight(6, " ") & " *)" & array(3).Replace("""", "").ToUpper.PadRight(28, " ") & "#" & array(4).Replace("""", "").PadRight(22, " ") & array(2).Replace("""", "").Substring(0, 3) & array(2).Replace("""", "").Substring(6, 2) & "@").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Used for Kellerstrauss job 2037010.00, 2037448.00, 2037449.00 | |
Private Sub GasCard() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & sequence.ToString.PadLeft(3, "0") & ".txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
out_file.WriteLine(line.Replace("% ?", "").PadRight(248, " ")) | |
sequence += 1 | |
End While | |
in_file.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' job 2036426.00, 2036563.00, 2036953.00, 2037428.00~.01, 2037429.00~.02 | |
Private Sub Generic() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim array(50) As String | |
Dim card_number As String | |
Dim full_card As String | |
Dim name As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file1 As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
'name = array(0).ToUpper.Replace("""", "").PadLeft((32 + array(0).Length) / 2).PadRight(32) | |
out_file1.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(0) & " (G\\D01=" & array(0) & "~\\" & """" & "%" & array(1) & "?;" & array(2) & "?").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & array(0) & " (G\\D01=" & array(0) & "~\\" & """" & "%" & array(1) & "?;" & array(2) & "?").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
sequence = 1 | |
out_file1.Close() | |
file_number += 1 | |
End While | |
total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Nexium purple pill 2036955.00, mckesson 2037383.00 | |
Private Sub Innerworkings() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
out_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & line & " (G\\D01=" & line & "~\\").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(7, "0") & "$" & line & " (G\\D01=" & line & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'Lake Las Vegas 2037114.00 | |
Private Sub SpltFile() | |
Dim dlg As New OpenFileDialog | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim array(3) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim file_one As New StreamWriter("C:\test\" & prefix_text_field.Text & "001.txt") | |
Dim file_two As New StreamWriter("C:\test\" & prefix_text_field.Text & "002.txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
If array(0).Length = 9 Then | |
file_one.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & array(1) & "~\\" & """" & ";" & array(0) & "?").PadRight(248, " ")) | |
sequence += 1 | |
Else | |
file_two.WriteLine((file_number.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & array(1) & "~\\" & """" & ";" & array(0) & "?").PadRight(248, " ")) | |
file_number += 1 | |
End If | |
End While | |
in_file.Close() | |
file_one.Close() | |
file_two.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' American Airlines job 2037123.00, 2037250.00 | |
Private Sub AA() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim sequence As Integer = 1 | |
Dim array(11) As String | |
Dim name As String | |
Dim file_number As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
name = array(2).Trim & " " & array(3).Trim | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(0).PadRight(7, " ") & " (G\\D01=" & name.ToUpper.PadRight(25, " ") & "~\D02=AAdvantage Member: " & array(0) & "~\D03=Expires: May 31, 2008~\D04=" & sequence.ToString.PadLeft(3, " ") & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
End While | |
file_number += 1 | |
in_file.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'Metro fuel card 2037103.00 | |
Private Sub Metro() | |
Dim dlg As New OpenFileDialog | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim array(40) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("C:\test\" & prefix_text_field.Text & "001.txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
' used for embossing file | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(5).Replace("""", "") & "*" & array(1).Replace("""", "") & ") #" & array(3).Replace("""", "") & " " & array(4).Replace("""", "") & "@ " & """" & array(7).Replace("""", "") & array(8).Replace("""", "")).PadRight(248, " ")) | |
' used for thermal file | |
'out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(5).Replace("""", "") & " G(\\D01=" & array(5).Replace("""", "") & "~\D02=" & array(6).Replace("""", "") & "~\BD1=" & array(5).Replace("""", "") & "~\\ " & """" & array(7).Replace("""", "") & array(8).Replace("""", "")).PadRight(248, " ")) | |
sequence += 1 | |
End While | |
in_file.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'apple itunes | |
Private Sub Apple() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim array(5) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
'Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total\") | |
'Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, vbTab) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & array(0) & "~\D02=" & array(1) & "~\BD1=" & array(2) & "~\\").PadRight(248, " ")) | |
'total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & array(0) & "~\D02=" & array(1) & "~\D03=" & array(2) & "~\BD1=" & array(3) & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
If sequence.ToString.Length > 6 Then | |
sequence = 0 | |
Else | |
sequence = 1 | |
End If | |
file_number += 1 | |
End While | |
'total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' used for vivendi wow cards | |
Private Sub WOW() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim array(3) As String | |
Dim total_sequence As Integer = 1 | |
Dim card_number As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
card_number = array(0).Substring(0, 4) & "-" & array(0).Substring(4, 6) & "-" & array(0).Substring(10, 5) & "-" & array(0).Substring(15, 6) & "-" & array(0).Substring(21, 4) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & card_number & "~\D02=" & array(1) & "~\\").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & array(1) & " (G\\D01=" & card_number & "~\D02=" & array(1) & "~\\").PadRight(248, " ")) | |
sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
file_number += 1 | |
End While | |
total_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' mcdonalds 2036848.00 | |
Private Sub MickeyD() | |
Dim dlg As New OpenFileDialog | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim form_file As New StreamWriter("C:\test\" & prefix_text_field.Text & "FRM.lst") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
form_file.WriteLine(sequence.ToString.PadLeft(6, "0") & "|" & line.Substring(38, 11) & "000" & line.Substring(1, 16) & "|") | |
'Dim front_file As New StreamWriter("C:\test\25F" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
'Dim back_file As New StreamWriter("C:\test\25B" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
'For i = 0 To CInt(breakdown_text_field.Text - 1) | |
' line = in_file.ReadLine | |
' 'back of card | |
' front_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & line.Substring(1, 16) & " (G\\D01=" & line.Substring(1, 16) & "~\D02=" & line.Substring(38, 11) & "000" & line.Substring(1, 16) & "~\BD1=" & line.Substring(38, 11) & "000" & line.Substring(1, 16) & "~\\ " & """" & "%" & line.Substring(20, 68) & "?;" & line.Substring(91, 37) & "?").PadRight(248, " ")) | |
' 'front of card | |
' back_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & "(G\\D01=Mcdonald's Giftbox Hybrid~\D02=$25~\D03=076750020353~\BD1=076750020353~\\").PadRight(248, " ")) | |
' sequence += 1 | |
' If in_file.Peek = -1 Then | |
' Exit For | |
' End If | |
'Next | |
'front_file.Close() | |
'back_file.Close() | |
sequence += 1 | |
'file_number += 1 | |
End While | |
form_file.Close() | |
in_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' ticketmaster 2036996.01 BLACKHAWK FORMAT!!!!!!!!! yes, there are mulitple ticketmaster formats. | |
Private Sub Ticketmaser() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim array(3) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
Dim upc As String = "07675003623" | |
Dim barcode As String = upc & array(0).Substring(2, 16).PadLeft(19, "0") | |
out_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & array(0).Substring(2, 16) & " (G\\D01=" & array(0).Substring(2, 16) & "~\D02=" & array(2) & "~\D03=" & upc & "~\BD1=" & barcode & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
total_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & array(0).Substring(2, 16) & " (G\\D01=" & array(0).Substring(2, 16) & "~\D02=" & array(2) & "~\D03=" & upc & "~\BD1=" & barcode & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Amazon 2037435.00~.05 | |
Private Sub Amazon() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim array(3) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
array = Split(line, ",") | |
Dim upc As String = "07675003623" | |
Dim barcode As String = upc & array(0).Substring(2, 16).PadLeft(19, "0") | |
out_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & array(0).Substring(2, 16) & " (G\\D01=" & array(0).Substring(2, 16) & "~\D02=" & array(2) & "~\D03=" & upc & "~\BD1=" & barcode & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
total_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & array(0).Substring(2, 16) & " (G\\D01=" & array(0).Substring(2, 16) & "~\D02=" & array(2) & "~\D03=" & upc & "~\BD1=" & barcode & "~\\ " & """" & array(0) & array(1)).PadRight(248, " ")) | |
sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
Private Sub ValueLink() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim barcode As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
'Dim front_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\F" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
Dim back_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
barcode = line.Substring(38, 11) & line.Substring(1, 16).PadLeft(19, "0") | |
'front_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & line.Substring(1, 16) & " (G\\D01=" & line.Substring(1, 16) & "~\\").PadRight(248, " ")) | |
back_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " (G\\BD1=" & barcode & "~\D01=" & barcode & "~\D02=" & line.Substring(131, 8) & "~\\" & """" & "%" & line.Substring(20, 68) & "?;" & line.Substring(91, 37) & "?").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & " (G\\BD1=" & barcode & "~\D01=" & barcode & "~\D02=" & line.Substring(131, 8) & "~\\" & """" & "%" & line.Substring(20, 68) & "?;" & line.Substring(91, 37) & "?").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
'front_file.Close() | |
back_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
Private Sub WesternUnion() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim name As String | |
Dim account As String | |
Dim control As String | |
Dim array(10) As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
'array = Split(line, vbTab) | |
'name = array(0).Replace(".", "") & ". " & array(1).PadRight(22, " ") | |
account = line.Substring(0, 3) & " " & line.Substring(3, 3) & " " & line.Substring(6, 3) | |
out_file.WriteLine((sequence.ToString.PadLeft(6, "0") & "$" & " *" & " ) #" & account & """" & WuMod10(line) & ";" & line & "?").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(6, "0") & "$" & " *" & " ) #" & account & """" & WuMod10(line) & ";" & line & "?").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
Private Sub AARP() | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text & "\org" | |
Dim line As String | |
Dim file_number As Integer = 1 | |
Dim sequence As Integer = 1 | |
Dim total_sequence As Integer = 1 | |
Dim name As String | |
Dim account As String | |
Dim control As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Directory.CreateDirectory("C:\test\" & job_number_text_field.Text & "\total") | |
Dim total_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\total\" & prefix_text_field.Text & "TOT.txt") | |
While in_file.Peek <> -1 | |
Dim out_file As New StreamWriter("C:\test\" & job_number_text_field.Text & "\" & prefix_text_field.Text & file_number.ToString.PadLeft(3, "0") & ".txt") | |
For i = 0 To CInt(breakdown_text_field.Text - 1) | |
line = in_file.ReadLine | |
name = line.Substring(0, 30).Trim(" ") | |
account = line.Substring(30, 9) & "-" & line.Substring(39, 1) | |
control = line.Substring(40, 7) | |
out_file.WriteLine((sequence.ToString.PadLeft(7, "0") & "$" & account & " (G\\D01=" & name.PadLeft((30 + name.Length) \ 2).PadRight(30) & "~\D02=ID#: " & account & "~\D03=" & control & "~\D04=Reply By: 12/6/2007~\\").PadRight(248, " ")) | |
total_file.WriteLine((total_sequence.ToString.PadLeft(7, "0") & "$" & account & " (G\\D01=" & name.PadLeft((30 + name.Length) \ 2).PadRight(30) & "~\D02=ID#: " & account & "~\D03=" & control & "~\D04=Reply By: 12/6/2007~\\").PadRight(248, " ")) | |
sequence += 1 | |
total_sequence += 1 | |
If in_file.Peek = -1 Then | |
Exit For | |
End If | |
Next | |
out_file.Close() | |
sequence = 1 | |
file_number += 1 | |
End While | |
in_file.Close() | |
total_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
' Main Run button | |
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click | |
Select Case ComboBox1.Text | |
Case "Generate Data" | |
Me.GenerateData() | |
Case "File Merger" | |
Me.FileMerger() | |
Case "Stop & Stor" | |
Me.StopStor() | |
Case "Capnet" | |
Me.Capnet() | |
Case "Blizz Conf" | |
Me.BlizzConf() | |
Case "Williams Sonoma" | |
Me.WilliamsSonoma() | |
Case "iTunes Blackhawk" | |
Me.Blackhawk() | |
Case "Crystal Cruises" | |
Me.CrystalCruises() | |
Case "Kohl's IPS" | |
Me.KohlsIPS() | |
Case "Gas Card" | |
Me.GasCard() | |
Case "Generic Jobs" | |
Me.Generic() | |
Case "Innerworkings" | |
Me.Innerworkings() | |
Case "Lake Las Vegas" | |
Me.SpltFile() | |
Case "American Airlines" | |
Me.AA() | |
Case "Metro" | |
Me.Metro() | |
Case "Apple" | |
Me.Apple() | |
Case "Blizzard" | |
Me.WOW() | |
Case "McDonalds" | |
Me.MickeyD() | |
Case "Ticketmaster" | |
Me.Ticketmaser() | |
Case "Value Link" | |
Me.ValueLink() | |
Case "AARP" | |
Me.AARP() | |
Case "WesternUnion" | |
Me.WesternUnion() | |
Case Else | |
MsgBox("You must select an item from the drop down menu first.") | |
End Select | |
End Sub | |
Private Sub RunToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunToolStripMenuItem.Click | |
Select Case ComboBox1.Text | |
Case "Generate Data" | |
Me.GenerateData() | |
Case "File Merger" | |
Me.FileMerger() | |
Case "Stop & Stor" | |
Me.StopStor() | |
Case "Capnet" | |
Me.Capnet() | |
Case "Blizz Conf" | |
Me.BlizzConf() | |
Case "Williams Sonoma" | |
Me.WilliamsSonoma() | |
Case "iTunes Blackhawk" | |
Me.Blackhawk() | |
Case "Crystal Cruises" | |
Me.CrystalCruises() | |
Case "Kohl's IPS" | |
Me.KohlsIPS() | |
Case "Gas Card" | |
Me.GasCard() | |
Case "Generic Jobs" | |
Me.Generic() | |
Case "Innerworkings" | |
Me.Innerworkings() | |
Case "Lake Las Vegas" | |
Me.SpltFile() | |
Case "American Airlines" | |
Me.AA() | |
Case "Metro" | |
Me.Metro() | |
Case "Apple" | |
Me.Apple() | |
Case "AARP" | |
Me.AARP() | |
Case Else | |
MsgBox("You must select an item from the drop down menu first.") | |
End Select | |
End Sub | |
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click | |
Me.Close() | |
End Sub | |
Function getMod10(ByVal acctNum As String) As String | |
Dim dlg As New OpenFileDialog | |
Dim flag As Integer = 0 | |
Dim seq As Integer = 1 | |
Dim i, checkdigit As Integer | |
Dim temp2 As Integer | |
Dim fields(2) As String | |
Dim bar As String | |
Dim totalSum As Integer | |
bar = acctNum | |
totalSum = 0 | |
flag = 0 | |
For i = bar.Length - 1 To 0 Step -1 | |
If flag Mod 2 = 0 Then | |
flag = 1 | |
temp2 = AscW(bar(i)) - 48 | |
temp2 = temp2 * 2 | |
If temp2 >= 10 Then | |
temp2 = temp2 - 9 | |
End If | |
totalSum = totalSum + temp2 | |
Else | |
flag = 0 | |
totalSum = totalSum + AscW(bar(i)) - 48 | |
End If | |
Next | |
If totalSum Mod 10 = 0 Then | |
checkdigit = 0 | |
Else | |
checkdigit = 10 - totalSum Mod 10 | |
End If | |
seq += 1 | |
Return (checkdigit) | |
End Function | |
Function AzaleaUPCcheckdigit(ByVal yourInput As String) As String | |
' Copyright 2006 Azalea Software, Inc. All rights reserved. www.azalea.com | |
' The input, yourInput, is your 11-digit company prefix + product number | |
Dim checkDigitSubtotal As Integer ' temporary variable during the calculation | |
checkDigitSubtotal = 3 * (Val(Microsoft.VisualBasic.Left(yourInput, 1) + Val(Mid$(yourInput, 3, 1)) + Val(Mid$(yourInput, 5, 1)) + Val(Mid$(yourInput, 7, 1)) + Val(Mid$(yourInput, 9, 1)) + Val(Microsoft.VisualBasic.Right(yourInput, 1)))) | |
checkDigitSubtotal = checkDigitSubtotal + Val(Mid$(yourInput, 2, 1)) + Val(Mid$(yourInput, 4, 1)) + Val(Mid$(yourInput, 6, 1)) + Val(Mid$(yourInput, 8, 1)) + Val(Mid$(yourInput, 10, 1)) | |
AzaleaUPCcheckdigit = Microsoft.VisualBasic.Right(Str$(300 - checkDigitSubtotal), 1) | |
Return (AzaleaUPCcheckdigit) | |
End Function | |
're-sequence | |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "K:\" & job_number_text_field.Text | |
'dlg.InitialDirectory = "C:\test\" & job_number_text_field.Text | |
Dim line As String | |
Dim sequence As Integer = 1 | |
Dim account_number As String | |
Dim array(22308) As String | |
'If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
' Dim in_file As New StreamReader(dlg.FileName) | |
' Dim out_file As New StreamWriter("K:\" & job_number_text_field.Text & "\data.txt") | |
' 'Dim out_file As New StreamWriter("C:\test\" & "data.txt") | |
' While in_file.Peek <> -1 | |
' For i = 1 To 1000 | |
' line = in_file.ReadLine | |
' account_number = line.Substring(7, 6) & "CL " | |
' out_file.WriteLine((line.Substring(0, 7) & account_number & line.Substring(13, 9) & account_number & "~\\").PadRight(248, " ")) | |
' Next | |
' For i = 1 To 750 | |
' line = in_file.ReadLine | |
' account_number = line.Substring(7, 6) & "BP " | |
' out_file.WriteLine((line.Substring(0, 7) & account_number & line.Substring(13, 9) & account_number & "~\\").PadRight(248, " ")) | |
' Next | |
' For i = 1 To 750 | |
' line = in_file.ReadLine | |
' account_number = line.Substring(7, 6) & "SPA" | |
' out_file.WriteLine((line.Substring(0, 7) & account_number & line.Substring(13, 9) & account_number & "~\\").PadRight(248, " ")) | |
' Next | |
' sequence += 1 | |
' End While | |
' in_file.Close() | |
' out_file.Close() | |
' MsgBox("Done!") | |
'End If | |
MsgBox(getMod10(misc.Text)) | |
End Sub | |
' add spaces button | |
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click | |
Dim dlg As New OpenFileDialog | |
dlg.InitialDirectory = "K:\" & job_number_text_field.Text | |
Dim line As String | |
Dim account_number As String | |
If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Dim in_file As New StreamReader(dlg.FileName) | |
Dim out_file As New StreamWriter("K:\" & job_number_text_field.Text & "\data.txt") | |
While in_file.Peek <> -1 | |
line = in_file.ReadLine | |
account_number = line.Substring(42, 26).Trim | |
out_file.WriteLine((line.Substring(0, 42) & account_number.PadLeft((26 + account_number.Length) \ 2).PadRight(26) & line.Substring(68, 3)).PadRight(248, " ")) | |
End While | |
in_file.Close() | |
out_file.Close() | |
MsgBox("Done!") | |
End If | |
End Sub | |
'returns track 1 | |
Function WuMod10(ByVal barcode As String) As String | |
Dim count As Integer = 0 | |
Dim seq As Integer = 1 | |
Dim i, checkdigit, totalSum As Integer | |
Dim bar As String | |
Dim temp2 As Integer | |
Dim fields(2) As String | |
totalSum = 0 | |
bar = "600604" & barcode | |
count = 0 | |
For i = bar.Length - 1 To 0 Step -1 | |
If count Mod 2 = 0 Then | |
count = 1 | |
temp2 = AscW(bar(i)) - 48 | |
temp2 = temp2 * 2 | |
totalSum = totalSum + temp2 | |
'sw.WriteLine(temp2) | |
Else | |
count = 0 | |
totalSum = totalSum + AscW(bar(i)) - 48 | |
'sw.WriteLine(AscW(bar(i)) - 48) | |
End If | |
Next | |
If totalSum Mod 10 = 0 Then | |
checkdigit = 0 | |
Else | |
checkdigit = 10 - totalSum Mod 10 | |
End If | |
Return ("%B" & bar & checkdigit & "?") | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment