diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index 4d45457..36292b3 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -64,6 +64,7 @@ Function ExportInkjetFile(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 ContactRs:Set ContactRs = oConn.Execute("SELECT * FROM Contacts WHERE [JURISCODE] ='" & KitRs("Jcode").Value & "';") Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & ".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 @@ -86,13 +87,14 @@ Function ExportInkjetFile(KitID) objInkjetCSV.SetColumnName 10,"Election Date" objInkJetCSV.SetColumnName 11,"Combined Pct_Ballot Num" objInkJetCSV.SetColumnName 12,"2D Matrix Barcode" - objInkJetCSV.SetColumnName 13,"G2 Full Name" - objInkJetCSV.SetColumnName 14,"G2 Company" - objInkJetCSV.SetColumnName 15,"G2 Alternate 1 Address" - objInkJetCSV.SetColumnName 16,"G2 Delivery Address" - objInkJetCSV.SetColumnName 17,"G2 City St ZIP+4" - objInkJetCSV.SetColumnName 18,"G2 IM barcode Characters" - objInkJetCSV.SetColumnName 19,"Matching Code" + objInkJetCSV.SetColumnName 13,"Title" + objInkJetCSV.SetColumnName 14,"G2 Full Name" + objInkJetCSV.SetColumnName 15,"G2 Company" + objInkJetCSV.SetColumnName 16,"G2 Alternate 1 Address" + objInkJetCSV.SetColumnName 17,"G2 Delivery Address" + objInkJetCSV.SetColumnName 18,"G2 City St ZIP+4" + objInkJetCSV.SetColumnName 19,"G2 IM barcode Characters" + objInkJetCSV.SetColumnName 20,"Matching Code" Dim AddressArray Dim row:row = 0 @@ -109,8 +111,9 @@ Dim row:row = 0 objInkJetCSV.SetCellByName row,"Ballot Number",TrimLeadingZeros(KitLabelsRs("BALLOT_NUMBER").Value) objInkJetCSV.SetCellByName row,"Jurisdiction code",KitRs("Jcode").Value objInkJetCSV.SetCellByName row,"Election Date",ElectionDate - objInkJetCSV.SetCellByName row,"Combined Pct_Ballot Num",KitLabelsRs("PRECINCT").Value & KitLabelsRs("BALLOT_NUMBER").Value + objInkJetCSV.SetCellByName row,"Combined Pct_Ballot Num",KitLabelsRs("PRECINCT").Value & TrimLeadingZeros(KitLabelsRs("BALLOT_NUMBER").Value objInkJetCSV.SetCellByName row,"2D Matrix Barcode",KitRs("Jcode").Value & KitLabelsRs("BALLOT_NUMBER").Value + objInkjetCSV.SetCellByName row,"Title",ContactRs("Title").Value objInkJetCSV.SetCellByName row,"G2 Full Name",JurisdictionRs("Name").Value objInkJetCSV.SetCellByName row,"G2 Company",JurisdictionRs("Mailing_Address").Value objInkJetCSV.SetCellByName row,"G2 Alternate 1 Address",JurisdictionRs("CSZ").Value @@ -129,6 +132,7 @@ Dim row:row = 0 oConn.Execute("UPDATE KIT SET [Status] ='Done',[InkJetJob]=1 WHERE [ID] =" & KitID & ";") If KitRs.State = 1 Then:KitRs.Close:End If + If ContactRs.State =1 Then:ContactRs.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