@@ -142,72 +142,72 @@ Function CreateExportForSnailWorks(KitID) | |||
" 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" | |||
Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & "_SW_EXPORT.csv" | |||
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) | |||
With objExportFile | |||
.Write("H") 'Record Type Required value must be = "H" (Header) | |||
.Write(PadString("5.1",5)) 'Version Required value must be ="5.1" for current release | |||
.Write(PadString("KCI",50)) 'UserId Required | |||
.Write(PadString(JurisdictionRs("Name").Value,50)) 'Client Name Required (will create new subaccount if not already defined) | |||
.Write(PadString("",50)) 'Parent Client Name Optional (use if 3-tier account structure) | |||
.Write(PadString("Purple envelope - " & KitRs("JobNumber").Value,50)) 'Job Name Required | |||
.Write(PadString("",50)) 'Job Description Optional | |||
.Write(PadString("",50)) 'Split Name Optional – will default to ‘Default’ | |||
.Write(PadString("",80)) 'Split Description Optional | |||
.Write(PadString("L",1)) 'Piece Type Required L-Letters, C-Cards, F-Flats | |||
.Write(PadString(Year(Now()) & "/" &_ | |||
Right("0" & Month(Now()), 2) & "/" & Right("0" & Day(Now()), 2),10)) 'MailDate Required (YYYY/MM/DD) | |||
.Write(PadString("N",1)) 'UploadType Required N = New job, new split A = Append new split to existing job R = Replace existing split | |||
.Write(PadString("",8)) 'TrackedQuantity Optional | |||
.Write(PadString("",8)) 'PiecesMailed Optional – shown as Estimated Quantity | |||
.Write(PadString("",10)) 'Target InHomeDateStart Optional (YYYY/MM/DD) | |||
.Write(PadString("",10)) 'Target InHomeDateEnd Optional (YYYY/MM/DD) | |||
.Write(PadString("",100)) 'ConfirmationEmail Optional | |||
.Write(PadString("",9)) 'JobId (SW) Optional for previously created jobs SWJobId | |||
.Write(PadString("",4)) 'SplitId (SW) Optional for previously created jobs SWJobId | |||
.Write(PadString(Choice(IsNull(KitRs("InboundSTID")),"O","R"),1)) 'TypeofTracking Required Values: O- Outbound Only I-Inbound Only R-Round Trip | |||
.Write(PadString("",11)) 'ReturnedPostalRoutingCode | |||
.Write(PadString("",2)) 'ReportId1 | |||
.Write(PadString("",255)) 'Report1Email | |||
.Write(PadString("",2)) 'ReportId2 | |||
.Write(PadString("",255)) 'Report2Email | |||
.Write("""H"",") 'Record Type Required value must be = "H" (Header) | |||
.Write(Truncate("5.1",5)) 'Version Required value must be ="5.1" for current release | |||
.Write(Truncate("KCI",50)) 'UserId Required | |||
.Write(Truncate(JurisdictionRs("Name").Value,50)) 'Client Name Required (will create new subaccount if not already defined) | |||
.Write(Truncate("",50)) 'Parent Client Name Optional (use if 3-tier account structure) | |||
.Write(Truncate("Purple envelope - " & KitRs("JobNumber").Value,50)) 'Job Name Required | |||
.Write(Truncate("",50)) 'Job Description Optional | |||
.Write(Truncate("",50)) 'Split Name Optional – will default to ‘Default’ | |||
.Write(Truncate("",80)) 'Split Description Optional | |||
.Write(Truncate("L",1)) 'Piece Type Required L-Letters, C-Cards, F-Flats | |||
.Write(Truncate(Year(Now()) & "/" &_ | |||
Right("0" & Month(Now()), 2) & "/" & Right("0" & Day(Now()), 2),10)) 'MailDate Required (YYYY/MM/DD) | |||
.Write(Truncate("N",1)) 'UploadType Required N = New job, new split A = Append new split to existing job R = Replace existing split | |||
.Write(Truncate("",8)) 'TrackedQuantity Optional | |||
.Write(Truncate("",8)) 'PiecesMailed Optional – shown as Estimated Quantity | |||
.Write(Truncate("",10)) 'Target InHomeDateStart Optional (YYYY/MM/DD) | |||
.Write(Truncate("",10)) 'Target InHomeDateEnd Optional (YYYY/MM/DD) | |||
.Write(Truncate("",100)) 'ConfirmationEmail Optional | |||
.Write(Truncate("",9)) 'JobId (SW) Optional for previously created jobs SWJobId | |||
.Write(Truncate("",4)) 'SplitId (SW) Optional for previously created jobs SWJobId | |||
.Write(Truncate(Choice(IsNull(KitRs("InboundSTID")),"O","R"),1)) 'TypeofTracking Required Values: O- Outbound Only I-Inbound Only R-Round Trip | |||
.Write(Truncate("",11)) 'ReturnedPostalRoutingCode | |||
.Write(Truncate("",2)) 'ReportId1 | |||
.Write(Truncate("",255)) 'Report1Email | |||
.Write(Truncate("",2)) 'ReportId2 | |||
.Write("""""") 'Report2Email | |||
.Write(vbCrLf) | |||
While Not KitLabelsRs.EOF | |||
.Write("D") 'RecordType Required value must be = “D” (Detail) | |||
.Write(PadString("",20)) 'CustomerUniqueIdentifier Optional- any identifier you designate | |||
.Write(PadString(KitLabelsRs("OutboundIMBDigits"),31)) 'IMB Required – Unencoded, numeric IMB | |||
.Write(PadString("",10)) 'Greeting Optional | |||
.Write(PadString("",50)) 'First Name Optional | |||
.Write(PadString("",2)) 'MI Optional | |||
.Write(PadString("",50)) 'Last Name Optional | |||
.Write(PadString("",10)) 'Suffix Optional | |||
.Write(PadString((KitLabelsRs("CassADDRESS1").Value),100)) 'Full Name Optional | |||
.Write(PadString("",50)) 'Company Optional | |||
.Write(PadString("",50)) 'Title Optional | |||
.Write(PadString(KitLabelsRs("CassADDRESS3").Value,128)) 'Address1 Optional | |||
.Write(PadString(KitLabelsRs("CassADDRESS4").Value,128)) 'Address2 Optional | |||
.Write(PadString(Left(KitLabelsRs("CassADDRESS5").Value, _ | |||
InStr(KitLabelsRs("CassADDRESS5").Value, ",") - 1),50)) 'City Optional | |||
.Write(PadString(Mid(KitLabelsRs("CassADDRESS5").Value, _ | |||
InStr(KitLabelsRs("CassADDRESS5").Value, ",") + 2, 2),2)) 'State Optional | |||
.Write PadString(Right(KitLabelsRs("CassADDRESS5").Value,11),11) 'Zip Optional | |||
.Write(PadString(KitRs("Jcode"),100)) 'UserDefined1 Optional - Summary fields only | |||
.Write(PadString("",100)) 'UserDefined2 Optional - Summary fields only | |||
.Write(PadString("",100)) 'UserDefined3 Optional - Summary fields only | |||
.Write(PadString(KitLabelsRs("PRECINCT").Value &_ | |||
KitLabelsRs("BALLOT_NUMBER"),80)) 'UserDefinedIdentifier4 Optional – Allows for unique identifiers | |||
.Write(PadString(KitLabelsRs("VOTERID").Value,80)) 'UserDefinedIdentifier5 Optional – Allows for unique identifiers | |||
.Write(PadString("",1)) 'SeedIndicator Optional - if true provide ‘Y’ | |||
.Write(PadString("",80)) 'InductionPoint Optional | |||
.Write(PadString("",10)) 'InductionDate Optional – Valid date format, ex. MM/DD/YYYY | |||
.Write(PadString(Choice(IsNull(KitRs("InboundSTID")),"", _ | |||
KitLabelsRs("InBoundIMBDigits").Value),31)) 'InboundIMB Optional – numeric IMB for Round trip jobs only | |||
.Write(PadString("",24)) 'IMCB Optional – Container Barcode | |||
.Write(PadString("",24)) 'IMTB Optional – Tray Barcode | |||
.Write("""D"",") 'RecordType Required value must be = “D” (Detail) | |||
.Write(Truncate("",20)) 'CustomerUniqueIdentifier Optional- any identifier you designate | |||
.Write(Truncate(KitLabelsRs("OutboundIMBDigits"),31)) 'IMB Required – Unencoded, numeric IMB | |||
.Write(Truncate("",10)) 'Greeting Optional | |||
.Write(Truncate("",50)) 'First Name Optional | |||
.Write(Truncate("",2)) 'MI Optional | |||
.Write(Truncate("",50)) 'Last Name Optional | |||
.Write(Truncate("",10)) 'Suffix Optional | |||
.Write(Truncate((KitLabelsRs("CassADDRESS1").Value),100)) 'Full Name Optional | |||
.Write(Truncate("",50)) 'Company Optional | |||
.Write(Truncate("",50)) 'Title Optional | |||
.Write(Truncate(KitLabelsRs("CassADDRESS3").Value,128)) 'Address1 Optional | |||
.Write(Truncate(KitLabelsRs("CassADDRESS4").Value,128)) 'Address2 Optional | |||
.Write(Truncate(Left(KitLabelsRs("CassADDRESS5").Value, _ | |||
InStr(KitLabelsRs("CassADDRESS5").Value, ",") - 1),50)) 'City Optional | |||
.Write(Truncate(Mid(KitLabelsRs("CassADDRESS5").Value, _ | |||
InStr(KitLabelsRs("CassADDRESS5").Value, ",") + 2, 2),2)) 'State Optional | |||
.Write Truncate(Right(KitLabelsRs("CassADDRESS5").Value,11),11) 'Zip Optional | |||
.Write(Truncate(KitRs("Jcode"),100)) 'UserDefined1 Optional - Summary fields only | |||
.Write(Truncate("",100)) 'UserDefined2 Optional - Summary fields only | |||
.Write(Truncate("",100)) 'UserDefined3 Optional - Summary fields only | |||
.Write(Truncate(KitLabelsRs("PRECINCT").Value &_ | |||
KitLabelsRs("BALLOT_NUMBER"),80)) 'UserDefinedIdentifier4 Optional – Allows for unique identifiers | |||
.Write(Truncate(KitLabelsRs("VOTERID").Value,80)) 'UserDefinedIdentifier5 Optional – Allows for unique identifiers | |||
.Write(Truncate("",1)) 'SeedIndicator Optional - if true provide ‘Y’ | |||
.Write(Truncate("",80)) 'InductionPoint Optional | |||
.Write(Truncate("",10)) 'InductionDate Optional – Valid date format, ex. MM/DD/YYYY | |||
.Write(Truncate(Choice(IsNull(KitRs("InboundSTID")),"", _ | |||
KitLabelsRs("InBoundIMBDigits").Value),31)) 'InboundIMB Optional – numeric IMB for Round trip jobs only | |||
.Write(Truncate("",24)) 'IMCB Optional – Container Barcode | |||
.Write("""""") 'IMTB Optional – Tray Barcode | |||
.Write(vbCrLf) | |||
KitLabelsRs.MoveNext | |||
Wend | |||
@@ -490,7 +490,11 @@ Else | |||
End If | |||
End Function | |||
Function Truncate(inputString, size) | |||
If Len(inputString) > size Then:Truncate = """" & Left(inputString,size) & """,":Else Truncate = """" & inputString & """,":End If | |||
End Function | |||
Function PadString(inputString, size) | |||
Dim paddedString | |||
Dim inputLength | |||
Powered by TurnKey Linux.