%@ LANGUAGE="VBSCRIPT" %>
<%
'-- Global Variables --
PageURL = "patillo_readsch.asp" ' Link to next page
blnNeedRs = False ' True: Create New Recordset
blnEmptyRs = False ' True: Database Query Returned empty recordset
adMaximumShow = 30 ' Maximum show on page
strFilename = Request.ServerVariables("PATH_INFO")
strnameParts = Split(strFilename,"/")
strFilename = strnameParts(UBound(strnameParts))
Dim PageNmr_aa
' -- Retrieve Page Parameters
' determine the current page number
strPageNmr = FormatTextHTML(request.QueryString("Page"))
If strPageNmr = "" Then
If IsEmpty(PageNmr_aa) Then
intPageNmr = 1
Else
intPageNmr = PageNmr_aa
End If
Else
intPageNmr = CInt(strPageNmr)
PageNmr_aa = intPageNmr
End If
strSort = FormatTextHTML(request.QueryString("Sort"))
Select Case strSort
Case "Age":
strSortBy = "Age"
End Select
Dim avar_Reports_aa
Dim SortType_aa
If IsEmpty(avar_Reports_aa) Then
blnNeedRs = True
ElseIf SortType_aa <> strSort Then
blnNeedRs = True
End If
'-- Open Database Connection --
If blnNeedRs Then
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT DISTINCT Age FROM " & TABLE_NAME & " WHERE Status =" & adLive & " AND Hold = 0 AND WritingType='PATI' "
rs.Open strSQL, CONNECTION_STRING, 3, 3
If NOT (rs.EOF AND rs.BOF) Then
avarReports = rs.GetRows()
Else
blnEmptyRs = True
End If
avar_Reports_aa = avarReports
SortType_aa = strSort
Else
avarReports = avar_Reports_aa
End If
'On Error Resume Next
If NOT blnEmptyRs Then
intTotalPages = Fix((UBound(avarReports,2) + 1)/adMaximumShow)
If UBound(avarReports,2) + 1 mod adMaximumShow <> 0 Then
intTotalPages = intTotalPages + 1
End If
End If
Response.Buffer = True
Response.Expires = 0
'Response.Write "Status " & blnEmptyRs & "|"
'Display Current page of total pages
If FormatTextHTML(request("Page")) <> "" then ' Is there Page # passed?
Page = FormatTextHTML(request("Page")) ' Yes, there is
If IsNumeric(Page) then Page = Int(Page)
Else
If intTotalPages > 1 Then intPageNmr = 1
End If
'strPageTitle = "Administration Page"
If FormatTextHTML(request("rand"))= NULL or FormatTextHTML(request("rand")) = "" then
rndnum = rnd
else
rndnum = FormatTextHTML(request("rand"))+ 1
end if
If intTotalPages > 1 Then
Response.Write "Page: " & intPageNmr & " of " & intTotalPages
End If
strNavBar = ""
'****** Generate page(s) link (30 records per each page) ***********
If NOT blnEmptyRs Then
' -- JUMP TO PAGE linkS --
If intTotalPages > 1 Then 'Generate pages only if find more than 30 records
If (intPageNmr > 1) then
strNavBar = strNavBar & "<<Previous "
End If
For intI = 1 To intTotalPages
If intI <> intPageNmr Then
strNavBar = strNavBar & " | " & intI & " "
Else
strNavBar = strNavBar & " | " & intI & " "
End If
Next
strNavBar = strNavBar & "|"
If ((intTotalPages > 1) and (intPageNmr < intTotalPages)) then
strNavBar = strNavBar & " Next>>"
End If
strNavBar = strNavBar & ""
End If
End If
%>