<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../checkuser.asa"-->
<%
if session("grade")="1" then
response.write"<SCRIPT language=JavaScript>alert('对不起,你没有操作此栏目的权限!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if
%>
<body bgcolor="#C6DBFF" style="font-size: 10pt">
<table width="122%" cellspacing="0" cellpadding="0" align=left class="tableBorder" size=2 color="#FF0000">
<font >
<tr>
</tr>
<table border="0" width="122%" id="table2">
<tr><td width="122%" height="122%">
<p>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from nsr_info"
rs.open sql,conn,1,1
allnum=rs.RecordCount
'取得最大的层数MaxLevel%>
<%
MaxLevel=1
for i=1 to allnum
if rs("ParentID")>MaxLevel then
MaxLevel=rs("ParentID")
else
MaxLevel=MaxLevel
end if
rs.movenext
next
rs.close
set rs=nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>纳税人基本情况</title>
<style type="text/css">
<!--
td {
font-size: 12px;
}
-->
</style>
<script language="javascript">
<!--
function divshow(cmy1,cmy2,cmy3)
file://展开/合并菜单函数
{
if(document.all("div"+cmy1+cmy2+cmy3).style.display==""){
document.all("div"+cmy1+cmy2+cmy3).style.display="none"
}
else{
document.all("div"+cmy1+cmy2+cmy3).style.display=""
}
}
file://-->
</script>
</head>
<body bgcolor="#33CCFF" topmargin="0" onload="divshow(1,0,1);">
<table border="0" cellpadding="0" cellspacing="0">
<%
dim toumh(10) '定义用于存放菜单前显示树图片的数组,如果应用时的最大级数大于十,请扩大数组维数
call menutree(1,0,MaxLevel,1)'首次调用菜单输出函数
'第一个参数:菜单的级数
'第二个参数:父菜单的ID,一级菜单默认为零
'第三个参数:菜单的最大级数
'第四个参数:用于区分层的名称,方便实现菜单的展开合并
%>
</table>
<%
'funno 菜单的级数
'funcid 父菜单的ID,一级菜单父级ID值为0
'MaxLevel 菜单的最大级数
'divno 用于区分层的名称,方便实现菜单的展开合并
'menutree() 数形菜单输出函数
function menutree(funno,nsrid,MaxLevel,divno)
dim rsfun,numfun,funcidfun
if session("shnum")<>"" then
set rsl = server.CreateObject ("adodb.recordset")
sqll = "select * from nsr_info where tax_no='"&session("shnum")&"'"
rsl.Open sqll,conn,1,1
strQuery1="select * from nsr_info where tlid='"&rsl("tlid")&"' and ParentStr='"&nsrid&"'"
end if
if session("mcname")<>"" then
set rsmc = server.CreateObject ("adodb.recordset")
sqlmc = "select * from nsr_info where tax_name='"&session("mcname")&"'"
rsmc.Open sqlmc,conn,1,1
strQuery1="select * from nsr_info where tlid='"&rsmc("tlid")&"' and ParentStr='"&nsrid&"'"
end if
set rsfun=server.createobject("adodb.recordset")
rsfun.open strQuery1,conn,1,1
numfun=rsfun.RecordCount
response.Write("<tr><td>")
response.Write("<div id='div"&funno&nsrid&divno&"' style='display:none'>")'输出层,并根据相关参数给层定义唯一的ID名称
response.Write("<table border='0' cellpadding='0' cellspacing='0'>")
for j=1 to numfun
funcidfun=rsfun("nsrid")
if j=numfun then '判断是否是本级菜单的最后一个
toumh(funno)="space.gif" '是则输出空白图片space.gif
else
toumh(funno)="line_v.gif" '否则输出竖线图片line_v.gif
end if
'判断是否有下级菜单
strQuery2="select * from nsr_info where ParentStr='"&funcidfun&"'"
set rsfun2=server.createobject("adodb.recordset")
rsfun2.open strQuery2,conn,1,1
numfun2=rsfun2.RecordCount
orders=rsfun("orders")
'如果numfun2>0则有,反之则无
if numfun2 > 0 then
response.Write("<tr onClick='javascriptivshow("&funno+1&","&funcidfun&","&j&");' style='cursor:hand'>")
'用单击事件调用展开/合并菜单函数
else
response.Write("<tr style='cursor:hand'>")
end if
response.Write("<td>")
if numfun2 > 0 then
treeico="close_normal.gif"
if j=numfun then
treeico="close_end.gif"
end if
else
treeico="none_normal.gif"
if j=numfun then
treeico="none_end.gif"
end if
end if
for m=1 to cint(funno)-1 '根据当前菜单的级数输出菜单前的数形图片
response.Write("<img src='images/"&toumh(m)&"' align='absMiddle'>")
next
response.Write("<img src='images/"&treeico&"' align='absMiddle'><a style='text-decoration: none' href=nsr_edit.asp?nsr_id="&rsfun("nsrid")&"&tax_name="&rsfun("tax_name")&"&tax_no="&rsfun("tax_no")&" target='I2'>"&left(rsfun("tax_name"),8))'输出可用菜单名
Response.Write "</a>"
if rsfun("orders")<>"0" then
Response.Write "["
Response.Write orders
Response.Write "]"
end if
response.Write("</td>")
response.Write("</tr>")
if cint(funno)<cint(MaxLevel) then
call menutree(cint(funno)+1,funcidfun,MaxLevel,j) '递归调用 menutree()函数
end if
rsfun.movenext
next
'response.Write("</td></tr>")
response.Write("</table></div>")
response.Write("</td></tr>")
end function
%></html></table></font>
</td>