//orgview.jsp
<%@ page contenttype="text/html;charset=big5"%>
<%@ include file="orgconninclude.jsp"%>
<%
request.setcharacterencoding("big5");
preparedstatement ps=null;
resultset rs=null;
string querycount=" select count(*) "+
" from ngb_org "+
" where total like ? order by total ";
string queryname=" select * "+
" from ngb_org "+
" where total like ? order by total ";
%>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=big5">
<title>組織架構</title>
<style type="text/css">
<!–
.style1 {color: #ffffff}
–>
</style>
</head>
<body>
<font color="#0099ff" size=4><center>*****有限公司組織架構圖</center></font>
<div align="right"><a href="orgmanage.jsp">管理入口</a>
</div>
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<!–th width="7%" rowspan="2" bgcolor="#0099ff" scope="col"> </th–>
<th width="29%" bgcolor="#0099ff" scope="col"><span class="style1">總經理</span></th>
<th width="19%" bgcolor="#0099ff" scope="col"><span class="style1">總經理直屬</span></th>
<th width="19%" bgcolor="#0099ff" scope="col"><span class="style1">處級所屬</span></th>
<th width="19%" bgcolor="#0099ff" scope="col"><span class="style1">部級所屬</span></th>
</tr>
<%
try{
int i=1;
ps=conn.preparestatement(querycount);
ps.setstring(1, "a10%");
rs=ps.executequery();
int result=1;
while(rs.next())
{ result++;}
//out.println(result);
for( i=1; i<=result; i++){
ps=conn.preparestatement(queryname) ;
string querynamecondition="a"+(9+i)+"%";
//out.println(querynamecondition);
ps.setstring(1, querynamecondition);
resultset rs1=ps.executequery();
string qa=null;
string qatemp=null;
string qatemp1=null;
while( rs1.next()){
qa=rs1.getstring("total");
qatemp=qa.substring(0,3);
qatemp1=qa.substring(3,6);
%>
<tr bgcolor="#f0f8ff">
<td width="29%" height="18"><%=rs1.getstring("name")%></td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"> </td>
</tr>
<%
querynamecondition=qatemp1+"%";
//out.println(querynamecondition);
ps.setstring(1, querynamecondition);
resultset rs2=ps.executequery();
int result1=1;
while(rs2.next())
{ result1++;}
//out.println(result1);
for( i=1; i<=result1; i++){
ps=conn.preparestatement(queryname) ;
ps.setstring(1, querynamecondition);
resultset rs3=ps.executequery();
string qb=null;
string qbtemp=null;
string qbtemp1=null;
while( rs3.next()){
qb=rs3.getstring("total");
qbtemp=qb.substring(3,5);
qbtemp1=qb.substring(3,6);
%>
<tr bgcolor="#f0f8ff">
<td width="29%" height="18"> </td>
<td width="19%" height="18"><%=rs3.getstring("name")%></td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"> </td>
</tr>
<%
ps=conn.preparestatement(querycount);
querynamecondition=qbtemp1+"%";
//out.println(querynamecondition);
ps.setstring(1, querynamecondition);
resultset rs4=ps.executequery();
int result2=1;
while(rs4.next())
{ result2++;}
//out.println(result);
for( i=1; i<=result2; i++){
ps=conn.preparestatement(queryname) ;
ps.setstring(1, querynamecondition);
resultset rs5=ps.executequery();
string qc=null;
string qctemp=null;
string qctemp1=null;
while( rs5.next()){
qc=rs5.getstring("total");
qctemp=qc.substring(3,5);
qctemp1=qc.substring(3,6);
%>
<tr bgcolor="#f0f8ff">
<td width="29%" height="18"> </td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"><%=rs5.getstring("name")%></td>
<td width="19%" height="18"> </td>
</tr>
<%
/* ps=conn.preparestatement(queryc2);
resultset qd2=ps.executequery();
int cd2=0;
while(qd2.next())
{cd2++;}
out.println(cd2);
ps=conn.preparestatement(querycount);
if(cd2>0)
{ querynamecondition="d"+(i+19)+"%";}
else
{ querynamecondition="d"+(i+9)+"%";}*/
ps=conn.preparestatement(querycount);
querynamecondition=qctemp1+"%";
//out.println(querynamecondition);
ps.setstring(1, querynamecondition);
resultset rs6=ps.executequery();
int result3=1;
while(rs6.next())
{ result3++;}
//out.println(result3);
for( i=1; i<=result3; i++){
ps=conn.preparestatement(queryname) ;
ps.setstring(1, querynamecondition);
resultset rs7=ps.executequery();
while( rs7.next()){
%>
<tr bgcolor="#f0f8ff">
<td width="29%" height="18"> </td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"> </td>
<td width="19%" height="18"><%=rs7.getstring("name")%></td>
</tr>
<%
ps=conn.preparestatement(querycount);
querynamecondition="e"+(i+9)+"%";
//out.println(querynamecondition);
ps.setstring(1, querynamecondition);
resultset rs8=ps.executequery();
int result4=1;
while(rs8.next())
{ result4++;}
//out.println(result3);
for( i=1; i<=result4; i++){
ps=conn.preparestatement(queryname) ;
ps.setstring(1, querynamecondition);
resultset rs9=ps.executequery();
while(rs9.next()){
rs9.getstring("name"); %>
<%}}%>
<%}}%>
<% }}%>
<% }}%>
<%}}%>
</table>
</body>
<%}
catch(sqlexception se1)
{se1.printstacktrace();}
finally{conn.close();}%>
</html>