diff --git a/CiCd/deploy.vbs b/CiCd/deploy.vbs index 2f4a1a3..b5d6c97 100644 --- a/CiCd/deploy.vbs +++ b/CiCd/deploy.vbs @@ -77,6 +77,9 @@ Sub CloneRepo objFile.WriteLine("Data/arrow ne.jpg") objFile.WriteLine("Data/Label_Report.rep") objFile.WriteLine("Data/png-transparent-arrow-arrow-angle-triangle-black-thumbnail.jpg") + objFile.WriteLine("Data/purple_envelope_sample_Page_1.jpg") + objFile.WriteLine("Data/purple_envelope_sample_Page_2.jpg") + objFile.WriteLine("Data/Proofs.rep") objFile.WriteLine("dist/") objFile.WriteLine("MVC/") objFile.WriteLine("Dependancies/") diff --git a/Data/Proofs.rep b/Data/Proofs.rep index 0f4d37c..a975024 100644 --- a/Data/Proofs.rep +++ b/Data/Proofs.rep @@ -40,7 +40,8 @@ object TRpReport 'tboundIMBDigits, KitLabels.InBoundIMBDigits, KitLabels.OutboundI' + 'MBPNG,'#13#10#9#9#9' KitLabels.INBOUNDIMBPNG, KitLabels.SetNumber'#13#10#9#9#9' FR' + 'OM InkjetRecords'#13#10#9#9#9' LEFT JOIN [KitLabels] ON InkjetRecords.Kit' + - 'LabelID = KitLabels.ID'#13#10#9#9#9' WHERE InkjetRecords.KitID = PBKITID' + 'LabelID = KitLabels.ID'#13#10#9#9#9' WHERE InkjetRecords.KitID = PBKITID ' + + 'AND InkjetRecords.ID >= PBMIN and InkjetRecords.ID <= PBMAX ' end item Alias = 'JURISDICTION' @@ -92,6 +93,32 @@ object TRpReport Search = '' ErrorMessage = '' Validation = '' + end + item + Name = 'PBMIN' + AllowNulls = False + Value = 139075 + ParamType = rpParamInteger + Datasets.Strings = ( + 'KITLABELS') + Description = '' + Hint = '' + Search = '' + ErrorMessage = '' + Validation = '' + end + item + Name = 'PBMAX' + AllowNulls = False + Value = 140314 + ParamType = rpParamInteger + Datasets.Strings = ( + 'KITLABELS') + Description = '' + Hint = '' + Search = '' + ErrorMessage = '' + Validation = '' end> StreamFormat = rpStreamText ReportAction = [] diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index 00a8fbf..e097fca 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -47,21 +47,56 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S WScript.Quit Function CreateProofForJurisdiction(KitID) + Dim Qpdf:Set Qpdf = WScript.CreateObject("DebenuPDFLibraryAX1013.PDFLibrary") + Dim Result:Result = Qpdf.UnlockKey("j564z3wi9i66k93cp3r798b3y") If oConn.State = 0 Then:oConn.Open(ConnectionString):End If + Dim Rs:set Rs = oConn.Execute("SELECT MIN(ID) as [MIN],MAX(ID) as [MAX] FROM InkjetRecords WHERE KitID = " & KitID &";") + Dim MIN:MIN = Rs("MIN").Value + Dim MAX:MAX = Rs("MAX").Value + Dim RecordCount:RecordCount = (MAX - MIN) + 1 + Rs.Close Dim KitRs:set KitRs = oConn.Execute("Select * From [Kit] Where [ID] =" & KitID & ";") Dim JurisdictionRs:set JurisdictionRs = oConn.Execute("SELECt * FROM [Jurisdiction] WHERE JCode='" & KitRs("Jcode").Value & "';") Dim ProofFileName:ProofFileName = objFSO.GetBaseName(KitRs("Filename")) & "-PROOF.PDF" If Not objFSO.FolderExists(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value) Then:objFSO.CreateFolder(ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value):End If Dim reportManager:set reportManager = CreateObject("ReportMan.ReportManX") - reportManager.Preview = False - reportManager.ShowProgress = False - reportManager.ShowPrintDialog = False - reportManager.filename = PurpleEnvelopeProofReport - reportManager.SetDatabaseConnectionString "WEBDATA",ConnectionString - reportManager.SetParamValue "PBKITID",KitID - reportManager.SetParamValue "PBJCODE",KitRs("Jcode").Value - reportManager.SaveToPDF ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ProofFileName,1 - oConn.Execute("UPDATE KIT SET [Status] ='Ready For Inkjet Export',[ExportedToSnailWorks] =#" & Now() & "# WHERE [ID] =" & KitID & ";") + With reportManager + .Preview = False + .ShowProgress = False + .ShowPrintDialog = False + .filename = PurpleEnvelopeProofReport + .SetDatabaseConnectionString "WEBDATA",ConnectionString + .SetParamValue "PBKITID",KitID + .SetParamValue "PBJCODE",KitRs("Jcode").Value + Dim MAXRECORDS:MAXRECORDS = 3750 + If RecordCount > MAXRECORDS Then + Dim i + For i = 0 To RecordCount / MAXRECORDS + + + Dim newMin:If MIN + (i * MAXRECORDS) > MIN Then:newMin = MIN + (i * MAXRECORDS) + 1:Else newMin = MIN:End If + Dim newMax:If MIN + (i * MAXRECORDS) + MAXRECORDS > MAX Then:newMax = MAX:Else newMax = MIN + (i * MAXRECORDS) + MAXRECORDS:End If + .SetParamValue "PBMIN",newMin + .SetParamValue "PBMAX",newMax + .SaveToPDF ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "\Part_" & i & "_" & ProofFileName,1 + Result = Qpdf.AddToFileList("Proofs",ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "\Part_" & i & "_" & ProofFileName) + Next + Result = Qpdf.MergeFileListFast("Proofs",ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ProofFileName) + Dim test + For test = 1 To Qpdf.FileListCount("Proofs") + + 'objFSO.DeleteFile Qpdf.FileListItem("Proofs",test),1 + WshShell.Run "cmd.exe /c DEL /F /Q """ & Qpdf.FileListItem("Proofs",test) & """" ,0,True + 'debug.WriteLine "cmd.exe /c DEL /F /Q """ & Qpdf.FileListItem("Proofs",test) & """" + 'debug.WriteLine Qpdf.FileListItem("Proofs",test) + Next + Else + .SetParamValue "PBMIN",MIN + .SetParamValue "PBMAX",MAX + .SaveToPDF ExportDirectory & KitRs("JobNumber").Value & "-" & JurisdictionRs("Name").value & "/" & ProofFileName,1 + End If + End With + oConn.Execute("UPDATE KIT SET [Status] ='Ready For Inkjet Export' WHERE [ID] =" & KitID & ";") If KitRs.State = 1 Then:KitRs.Close:End If If JurisdictionRs.State = 1 Then:JurisdictionRs.Close:End If If oConn.State = 1 Then:oConn.Close:End If @@ -462,7 +497,7 @@ Function PadString(inputString, size) Dim paddedString Dim inputLength Dim i - + If IsNull(inputString) Then:inputString = "" ' Get the length of the input string inputLength = Len(inputString) @@ -484,6 +519,10 @@ Function PadString(inputString, size) PadString = paddedString End Function +Function CleanNull(StringToClean) + If IsNull(StringToClean) Then:CleanNull = "":End If +End Function + Public Sub Assign(ByRef var, ByVal val) If IsObject(val) Then Set var = val