c-innovacion2/resoft/field_manager/process/bcb/statistic/list.jsp

193 lines
6.4 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/field_manager/include/manager_head.jsp"%>
<%
int c_home = 0;
String s_year = r_call(request.getParameter("s_year"));
Calendar currentCalendar = Calendar.getInstance();
int now_year = currentCalendar.get(Calendar.YEAR);
int now_month = currentCalendar.get(Calendar.MONTH) + 1;
int c_year = now_year;
if(!s_year.equals("")){
c_year = Integer.parseInt(s_year);
}
%>
<%
String c_project_no = r_call(request.getParameter("c_project_no"));
if(c_project_no.equals("")){
%>
<script>
alert("Wrong Connection.")
location.href="/"
</script>
<%
}else{
String sql_up = " SELECT c.*, a.c_name as u_name, b.c_name as f_name from tbl_project c ";
sql_up = sql_up + " inner join tbl_project a on a.c_no = c.c_up_no ";
sql_up = sql_up + " inner join tbl_field b on b.c_no = a.c_field ";
sql_up = sql_up + " where c.c_no = " + c_project_no;
ResultSet rs_up = stmt.executeQuery(sql_up);
if (rs_up.next()) {
%>
<center>
<table width="1000" cellSpacing="0" cellPadding="0" border="0">
<tr >
<td >
<table width="100%" cellSpacing="0" cellPadding="0" border="0" bgcolor=ffffff>
<tr >
<td height="60" style="font-weight:bold;">
Project BMC access statistics
</td>
</tr>
</table>
<!---------------------------------------------------------------------------------------->
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor=dddddd >
<tr height="40" bgcolor=ffffff>
<td colspan=2 width="25%" align=center style="font-weight:bold;"> Field</td>
<td width="75%" style="padding:5px">
<b><%=rs_up.getString("f_name")%>
</td>
</tr>
<tr height="40" bgcolor=ffffff>
<td colspan=2 align=center style="font-weight:bold;"> Category</td>
<td style="padding:5px">
<b><%=rs_up.getString("u_name")%>
</td>
</tr>
<tr height="40" height=30 bgcolor=ffffff>
<td colspan=2 align=center style="font-weight:bold;"> Project </td>
<td style="padding:5px">
<font color=red><b><%=rs_up.getString("c_name")%></b></font>
</tr>
</table>
<%
}
rs_up.close();
%> <br>
<!---------------------------------------------------------------------------------------->
<script>
function s_search(){
document.s_bcb.action="list.jsp?c_project_no=<%=c_project_no%>";
document.s_bcb.method="post";
document.s_bcb.submit();
}
</script>
<table width="100%" cellSpacing="0" cellPadding="0" border="0" bgcolor=ffffff>
<form name="s_bcb" action="list.jsp" method="post" target="_self">
<tr >
<td align=left valign=bottom style="line-height:120%;padding-bottom:5px">
<select name="s_year" style="height:24px" onchange="s_search()">
<%for(int y = 2018 ; y < now_year + 1 ; y++){%>
<option value="<%=y%>" <%if(c_year == y){%>selected<%}%>><%=y%></option>
<%}%>
</select>
</td>
</tr>
</form>
</table>
<table width="100%" cellSpacing="1" cellPadding="0" border="0" bgcolor=cdcdcd>
<tr bgcolor=ededed style="font-weight:bold;">
<td height="26px" align=center>Menu</td>
<%for(int m = 1 ; m < 13 ; m++){%>
<td align=center width=60><%=m%>Month</td>
<%}%>
</tr>
<%
int m_co[] = new int[13];
String sql1=" SELECT * from tbl_menu where c_no > 1 and c_up_no = 0 and c_home="+ c_home +" order by c_no asc";
ResultSet rst = stmt.executeQuery(sql1);
while (rst.next()) {
%>
<%
for(int cho = 0; cho < 13; cho++){
m_co[cho] = 0;
}
String sql_co = "select c_visit, c_month from tbl_visit where c_home = "+ c_home +" and c_project_no = "+ c_project_no +" and c_show_no = "+ rst.getInt("c_no") +" and c_c_no = 0 and c_year = " + c_year + " order by c_month asc ";
ResultSet rs_co = stmt.executeQuery(sql_co);
while(rs_co.next()){
m_co[rs_co.getInt("c_month")] = rs_co.getInt("c_visit");
}
rs_co.close();
%>
<%
if(rst.getInt("c_no") == 10){%>
<tr bgcolor=ffffff >
<td height="26px" align=left style="padding-left:10px" colspan=13>Data </td>
</tr>
<%}
%>
<tr bgcolor=ffffff onMouseover="this.bgColor='#B9C1FF'" onMouseout="this.bgColor='#ffffff'" >
<td height="26px" align=left style="padding-left:<%if(rst.getInt("c_no") > 9 && rst.getInt("c_no") <13){%>30px<%}else{%>10px<%}%>" ><%if(rst.getInt("c_no") > 9 && rst.getInt("c_no") <13){%>└<%}%> <%=rst.getString("c_name")%> </td>
<%for(int m = 1 ; m < 13 ; m++){%>
<td align=center >
<%if(m_co[m]>0){%>
<%=m_co[m]%>
<%}%>
</td>
<%}%>
</tr>
<% }
rst.close();
%>
<tr bgcolor=ffffff >
<td height="26px" align=left style="padding-left:10px" colspan=13>Membership </td>
</tr>
<%
String sql121=" SELECT * from tbl_menu where c_up_no = 1 order by c_order asc";
ResultSet rst2 = stmt2.executeQuery(sql121);
while (rst2.next()) {
%>
<%
for(int cho = 0; cho < 13; cho++){
m_co[cho] = 0;
}
String sql_co = "select c_visit , c_month from tbl_visit where c_home = "+ c_home +" and c_project_no = "+ c_project_no +" and c_show_no = "+ rst2.getInt("c_no") +" and c_c_no = 0 and c_year = " + c_year + " order by c_month asc ";
ResultSet rs_co = stmt.executeQuery(sql_co);
while(rs_co.next()){
m_co[rs_co.getInt("c_month")] = rs_co.getInt("c_visit");
}
rs_co.close();
%>
<tr bgcolor=ffffff onMouseover="this.bgColor='#B9C1FF'" onMouseout="this.bgColor='#ffffff'">
<td height="26px" align=left style="padding-left:30px" >└ <%=rst2.getString("c_name")%> </td>
<%for(int m = 1 ; m < 13 ; m++){%>
<td align=center >
<%if(m_co[m]>0){%>
<%=m_co[m]%>
<%}%>
</td>
<%}%>
</tr>
<% }
rst2.close();
%>
</table>
<!---------------------------------------------------------------------------------------->
</tr>
</table>
<br />
<br />
<br />
<br />
<%
}
%>
<%@include file="/field_manager/include/manager_bottom.jsp"%>