Browse Source

Getting the SnailWorksExportWork working

pull/8/head
Daniel Covington 6 months ago
parent
commit
bcc4992869
5 changed files with 491 additions and 111 deletions
  1. +337
    -0
      Data/Proofs.rep
  2. BIN
      Data/purple_envelope_sample_Page_1.png
  3. BIN
      Data/purple_envelope_sample_Page_2.png
  4. +0
    -110
      ImportService/TrackingDataCass.vbs
  5. +154
    -1
      ImportService/TrackingDataImport.vbs

+ 337
- 0
Data/Proofs.rep View File

@@ -0,0 +1,337 @@
object TRpReport
PageBackColor = 16777215
SubReports = <
item
SubReport = TRpSubReport0
end>
DataInfo = <
item
Alias = 'KIT'
DatabaseAlias = 'WEBDATA'
SQL = 'SELECT * FROM Kit WHERE ID = PBKITID'
end
item
Alias = 'KITLABELS'
DatabaseAlias = 'WEBDATA'
SQL =
'SELECT InkjetRecords.ID, InkjetRecords.KitID, InkjetRecords.VOTE' +
'RID, InkjetRecords.LASTNAME,'#13#10#9#9#9' InkjetRecords.FIRSTNAME, Inkje' +
'tRecords.MIDDLENAME, InkjetRecords.SUFFIX, InkjetRecords.PRECINC' +
'T,'#13#10#9#9#9' InkjetRecords.ADDRESS1, InkjetRecords.ADDRESS2, InkjetRe' +
'cords.ADDRESS3, InkjetRecords.ADDRESS4,'#13#10#9#9#9' InkjetRecords.ADDRE' +
'SS5, InkjetRecords.APPSENT, InkjetRecords.APPRETURNED, InkjetRec' +
'ords.BALSENT,'#13#10#9#9#9' InkjetRecords.BALRETURNED, InkjetRecords.Coun' +
'tingBoard, InkjetRecords.UOCAVASTATUS, InkjetRecords.EMAILADDRES' +
'S,'#13#10#9#9#9' InkjetRecords.PHONENUMBER, InkjetRecords.BALLOT_NUMBER, ' +
'InkjetRecords.CassADDRESS1, InkjetRecords.CassADDRESS2,'#13#10#9#9#9' Ink' +
'jetRecords.CassADDRESS3, InkjetRecords.CassADDRESS4, InkjetRecor' +
'ds.CassADDRESS5, InkjetRecords.KitLabelID,'#13#10#9#9#9' KitLabels.ID, Ki' +
'tLabels.KitID, KitLabels.OutboundSerial, KitLabels.InBoundSerial' +
', KitLabels.OutboundIMB,'#13#10#9#9#9' KitLabels.InBoundIMB, KitLabels.Ou' +
'tboundIMBDigits, KitLabels.InBoundIMBDigits, KitLabels.OutboundI' +
'MBPNG,'#13#10#9#9#9' KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber'#13#10#9#9#9' FR' +
'OM InkjetRecords'#13#10#9#9#9' LEFT JOIN [KitLabels] ON InkjetRecords.Kit' +
'LabelID = KitLabels.ID'#13#10#9#9#9' WHERE InkjetRecords.KitID = PBKITID'
end
item
Alias = 'JURISDICTION'
DatabaseAlias = 'WEBDATA'
SQL = 'SELECT * FROM JURISDICTION WHERE JCode =PBJCODE'
end>
DatabaseInfo = <
item
Alias = 'WEBDATA'
LoadParams = True
LoadDriverParams = True
LoginPrompt = False
Driver = rpdataado
ReportTable = 'REPMAN_REPORTS'
ReportSearchField = 'REPORT_NAME'
ReportField = 'REPORT'
ReportGroupsTable = 'REPMAN_GROUPS'
ADOConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data So' +
'urce=F:\Development\Tracking_Kits\Data\webdata - Copy.mdb;Persis' +
't Security Info=False;'
end>
Params = <
item
Name = 'PBKITID'
AllowNulls = False
Value = 157
ParamType = rpParamInteger
Datasets.Strings = (
'KIT'
'KITLABELS'
'JURISDICTION')
SearchDataset = 'KIT'
SearchParam = 'KITID'
Description = ''
Hint = ''
Search = ''
ErrorMessage = ''
Validation = ''
end
item
Name = 'PBJCODE'
AllowNulls = False
Value = '34000'
Datasets.Strings = (
'JURISDICTION')
Description = ''
Hint = ''
Search = ''
ErrorMessage = ''
Validation = ''
end>
StreamFormat = rpStreamText
ReportAction = []
Type1Font = poHelvetica
WFontName = 'Arial'
LFontName = 'Helvetica'
object TRpSubReport0: TRpSubReport
Sections = <
item
Section = TRpSection0
end
item
Section = TRpSection1
end>
Alias = 'KITLABELS'
end
object TRpSection0: TRpSection
Width = 14285
Height = 9418
SubReport = TRpSubReport0
ChangeBool = False
PageRepeat = False
SkipPage = False
AlignBottom = False
SectionType = rpsecdetail
Components = <
item
Component = TRpExpression1
end
item
Component = TRpExpression2
end
item
Component = TRpExpression3
end>
ExternalTable = 'REPMAN_REPORTS'
ExternalField = 'REPORT'
ExternalSearchField = 'REPORT_NAME'
StreamFormat = rpStreamText
dpires = 300
BackStyle = baPrint
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
ChangeExpression = ''
BeginPageExpression = ''
ChangeExpression = ''
SkipExpreV = ''
SkipExpreH = ''
SkipToPageExpre = ''
BackExpression =
#39'F:\Development\Tracking_Kits\Data\purple_envelope_sample_Page_1' +
'.png'#39
Stream = {0000000000000000}
end
object TRpSection1: TRpSection
Width = 14285
Height = 9418
SubReport = TRpSubReport0
ChangeBool = False
PageRepeat = False
SkipPage = False
AlignBottom = False
SectionType = rpsecdetail
Components = <
item
Component = TRpExpression0
end
item
Component = TRpExpression4
end
item
Component = TRpExpression5
end
item
Component = TRpExpression6
end>
ExternalTable = 'REPMAN_REPORTS'
ExternalField = 'REPORT'
ExternalSearchField = 'REPORT_NAME'
StreamFormat = rpStreamText
dpires = 300
BackStyle = baPrint
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
ChangeExpression = ''
BeginPageExpression = ''
ChangeExpression = ''
SkipExpreV = ''
SkipExpreH = ''
SkipToPageExpre = ''
BackExpression =
#39'F:\Development\Tracking_Kits\Data\purple_envelope_sample_Page_2' +
'.png'#39
Stream = {0000000000000000}
end
object TRpExpression0: TRpExpression
Width = 4200
Height = 264
PosX = 8400
PosY = 7125
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'KITLABELS.CassADDRESS1'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression2: TRpExpression
Width = 4200
Height = 264
PosX = 6555
PosY = 6090
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.Name'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression3: TRpExpression
Width = 4200
Height = 264
PosX = 6555
PosY = 6555
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.CSZ'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression1: TRpExpression
Width = 4200
Height = 264
PosX = 6555
PosY = 6330
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.Mailing_Address'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression4: TRpExpression
Width = 4200
Height = 264
PosX = 8160
PosY = 5295
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.Name'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression5: TRpExpression
Width = 4200
Height = 264
PosX = 8160
PosY = 5760
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.CSZ'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
object TRpExpression6: TRpExpression
Width = 4200
Height = 264
PosX = 8160
PosY = 5535
Type1Font = poHelvetica
AutoExpand = False
AutoContract = False
ExportPosition = 0
ExportSize = 1
ExportDoNewLine = False
PrintCondition = ''
DoBeforePrint = ''
DoAfterPrint = ''
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression = 'JURISDICTION.Mailing_Address'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
ExportExpression = ''
end
end

BIN
Data/purple_envelope_sample_Page_1.png View File

Before After
Width: 2975  |  Height: 1963  |  Size: 68KB

BIN
Data/purple_envelope_sample_Page_2.png View File

Before After
Width: 2975  |  Height: 1963  |  Size: 81KB

+ 0
- 110
ImportService/TrackingDataCass.vbs View File

@@ -1,110 +0,0 @@
Option Explicit
Dim dev:dev = True
Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell")
Dim fso:Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Dim outFile
Dim DataDirectory
Dim ConnectionString
Dim oConn:Set oConn = WScript.CreateObject("ADODB.Connection")
Dim glob:set glob = CreateObject("Chilkat_9_5_0.Global")
Dim success:success = glob.UnlockBundle("KENTCM.CB1022025_RGzBPM5J655e")

If (success <> 1) Then
WriteLine(glob.LastErrorText)
WScript.Quit
End If
Dim objCSV:Set objCsv = CreateObject("Chilkat_9_5_0.Csv")
Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
If dev Then
'set outFile = fso.CreateTextFile("F:\Development\Tracking_Kits\ImportService\temp.csv",True)
set outFile = fso.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True)
DataDirectory = WorkingDirectory & "test"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=F:\Development\Tracking_Kits\Data\webdata - Copy.mdb;"
Else
DataDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataImport\"
set outFile = fso.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True)
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;"
End If
oConn.ConnectionString = ConnectionString
oConn.Open
Dim KitID:KitID = CheckForJobsToCass()
If KitID > 0 Then
ExportMMCsv(KitID)
RunMailManager
ImportCass
End If
Sub ImportCass
Dim currentRow
objCsv.LoadFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\FROM_MM.CSV")

For currentRow = 0 To objCsv.NumRows -1
oConn.Execute("UPDATE InkJetRecords SET CassADDRESS1 = '" & objCsv.GetCell(currentRow,1) & "', " &_
"CassADDRESS2 = '" & objCSV.GetCell(currentRow,3) & "', " &_
"CassADDRESS3 = '" & objCSV.GetCell(currentRow,4) & "', " &_
"CassADDRESS4 = '" & objCSV.GetCell(currentRow,5) & "', " &_
"CassADDRESS5 = '" & objCsv.GetCell(currentRow,6) & ", " & objCsv.GetCell(currentRow,7) & " " & objCsv.GetCell(currentRow,8) & "'" &_
" WHERE ID = " & objCSV.GetCell(currentRow,0) & ";")
Next

oConn.Execute("UPDATE Kit SET Status ='Ready To Create Labels' WHERE ID =" & KitID & ";")
End Sub

Sub RunMailManager
WshShell.Run "\\MM2012\APPS\BCC\MM2010\mailman.exe -p -j MMJOB.mjb -u DAN",1,True
End Sub
Sub ExportMMCsv(KitId)
Dim success
objCsv.HasColumnNames = 1
objCSV.EnableQuotes = 1
success = objCsv.SetColumnName(0,"ID")
success = objCsv.SetColumnName(1,"NAME")
success = objCsv.SetColumnName(2,"ADDRESS1")
success = objCsv.SetColumnName(3,"ADDRESS2")
success = objCsv.SetColumnName(4,"ADDRESS3")
success = objCsv.SetColumnName(5,"ADDRESS4")
success = objCsv.SetColumnName(6,"ADDRESS5")
Dim rs : Set rs = oConn.Execute("Select ID," & _
"IIF(FIRSTNAME IS NULL,'',FIRSTNAME & ' ') & " & _
"IIF(MIDDLENAME IS NULL,'',MIDDLENAME & ' ') & " & _
"IIF(LASTNAME IS NULL,'',LASTNAME & ' ') & " & _
"IIF(SUFFIX IS NULL,'',SUFFIX & ' ') " & _
"AS NAME, ADDRESS1,ADDRESS2,ADDRESS3,ADDRESS4,ADDRESS5 FROM InkjetRecords WHERE KitID =" & KitID & " ORDER By ID;")
Dim CurrentRow:CurrentRow = 0
While Not rs.EOF
objCSV.SetCell CurrentRow,0,rs("ID").value
objCSV.SetCell CurrentRow,1,rs("NAME").value
objCSV.SetCell CurrentRow,2,rs("ADDRESS1").value
objCSV.SetCell CurrentRow,3,rs("ADDRESS2").value
objCSV.SetCell CurrentRow,4,rs("ADDRESS3").value
objCSV.SetCell CurrentRow,5,rs("ADDRESS4").value
objCSV.SetCell CurrentRow,6,rs("ADDRESS5").value
rs.MoveNext
CurrentRow = CurrentRow +1
Wend
Dim CsvString:CsvString = objCSV.SaveToString()
outFile.WriteLine CsvString
outFile.Close

End Sub
Function CheckForJobsToCass()



Dim rs : set rs = oConn.Execute("Select TOP 1 ID from Kit Where Status ='Ready to Cass' ORDER BY ID DESC;")
If Not rs.EOF Then
Dim kitId : kitId = rs("ID").value
rs.Close
CheckForJobsToCass = KitID
oConn.Execute("UPDATE Kit SET Status ='Cassing' WHERE ID =" & KitID & ";")
Else
CheckForJobsToCass = 0
End If

End Function


+ 154
- 1
ImportService/TrackingDataImport.vbs View File

@@ -3,6 +3,7 @@ Dim dev:dev = True
Dim outFile
Dim WaitTime:WaitTime = 15000
Dim DataDirectory
Dim ExportDirectory
Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell")
Dim oConn:Set oConn = WScript.CreateObject("ADODB.Connection")
Dim ConnectionString
@@ -19,10 +20,12 @@ Dim objCSV:Set objCsv = CreateObject("Chilkat_9_5_0.Csv")
Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.ScriptName,"")
If dev Then
DataDirectory = WorkingDirectory & "test"
ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=F:\Development\Tracking_Kits\Data\webdata - Copy.mdb;"
set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True)
Else
DataDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataImport"
ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;"
set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True)
End If
@@ -42,9 +45,117 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S
If KitID > 0 Then
createTrackingInfoForKit(KitID)
End If
KitID = CheckForReadyToExportToSnailWorks()
If KitID > 0 Then
CreateExportForSnailWorks(KitID)
End If
WScript.Quit

Function CheckForReadyToExportToSnailWorks()
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If
Dim rs:Set rs = oConn.Execute("Select TOP 1 [ID] FROM [Kit] Where Status ='Ready For Export' and JobType='Purple Envelopes';")
If Not rs.EOF Then
CheckForReadyToExportToSnailWorks = rs("ID").value
Else
CheckForReadyToExportToSnailWorks = 0
End If
If rs.State = 1 Then:rs.Close:End If
If oConn.State = 1 Then:oConn.Close:End If
End Function

Function CreateExportForSnailWorks(KitID)
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If
Dim KitRs:set KitRs = oConn.Execute("Select * From [Kit] Where [ID] =" & KitID & ";")
Dim KitLabelsRs: Set KitLabelsRs = oConn.Execute("SELECT InkjetRecords.ID, InkjetRecords.KitID, InkjetRecords.VOTERID, InkjetRecords.LASTNAME," &_
" InkjetRecords.FIRSTNAME, InkjetRecords.MIDDLENAME, InkjetRecords.SUFFIX, InkjetRecords.PRECINCT," &_
" InkjetRecords.ADDRESS1, InkjetRecords.ADDRESS2, InkjetRecords.ADDRESS3, InkjetRecords.ADDRESS4," &_
" InkjetRecords.ADDRESS5, InkjetRecords.APPSENT, InkjetRecords.APPRETURNED, InkjetRecords.BALSENT," &_
" InkjetRecords.BALRETURNED, InkjetRecords.CountingBoard, InkjetRecords.UOCAVASTATUS, InkjetRecords.EMAILADDRESS," &_
" InkjetRecords.PHONENUMBER, InkjetRecords.BALLOT_NUMBER, InkjetRecords.CassADDRESS1, InkjetRecords.CassADDRESS2," &_
" InkjetRecords.CassADDRESS3, InkjetRecords.CassADDRESS4, InkjetRecords.CassADDRESS5, InkjetRecords.KitLabelID," &_
" KitLabels.ID, KitLabels.KitID, KitLabels.OutboundSerial, KitLabels.InBoundSerial, KitLabels.OutboundIMB," &_
" KitLabels.InBoundIMB, KitLabels.OutboundIMBDigits, KitLabels.InBoundIMBDigits, KitLabels.OutboundIMBPNG," &_
" KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber" &_
" FROM InkjetRecords" &_
" LEFT JOIN [KitLabels] ON InkjetRecords.KitLabelID = KitLabels.ID" & _
" WHERE InkjetRecords.KitID =" & KitID & " ;")
Dim JurisdictionRs:Set JurisdictionRs = oConn.Execute("SELECT * FROM Jurisdiction WHERE JCode ='" & KitRs("Jcode").Value & "';")
Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & "_SW_EXPORT"
If Not objFSO.FolderExists(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value) Then:objFSO.CreateFolder(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value):End If
If objFSO.FileExists(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ExportFileName) Then:objFSO.DeleteFile(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ExportFileName):End If
Dim objExportFile:set objExportFile = objFSO.CreateTextFile(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ExportFileName,2)
objExportFile.Write("H") 'Record Type Required value must be = "H" (Header)
objExportFile.Write(PadString("5.1",5)) 'Version Required value must be ="5.1" for current release
objExportFile.Write(PadString("?",50)) 'UserId Required
objExportFile.Write(PadString(JurisdictionRs("Name").Value,50)) 'Client Name Required (will create new subaccount if not already defined)
objExportFile.Write(PadString("",50)) 'Parent Client Name Optional (use if 3-tier account structure)
objExportFile.Write(PadString("Purple envelope - " &_
KitRs("JobNumber").Value,50)) 'Job Name Required
objExportFile.Write(PadString("",50)) 'Job Description Optional
objExportFile.Write(PadString("",50)) 'Split Name Optional – will default to ‘Default’
objExportFile.Write(PadString("",80)) 'Split Description Optional
objExportFile.Write(PadString("L",1)) 'Piece Type Required L-Letters, C-Cards, F-Flats
objExportFile.Write(PadString(Year(Now()) & "/" &_
Right("0" & Month(Now()), 2) & "/" & Right("0" & Day(Now()), 2),10)) 'MailDate Required (YYYY/MM/DD)
objExportFile.Write(PadString("N",1)) 'UploadType Required N = New job, new split A = Append new split to existing job R = Replace existing split
objExportFile.Write(PadString("",8)) 'TrackedQuantity Optional
objExportFile.Write(PadString("",8)) 'PiecesMailed Optional – shown as Estimated Quantity
objExportFile.Write(PadString("",10)) 'Target InHomeDateStart Optional (YYYY/MM/DD)
objExportFile.Write(PadString("",10)) 'Target InHomeDateEnd Optional (YYYY/MM/DD)
objExportFile.Write(PadString("",100)) 'ConfirmationEmail Optional
objExportFile.Write(PadString("",9)) 'JobId (SW) Optional for previously created jobs SWJobId
objExportFile.Write(PadString("",4)) 'SplitId (SW) Optional for previously created jobs SWJobId
objExportFile.Write(PadString(Choice(IsNull(KitRs("InboundSTID")),"O","R"),1))'TypeofTracking Required Values: O- Outbound Only I-Inbound Only R-Round Trip
objExportFile.Write(PadString("",11)) 'ReturnedPostalRoutingCode
objExportFile.Write(PadString("",2)) 'ReportId1
objExportFile.Write(PadString("",255)) 'Report1Email
objExportFile.Write(PadString("",2)) 'ReportId2
objExportFile.Write(PadString("",255)) 'Report2Email
objExportFile.Write(vbCrLf)
While Not KitLabelsRs.EOF
objExportFile.Write("D") 'RecordType Required value must be = “D” (Detail)
objExportFile.Write(PadString("",20)) 'CustomerUniqueIdentifier Optional- any identifier you designate
objExportFile.Write(PadString(KitLabelsRs("OutboundIMBDigits"),31)) 'IMB Required – Unencoded, numeric IMB
objExportFile.Write(PadString((""),10)) 'Greeting Optional
objExportFile.Write(PadString((""),50)) 'First Name Optional
objExportFile.Write(PadString((""),2)) 'MI Optional
objExportFile.Write(PadString((""),50)) 'Last Name Optional
objExportFile.Write(PadString((""),10)) 'Suffix Optional
objExportFile.Write(PadString((KitLabelsRs("CassADDRESS1").Value),100)) 'Full Name Optional
objExportFile.Write(PadString((""),50)) 'Company Optional
objExportFile.Write(PadString((""),50)) 'Title Optional
objExportFile.Write(PadString(KitLabelsRs("CassADDRESS3").Value,128)) 'Address1 Optional
objExportFile.Write(PadString(KitLabelsRs("CassADDRESS4").Value,128)) 'Address2 Optional
objExportFile.Write(PadString(Left(KitLabelsRs("CassADDRESS5").Value, InStr(KitLabelsRs("CassADDRESS5").Value, ",") - 1),50)) 'City Optional
objExportFile.Write(PadString(Mid(KitLabelsRs("CassADDRESS5").Value, InStr(KitLabelsRs("CassADDRESS5").Value, ",") + 2, 2),2)) 'State Optional
objExportFile.Write PadString(Right(KitLabelsRs("CassADDRESS5").Value,11),11)'Zip Optional
objExportFile.Write(PadString(KitRs("Jcode"),100)) 'UserDefined1 Optional - Summary fields only
objExportFile.Write(PadString((""),100)) 'UserDefined2 Optional - Summary fields only
objExportFile.Write(PadString((""),100)) 'UserDefined3 Optional - Summary fields only
objExportFile.Write(PadString(KitLabelsRs("PRECINCT").Value & KitLabelsRs("BALLOT_NUMBER"),80)) 'UserDefinedIdentifier4 Optional – Allows for unique identifiers
objExportFile.Write(PadString(KitLabelsRs("VOTERID").Value,80)) 'UserDefinedIdentifier5 Optional – Allows for unique identifiers
objExportFile.Write(PadString((""),1)) 'SeedIndicator Optional - if true provide ‘Y’
objExportFile.Write(PadString((""),80)) 'InductionPoint Optional
objExportFile.Write(PadString((""),10)) 'InductionDate Optional – Valid date format, ex. MM/DD/YYYY
objExportFile.Write(PadString(Choice(IsNull(KitRs("InboundSTID")),"", _
KitLabelsRs("InBoundIMBDigits").Value),31)) 'InboundIMB Optional – numeric IMB for Round trip jobs only
objExportFile.Write(PadString((""),24)) 'IMCB Optional – Container Barcode
objExportFile.Write(PadString((""),24)) 'IMTB Optional – Tray Barcode
objExportFile.Write(vbCrLf)
KitLabelsRs.MoveNext
Wend

objExportFile.Close
oConn.Execute("UPDATE KIT SET [Status] ='Ready to Proof',[ExportedToSnailWorks] =#" & Now() & "# WHERE [ID] =" & KitID & ";")
If KitRs.State = 1 Then:KitRs.Close:End If
If KitLabelsRs.State = 1 Then:KitLabelsRs.Close: End If
If JurisdictionRs.State = 1 Then:JurisdictionRs.Close:End If
If oConn.State = 1 Then:oConn.Close:End If
End Function

Function createTrackingInfoForKit(KitID)
Dim KitRs:set KitRs = oConn.Execute("Select * from Kit Where ID =" & KitID & ";")
Dim InkjetRs:Set InkjetRs = oConn.Execute("Select * from InkjetRecords Where KitID =" & KitID & ";")
@@ -313,4 +424,46 @@ Else
PadLeft = originalString
End If

End Function

Function PadString(inputString, size)
Dim paddedString
Dim inputLength
Dim i

' Get the length of the input string
inputLength = Len(inputString)

' If the input string is already equal to or longer than the specified size, return it as is
If inputLength >= size Then
PadString = inputString
Exit Function
End If

' Initialize the padded string with the input string
paddedString = inputString

' Pad spaces to the right of the input string until it reaches the specified size
For i = 1 To (size - inputLength)
paddedString = paddedString & " "
Next

' Return the padded string
PadString = paddedString
End Function

Public Sub Assign(ByRef var, ByVal val)
If IsObject(val) Then
Set var = val
Else
var = val
End If
End Sub

Public Function Choice(ByVal cond, ByVal if_true, ByVal if_false)
If cond Then
Assign Choice, if_true
Else
Assign Choice, if_false
End If
End Function

Loading…
Cancel
Save

Powered by TurnKey Linux.