darksirius
Technical User
Hi everyone, how r u guys? Well, I have here a problem with page navigation, I did tried to solve it by referring to other people's work but still cound'nt fix this, I paste along my coding so hopefully if anyone could show me some light, thanx..
here is the code.. my problem is that the page wont limit to the limits i set it, but the page counting is working fine..
<!--#include file="../DBConfig/DBOpen.asp" -->
<!--#include file="../Scripts/DateFormat.asp" -->
<%
dim rc
Dim bColor ' Boolean we use to alternate colors
Dim lngNumberOfRecords, lngNumberOfPages, lngPageNumber
Dim strPageNumber
strIsNavigation = Request.Form("txtIsNavigation")
If strIsNewSearch <> "True" And strIsNavigation <> "True" Then
Format_Page_For_First_Use()
else
Retrieve_Post_Value
end if
Set_Record_Count
Filter_Records
Sub Retrieve_Post_Value()
If strIsNavigation = "True" Then
strPageNumber = Request.Form("txtPageNumber")
End If
end sub
sub Format_Page_For_First_Use()
strPageNumber = "1"
end sub
bColor = False
dim GRPTYPE
GRPTYPE = request.querystring("GRPTYPE")
'dim CLRTYPE
'CLRTYPE = request.querystring("GRPTYPE")
if trim(session("usid")) = "" then
Response.Redirect "../index.asp"
end if
PRJID=Session("usid")
if Request.QueryString("TYPE")="SAVE" then
SQL = "INSERT INTO groupt "
SQL = SQL & "(datecreate,creator,groupdesc,grouptype) "
SQL = SQL & "VALUES ("
SQL = SQL & "NOW(),"
SQL = SQL & PRJID & ","
SQL = SQL & "'" & Replace(Trim(Request.QueryString("GRP")), "'", "''") & "', "
SQL = SQL & "'" & GRPTYPE & "' "
SQL = SQL & ")"
db.execute SQL
SQL1="SELECT groupid FROM groupt WHERE creator=" & PRJID
set rc = db.execute(SQL1)
do while not rc.eof
gpid=rc(0)
set rc1 = server.CreateObject ("adodb.recordset")
rc1.ActiveConnection = db
rc1.Source = "SELECT * FROM groupmem WHERE groupid = " & gpid & " AND ownergrp= " & PRJID
rc1.CursorType = 0 'adOpenKeyset
rc1.CursorLocation = 3 'adUseClient
rc1.LockType = 2 'adLockReadOnly
rc1.Open()
if rc1.eof then
SQL = "INSERT INTO groupmem "
SQL = SQL & "(datecreate,groupid,ownergrp,regid,status) "
SQL = SQL & "VALUES ("
SQL = SQL & "NOW(),"
SQL = SQL & gpid & ","
SQL = SQL & PRJID & ","
SQL = SQL & PRJID & ","
SQL = SQL & "'2'"
SQL = SQL & ")"
db.execute SQL
end if
rc1.close
set rc1 = nothing
rc.movenext
loop
rc.close
set rc = nothing
end if
strSql="SELECT taskid,duedate,taskstatus FROM grouptask " & _
"WHERE grouptask.userregid= " & PRJID & ""
set kc = db.execute(strSql)
'response.write(strSql)
'response.end
do while not kc.EOF
ddif=DateDiff("d",kc(1),Date)
'alert ( rc(8) )
if kc(2) <> "c" then
if ddif = 0 or ddif = -2 or ddif = -1 then
colr = "y"
elseif ddif > 0 then
colr = "r"
else
colr = "n"
end if
else
colr = "c"
end if
'response.write ("<script type=""text/vbscript"">MsgBox(""" & kc(2) & """)</script>")
sql2 = "UPDATE grouptask SET "
sql2= sql2 & "taskstatus = '" & colr & "' "
sql2= sql2 & "where taskid = " & kc(0) & ""
'response.write sql2
'response.write ("<script type=""text/vbscript"">MsgBox(""" & colr & """)</script>")
db.Execute sql2
kc.movenext
loop
kc.Close
set kc = nothing
strSql="SELECT groupmem.id,groupt.groupdesc,users.name,groupmem.status,groupmem.groupid,groupmem.ownergrp,grouptype.description,grouptask.taskstatus,grouptask.duedate,grouptask.taskid,grouptask.project FROM groupmem " & _
"LEFT JOIN users ON groupmem.ownergrp = users.regid " & _
"LEFT JOIN groupt ON groupmem.groupid = groupt.groupid " & _
"LEFT JOIN grouptype ON grouptype.id = groupt.grouptype " & _
"LEFT JOIN task ON groupmem.regid = task.userregid " & _
"LEFT JOIN grouptask ON grouptask.project = groupt.groupid " & _
"WHERE groupmem.regid = " & PRJID & " AND groupmem.status=2 GROUP BY groupmem.id"
'response.write(strSql)
'response.end
'groupid, ownergrp, regid
set rc = server.createobject("adodb.recordset")
with rc
.activeconnection = db
.source = strSql
.CursorType = 1
.CursorLocation = 3
.LockType = 1
.open
end with
dim kir
sqlkr = "SELECT COUNT(groupt.groupdesc) " & _
"FROM groupt "
set kir = db.execute(sqlkr)
If Not kir.EOF Then
kira = kir(0)
Else
kira = 0
End If
kir.Close
set kir = nothing
sub Set_Record_Count()
If strIsNavigation = "True" Then
lngNumberOfRecords = CLng(Request.Form("txtNumberOfRecords"))
lngNumberOfPages = CLng(Request.Form("txtNumberOfPages"))
Else
If strLocationDescription = "" Then
sql = "SELECT COUNT(*) "
sql = sql & "FROM groupt "
sql = sql & strFilter
End If
'response.write(sql)
'response.End()
Set rstCount = db.Execute(sql)
lngNumberOfRecords = CLng(rstCount(0))
rstCount.Close
Set rstCount = Nothing
If lngNumberOfRecords = 0 Then
lngNumberOfPages = 1
Else
lngNumberOfPages = Fix(lngNumberOfRecords / 20)
If lngNumberOfRecords Mod 20 > 0 Then
lngNumberOfPages = lngNumberOfPages + 1
End If
End If
End If
end sub
sub Filter_Records()
sqls = "SELECT groupt.groupid, groupmem.groupid " & _
"FROM groupt " & _
"LEFT JOIN groupmem ON groupt.groupid = groupmem.groupid GROUP BY groupmem.id" & _
strFilter & strOrderBy
If strPageNumber <> "1" Then
lngPageNumber = CLng(strPageNumber)
sqls = sqls & " LIMIT " & CStr((lngPageNumber - 1) * 10) & ", 20"
Else
sqls = sqls & " LIMIT 0, 20"
End If
'response.write (sqls)
'RESPONSE.END
set kr = server.CreateObject ("adodb.recordset")
kr.ActiveConnection = db
kr.Source = sqls
kr.CursorType = 1 'adOpenKeyset
kr.CursorLocation = 3 'adUseClient
kr.LockType = 1
kr.Open()
end sub
'response.write (sqls)
'RESPONSE.END
'"WHERE groupmem.regid = " & PRJID & " AND groupmem.status=2 " & _
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="../Scripts/CworksCSS.css" type="text/css">
<script language="javascript" src="../Scripts/JCworks.js"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin=0 topmargin=10 style="text-align: center">
<div align="left">
<table align = "LEFT" width="100%" border="0" bgcolor="#FFFFFF" cellpadding="4" cellspacing="1" height="80">
<tr>
<td width="99%" valign="top" align=right bgcolor="#FFFFFF">
<form name="form1">
<div align="center">
<table width="100%" border="1" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" height="141" style="border-width:0px; border-collapse: collapse; " bordercolor="#000000">
<td valign="middle" height="29" class="zipcode" align=left bgcolor="#FFFFFF" colspan="8" cellpadding="0" cellspacing="0" bordercolor="0">
<font face="Verdana"><b>No of records found = <%=kira%></b></font></td>
<td align="middle" colspan="4">
<%
Response.Write "<b>Page " & strPageNumber & " 0f " & CStr(lngNumberOfPages) & "</b>"
If strPageNumber = "1" Then
Response.Write " [ <img alt='First' src='../images/first_bw.gif' border='0'>"
Else
Response.Write " [ <a href=""#"" onclick=""GotoFirstPage()""><img alt='First' src='../images/first_clr.gif' border='0'></a>"
End If
If strPageNumber = "1" Then
Response.Write " | <img alt='Previous' src='../images/back_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoPreviousPage()""><b><img alt='Previous' src='../images/back_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Next' src='../images/forward_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoNextPage()""><b><img alt='Next' src='../images/forward_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Last' src='../images/forward_bw.gif' border='0'> ]"
Else
Response.Write " | <a href=""#"" onclick=""GotoLastPage()""><img alt='Last' src='../images/last_clr.gif' border='0'></a> ]"
End If
%>
</td>
<tr>
<td valign="top" width="4%" height="13" class="zipcode" align=left bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="19%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
</tr>
<tr>
<td valign="top" width="4%" height="23" class="zipcode" align=left bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<u>
<font face="Verdana">No.</font></u></td>
<!--td valign="top" width="15%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="left">
<u>
<font face="Verdana">
Date Created</font></u></td-->
<td valign="top" width="19%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="left">
<u><font face="Verdana">Group / Project</font></u></td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="middle">
<u>
<font face="Verdana">Owner</font></u> </td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<u> <font face="Verdana">Type</font></u> </td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u> <font face="Verdana">Invite</font></u> </td>
<!--
<td valign="top" width="9%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Total </u> </td>-->
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u> <font face="Verdana">Joined</font> </u></td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Members </u> </td>
<!--
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>All</u></td>-->
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Task </u> </td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>Not Due </u> </td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>About To Due</u> </td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>Due And Late</u> </td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
Complete</td>
</tr>
<%
i=1
do while not rc.eof
bColor = Not bColor
If bColor Then
altcolor = "#DDFFDD"
Else
altcolor = "#FFFFFF"
End If
SQL1 = "SELECT COUNT(groupid) " & _
"FROM groupmem " & _
"WHERE groupid =" & rc(4) & " AND status='1'"
Set rc1 = db.execute(SQL1)
If Not rc1.EOF Then
INV = rc1(0)
Else
INV = 0
End If
rc1.Close
set rc1 = nothing
SQL2 = "SELECT COUNT(groupid) " & _
"FROM groupmem " & _
"WHERE groupid =" & rc(4) & " AND status='2'"
Set rc1 = db.execute(SQL2)
If Not rc1.EOF Then
JOI = rc1(0)
Else
JOI = 0
End If
rc1.Close
set rc1 = nothing
TOTMEM=cint(INV)+cint(JOI)
SQL3 = "SELECT COUNT(project) " & _
"FROM grouptask " & _
"WHERE project = " & rc(4) & " "
Set rc2= db.execute(SQL3)
If Not rc2.EOF Then
JNTS = rc2(0)
Else
JNTS = 0
End If
rc2.Close
set rc2 = nothing
SQL4 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'n' AND project = " & rc(4) & " "
Set rmz = db.execute(SQL4)
If Not rmz.EOF Then
TSKLST = rmz(0)
Else
TSKLST = 0
End If
rmz.Close
set rmz = nothing
SQL5 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'c' AND project = " & rc(4) & " "
Set rm1 = db.execute(SQL5)
If Not rm1.EOF Then
COMPLETE = rm1(0)
Else
COMPLETE = 0
End If
rm1.Close
set rm1 = nothing
SQL6 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'r' AND project = " & rc(4) & " "
Set rm2 = db.execute(SQL6)
If Not rm2.EOF Then
NOTCOM = rm2(0)
Else
NOTCOM = 0
End If
rm2.Close
set rm2 = nothing
SQL7 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'y' AND project = " & rc(4) & " "
Set rm3 = db.execute(SQL7)
If Not rm3.EOF Then
HAlFCOM = rm3(0)
Else
HAlFCOM = 0
End If
rm3.Close
set rm3 = nothing
'response.write ("<script type=""text/vbscript"">MsgBox(""" & colr & """)</script>")
%>
<tr>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=i%>.</font></td>
<!--td valign="top" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>><font size="2" face="verdana" color="#0000FF"><%=FormatDate_d_mmm_yyyy(rc(1))%></font></td-->
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=rc(1)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=rc(2)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><p align="center"><%=rc(6)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<p align="center">
<%if PRJID=rc(5) then %>
<a href="pmt_invite.asp?grpid=<%=rc(4)%>&grpnm=<%=rc(1)%>">
<img border="0" src="../Images/invite.gif" width="24" height="24" title="click here to invite members to join this group"></a></td>
<%else%>
<img border="0" src="../Images/invite.gif" width="24" height="24" title="Authorization to invite members is not allowed"></a></td>
<%end if%>
<!--
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>>
<p align="center">
<b><font size="2"><%=INV%></font></b></td>-->
<td valign="middle" align=center style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<a href="pmt_joint.asp?grpid=<%=rc(4)%>&grpnm=<%=rc(1)%>"><img border="0" src="../Images/join.gif" width="24" height="24" title="click here to view a list of members accept to join this group"></a></td>
<td valign="middle" align=center style="border-style:none; border-width:medium; " title="Members being assigned to this project" bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<b><font size="2" color=#000000 font.bold=true><%=JOI%></font></b></td>
<!--
<td valign="middle" align=center style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>>
<b><font size="2"><%=TOTMEM%></font></b></td>-->
<td valign="middle" align=center style="border-style:none; border-width:medium; " title="Amount of task being assigned to this project" bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<b><font size="2" color=#000000 font.bold=true><%=JNTS%></font></b></td>
<td align=center title="Amount of task within due date" bordercolor="#008000" bgcolor="lightgreen" height="38">
<b><font size="2" border="1" color= #0000FF font.bold=true><%=TSKLST%></font></b></td>
<td valign="middle" align=center title="Amount of task about to due" bordercolor="#C7D8D2" bgcolor="Yellow" height="38">
<b><font size="2" color=#3333FF font.bold=true><%=HAlFCOM%></font></b></td>
<td valign="middle" align=center border="1" title="Amount of task passed due date and late" bgcolor="red" height="38">
<b><font size="2" color=#3333FF font.bold=true><%=NOTCOM%></font></b></td>
<td valign="middle" align=center title="Amount of task completed" bordercolor="#FFFF00" bgcolor="blue" height="38">
<b><font size="2" color=#FFFFFF face="verdana" ><%=COMPLETE%></font></b></td>
</tr>
<%
i = i + 1
Response.Flush
rc.movenext
loop
rc.close
set rc = nothing
%>
<tr>
<td valign="middle" height="13" class="zipcode" style="border-style:none; border-width:medium; " align=left bgcolor="#FFFFFF" colspan="12">
</td>
</tr>
<td valign="middle" height="26" class="zipcode" align=left bgcolor="#FFFFFF" colspan="8">
<font face="Verdana"><b>No of records found = <%=kira%></b></font></td>
<td align="middle" colspan="4">
<%
Response.Write "<b>Page " & strPageNumber & " 0f " & CStr(lngNumberOfPages) & "</b>"
If strPageNumber = "1" Then
Response.Write " [ <img alt='First' src='../images/first_bw.gif' border='0'>"
Else
Response.Write " [ <a href=""#"" onclick=""GotoFirstPage()""><img alt='First' src='../images/first_clr.gif' border='0'></a>"
End If
If strPageNumber = "1" Then
Response.Write " | <img alt='Previous' src='../images/back_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoPreviousPage()""><b><img alt='Previous' src='../images/back_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Next' src='../images/forward_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoNextPage()""><b><img alt='Next' src='../images/forward_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Last' src='../images/forward_bw.gif' border='0'> ]"
Else
Response.Write " | <a href=""#"" onclick=""GotoLastPage()""><img alt='Last' src='../images/last_clr.gif' border='0'></a> ]"
End If
%>
</td>
<input type="hidden" id="txtPageNumber" name="txtPageNumber" value="<%=strPageNumber%>">
<input type="hidden" id="txtNumberOfRecords" name="txtNumberOfRecords" value="<%=CStr(lngNumberOfRecords)%>">
<input type="hidden" id="txtNumberOfPages" name="txtNumberOfPages" value="<%=CStr(lngNumberOfPages)%>">
<input type="hidden" id="txtIsNavigation" name="txtIsNavigation">
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
<script language=vbscript>
sub GotoFirstPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = "1"
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoPreviousPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = CStr(CLng(form1.txtPageNumber.value) - 1)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoNextPage()
form1.action = "pmt_grouplist.asp?pagenumber="&CStr(CLng(form1.txtPageNumber.value) + 1)
form1.method = "Post"
form1.txtPageNumber.value = CStr(CLng(form1.txtPageNumber.value) + 1)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoLastPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = CStr(form1.txtNumberOfPages.value)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
Sub OpenForm1(ID)
Dim strURL
strURL = UpdateWindow1("pmt_updatecheck.asp?TYPE=indvtask" & "&ID=" & ID)
If strURL <> "" Then
window.navigate strURL
End If
End Sub
Sub OpenForm2(ID)
Dim strURL
strURL = UpdateWindow1("pmt_updatestatus.asp?TYPE=indvtask" & "&ID=" & ID)
If strURL <> "" Then
window.navigate strURL
End If
End Sub
</script>
</html>
<%
db.close
set db = nothing
%>
here is the code.. my problem is that the page wont limit to the limits i set it, but the page counting is working fine..
<!--#include file="../DBConfig/DBOpen.asp" -->
<!--#include file="../Scripts/DateFormat.asp" -->
<%
dim rc
Dim bColor ' Boolean we use to alternate colors
Dim lngNumberOfRecords, lngNumberOfPages, lngPageNumber
Dim strPageNumber
strIsNavigation = Request.Form("txtIsNavigation")
If strIsNewSearch <> "True" And strIsNavigation <> "True" Then
Format_Page_For_First_Use()
else
Retrieve_Post_Value
end if
Set_Record_Count
Filter_Records
Sub Retrieve_Post_Value()
If strIsNavigation = "True" Then
strPageNumber = Request.Form("txtPageNumber")
End If
end sub
sub Format_Page_For_First_Use()
strPageNumber = "1"
end sub
bColor = False
dim GRPTYPE
GRPTYPE = request.querystring("GRPTYPE")
'dim CLRTYPE
'CLRTYPE = request.querystring("GRPTYPE")
if trim(session("usid")) = "" then
Response.Redirect "../index.asp"
end if
PRJID=Session("usid")
if Request.QueryString("TYPE")="SAVE" then
SQL = "INSERT INTO groupt "
SQL = SQL & "(datecreate,creator,groupdesc,grouptype) "
SQL = SQL & "VALUES ("
SQL = SQL & "NOW(),"
SQL = SQL & PRJID & ","
SQL = SQL & "'" & Replace(Trim(Request.QueryString("GRP")), "'", "''") & "', "
SQL = SQL & "'" & GRPTYPE & "' "
SQL = SQL & ")"
db.execute SQL
SQL1="SELECT groupid FROM groupt WHERE creator=" & PRJID
set rc = db.execute(SQL1)
do while not rc.eof
gpid=rc(0)
set rc1 = server.CreateObject ("adodb.recordset")
rc1.ActiveConnection = db
rc1.Source = "SELECT * FROM groupmem WHERE groupid = " & gpid & " AND ownergrp= " & PRJID
rc1.CursorType = 0 'adOpenKeyset
rc1.CursorLocation = 3 'adUseClient
rc1.LockType = 2 'adLockReadOnly
rc1.Open()
if rc1.eof then
SQL = "INSERT INTO groupmem "
SQL = SQL & "(datecreate,groupid,ownergrp,regid,status) "
SQL = SQL & "VALUES ("
SQL = SQL & "NOW(),"
SQL = SQL & gpid & ","
SQL = SQL & PRJID & ","
SQL = SQL & PRJID & ","
SQL = SQL & "'2'"
SQL = SQL & ")"
db.execute SQL
end if
rc1.close
set rc1 = nothing
rc.movenext
loop
rc.close
set rc = nothing
end if
strSql="SELECT taskid,duedate,taskstatus FROM grouptask " & _
"WHERE grouptask.userregid= " & PRJID & ""
set kc = db.execute(strSql)
'response.write(strSql)
'response.end
do while not kc.EOF
ddif=DateDiff("d",kc(1),Date)
'alert ( rc(8) )
if kc(2) <> "c" then
if ddif = 0 or ddif = -2 or ddif = -1 then
colr = "y"
elseif ddif > 0 then
colr = "r"
else
colr = "n"
end if
else
colr = "c"
end if
'response.write ("<script type=""text/vbscript"">MsgBox(""" & kc(2) & """)</script>")
sql2 = "UPDATE grouptask SET "
sql2= sql2 & "taskstatus = '" & colr & "' "
sql2= sql2 & "where taskid = " & kc(0) & ""
'response.write sql2
'response.write ("<script type=""text/vbscript"">MsgBox(""" & colr & """)</script>")
db.Execute sql2
kc.movenext
loop
kc.Close
set kc = nothing
strSql="SELECT groupmem.id,groupt.groupdesc,users.name,groupmem.status,groupmem.groupid,groupmem.ownergrp,grouptype.description,grouptask.taskstatus,grouptask.duedate,grouptask.taskid,grouptask.project FROM groupmem " & _
"LEFT JOIN users ON groupmem.ownergrp = users.regid " & _
"LEFT JOIN groupt ON groupmem.groupid = groupt.groupid " & _
"LEFT JOIN grouptype ON grouptype.id = groupt.grouptype " & _
"LEFT JOIN task ON groupmem.regid = task.userregid " & _
"LEFT JOIN grouptask ON grouptask.project = groupt.groupid " & _
"WHERE groupmem.regid = " & PRJID & " AND groupmem.status=2 GROUP BY groupmem.id"
'response.write(strSql)
'response.end
'groupid, ownergrp, regid
set rc = server.createobject("adodb.recordset")
with rc
.activeconnection = db
.source = strSql
.CursorType = 1
.CursorLocation = 3
.LockType = 1
.open
end with
dim kir
sqlkr = "SELECT COUNT(groupt.groupdesc) " & _
"FROM groupt "
set kir = db.execute(sqlkr)
If Not kir.EOF Then
kira = kir(0)
Else
kira = 0
End If
kir.Close
set kir = nothing
sub Set_Record_Count()
If strIsNavigation = "True" Then
lngNumberOfRecords = CLng(Request.Form("txtNumberOfRecords"))
lngNumberOfPages = CLng(Request.Form("txtNumberOfPages"))
Else
If strLocationDescription = "" Then
sql = "SELECT COUNT(*) "
sql = sql & "FROM groupt "
sql = sql & strFilter
End If
'response.write(sql)
'response.End()
Set rstCount = db.Execute(sql)
lngNumberOfRecords = CLng(rstCount(0))
rstCount.Close
Set rstCount = Nothing
If lngNumberOfRecords = 0 Then
lngNumberOfPages = 1
Else
lngNumberOfPages = Fix(lngNumberOfRecords / 20)
If lngNumberOfRecords Mod 20 > 0 Then
lngNumberOfPages = lngNumberOfPages + 1
End If
End If
End If
end sub
sub Filter_Records()
sqls = "SELECT groupt.groupid, groupmem.groupid " & _
"FROM groupt " & _
"LEFT JOIN groupmem ON groupt.groupid = groupmem.groupid GROUP BY groupmem.id" & _
strFilter & strOrderBy
If strPageNumber <> "1" Then
lngPageNumber = CLng(strPageNumber)
sqls = sqls & " LIMIT " & CStr((lngPageNumber - 1) * 10) & ", 20"
Else
sqls = sqls & " LIMIT 0, 20"
End If
'response.write (sqls)
'RESPONSE.END
set kr = server.CreateObject ("adodb.recordset")
kr.ActiveConnection = db
kr.Source = sqls
kr.CursorType = 1 'adOpenKeyset
kr.CursorLocation = 3 'adUseClient
kr.LockType = 1
kr.Open()
end sub
'response.write (sqls)
'RESPONSE.END
'"WHERE groupmem.regid = " & PRJID & " AND groupmem.status=2 " & _
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="../Scripts/CworksCSS.css" type="text/css">
<script language="javascript" src="../Scripts/JCworks.js"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin=0 topmargin=10 style="text-align: center">
<div align="left">
<table align = "LEFT" width="100%" border="0" bgcolor="#FFFFFF" cellpadding="4" cellspacing="1" height="80">
<tr>
<td width="99%" valign="top" align=right bgcolor="#FFFFFF">
<form name="form1">
<div align="center">
<table width="100%" border="1" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" height="141" style="border-width:0px; border-collapse: collapse; " bordercolor="#000000">
<td valign="middle" height="29" class="zipcode" align=left bgcolor="#FFFFFF" colspan="8" cellpadding="0" cellspacing="0" bordercolor="0">
<font face="Verdana"><b>No of records found = <%=kira%></b></font></td>
<td align="middle" colspan="4">
<%
Response.Write "<b>Page " & strPageNumber & " 0f " & CStr(lngNumberOfPages) & "</b>"
If strPageNumber = "1" Then
Response.Write " [ <img alt='First' src='../images/first_bw.gif' border='0'>"
Else
Response.Write " [ <a href=""#"" onclick=""GotoFirstPage()""><img alt='First' src='../images/first_clr.gif' border='0'></a>"
End If
If strPageNumber = "1" Then
Response.Write " | <img alt='Previous' src='../images/back_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoPreviousPage()""><b><img alt='Previous' src='../images/back_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Next' src='../images/forward_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoNextPage()""><b><img alt='Next' src='../images/forward_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Last' src='../images/forward_bw.gif' border='0'> ]"
Else
Response.Write " | <a href=""#"" onclick=""GotoLastPage()""><img alt='Last' src='../images/last_clr.gif' border='0'></a> ]"
End If
%>
</td>
<tr>
<td valign="top" width="4%" height="13" class="zipcode" align=left bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="19%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
</td>
</tr>
<tr>
<td valign="top" width="4%" height="23" class="zipcode" align=left bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<u>
<font face="Verdana">No.</font></u></td>
<!--td valign="top" width="15%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="left">
<u>
<font face="Verdana">
Date Created</font></u></td-->
<td valign="top" width="19%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="left">
<u><font face="Verdana">Group / Project</font></u></td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p align="middle">
<u>
<font face="Verdana">Owner</font></u> </td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<u> <font face="Verdana">Type</font></u> </td>
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u> <font face="Verdana">Invite</font></u> </td>
<!--
<td valign="top" width="9%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Total </u> </td>-->
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u> <font face="Verdana">Joined</font> </u></td>
<td valign="top" width="7%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Members </u> </td>
<!--
<td valign="top" width="8%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>All</u></td>-->
<td valign="top" width="6%" class="zipcode" align=center bgcolor="#FFFFFF" style="border-style:none; border-width:medium; ">
<p>
<u>Task </u> </td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>Not Due </u> </td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>About To Due</u> </td>
<td valign="top" width="10%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
<p>
<u>Due And Late</u> </td>
<td valign="top" width="8%" class="zipcode" align=center bgcolor="" style="border-style:none; border-width:medium; ">
Complete</td>
</tr>
<%
i=1
do while not rc.eof
bColor = Not bColor
If bColor Then
altcolor = "#DDFFDD"
Else
altcolor = "#FFFFFF"
End If
SQL1 = "SELECT COUNT(groupid) " & _
"FROM groupmem " & _
"WHERE groupid =" & rc(4) & " AND status='1'"
Set rc1 = db.execute(SQL1)
If Not rc1.EOF Then
INV = rc1(0)
Else
INV = 0
End If
rc1.Close
set rc1 = nothing
SQL2 = "SELECT COUNT(groupid) " & _
"FROM groupmem " & _
"WHERE groupid =" & rc(4) & " AND status='2'"
Set rc1 = db.execute(SQL2)
If Not rc1.EOF Then
JOI = rc1(0)
Else
JOI = 0
End If
rc1.Close
set rc1 = nothing
TOTMEM=cint(INV)+cint(JOI)
SQL3 = "SELECT COUNT(project) " & _
"FROM grouptask " & _
"WHERE project = " & rc(4) & " "
Set rc2= db.execute(SQL3)
If Not rc2.EOF Then
JNTS = rc2(0)
Else
JNTS = 0
End If
rc2.Close
set rc2 = nothing
SQL4 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'n' AND project = " & rc(4) & " "
Set rmz = db.execute(SQL4)
If Not rmz.EOF Then
TSKLST = rmz(0)
Else
TSKLST = 0
End If
rmz.Close
set rmz = nothing
SQL5 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'c' AND project = " & rc(4) & " "
Set rm1 = db.execute(SQL5)
If Not rm1.EOF Then
COMPLETE = rm1(0)
Else
COMPLETE = 0
End If
rm1.Close
set rm1 = nothing
SQL6 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'r' AND project = " & rc(4) & " "
Set rm2 = db.execute(SQL6)
If Not rm2.EOF Then
NOTCOM = rm2(0)
Else
NOTCOM = 0
End If
rm2.Close
set rm2 = nothing
SQL7 = "SELECT COUNT(taskstatus) " & _
"FROM grouptask " & _
"WHERE grouptask.taskstatus = 'y' AND project = " & rc(4) & " "
Set rm3 = db.execute(SQL7)
If Not rm3.EOF Then
HAlFCOM = rm3(0)
Else
HAlFCOM = 0
End If
rm3.Close
set rm3 = nothing
'response.write ("<script type=""text/vbscript"">MsgBox(""" & colr & """)</script>")
%>
<tr>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=i%>.</font></td>
<!--td valign="top" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>><font size="2" face="verdana" color="#0000FF"><%=FormatDate_d_mmm_yyyy(rc(1))%></font></td-->
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=rc(1)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><%=rc(2)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36"><font size="1" face="verdana" color="#0000FF"><p align="center"><%=rc(6)%></font></td>
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<p align="center">
<%if PRJID=rc(5) then %>
<a href="pmt_invite.asp?grpid=<%=rc(4)%>&grpnm=<%=rc(1)%>">
<img border="0" src="../Images/invite.gif" width="24" height="24" title="click here to invite members to join this group"></a></td>
<%else%>
<img border="0" src="../Images/invite.gif" width="24" height="24" title="Authorization to invite members is not allowed"></a></td>
<%end if%>
<!--
<td valign="middle" align=left style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>>
<p align="center">
<b><font size="2"><%=INV%></font></b></td>-->
<td valign="middle" align=center style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<a href="pmt_joint.asp?grpid=<%=rc(4)%>&grpnm=<%=rc(1)%>"><img border="0" src="../Images/join.gif" width="24" height="24" title="click here to view a list of members accept to join this group"></a></td>
<td valign="middle" align=center style="border-style:none; border-width:medium; " title="Members being assigned to this project" bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<b><font size="2" color=#000000 font.bold=true><%=JOI%></font></b></td>
<!--
<td valign="middle" align=center style="border-style:none; border-width:medium; " bordercolor="#C7D8D2" bgcolor=<%=altcolor%>>
<b><font size="2"><%=TOTMEM%></font></b></td>-->
<td valign="middle" align=center style="border-style:none; border-width:medium; " title="Amount of task being assigned to this project" bordercolor="#C7D8D2" bgcolor=<%=altcolor%> height="36">
<b><font size="2" color=#000000 font.bold=true><%=JNTS%></font></b></td>
<td align=center title="Amount of task within due date" bordercolor="#008000" bgcolor="lightgreen" height="38">
<b><font size="2" border="1" color= #0000FF font.bold=true><%=TSKLST%></font></b></td>
<td valign="middle" align=center title="Amount of task about to due" bordercolor="#C7D8D2" bgcolor="Yellow" height="38">
<b><font size="2" color=#3333FF font.bold=true><%=HAlFCOM%></font></b></td>
<td valign="middle" align=center border="1" title="Amount of task passed due date and late" bgcolor="red" height="38">
<b><font size="2" color=#3333FF font.bold=true><%=NOTCOM%></font></b></td>
<td valign="middle" align=center title="Amount of task completed" bordercolor="#FFFF00" bgcolor="blue" height="38">
<b><font size="2" color=#FFFFFF face="verdana" ><%=COMPLETE%></font></b></td>
</tr>
<%
i = i + 1
Response.Flush
rc.movenext
loop
rc.close
set rc = nothing
%>
<tr>
<td valign="middle" height="13" class="zipcode" style="border-style:none; border-width:medium; " align=left bgcolor="#FFFFFF" colspan="12">
</td>
</tr>
<td valign="middle" height="26" class="zipcode" align=left bgcolor="#FFFFFF" colspan="8">
<font face="Verdana"><b>No of records found = <%=kira%></b></font></td>
<td align="middle" colspan="4">
<%
Response.Write "<b>Page " & strPageNumber & " 0f " & CStr(lngNumberOfPages) & "</b>"
If strPageNumber = "1" Then
Response.Write " [ <img alt='First' src='../images/first_bw.gif' border='0'>"
Else
Response.Write " [ <a href=""#"" onclick=""GotoFirstPage()""><img alt='First' src='../images/first_clr.gif' border='0'></a>"
End If
If strPageNumber = "1" Then
Response.Write " | <img alt='Previous' src='../images/back_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoPreviousPage()""><b><img alt='Previous' src='../images/back_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Next' src='../images/forward_bw.gif' border='0'>"
Else
Response.Write " | <a href=""#"" onclick=""GotoNextPage()""><b><img alt='Next' src='../images/forward_clr.gif' border='0'></b></a>"
End If
If CLng(strPageNumber) = lngNumberOfPages Then
Response.Write " | <img alt='Last' src='../images/forward_bw.gif' border='0'> ]"
Else
Response.Write " | <a href=""#"" onclick=""GotoLastPage()""><img alt='Last' src='../images/last_clr.gif' border='0'></a> ]"
End If
%>
</td>
<input type="hidden" id="txtPageNumber" name="txtPageNumber" value="<%=strPageNumber%>">
<input type="hidden" id="txtNumberOfRecords" name="txtNumberOfRecords" value="<%=CStr(lngNumberOfRecords)%>">
<input type="hidden" id="txtNumberOfPages" name="txtNumberOfPages" value="<%=CStr(lngNumberOfPages)%>">
<input type="hidden" id="txtIsNavigation" name="txtIsNavigation">
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
<script language=vbscript>
sub GotoFirstPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = "1"
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoPreviousPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = CStr(CLng(form1.txtPageNumber.value) - 1)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoNextPage()
form1.action = "pmt_grouplist.asp?pagenumber="&CStr(CLng(form1.txtPageNumber.value) + 1)
form1.method = "Post"
form1.txtPageNumber.value = CStr(CLng(form1.txtPageNumber.value) + 1)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
sub GotoLastPage()
form1.action = "pmt_grouplist.asp"
form1.method = "Post"
form1.txtPageNumber.value = CStr(form1.txtNumberOfPages.value)
form1.txtIsNavigation.value = "True"
form1.submit
end sub
Sub OpenForm1(ID)
Dim strURL
strURL = UpdateWindow1("pmt_updatecheck.asp?TYPE=indvtask" & "&ID=" & ID)
If strURL <> "" Then
window.navigate strURL
End If
End Sub
Sub OpenForm2(ID)
Dim strURL
strURL = UpdateWindow1("pmt_updatestatus.asp?TYPE=indvtask" & "&ID=" & ID)
If strURL <> "" Then
window.navigate strURL
End If
End Sub
</script>
</html>
<%
db.close
set db = nothing
%>