From 93ccd8cab2284f7b63b1e4577a6428f4d492b288 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Tue, 28 May 2024 14:37:40 -0400 Subject: [PATCH] Got the labels report to run --- App/Controllers/Kit/KitController.asp | 38 ++++++++++++++++++++++++++- App/Views/Kit/SwitchBoardEdit.asp | 2 +- Data/Label_Report.rep | 4 +-- MVC/activeXdepedancies.asp | 8 ++++++ 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/App/Controllers/Kit/KitController.asp b/App/Controllers/Kit/KitController.asp index ca703bc..31923b4 100644 --- a/App/Controllers/Kit/KitController.asp +++ b/App/Controllers/Kit/KitController.asp @@ -104,8 +104,9 @@ Class KitController End Sub Public Sub SwitchBoardEdit - + dim id : id = Request.QueryString("Id") + set Model = new SwitchBoard_ViewModel_Class set Model.Kit = KitRepository.SwitchBoardEditFindById(id) set Model.Labels = KitLabelsRepository.Find(Array("KitId =?",id),empty) @@ -113,12 +114,47 @@ Class KitController HTMLSecurity.SetAntiCSRFToken "KitEditForm" %> <% End Sub + Public Sub DownloadTrackingkitSnailWorksPDF + + dim id : id = Request.QueryString("Id") + ReportManager.Filename = Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\Label_Report.rep" + if dev = true Then + + ReportManager.SetDatabaseConnectionString "TRACKINGKITLABELS","Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;" + + else + + ReportManager.SetDatabaseConnectionString "TRACKINGKITLABELS","Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\inetpub\Data\webdata - Copy.mdb;" + + End If + ReportManager.Preview = false + ReportManager.ShowProgress = false + ReportManager.ShowPrintDialog = false + + ReportManager.SetParamValue "PBKITID", CInt(id) + + ReportManager.SaveToPdf Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\" & id & ".pdf",1 + + Dim objStream:Set objStream = Server.CreateObject("ADODB.Stream") + objStream.Type = 1 'adTypeBinary + objStream.Open + objStream.LoadFromFile(Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\" & id & ".pdf") + Response.ContentType = "application/octet-stream" + Response.Addheader "Content-Disposition", "attachment; filename=" & id & ".pdf" + Response.BinaryWrite objStream.Read + objStream.Close + Set objStream = Nothing + + + End Sub + Public Sub DownloadTrackingkitSnailWorks dim id : id = Request.QueryString("Id") dim export: set export = SnailWorksRepository.GetSnailWorksExportById(id) if export.DetailRecords.Count > 0 Then + If Not Server.CreateObject("Scripting.FileSystemObject").FolderExists(server.mappath("/uploads/")) Then : Server.CreateObject("Scripting.FileSystemObject").CreateFolder(server.mappath("/uploads/")):End If dim objExportFile: Set objExportFile = Server.CreateObject("Scripting.FileSystemObject").CreateTextFile(server.mappath("/uploads/" & id & ".csv"),2) With objExportFile .Write """" & export.Header.RecordType & """," diff --git a/App/Views/Kit/SwitchBoardEdit.asp b/App/Views/Kit/SwitchBoardEdit.asp index 6879662..16d5c66 100644 --- a/App/Views/Kit/SwitchBoardEdit.asp +++ b/App/Views/Kit/SwitchBoardEdit.asp @@ -11,7 +11,7 @@

Labels Printed On : <%= Model.Kit.LabelsPrinted %>

Exported to SnailWorks On: <%= Model.Kit.ExportedToSnailWorks %>

<%= HTML.LinkToExt("Download SnailWorks File","Kit", "DownloadTrackingkitSnailWorks", Array("Id",Model.Kit.ID,"_P","1"),Array("class","btn btn-primary")) %> - + <%= HTML.LinkToExt("Download PDF File To Print","Kit", "DownloadTrackingkitSnailWorksPDF", Array("Id",Model.Kit.ID,"_P","1"),Array("class","btn btn-primary")) %> diff --git a/Data/Label_Report.rep b/Data/Label_Report.rep index 9c91fed..fb1857b 100644 --- a/Data/Label_Report.rep +++ b/Data/Label_Report.rep @@ -19,7 +19,7 @@ object TRpReport 's.InBoundIMB, Kit.Jcode, Jurisdiction.Name AS Jurisdiction, Juri' + 'sdiction.Mailing_Address, 1 AS Num'#13#10'FROM (KitLabels INNER JOIN K' + 'it ON KitLabels.KitId = Kit.ID) INNER JOIN Jurisdiction ON Kit.J' + - 'code = Jurisdiction.JCode'#13#10'WHERE KitLabels.KITId = pbKitId'#13#10 + 'code = Jurisdiction.JCode'#13#10'WHERE KitLabels.KITId = PBKITID'#13#10 end item Alias = 'KITLABELS' @@ -29,7 +29,7 @@ object TRpReport 's.InBoundIMB, Kit.Jcode, Jurisdiction.Name AS Jurisdiction, Juri' + 'sdiction.Mailing_Address,KitLabels.SetNumber'#13#10'FROM (KitLabels IN' + 'NER JOIN Kit ON KitLabels.KitId = Kit.ID) INNER JOIN Jurisdictio' + - 'n ON Kit.Jcode = Jurisdiction.JCode'#13#10'WHERE KitLabels.KITId=pbKIT' + + 'n ON Kit.Jcode = Jurisdiction.JCode'#13#10'WHERE KitLabels.KITId=PBKIT' + 'ID'#13#10'ORDER BY SetNumber;' end> DatabaseInfo = < diff --git a/MVC/activeXdepedancies.asp b/MVC/activeXdepedancies.asp index 25f5021..fd55559 100644 --- a/MVC/activeXdepedancies.asp +++ b/MVC/activeXdepedancies.asp @@ -7,4 +7,12 @@ set Chilkat_CSV = m_Chilkat_CSV End Function + dim m_ReportManager + Private Function ReportManager + if not isobject(m_ReportManager) then + set m_ReportManager = Server.CreateObject("ReportMan.ReportManX") + end if + set ReportManager = m_ReportManager + End Function + %> \ No newline at end of file