|
@@ -1,5 +1,5 @@ |
|
|
Option Explicit |
|
|
Option Explicit |
|
|
Dim dev:dev = True |
|
|
|
|
|
|
|
|
Dim dev:dev = False |
|
|
Dim outFile |
|
|
Dim outFile |
|
|
Dim WaitTime:WaitTime = 15000 |
|
|
Dim WaitTime:WaitTime = 15000 |
|
|
Dim DataDirectory |
|
|
Dim DataDirectory |
|
@@ -96,7 +96,8 @@ End Sub |
|
|
Function ExportInkjetFile(KitID) |
|
|
Function ExportInkjetFile(KitID) |
|
|
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If |
|
|
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If |
|
|
Dim KitRs:set KitRs = oConn.Execute("Select * From [Kit] Where [ID] =" & KitID & ";") |
|
|
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," &_ |
|
|
|
|
|
|
|
|
Dim KitLabelsRs: Set KitLabelsRs = oConn.Execute("Select * FROM (SELECT IIf(Len([PRECINCT]) = 1, '0' & [PRECINCT] & Right([BALLOT_NUMBER],4), [PRECINCT] & Right([BALLOT_NUMBER],4)) AS SORT_ORDER," &_ |
|
|
|
|
|
"InkjetRecords.ID, InkjetRecords.KitID, InkjetRecords.VOTERID, InkjetRecords.LASTNAME," &_ |
|
|
" InkjetRecords.FIRSTNAME, InkjetRecords.MIDDLENAME, InkjetRecords.SUFFIX, InkjetRecords.PRECINCT," &_ |
|
|
" InkjetRecords.FIRSTNAME, InkjetRecords.MIDDLENAME, InkjetRecords.SUFFIX, InkjetRecords.PRECINCT," &_ |
|
|
" InkjetRecords.ADDRESS1, InkjetRecords.ADDRESS2, InkjetRecords.ADDRESS3, InkjetRecords.ADDRESS4," &_ |
|
|
" InkjetRecords.ADDRESS1, InkjetRecords.ADDRESS2, InkjetRecords.ADDRESS3, InkjetRecords.ADDRESS4," &_ |
|
|
" InkjetRecords.ADDRESS5, InkjetRecords.APPSENT, InkjetRecords.APPRETURNED, InkjetRecords.BALSENT," &_ |
|
|
" InkjetRecords.ADDRESS5, InkjetRecords.APPSENT, InkjetRecords.APPRETURNED, InkjetRecords.BALSENT," &_ |
|
@@ -108,7 +109,7 @@ Function ExportInkjetFile(KitID) |
|
|
" KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber" &_ |
|
|
" KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber" &_ |
|
|
" FROM InkjetRecords" &_ |
|
|
" FROM InkjetRecords" &_ |
|
|
" LEFT JOIN [KitLabels] ON InkjetRecords.KitLabelID = KitLabels.ID" & _ |
|
|
" LEFT JOIN [KitLabels] ON InkjetRecords.KitLabelID = KitLabels.ID" & _ |
|
|
" WHERE InkjetRecords.KitID =" & KitID & " Order by PRECINCT Desc, Clng(BALLOT_NUMBER) Desc;") |
|
|
|
|
|
|
|
|
" WHERE InkjetRecords.KitID =" & KitID & ") as [Data] Order By SORT_ORDER Desc;") |
|
|
Dim JurisdictionRs:Set JurisdictionRs = oConn.Execute("SELECT * FROM Jurisdiction WHERE JCode ='" & KitRs("Jcode").Value & "';") |
|
|
Dim JurisdictionRs:Set JurisdictionRs = oConn.Execute("SELECT * FROM Jurisdiction WHERE JCode ='" & KitRs("Jcode").Value & "';") |
|
|
Dim ContactRs:Set ContactRs = oConn.Execute("SELECT * FROM Contacts WHERE [JURISCODE] ='" & KitRs("Jcode").Value & "';") |
|
|
Dim ContactRs:Set ContactRs = oConn.Execute("SELECT * FROM Contacts WHERE [JURISCODE] ='" & KitRs("Jcode").Value & "';") |
|
|
Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & ".csv" |
|
|
Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & ".csv" |
|
@@ -250,8 +251,8 @@ Function CreateProofForJurisdiction(KitID) |
|
|
End Function |
|
|
End Function |
|
|
|
|
|
|
|
|
Function CreateExportForSnailWorks(KitID) |
|
|
Function CreateExportForSnailWorks(KitID) |
|
|
Dim State |
|
|
|
|
|
Dim ForeignTest |
|
|
|
|
|
|
|
|
Dim State |
|
|
|
|
|
Dim ForeignTest |
|
|
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If |
|
|
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If |
|
|
Dim KitRs:set KitRs = oConn.Execute("Select * From [Kit] Where [ID] =" & KitID & ";") |
|
|
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," &_ |
|
|
Dim KitLabelsRs: Set KitLabelsRs = oConn.Execute("SELECT InkjetRecords.ID, InkjetRecords.KitID, InkjetRecords.VOTERID, InkjetRecords.LASTNAME," &_ |
|
@@ -282,14 +283,14 @@ Dim ForeignTest |
|
|
.Write(Truncate("",50)) 'Parent Client Name Optional (use if 3-tier account structure) |
|
|
.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("Purple envelope - " & KitRs("JobNumber").Value,50)) 'Job Name Required |
|
|
.Write(Truncate("",50)) 'Job Description Optional |
|
|
.Write(Truncate("",50)) 'Job Description Optional |
|
|
.Write(Truncate("",50)) 'Split Name Optional – will default to ‘Default’ |
|
|
|
|
|
|
|
|
.Write(Truncate("",50)) 'Split Name Optional � will default to �Default� |
|
|
.Write(Truncate("",80)) 'Split Description Optional |
|
|
.Write(Truncate("",80)) 'Split Description Optional |
|
|
.Write(Truncate("L",1)) 'Piece Type Required L-Letters, C-Cards, F-Flats |
|
|
.Write(Truncate("L",1)) 'Piece Type Required L-Letters, C-Cards, F-Flats |
|
|
.Write(Truncate(Year(Now()) & "/" &_ |
|
|
.Write(Truncate(Year(Now()) & "/" &_ |
|
|
Right("0" & Month(Now()), 2) & "/" & Right("0" & Day(Now()), 2),10)) 'MailDate Required (YYYY/MM/DD) |
|
|
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("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)) 'TrackedQuantity Optional |
|
|
.Write(Truncate("",8)) 'PiecesMailed Optional – shown as Estimated Quantity |
|
|
|
|
|
|
|
|
.Write(Truncate("",8)) 'PiecesMailed Optional � shown as Estimated Quantity |
|
|
.Write(Truncate("",10)) 'Target InHomeDateStart Optional (YYYY/MM/DD) |
|
|
.Write(Truncate("",10)) 'Target InHomeDateStart Optional (YYYY/MM/DD) |
|
|
.Write(Truncate("",10)) 'Target InHomeDateEnd Optional (YYYY/MM/DD) |
|
|
.Write(Truncate("",10)) 'Target InHomeDateEnd Optional (YYYY/MM/DD) |
|
|
.Write(Truncate("danielc@kentcommunications.com",100)) 'ConfirmationEmail Optional |
|
|
.Write(Truncate("danielc@kentcommunications.com",100)) 'ConfirmationEmail Optional |
|
@@ -304,13 +305,16 @@ Dim ForeignTest |
|
|
.Write("""N""") 'INFOONLY |
|
|
.Write("""N""") 'INFOONLY |
|
|
.Write(vbCrLf) |
|
|
.Write(vbCrLf) |
|
|
While Not KitLabelsRs.EOF |
|
|
While Not KitLabelsRs.EOF |
|
|
ForeignTest = KitLabelsRs("CassADDRESS5").Value & KitLabelsRs("CassADDRESS4").Value |
|
|
|
|
|
|
|
|
ForeignTest = KitLabelsRs("CassADDRESS5").Value & " " & KitLabelsRs("CassADDRESS4").Value |
|
|
State = Truncate(Mid(KitLabelsRs("CassADDRESS5").Value, _ |
|
|
State = Truncate(Mid(KitLabelsRs("CassADDRESS5").Value, _ |
|
|
InStr(KitLabelsRs("CassADDRESS5").Value, ",") + 2, 2),2) |
|
|
InStr(KitLabelsRs("CassADDRESS5").Value, ",") + 2, 2),2) |
|
|
If ((InStr(ForeignTest,"CANADA") = 0) And (InStr(ForeignTest,"AUSTRALIA") = 0)) And State <> " " Then |
|
|
|
|
|
.Write("""D"",") 'RecordType Required value must be = “D” (Detail) |
|
|
|
|
|
|
|
|
State = Replace(State," ","") |
|
|
|
|
|
If CheckStringDoesNotHaveForiegnCountries(ForeignTest) And State <> """""," then |
|
|
|
|
|
'If InStr(ForeignTest,"CANADA") = 0 And InStr(ForeignTest,"AUSTRALIA") = 0 And State <> "" Then " ", |
|
|
|
|
|
|
|
|
|
|
|
.Write("""D"",") 'RecordType Required value must be = �D� (Detail) |
|
|
.Write(Truncate("",20)) 'CustomerUniqueIdentifier Optional- any identifier you designate |
|
|
.Write(Truncate("",20)) 'CustomerUniqueIdentifier Optional- any identifier you designate |
|
|
.Write(Truncate(KitLabelsRs("OutboundIMBDigits"),31)) 'IMB Required – Unencoded, numeric IMB |
|
|
|
|
|
|
|
|
.Write(Truncate(KitLabelsRs("OutboundIMBDigits"),31)) 'IMB Required � Unencoded, numeric IMB |
|
|
.Write(Truncate("",10)) 'Greeting Optional |
|
|
.Write(Truncate("",10)) 'Greeting Optional |
|
|
.Write(Truncate("",50)) 'First Name Optional |
|
|
.Write(Truncate("",50)) 'First Name Optional |
|
|
.Write(Truncate("",2)) 'MI Optional |
|
|
.Write(Truncate("",2)) 'MI Optional |
|
@@ -329,16 +333,17 @@ Dim ForeignTest |
|
|
.Write(Truncate("",100)) 'UserDefined2 Optional - Summary fields only |
|
|
.Write(Truncate("",100)) 'UserDefined2 Optional - Summary fields only |
|
|
.Write(Truncate("",100)) 'UserDefined3 Optional - Summary fields only |
|
|
.Write(Truncate("",100)) 'UserDefined3 Optional - Summary fields only |
|
|
.Write(Truncate(KitLabelsRs("PRECINCT").Value &_ |
|
|
.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’ |
|
|
|
|
|
|
|
|
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("",80)) 'InductionPoint Optional |
|
|
.Write(Truncate("",10)) 'InductionDate Optional – Valid date format, ex. MM/DD/YYYY |
|
|
|
|
|
|
|
|
.Write(Truncate("",10)) 'InductionDate Optional � Valid date format, ex. MM/DD/YYYY |
|
|
.Write(Truncate(Choice(IsNull(KitRs("InboundSTID")),"", _ |
|
|
.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 |
|
|
|
|
|
|
|
|
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) |
|
|
.Write(vbCrLf) |
|
|
|
|
|
|
|
|
End If |
|
|
End If |
|
|
KitLabelsRs.MoveNext |
|
|
KitLabelsRs.MoveNext |
|
|
Wend |
|
|
Wend |
|
@@ -376,12 +381,11 @@ While Not InkjetRs.EOF |
|
|
oRsKitLabels("OutboundSerial") = serialStart |
|
|
oRsKitLabels("OutboundSerial") = serialStart |
|
|
oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart |
|
|
oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart |
|
|
Else |
|
|
Else |
|
|
oRsKitLables.AddNew |
|
|
|
|
|
oRsKitLabels("KitID") = KitID |
|
|
oRsKitLabels("KitID") = KitID |
|
|
oRsKitLabels("OutboundSerial") = serialStart |
|
|
oRsKitLabels("OutboundSerial") = serialStart |
|
|
oRsKitLables("InBoundSerial") = serialStart + 1 |
|
|
|
|
|
|
|
|
oRsKitLabels("InBoundSerial") = serialStart + 1 |
|
|
oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart |
|
|
oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart |
|
|
oRsKitLables("InBoundIMBDigits") = KitRs("InboundSTID").Value & serialStart + 1 & Jcode |
|
|
|
|
|
|
|
|
oRsKitLabels("InBoundIMBDigits") = KitRs("InboundSTID").Value & serialStart + 1 & Jcode |
|
|
End If |
|
|
End If |
|
|
oRsKitLabels.Update |
|
|
oRsKitLabels.Update |
|
|
oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";") |
|
|
oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";") |
|
@@ -451,7 +455,25 @@ oRs.Close |
|
|
oConn.Close |
|
|
oConn.Close |
|
|
End Function |
|
|
End Function |
|
|
|
|
|
|
|
|
|
|
|
Function CheckStringDoesNotHaveForiegnCountries(StringToCheck) |
|
|
|
|
|
Dim Countries |
|
|
|
|
|
Countries = Array("UNITED KINGDOM","NORWAY","AUSTRALIA","FRANCE","UK LL","KENT ENGLAND","CANADA","NETHERLANDS","GERMANY","TAIWAN","NICARAGUA","IREL") |
|
|
|
|
|
Dim Country |
|
|
|
|
|
For Each Country In Countries |
|
|
|
|
|
|
|
|
|
|
|
If InStr(StringToCheck,Country) Then |
|
|
|
|
|
|
|
|
|
|
|
CheckStringDoesNotHaveForiegnCountries = False |
|
|
|
|
|
Exit For |
|
|
|
|
|
End If |
|
|
|
|
|
|
|
|
|
|
|
CheckStringDoesNotHaveForiegnCountries = True |
|
|
|
|
|
|
|
|
|
|
|
Next |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End Function |
|
|
Function SetupKit(CsvString,FileName) |
|
|
Function SetupKit(CsvString,FileName) |
|
|
Dim JobNumber:JobNumber = Mid(FileName,9,6) |
|
|
Dim JobNumber:JobNumber = Mid(FileName,9,6) |
|
|
Dim JCode:JCode = Left(Filename,5) |
|
|
Dim JCode:JCode = Left(Filename,5) |
|
|