当前位置:首页 > 网络技术 > 详细内容
社科成果奖评审结果积分核算分页及循环语句代码
发布时间:2010/4/19  阅读次数:714  字体大小: 【】 【】【

<!--#include file="../include/chkadmin.asp"-->
<!--#include file="../include/base.asp"-->
<html>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<script src="../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/css.css" rel="stylesheet" type="text/css">
<body style="background-color: #006699">
<!--
本系统由北漠空间—张科设计完成
联系方式:
手机:13.99120869
邮箱:zk6010@126.com
QQ:329627278
-->


<%
if Request("area")<>"" then
  set rs=server.createobject("adodb.recordset")
  set rsu=server.createobject("adodb.recordset")
  set rss1=server.createobject("adodb.recordset")
  set rss2=server.createobject("adodb.recordset")
  set rss3=server.createobject("adodb.recordset")
  set rss4=server.createobject("adodb.recordset")
  set rss5=server.createobject("adodb.recordset")
  set rss6=server.createobject("adodb.recordset")
  set rss7=server.createobject("adodb.recordset")
  rs.open "select * from item where area = '"&Request("area")&"'",conn,1,1
  if rs.eof and rs.bof then
    Response.Write "<div align='center'>数据库中没有符合您搜索条件的记录!<br>"
    Response.Write "三秒后自动返回搜索页面<br></div>"
    Response.Write "<meta http-equiv='refresh' content='3;url=scoreitem.asp'>"
    Response.End
  else
%>
<%
dim action
action=request.QueryString("action")    
Const MaxPerPage=20  
dim totalPut    
dim CurrentPage
dim TotalPages
dim sql
if Not isempty(request("page")) then
     currentPage=Cint(request("page"))
else
     currentPage=1
end if
%>
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#ffffff" style="border-collapse: collapse">
      
       <tr align="center" valign="middle">
           <td height="25" colspan="15" background="../Images/admin_table_bg.gif">
           <p align="center"><font color="#FFFFFF"><b>项目评审结果</b></font></td>
   </tr>
      
       <tr align="center" valign="middle">
           <td height="30" colspan="15" bgcolor="#D9E6FF"><div align="left">&nbsp;&nbsp;现有项目<font color="#FF0000"><%=rs.recordcount%></font>个&nbsp;<span class="STYLE1">&nbsp;(查看具体结果与打印结果报表请下载数据库后依据系统使用说明操作)</span></div></td>
       </tr>
       <tr align="center" valign="middle">
           <td width="4%" height="15" bgcolor="#D9E6FF">序号</td>
           <td width="19%" bgcolor="#D9E6FF">成果题目</td>
           <td width="7%" bgcolor="#D9E6FF">成果类别</td>
           <td width="13%" bgcolor="#D9E6FF">申报单位</td>
           <td width="7%" bgcolor="#D9E6FF">第一作者</td>
           <td width="6%" bgcolor="#D9E6FF">引用分</td>
           <td width="5%" bgcolor="#D9E6FF">评委1</td>
           <td width="5%" bgcolor="#D9E6FF">评委2</td>
           <td width="5%" bgcolor="#D9E6FF">评委3</td>
           <td width="5%" bgcolor="#D9E6FF">评委4</td>
           <td width="5%" bgcolor="#D9E6FF">评委5</td>
           <td width="5%" bgcolor="#D9E6FF">评委6</td>
           <td width="5%" bgcolor="#D9E6FF">评委7</td>
           <td width="8%" bgcolor="#D9E6FF">评委平均分</td>
           <td width="5%" bgcolor="#D9E6FF">终评分</td>
       </tr>
<% if err.number<>0 then
       response.write "<p align='center'>数据库中暂时无数据</p>"
       end if      
           if rs.eof And rs.bof then
                     Response.Write "<p align='center'>没有记录!</p>"
             else
totalPut=rs.recordcount
                   if currentpage<1 then
                           currentpage=1
                   end if

                   if (currentpage-1)*MaxPerPage>totalput then
                 if (totalPut mod MaxPerPage)=0 then
                     currentpage= totalPut \ MaxPerPage
                 else
                       currentpage= totalPut \ MaxPerPage + 1
                 end if
                   end if

                     if currentPage=1 then
                             showContent                            
                             showpage totalput,MaxPerPage,""&request.ServerVariables("script_name")&""  
                     else
                           if (currentPage-1)*MaxPerPage<totalPut then
                               rs.move   (currentPage-1)*MaxPerPage
                            
                               showContent
                                 showpage totalput,MaxPerPage,""&request.ServerVariables("script_name")&""  
                       else
                         currentPage=1
                               showContent
                              
                               showpage totalput,MaxPerPage,""&request.ServerVariables("script_name")&""  
                              
                     end if
               end if
                     end if
'=============分页类代码结束%>
<%'=============循环体开始
     sub showContent
     dim i
     i=0
     do while not rs.eof
  id=rs("id")
  title=rs("title")
  rsu.open "select * from unit where id = "&rs("unit_id"),conn,1,1
  unit=rsu("u_name")
  author=rs("author")
  citedscore=rs("cited")*2
  if citedscore>10 then
    citedscore=10
  end if
  rss1.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert1"),conn,1,1
  rss2.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert2"),conn,1,1
  rss3.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert3"),conn,1,1
  rss4.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert4"),conn,1,1
  rss5.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert5"),conn,1,1
  rss6.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert6"),conn,1,1
  rss7.open "select * from score where item_id = "&rs("id")&" and expert_id="&rs("expert7"),conn,1,1
  if rss1.bof and rss1.eof then
    expert1score=0
  else  
    expert1score=rss1("part1")+rss1("part2")+rss1("part3")+rss1("part4")+rss1("part5")
  end if
  if rss2.bof and rss2.eof then
    expert2score=0
  else
    expert2score=rss2("part1")+rss2("part2")+rss2("part3")+rss2("part4")+rss2("part5")
  end if
  if rss3.bof and rss3.eof then
    expert3score=0
  else
    expert3score=rss3("part1")+rss3("part2")+rss3("part3")+rss3("part4")+rss3("part5")
  end if
    if rss4.bof and rss4.eof then
    expert4score=0
  else  
    expert4score=rss4("part1")+rss4("part2")+rss4("part3")+rss4("part4")+rss4("part5")
  end if
    if rss5.bof and rss5.eof then
    expert5score=0
  else  
    expert5score=rss5("part1")+rss5("part2")+rss5("part3")+rss5("part4")+rss5("part5")
  end if
    if rss6.bof and rss6.eof then
    expert6score=0
  else  
    expert6score=rss6("part1")+rss6("part2")+rss6("part3")+rss6("part4")+rss6("part5")
  end if
    if rss7.bof and rss7.eof then
    expert7score=0
  else  
    expert7score=rss7("part1")+rss7("part2")+rss7("part3")+rss7("part4")+rss7("part5")
  end if
  expertscore2=(expert1score+expert2score+expert3score+expert4score+expert5score+expert6score+expert7score)/7
  expertscore=round(expertscore2,2)
  finallyscore=expertscore+citedscore
  num=0
%>
  <tr align="center" valign="middle">
           <td height="15" bgcolor="#D9E6FF"><%=id%></td>
           <td bgcolor="#D9E6FF"><%=title %></td>
           <td bgcolor="#D9E6FF"><%=rs("type") %></td>
           <td bgcolor="#D9E6FF"><%=unit %></td>
           <td bgcolor="#D9E6FF"><%=author %></td>
           <td bgcolor="#D9E6FF"><%=citedscore %></td>
           <td bgcolor="#D9E6FF"><%=expert1score %></td>
           <td bgcolor="#D9E6FF"><%=expert2score %></td>
           <td bgcolor="#D9E6FF"><%=expert3score %></td>
           <td bgcolor="#D9E6FF"><%=expert4score %></td>
           <td bgcolor="#D9E6FF"><%=expert5score %></td>
           <td bgcolor="#D9E6FF"><%=expert6score %></td>
           <td bgcolor="#D9E6FF"><%=expert7score %></td>
           <td bgcolor="#D9E6FF"><%=expertscore %></td>
           <td bgcolor="#D9E6FF"><%=finallyscore %></td>
   </tr>
   <%
  rsu.close
  rss1.close
  rss2.close
  rss3.close
  rss4.close
  rss5.close
  rss6.close
  rss7.close
   %>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close    
set rs=nothing
set rsu=nothing
set rss1=nothing
set rss2=nothing
set rss3=nothing
set rss4=nothing
set rss5=nothing
set rss6=nothing
set rss7=nothing
  End Sub    
%>      
   <%
   Function showpage(totalnumber,maxperpage,filename)  
           Dim n          
       If totalnumber Mod maxperpage=0 Then  
         n= totalnumber \ maxperpage  
       Else
         n= totalnumber \ maxperpage+1  
       End If %>     <tr align="center" valign="bottom">
           <td height="15" colspan="15" bgcolor="#D9E6FF"><form method=Post action=<%=filename%>>
       <%If CurrentPage<2 Then   %>
       首 页 上一页
       <% Else   %>
       <a href=<% = filename %>?page=1&area=<%=Request("area")%>>首 页</a> <a href=<% = filename %>?page=<% = CurrentPage-1 %>&area=<%=Request("area")%>>上一页</a>
       <% End If
       If n-currentpage<1 Then   %>
       下一页 尾 页
       <%   Else   %>
       <a href=<% = filename %>?page=<% = (CurrentPage+1) %>&area=<%=Request("area")%>>下一页</a> <a href=<% = filename %>?page=<% = n %>&area=<%=Request("area")%>>尾 页</a>&nbsp;&nbsp;
       <% End If   %>
       页次:<b><font color=red>
       <% = CurrentPage %>
       </font></b>/<b>
       <% = n %>
       </b>页 <b><%=maxperpage%></b>个记录/页 共<b><%=totalnumber %></b>个记录 转到:
<select name="cndok" onChange="javascript:location=this.options[this.selectedIndex].value;">
<%for i = 1 to n
if i = CurrentPage then%>
           <option value="<% = filename %>?page=<%=i%>&area=<%=Request("area")%>" selected>第<%=i%>页</option>
           <%else%>
           <option value="<% = filename %>?page=<%=i%>&area=<%=Request("area")%>">第<%=i%>页</option>
           <%end if
     next%>
       </select></form></td></tr><%End Function
%>
   </table>
<%
  end if
else
%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#ffffff" width="100%" height="82">
   <tr>
       <td width="100%" background="../Images/admin_table_bg.gif" height="25" align="center">
           <p align="center"><font color="#FFFFFF"><b>项目评审结果查询</b></font></td>
   </tr>
   <tr>
       <td width="100%" height="300" bgcolor="#D9E6FF" align="center">
  <form name="form1" method="post" action="scoreitem.asp">
     <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
               <tr>
                   <td align="center"><div align="center">按<span id="spryselect1">
                           <%call area("null") %>
                           <span class="selectRequiredMsg">请选择一个项目。</span></span><span id="sprytextfield1"><span class="textfieldRequiredMsg">需要提供一个值。</span></span> &nbsp;&nbsp;
                           <input type="submit" name="Submit" value="查看">
                       &nbsp;&nbsp;(支持模糊查询)</div></td>
               </tr>
           </table>
  </form></td>
   </tr>
</table>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {validateOn:["blur"]});
//-->
</script>
<%End if%>
</body>
</html>

我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!

 版权信息©2008-2011 All Rights Reserved 
关于本站|我的web2.0|甘肃社科|技术验证
注册许可证:甘公网安备 62010502000826号

CNZZ: