<%
pageLen = 99 'กำหนดจำนวนแต่ละหน้าที่ต้องการแสดงกี่ Reccord
pageNo = request.QueryString("pageNo")
if pageNo="" then pageNo = 1
IF Trim(Request.QueryString("q")) <> "" Then
strCondition = " and Workname like '%"&Trim(Request.QueryString("q")) &"%' "
End If
IF (Trim(Request.QueryString("StatusID")) <> "") Then
strCondition = strCondition & " and StatusID IN (" & Request.QueryString("StatusID") & ")"
End If
If Request.QueryString("period_month") = 3 Then
NextMonth = 1
NextYear = Request.QueryString("period_year")+543 +1
Else
NextMonth = Request.QueryString("period_month")*3+4
NextYear = Request.QueryString("period_year")+543
End If
cDateT= CDATE("01-" &NextMonth& "-" & NextYear)-1
DateT= Year(CDATE(cDateT)) & "-" &Month(CDATE(cDateT))& "-" & Day(CDATE(cDateT))' & " 00:00:00', 102
strCondition =" and StartDate between #"&DateF&"# and #"& DateT&"#"
Case 4
DateF= Request.QueryString("period_year")& "-01-01" '& " 00:00:00', 102"
DateT= Request.QueryString("period_year") & "-12-31" ' & " 00:00:00', 102
strCondition =" and StartDate between #"&DateF&"# and #"& DateT&"#"
End Select
IF (Trim(Request.QueryString("StatusID")) <> "") Then
strCondition = strCondition & " and StatusID IN (" & Request.QueryString("StatusID") & ")"
End If
Sql ="SELECT *FROM Work where 1=1 "&strCondition&" and OfficerID IN (Select OfficerID from Officer where DivisionID = "&RsAdmin.Fields("DivisionID").Value&" and SectionID = "&RsAdmin.Fields("SectionID").Value&" ) "&strCondition1&" order by StartDate DESC"
Set RS =Server.CreateObject("ADODB.Recordset")
RS.open Sql,Conn,1,3
if NOT Rs.EOF Then
Nrecord=RS.recordcount
rs.pageSize = pageLen
totalPage = rs.PageCount
rs.absolutePage = pageNo
recNo=1
'*** แสดงข้อมูลทุก Record ที่อยู่ในช่วง Page ***'
Do While Not RS.EOF and recNo <= pageLen
k = k +1