Browse Source

update

pull/8/head
Daniel Covington 4 months ago
parent
commit
31829f651f
3 changed files with 49 additions and 27 deletions
  1. +2
    -2
      App/DomainModels/SnailWorksRepository.asp
  2. +4
    -4
      Data/Label_Report.rep
  3. +43
    -21
      ImportService/TrackingDataImport.vbs

+ 2
- 2
App/DomainModels/SnailWorksRepository.asp View File

@@ -105,10 +105,10 @@ Class SnailWorksRepository_Class
Private Function GetSnailWorksHeaderByKitId(id)

Dim Header:Set Header = New SnailWorksExportHeaderModel_Class
dim sql : sql = "SELECT ""H"" as RecordType,""5.1"" as Version, ""KCI2024Type2FTPUser"" as UserId,[Jcode] as ClientName,"""" as ParentClientName," &_
dim sql : sql = "SELECT ""H"" as RecordType,""5.2"" as Version, ""KCI2024Type2FTPUser"" as UserId,[Jcode] as ClientName,"""" as ParentClientName," &_
"""Tracking Kit - "" & [JobNumber] as JobName,"""" as JobDescription,"""" as SplitName,"""" as SplitDescription,""L"" as PieceType," &_
"Year(Now()) & ""/"" & RIGHT(""0"" & Month(Now()),2) & ""/"" & RIGHT(""0"" & Day(Now()),2) as MailDate,""N"" as UploadType,"""" as TrackedQuanity," &_
""""" as PiecesMailed,"""" as TargetInHomeDateStart,"""" as TargetInHomeDateEnd,"""" as ConfirmationEmail,"""" as JobId," &_
""""" as PiecesMailed,"""" as TargetInHomeDateStart,"""" as TargetInHomeDateEnd,""amandaw@kentcommunications.com"" as ConfirmationEmail,"""" as JobId," &_
""""" as SplitId,""R"" as TypeofTracking,"""" as ReturnedPostalRoutingCode,"""" as ReportId1," &_
""""" as Report1Email,"""" as ReportId2,"""" as Report2Email,"""" as INFOONLY From Kit WHERE ID =?;"


+ 4
- 4
Data/Label_Report.rep View File

@@ -1174,8 +1174,8 @@ object TRpReport
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression =
#39'OutBound Tracking Labels crreated by TrackMIBallot for '#39' + KIT' +
'LABELS.Jurisdiction'
#39'OutBound Tracking Labels created by TrackMIBallot for '#39' + KITL' +
'ABELS.Jurisdiction'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'
@@ -1200,8 +1200,8 @@ object TRpReport
WFontName = 'Arial'
LFontName = 'Helvetica'
Expression =
#39'InBound Tracking Labels crreated by TrackMIBallot for '#39' + KITL' +
'ABELS.Jurisdiction'
#39'InBound Tracking Labels created by TrackMIBallot for '#39' + KITLA' +
'BELS.Jurisdiction'
DisplayFormat = ''
ExportDisplayFormat = ''
AgIniValue = '0'


+ 43
- 21
ImportService/TrackingDataImport.vbs View File

@@ -1,5 +1,5 @@
Option Explicit
Dim dev:dev = True
Dim dev:dev = False
Dim outFile
Dim WaitTime:WaitTime = 15000
Dim DataDirectory
@@ -96,7 +96,8 @@ End Sub
Function ExportInkjetFile(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," &_
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.ADDRESS1, InkjetRecords.ADDRESS2, InkjetRecords.ADDRESS3, InkjetRecords.ADDRESS4," &_
" InkjetRecords.ADDRESS5, InkjetRecords.APPSENT, InkjetRecords.APPRETURNED, InkjetRecords.BALSENT," &_
@@ -108,7 +109,7 @@ Function ExportInkjetFile(KitID)
" KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber" &_
" FROM InkjetRecords" &_
" 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 ContactRs:Set ContactRs = oConn.Execute("SELECT * FROM Contacts WHERE [JURISCODE] ='" & KitRs("Jcode").Value & "';")
Dim ExportFileName:ExportFileName = objFSO.GetBaseName(KitRs("Filename")) & ".csv"
@@ -250,8 +251,8 @@ Function CreateProofForJurisdiction(KitID)
End Function

Function CreateExportForSnailWorks(KitID)
Dim State
Dim ForeignTest
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," &_
@@ -282,14 +283,14 @@ Dim ForeignTest
.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("",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("",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("danielc@kentcommunications.com",100)) 'ConfirmationEmail Optional
@@ -304,13 +305,16 @@ Dim ForeignTest
.Write("""N""") 'INFOONLY
.Write(vbCrLf)
While Not KitLabelsRs.EOF
ForeignTest = KitLabelsRs("CassADDRESS5").Value & KitLabelsRs("CassADDRESS4").Value
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)
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(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("",50)) 'First Name Optional
.Write(Truncate("",2)) 'MI Optional
@@ -329,16 +333,17 @@ Dim ForeignTest
.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’
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("",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
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
@@ -376,12 +381,11 @@ While Not InkjetRs.EOF
oRsKitLabels("OutboundSerial") = serialStart
oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart
Else
oRsKitLables.AddNew
oRsKitLabels("KitID") = KitID
oRsKitLabels("OutboundSerial") = serialStart
oRsKitLables("InBoundSerial") = serialStart + 1
oRsKitLabels("InBoundSerial") = serialStart + 1
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
oRsKitLabels.Update
oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";")
@@ -451,7 +455,25 @@ oRs.Close
oConn.Close
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)
Dim JobNumber:JobNumber = Mid(FileName,9,6)
Dim JCode:JCode = Left(Filename,5)


Loading…
Cancel
Save

Powered by TurnKey Linux.