diff --git a/App/Controllers/Home/HomeController.asp b/App/Controllers/Home/HomeController.asp index d9f3803..c549ebd 100644 --- a/App/Controllers/Home/HomeController.asp +++ b/App/Controllers/Home/HomeController.asp @@ -40,10 +40,20 @@ Class HomeController End Sub - Public Sub PostCreateKit - - - End Sub + + Public Sub Print + Dim objAccess, objDB, objReport, objPrinter +' Create an instance of Access application + Set objAccess = Server.CreateObject("Access.Application") +set objDB = objAccess.OpenCurrentDatabase("F:\Development\Tracking_Kits\Data\webdata - Copy.mdb",0) +set objDB = objAccess.DoCmd.OpenReport ("rptKitLables" ,0) + objAccess.DoCmd.Close 3 + 'Set objReport = objDB.DoCmd.OpenReport("KitLabels", 0) ' 2 represents acViewPreview + 'objAccess.DoCmd.OutputTo 3,"rptKitLables",acFormatPDF, Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\test1.pdf",0 + objAccess.Quit + + Set objAccess = Nothing + End Sub End Class MVC.Dispatch diff --git a/App/Controllers/Kit/KitController.asp b/App/Controllers/Kit/KitController.asp index 9715264..f6df8f1 100644 --- a/App/Controllers/Kit/KitController.asp +++ b/App/Controllers/Kit/KitController.asp @@ -4,15 +4,29 @@ <% Class KitController Public Model + Public Sub SwitchBoardIndex + dim page_size : page_size = 10 + dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1) + dim page_count, record_count + set Model = new PagedIndex_ViewModel_Class + Model.Title = "Tracking Kits" + set Model.Kit = KitRepository.PagedIndexView(page_size, page_num, page_count, record_count) + Model.CurrentPageNumber = page_num + Model.PageSize = page_size + Model.PageCount = page_count + Model.RecordCount = record_count + %> <% + + End Sub Public Sub Index dim page_size : page_size = 10 dim page_num : page_num = Choice(Len(Request.Querystring("page_num")) > 0, Request.Querystring("page_num"), 1) dim page_count, record_count set Model = new PagedIndex_ViewModel_Class - Model.Title = "Kit" - set Model.Kit = KitRepository.FindPaged(empty, "ID", page_size, page_num, page_count, record_count) + Model.Title = "Tracking Kits" + set Model.Kit = KitRepository.FindPaged(empty, "ID", page_size, page_num, page_count, record_count) Model.CurrentPageNumber = page_num Model.PageSize = page_size Model.PageCount = page_count @@ -37,6 +51,17 @@ 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) + Model.Title = "Kit for " + HTMLSecurity.SetAntiCSRFToken "KitEditForm" + %> <% + End Sub + Public Sub Edit dim id : id = Request.QueryString("Id") diff --git a/App/DAL/lib.DAL.asp b/App/DAL/lib.DAL.asp index 8162633..9f8b72f 100644 --- a/App/DAL/lib.DAL.asp +++ b/App/DAL/lib.DAL.asp @@ -21,7 +21,7 @@ dim DAL__Singleton : set DAL__Singleton = Nothing Function DAL() If DAL__Singleton is Nothing then set DAL__Singleton = new Database_Class - DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata.mdb;" + DAL__Singleton.Initialize "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "Data\webdata - Copy.mdb;" End If set DAL = DAL__Singleton diff --git a/App/DomainModels/KitLabelsRepository.asp b/App/DomainModels/KitLabelsRepository.asp index be2dd33..69252d8 100644 --- a/App/DomainModels/KitLabelsRepository.asp +++ b/App/DomainModels/KitLabelsRepository.asp @@ -207,13 +207,14 @@ Class KitLabelsRepository_Class NewKitLabel.OutboundIMBDigits ="00716" & MailingID & NewKitLabel.OutboundSerial & "000000000" NewKitLabel.InBoundIMBDigits = "00778" & MailingID & NewKitLabel.InBoundSerial & right(Jurisdiction.IMB_Digits,9) dim imbJson : imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.OutboundIMBDigits) + json.loadJSON(imbJson) - 'dim ugh : set ugh = json.loadJSON(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.OutboundIMBDigits)) - NewKitLabel.OutboundIMB = json.Data("imb") 'left(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & "000000000"),250) + + NewKitLabel.OutboundIMB = json.Data("imb") NewKitLabel.OutboundIMBPNG = json.Data("imbImage") imbJson = rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits ) json.loadJSON(imbJson) - NewKitLabel.InBoundIMB = json.Data("imb") 'left(rest.FullRequestNoBody("get","/ppro-tools-api/imb/encode?imb=" & NewKitLabel.InBoundIMBDigits),250) + NewKitLabel.InBoundIMB = json.Data("imb") NewKitLabel.INBOUNDIMBPNG = json.Data("imbImage") me.AddNew NewKitLabel Next @@ -221,7 +222,7 @@ Class KitLabelsRepository_Class DAL.Execute "UPDATE Settings SET [Value] ='" & (Amount * 2) + serialOffset & "' Where [Name] ='SerialOffset'",empty -'https://postalpro.usps.com/ppro-tools-api/imb/encode?imb=00778202248200000081493019915 + End Sub diff --git a/App/DomainModels/KitRepository.asp b/App/DomainModels/KitRepository.asp index 6e128dc..2f3a4af 100644 --- a/App/DomainModels/KitRepository.asp +++ b/App/DomainModels/KitRepository.asp @@ -18,12 +18,78 @@ Class KitModel_Class End CLass +Class IndexKitModel_Class + Public Validator + Public Class_Get_Properties + + Public ID + Public JobNumber '90 + Public Jurisdiction '106 + Public LabelCount '106 + Public CreatedOn + Public LabelsPrinted + Public ExportedToSnailWorks + + Private Sub Class_Initialize + 'ValidateExitsts Me, "","" + Class_Get_Properties = Array("ID, JobNumber, Jurisdiction,LabelCount,CreatedOn,LabelsPrinted,ExportedToSnailWorks") + End Sub +End Class + + '======================================================================================================================= ' Kit Repository '======================================================================================================================= Class KitRepository_Class + Public Function PagedIndexView(per_page, page_num, ByRef page_count, ByRef record_count) + dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_ + "Jurisdiction.Name As Jurisdiction," &_ + "(SELECT COUNT(*) From KitLabels Where KitId = Kit.ID)" &_ + " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode;" + + dim list : set list = new LinkedList_Class + dim rs : set rs = DAL.PagedQuery(sql, empty, per_page, page_num) + If Not rs.EOF and Not (IsEmpty(per_page) and IsEmpty(page_num) and IsEmpty(page_count) and IsEmpty(record_count)) then + rs.PageSize = per_page + rs.AbsolutePage = page_num + page_count = rs.PageCount + record_count = rs.RecordCount + End If + set PagedIndexView = PagedIndexViewKitList(rs, per_page) + Destroy rs + End Function + + Private Function PagedIndexViewKitList(rs, per_page) + dim list : set list = new LinkedList_Class + + dim x : x =0 + Do While x < per_page and Not rs.EOF + list.Push Automapper.AutoMap(rs, new IndexKitModel_Class) + x = x +1 + rs.MoveNext + Loop + set PagedIndexViewKitList = list + End Function + + Public Function SwitchBoardEditFindById(ID) + dim sql : sql = "SELECT Kit.ID,Kit.JobNumber as [JobNumber], " &_ + "Jurisdiction.Name As Jurisdiction," &_ + "(SELECT COUNT(*) From KitLabels Where KitId = Kit.ID)" &_ + " As [LabelCount],[CreatedOn],[LabelsPrinted],[ExportedToSnailWorks] FROM Kit INNER JOIN Jurisdiction ON Kit.Jcode = Jurisdiction.JCode " &_ + "WHERE ID = ?" + + dim rs : set rs = DAL.Query(sql,ID) + If rs.EOF then + Err.Raise 1, "KitRepository_Class", KitNotFoundException("ID", ID) + Else + set SwitchBoardEditFindByID = Automapper.AutoMap(rs,"IndexKitModel_Class") + End If + + + End Function + Public Function FindByID(ID) dim sql : sql = "Select [ID], [JobNumber], [Jcode] FROM [Kit] WHERE ID = ?" dim rs : set rs = DAL.Query(sql,ID) diff --git a/App/ViewModels/KitViewModels.asp b/App/ViewModels/KitViewModels.asp index 6fe38ea..6766e88 100644 --- a/App/ViewModels/KitViewModels.asp +++ b/App/ViewModels/KitViewModels.asp @@ -15,6 +15,13 @@ Class Edit_ViewModel_Class End Class +Class SwitchBoard_ViewModel_Class + Public Title + Public Kit + Public Labels +End Class + + Class Create_ViewModel_Class Public Title Public JobNumber diff --git a/App/Views/Home/Index.asp b/App/Views/Home/Index.asp index 1854369..3f72b12 100644 --- a/App/Views/Home/Index.asp +++ b/App/Views/Home/Index.asp @@ -10,7 +10,7 @@