From 51ade5311cae60241367b84a642d7034ddbe018a Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Tue, 11 Jun 2024 12:46:22 -0400 Subject: [PATCH] adding cleanup and details for finish --- App/DomainModels/SnailWorksRepository.asp | 2 +- Data/Label_Report.rep | 101 +++++++++++++--------- Data/Proofs.rep | 7 +- ImportService/TrackingDataImport.vbs | 33 ++++--- 4 files changed, 89 insertions(+), 54 deletions(-) diff --git a/App/DomainModels/SnailWorksRepository.asp b/App/DomainModels/SnailWorksRepository.asp index fe7819e..5bd22ef 100644 --- a/App/DomainModels/SnailWorksRepository.asp +++ b/App/DomainModels/SnailWorksRepository.asp @@ -105,7 +105,7 @@ 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, ""KCI"" as UserId,[Jcode] as ClientName,"""" as ParentClientName," &_ + dim sql : sql = "SELECT ""H"" as RecordType,""5.1"" 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," &_ diff --git a/Data/Label_Report.rep b/Data/Label_Report.rep index 008105d..f601877 100644 --- a/Data/Label_Report.rep +++ b/Data/Label_Report.rep @@ -33,6 +33,11 @@ object TRpReport 'NER JOIN Kit ON KitLabels.KitId = Kit.ID) INNER JOIN Jurisdictio' + 'n ON Kit.Jcode = Jurisdiction.JCode'#13#10'WHERE KitLabels.KITId=PBKIT' + 'ID'#13#10'ORDER BY SetNumber;' + end + item + Alias = 'ELECTIONDATE' + DatabaseAlias = 'TRACKINGKITLABELS' + SQL = 'SELECT [Value] FROM Settings Where [Name] = '#39'Electiondate'#39 end> DatabaseInfo = < item @@ -53,7 +58,7 @@ object TRpReport item Name = 'PBKITID' AllowNulls = False - Value = '84' + Value = '132' Datasets.Strings = ( 'LABLES' 'KITLABELS') @@ -106,9 +111,6 @@ object TRpReport item Component = TRpExpression2 end - item - Component = TRpLabel0 - end item Component = TRpLabel1 end @@ -130,9 +132,6 @@ object TRpReport item Component = TRpExpression7 end - item - Component = TRpLabel3 - end item Component = TRpExpression8 end @@ -144,6 +143,12 @@ object TRpReport end item Component = TRpExpression11 + end + item + Component = TRpExpression12 + end + item + Component = TRpExpression13 end> ExternalTable = 'REPMAN_REPORTS' ExternalField = 'REPORT' @@ -1202,36 +1207,6 @@ object TRpReport AgIniValue = '0' ExportExpression = '' end - object TRpLabel0: TRpLabel - Width = 1440 - Height = 240 - PosX = 5760 - PosY = 360 - Type1Font = poHelvetica - FontSize = 7 - Alignment = 2 - PrintCondition = '' - DoBeforePrint = '' - DoAfterPrint = '' - WFontName = 'Arial' - LFontName = 'Helvetica' - WideText = '5/7/2024' - end - object TRpLabel3: TRpLabel - Width = 1440 - Height = 240 - PosX = 5760 - PosY = 1380 - Type1Font = poHelvetica - FontSize = 7 - Alignment = 2 - PrintCondition = '' - DoBeforePrint = '' - DoAfterPrint = '' - WFontName = 'Arial' - LFontName = 'Helvetica' - WideText = '5/7/2024' - end object TRpExpression8: TRpExpression Width = 2640 Height = 240 @@ -1349,8 +1324,56 @@ object TRpReport WFontName = 'Arial' LFontName = 'Helvetica' Expression = - #39'Code Expires on 8/5/2024 '#39' +'#13#10#39'Destroy Unused Lables '#39' +'#13#10#39'afte' + - 'r election'#39 + #39'Code Expires on '#39' + ELECTIONDATE.Value +'#13#10#39' Destroy Unused Labl' + + 'es '#39' +'#13#10#39'after election'#39 + DisplayFormat = '' + ExportDisplayFormat = '' + AgIniValue = '0' + ExportExpression = '' + end + object TRpExpression12: TRpExpression + Width = 1440 + Height = 240 + PosX = 5760 + PosY = 360 + Type1Font = poHelvetica + FontSize = 7 + Alignment = 2 + AutoExpand = False + AutoContract = False + ExportPosition = 0 + ExportSize = 1 + ExportDoNewLine = False + PrintCondition = '' + DoBeforePrint = '' + DoAfterPrint = '' + WFontName = 'Arial' + LFontName = 'Helvetica' + Expression = 'ELECTIONDATE.Value' + DisplayFormat = '' + ExportDisplayFormat = '' + AgIniValue = '0' + ExportExpression = '' + end + object TRpExpression13: TRpExpression + Width = 1440 + Height = 240 + PosX = 5760 + PosY = 1380 + Type1Font = poHelvetica + FontSize = 7 + Alignment = 2 + AutoExpand = False + AutoContract = False + ExportPosition = 0 + ExportSize = 1 + ExportDoNewLine = False + PrintCondition = '' + DoBeforePrint = '' + DoAfterPrint = '' + WFontName = 'Arial' + LFontName = 'Helvetica' + Expression = 'ELECTIONDATE.Value' DisplayFormat = '' ExportDisplayFormat = '' AgIniValue = '0' diff --git a/Data/Proofs.rep b/Data/Proofs.rep index d359632..0f383e1 100644 --- a/Data/Proofs.rep +++ b/Data/Proofs.rep @@ -57,6 +57,11 @@ object TRpReport Alias = 'CONTACTS' DatabaseAlias = 'WEBDATA' SQL = 'SELECT * FROM [Contacts] WHERE JURISCODE = PBJCODE' + end + item + Alias = 'ELECTIONDATE' + DatabaseAlias = 'WEBDATA' + SQL = 'SELECT [Value] FROM Settings Where [Name] = '#39'Electiondate'#39 end> DatabaseInfo = < item @@ -4363,7 +4368,7 @@ object TRpReport DoAfterPrint = '' WFontName = 'Arial' LFontName = 'Helvetica' - Expression = #39'8/5/2024'#39 + Expression = 'ELECTIONDATE.Value' DisplayFormat = '' ExportDisplayFormat = '' AgIniValue = '0' diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index c3b643e..7ee9f7e 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -62,7 +62,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 & Clng(BALLOT_NUMBER) Desc;") + " WHERE InkjetRecords.KitID =" & KitID & " Order by PRECINCT Desc, Clng(BALLOT_NUMBER) 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" @@ -228,8 +228,8 @@ Function CreateExportForSnailWorks(KitID) 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(Truncate("5.1",5)) 'Version Required value must be ="5.1" for current release - .Write(Truncate("KCI",50)) 'UserId Required + .Write(Truncate("5.2",5)) 'Version Required value must be ="5.2" for current release + .Write(Truncate("KCIHotFolder2024FTPUser",50)) 'UserId Required .Write(Truncate(KitRs("Jcode").Value,50)) 'Client Name Required (will create new subaccount if not already defined) - We decideded to make this the juriscode .Write(Truncate("",50)) 'Parent Client Name Optional (use if 3-tier account structure) .Write(Truncate("Purple envelope - " & KitRs("JobNumber").Value,50)) 'Job Name Required @@ -244,7 +244,7 @@ Function CreateExportForSnailWorks(KitID) .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("danielc@kentcommunications.com",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 @@ -315,24 +315,31 @@ Dim KitLabelRs Dim Mid:Mid = GetSetting("MailingID") Dim Step : If KitRs("InboundSTID") <> "" Then : Step = 2 : Else Step = 1 serialStart = PadLeft(serialStart + CLng(Counter),9,"0") +Dim oRsKitLabels : Set oRsKitLabels = CreateObject("ADODB.Recordset"):oRsKitLabels.Open "Select * FROM [KitLabels] Where KitID =" & KitID & ";",oConn,3,3 While Not InkjetRs.EOF - + oRsKitLabels.AddNew + KitLabelID = oRsKitLabels("ID").value If Step = 1 Then - oConn.Execute("INSERT INTO KitLabels (KitID,OutboundSerial,OutboundIMBDigits) " &_ - "VALUES(" & KitID & ",'" & serialStart & "','" & KitRs("OutBoundSTID").Value & Mid & serialStart & "');") - - Else - oConn.Execute "INSERT INTO KitLabels (KitID,OutboundSerial,InBoundSerial,OutboundIMBDigits,InBoundIMBDigits) " &_ - "VALUES(" & KitID & ",'" & serialStart & "','" & serialStart + 1 & "','" & KitRs("OutBoundSTID").Value & Mid & serialStart & "','" & KitRs("InboundSTID").Value & serialStart + 1 & Jcode & "');" + oRsKitLabels("KitID") = KitID + oRsKitLabels("OutboundSerial") = serialStart + oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart + Else + oRsKitLables.AddNew + oRsKitLabels("KitID") = KitID + oRsKitLabels("OutboundSerial") = serialStart + oRsKitLables("InBoundSerial") = serialStart + 1 + oRsKitLabels("OutboundIMBDigits") = KitRs("OutBoundSTID").Value & Mid & serialStart + oRsKitLables("InBoundIMBDigits") = KitRs("InboundSTID").Value & serialStart + 1 & Jcode End If - Set KitLabelRs = oConn.Execute("SELECT TOP 1 [ID] FROM KitLabels ORDER BY ID DESC"):KitLabelID = KitLabelRs("ID").Value - + oRsKitLabels.Update oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";") Counter = Counter + Step serialStart = serialStart + Step InkjetRs.MoveNext Wend + oRsKitLabels.Update + oRsKitLabels.Close oConn.Execute("UPDATE Settings Set [Value]='" & serialOffset + Counter & "' WHERE [Name] = 'SerialOffset';") oConn.Execute("UPDATE Kit Set [Status]='Ready For Export', LabelsPrinted=#" & Now() & "# WHERE [ID] =" & KitID &";") oConn.Close