|
@@ -47,21 +47,56 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S |
|
|
|
|
|
|
|
|
WScript.Quit |
|
|
WScript.Quit |
|
|
Function CreateProofForJurisdiction(KitID) |
|
|
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 |
|
|
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 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 JurisdictionRs:set JurisdictionRs = oConn.Execute("SELECt * FROM [Jurisdiction] WHERE JCode='" & KitRs("Jcode").Value & "';") |
|
|
Dim ProofFileName:ProofFileName = objFSO.GetBaseName(KitRs("Filename")) & "-PROOF.PDF" |
|
|
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 |
|
|
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") |
|
|
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 KitRs.State = 1 Then:KitRs.Close:End If |
|
|
If JurisdictionRs.State = 1 Then:JurisdictionRs.Close:End If |
|
|
If JurisdictionRs.State = 1 Then:JurisdictionRs.Close:End If |
|
|
If oConn.State = 1 Then:oConn.Close:End If |
|
|
If oConn.State = 1 Then:oConn.Close:End If |
|
@@ -462,7 +497,7 @@ Function PadString(inputString, size) |
|
|
Dim paddedString |
|
|
Dim paddedString |
|
|
Dim inputLength |
|
|
Dim inputLength |
|
|
Dim i |
|
|
Dim i |
|
|
|
|
|
|
|
|
|
|
|
If IsNull(inputString) Then:inputString = "" |
|
|
' Get the length of the input string |
|
|
' Get the length of the input string |
|
|
inputLength = Len(inputString) |
|
|
inputLength = Len(inputString) |
|
|
|
|
|
|
|
@@ -484,6 +519,10 @@ Function PadString(inputString, size) |
|
|
PadString = paddedString |
|
|
PadString = paddedString |
|
|
End Function |
|
|
End Function |
|
|
|
|
|
|
|
|
|
|
|
Function CleanNull(StringToClean) |
|
|
|
|
|
If IsNull(StringToClean) Then:CleanNull = "":End If |
|
|
|
|
|
End Function |
|
|
|
|
|
|
|
|
Public Sub Assign(ByRef var, ByVal val) |
|
|
Public Sub Assign(ByRef var, ByVal val) |
|
|
If IsObject(val) Then |
|
|
If IsObject(val) Then |
|
|
Set var = val |
|
|
Set var = val |
|
|