@@ -4,6 +4,7 @@ Dim outFile | |||||
Dim WaitTime:WaitTime = 15000 | Dim WaitTime:WaitTime = 15000 | ||||
Dim DataDirectory | Dim DataDirectory | ||||
Dim ExportDirectory | Dim ExportDirectory | ||||
Dim PurpleEnvelopeProofReport | |||||
Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell") | Dim WshShell:Set WshShell = WScript.CreateObject("Wscript.Shell") | ||||
Dim oConn:Set oConn = WScript.CreateObject("ADODB.Connection") | Dim oConn:Set oConn = WScript.CreateObject("ADODB.Connection") | ||||
Dim ConnectionString | Dim ConnectionString | ||||
@@ -22,35 +23,63 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S | |||||
DataDirectory = WorkingDirectory & "test" | DataDirectory = WorkingDirectory & "test" | ||||
ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\" | ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\" | ||||
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=F:\Development\Tracking_Kits\Data\webdata - Copy.mdb;" | ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=F:\Development\Tracking_Kits\Data\webdata - Copy.mdb;" | ||||
PurpleEnvelopeProofReport = "F:\Development\Tracking_Kits\Data\Proofs.rep" | |||||
set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True) | set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True) | ||||
Else | Else | ||||
DataDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataImport" | DataDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataImport" | ||||
ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\" | ExportDirectory = "\\kci-syn-cl01\PC Transfer\TrackingDataExport\" | ||||
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;" | ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;" | ||||
PurpleEnvelopeProofReport ="C:\inetpub\tracking\Data\Proofs.rep" | |||||
set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True) | set outFile = objFSO.CreateTextFile("\\kci-syn-cl01\PC Transfer\TrackingDataExport\temp.csv",True) | ||||
End If | End If | ||||
Dim KitID | |||||
CheckForFiles | |||||
KitID = CheckForJobsToCass() | |||||
Dim KitID:CheckForFiles:KitID = CheckForJobsToCass() | |||||
If KitID > 0 Then | If KitID > 0 Then | ||||
ExportMMCsv(KitID) | ExportMMCsv(KitID) | ||||
RunMailManager | RunMailManager | ||||
ImportCass | ImportCass | ||||
End If | End If | ||||
'oConn.Open(ConnectionString) | |||||
KitID = CheckForReadyToLabel() | |||||
If KitID > 0 Then | |||||
createTrackingInfoForKit(KitID) | |||||
End If | |||||
KitID = CheckForReadyToExportToSnailWorks() | |||||
If KitID > 0 Then | |||||
CreateExportForSnailWorks(KitID) | |||||
End If | |||||
KitID = CheckForReadyToLabel():If KitID > 0 Then:createTrackingInfoForKit(KitID):End If | |||||
KitID = CheckForReadyToExportToSnailWorks():If KitID > 0 Then:CreateExportForSnailWorks(KitID):End If | |||||
KitID = CheckForProofReady(KitID):If KitID > 0 Then:CreateProofForJurisdiction(KitID):End If | |||||
WScript.Quit | WScript.Quit | ||||
Function CreateProofForJurisdiction(KitID) | |||||
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If | |||||
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 & ";") | |||||
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 | |||||
End Function | |||||
Function CheckForProofReady(KitID) | |||||
If oConn.State = 0 Then:oConn.Open(ConnectionString):End If | |||||
Dim rs:Set rs = oConn.Execute("Select TOP 1 [ID] FROM [Kit] Where Status ='Ready to Proof' and JobType='Purple Envelopes';") | |||||
If Not rs.EOF Then | |||||
CheckForProofReady = rs("ID").value | |||||
Else | |||||
CheckForProofReady = 0 | |||||
End If | |||||
If rs.State = 1 Then:rs.Close:End If | |||||
If oConn.State = 1 Then:oConn.Close:End If | |||||
End Function | |||||
Function CheckForReadyToExportToSnailWorks() | Function CheckForReadyToExportToSnailWorks() | ||||
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 TOP 1 [ID] FROM [Kit] Where Status ='Ready For Export' and JobType='Purple Envelopes';") | Dim rs:Set rs = oConn.Execute("Select TOP 1 [ID] FROM [Kit] Where Status ='Ready For Export' and JobType='Purple Envelopes';") | ||||
Powered by TurnKey Linux.