<% Option Explicit %>
<!--#include file="../../include_all.asp"-->
<!--#include file="../../ViewModels/JurisdictionViewModels.asp"-->

<%
dim Model
Class HomeController
    Public Sub Index
        %> <!--#include file="../../Views/Home/Index.asp"--> <% 
    End Sub

    Public Sub CreateKit
        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                 = "Create Kit"
		set Model.Jurisdiction      = JurisdictionRepository.FindPaged(empty, "JCode", page_size, page_num, page_count, record_count)
		Model.CurrentPageNumber     = page_num
		Model.PageSize              = page_size
		Model.PageCount             = page_count
		Model.RecordCount           = record_count
        %> <!--#include file="../../Views/Home/CreateKit.asp"--> <% 
    End Sub

    	Public Sub Search

    	dim searchValue:searchValue = Choice(Request.Form.Count = 0,Request.QueryString("q"),Request.Form("q"))
		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                 = "Create Kit"
		set Model.Jurisdiction      = JurisdictionRepository.SearchTablePaged(Array("JCode","%" & searchValue & "%","Name","%" & searchValue & "%","Mailing_Address","%" & searchValue & "%","CSZ","%" & searchValue & "%","IMB","%" & searchValue & "%","IMB_Digits","%" & searchValue & "%"),"JCode", page_size, page_num, page_count, record_count)
		Model.CurrentPageNumber     = page_num
		Model.PageSize              = page_size
		Model.PageCount             = page_count
		Model.RecordCount           = record_count
        %> <!--#include file="../../Views/Home/CreateKit.asp"--> <% 

	End Sub


	Public Sub Print
	Dim objAccess, objDB, objReport, objPrinter
	
	dim blah:set blah = Server.CreateObject("ReportMan.ReportManX")
		blah.Preview = false
		blah.ShowProgress = false
		blah.ShowPrintDialog = false
		blah.Filename = "F:\Development\Tracking_Kits\Data\Label_Report.rep"
		blah.SaveToPdf "F:\Development\Tracking_Kits\Data\sample.pdf",1
	End Sub
End Class

MVC.Dispatch
%>