From 9ecc5e849e00a9b21ade993ce5f9055da629762a Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Wed, 12 Jun 2024 20:50:20 -0400 Subject: [PATCH] Cleanup Snailworks export --- ImportService/TrackingDataImport.vbs | 70 +++++++++++++++------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index 5e8f290..bcb8bae 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -250,6 +250,8 @@ Function CreateProofForJurisdiction(KitID) End Function Function CreateExportForSnailWorks(KitID) +Dim State +Dim ForeignTest 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," &_ @@ -302,38 +304,42 @@ Function CreateExportForSnailWorks(KitID) .Write("""N""") 'INFOONLY .Write(vbCrLf) While Not KitLabelsRs.EOF - .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 Choice(InStr(KitLabelsRs("CassADDRESS5").Value,"-"),Truncate(Right(KitLabelsRs("CassADDRESS5").Value,11),11),Truncate(Right(KitLabelsRs("CassADDRESS5").Value,5),5)) '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) + ForeignTest = KitLabelsRs("CassADDRESS5").Value & KitLabelsRs("CassADDRESS4").Value + State = Truncate(Mid(KitLabelsRs("CassADDRESS5").Value, _ + 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) + .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(State) 'State Optional + .Write Choice(InStr(KitLabelsRs("CassADDRESS5").Value,"-"),Truncate(Right(KitLabelsRs("CassADDRESS5").Value,11),11),Truncate(Right(KitLabelsRs("CassADDRESS5").Value,5),5)) '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) + End If KitLabelsRs.MoveNext Wend