c-innovacion2/resoft/field_manager/process/project/plan/list.jsp

486 lines
18 KiB
Plaintext

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/field_manager/include/manager_head.jsp"%>
<%
String c_no = r_call(request.getParameter("c_project_no"));
if(c_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_no;
ResultSet rs_up = stmt.executeQuery(sql_up);
if (rs_up.next()) {
String sql_sub = "select * from tbl_project_plan where c_relation = 0 and c_project_no = " + c_no;
ResultSet rs_sub = stmt.executeQuery(sql_sub);
if (!rs_sub.next()) {
String sql_ins = "insert into tbl_project_plan (c_relation, c_project_no,c_propose_s_date,c_propose_e_date,c_bcb_s_date,c_bcb_e_date,c_bcb_period,c_date) values (0,"+ c_no +", CURDATE(),CURDATE(),CURDATE(),CURDATE(),1,now())";
stmt2.execute(sql_ins);
sql_ins = "insert into tbl_project_plan_bcb_period (c_project_no,c_period_no,c_s_date,c_e_date) values ("+ c_no +", 1,CURDATE(),CURDATE())";
stmt2.execute(sql_ins);
}
rs_sub.close();
sql_sub = "select * from tbl_project_plan where c_relation = 0 and c_project_no = " + c_no;
rs_sub = stmt.executeQuery(sql_sub);
if (rs_sub.next()) {
%>
<center>
<table width="800" 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 operation schedule management
</td>
</tr>
</table>
<!---------------------------------------------------------------------------------------->
<table width="100%" cellSpacing="0" cellPadding="0" border="0" bgcolor=ffffff>
<tr >
<td align=right style="line-height:120%">
<font color=red>
* The project operation schedule is linked to the project related items.
</font>
</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 Name </td>
<td style="padding:5px">
<font color=red><b><%=rs_up.getString("c_name")%></b></font>
</tr>
<tr height="40" height=30 bgcolor=ffffff>
<td colspan=2 align=center style="font-weight:bold;"> Project Status </td>
<td style="padding:5px;">
<b>
<%if(rs_sub.getInt("c_now") == 0){%>
<a href="change_mode.jsp?c_mode=c_now&c_value=1&c_project_no=<%=c_no%>"><font color=blue>Waiting</font></a>
<%}%>
<%if(rs_sub.getInt("c_now") == 1){%>
<a href="change_mode.jsp?c_mode=c_now&c_value=2&c_project_no=<%=c_no%>"><font color=red>Proceeding</font></a>
<%}%>
<%if(rs_sub.getInt("c_now") == 2){%>
<a href="change_mode.jsp?c_mode=c_now&c_value=0&c_project_no=<%=c_no%>">End</a>
<%}%>
</b>
&nbsp;&nbsp;
* You can change it by clicking on the status.
</tr>
<tr height=1 bgcolor=ffffff>
<td colspan=3 ></td>
</tr>
<script>
function none_block(flag1,flag2){
document.getElementById(flag1).style.display = "none";
document.getElementById(flag2).style.display = "block";
}
</script>
<%if(rs_up.getInt("c_propose") == 0){%>
<tr bgcolor=ffffff>
<td rowspan=2 width=15% align=center style="font-weight:bold;"> Application schedule</td>
<td height="40" width=10% align=center style="font-weight:bold;"> Now Status </td>
<td style="padding:5px;">
<%if(rs_sub.getInt("c_now") < 2){%>
<b>
<%if(rs_sub.getInt("c_now_propose") == 0){%>
<a href="change_mode.jsp?c_mode=c_now_propose&c_value=1&c_project_no=<%=c_no%>"><font color=blue>Waiting</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_propose") == 1){%>
<a href="change_mode.jsp?c_mode=c_now_propose&c_value=2&c_project_no=<%=c_no%>"><font color=red>Proceeding</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_propose") == 2){%>
<a href="change_mode.jsp?c_mode=c_now_propose&c_value=0&c_project_no=<%=c_no%>">End</a>
<%}%>
</b>
&nbsp;&nbsp;
* You can change it by clicking on the status.
<%}else{%>
<font color=red>* If the project is closed, it is not possible to change the status.
<%}%>
</tr>
<tr height="40" bgcolor=ffffff>
<td align=center style="font-weight:bold;"> term </td>
<td style="padding:5px;">
<span id="d11">
<b><%=rs_sub.getString("c_propose_s_date").substring(0,16)%> ~ <%=rs_sub.getString("c_propose_e_date").substring(0,16)%>
<%if(rs_sub.getInt("c_now") < 2 && rs_sub.getInt("c_now_propose") < 2){%>
<a href="#none" onclick="none_block('d11','d12')"><font color=blue>[Edit]</font></a>
<%}%>
</span>
<span id="d12" style="display:none">
<%
String d1 = rs_sub.getString("c_propose_s_date").substring(0,10);
String d2 = rs_sub.getString("c_propose_e_date").substring(0,10);
int h1 = Integer.parseInt(rs_sub.getString("c_propose_s_date").substring(11,13));
int h2 = Integer.parseInt(rs_sub.getString("c_propose_e_date").substring(11,13));
int m1 = Integer.parseInt(rs_sub.getString("c_propose_s_date").substring(14,16));
int m2 = Integer.parseInt(rs_sub.getString("c_propose_e_date").substring(14,16));
%>
<script>
function go_propose(){
document.bcb1.action="time_set.jsp"
document.bcb1.method="post"
document.bcb1.submit()
}
</script>
<table cellpadding=0 cellspacing=0>
<form name="bcb1">
<input name="c_project_no" value="<%=c_no%>" type="hidden">
<input name="c_mode" value="c_propose" type="hidden">
<tr><td>
<input name="c_propse_s_date" value="<%=d1%>" class="date-picker" type="text" style="width:80px" readonly>
</td><td style="padding-left:5px">
<select name="c_propse_s_time1" style="height:19px;">
<%for(int i = 0; i < 24; i++){%>
<option value="<%=i%>" <%if(i == h1){%>selected<%}%>><%=i%></option>
<%}%>
</select>
</td><td style="padding-left:5px">
:
</td><td style="padding-left:5px">
<select name="c_propse_s_time2" style="height:19px;">
<%for(int i = 0; i < 60; i++){%>
<option value="<%=i%>" <%if(i == m1){%>selected<%}%>><%=i%></option>
<%}%>
</select>
</td><td style="padding-left:10px">
~
</td><td style="padding-left:10px">
<input name="c_propse_e_date" value="<%=d2%>" class="date-picker" type="text" style="width:80px" readonly>
</td><td style="padding-left:5px">
<select name="c_propse_e_time1" style="height:19px;">
<%for(int i = 0; i < 24; i++){%>
<option value="<%=i%>" <%if(i == h2){%>selected<%}%>><%=i%></option>
<%}%>
</select>
</td><td style="padding-left:5px">
:
</td><td style="padding-left:5px">
<select name="c_propse_e_time2" style="height:19px;">
<%for(int i = 0; i < 60; i++){%>
<option value="<%=i%>" <%if(i == m2){%>selected<%}%>><%=i%></option>
<%}%>
</select>
</td><td style="padding-left:10px">
<a href="#none" onclick="go_propose()"><b><font color=blue>[Edit]</font></b></a>
<a href="#none" onclick="none_block('d12','d11')"><b>[Cancel]</b></a>
</td></tr>
</form>
</table>
</span>
</tr>
<%}else{%>
<tr height=40 bgcolor=ffffff>
<td align=center style="font-weight:bold;"> Apply Schedule </td>
<td colspan=2 align=center style="padding:5px;">
Not use
</tr>
<%}%>
<%if(rs_up.getInt("c_survey") == 0){%>
<tr height=40 bgcolor=ffffff>
<td width=15% align=center style="font-weight:bold;">Survey schedule </td>
<td width=10% align=center style="font-weight:bold;"> Current Status </td>
<td style="padding:5px;">
<%if(rs_sub.getInt("c_now") < 2){%>
<b>
<%if(rs_sub.getInt("c_now_survey") == 0){%>
<a href="change_mode.jsp?c_mode=c_now_survey&c_value=1&c_project_no=<%=c_no%>"><font color=blue>Waiting</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_survey") == 1){%>
<a href="change_mode.jsp?c_mode=c_now_survey&c_value=2&c_project_no=<%=c_no%>"><font color=red>Proceeding</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_survey") == 2){%>
<a href="change_mode.jsp?c_mode=c_now_survey&c_value=0&c_project_no=<%=c_no%>">End</a>
<%}%>
</b>
&nbsp;&nbsp;
* You can change it by clicking on the status.
<%}else{%>
<font color=red>* If the project is closed, it is not possible to change the status.
<%}%>
</tr>
<%}else{%>
<tr height=40 bgcolor=ffffff>
<td align=center style="font-weight:bold;"> Survey schedule </td>
<td colspan=2 align=center style="padding:5px;">
Not Use
</tr>
<%}%>
<%if(rs_up.getInt("c_point") == 0){%>
<tr height=40 bgcolor=ffffff>
<td width=15% align=center style="font-weight:bold;"> Evaluation schedule </td>
<td width=10% align=center style="font-weight:bold;"> Current Status </td>
<td style="padding:5px;">
<%if(rs_sub.getInt("c_now") < 2){%>
<b>
<%if(rs_sub.getInt("c_now_point") == 0){%>
<a href="change_mode.jsp?c_mode=c_now_point&c_value=1&c_project_no=<%=c_no%>"><font color=blue>Waiting</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_point") == 1){%>
<a href="change_mode.jsp?c_mode=c_now_point&c_value=2&c_project_no=<%=c_no%>"><font color=red>Proceeding</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_point") == 2){%>
<a href="change_mode.jsp?c_mode=c_now_point&c_value=0&c_project_no=<%=c_no%>">End</a>
<%}%>
</b>
&nbsp;&nbsp;
* You can change it by clicking on the status.
<%}else{%>
<font color=red>* If the project is closed, it is not possible to change the status.
<%}%>
</tr>
<%}else{%>
<tr height=40 bgcolor=ffffff>
<td align=center style="font-weight:bold;"> Evaluation schedule </td>
<td colspan=2 align=center style="padding:5px;">
Not Use
</tr>
<%}%>
<%if(rs_up.getInt("c_bcb") == 0){%>
<tr bgcolor=ffffff>
<td rowspan=3 width=15% align=center style="font-weight:bold;"> BMC Schedule </td>
<td height=40 width=10% align=center style="font-weight:bold;"> Current Status </td>
<td style="padding:5px;">
<%if(rs_sub.getInt("c_now") < 2){%>
<b>
<%if(rs_sub.getInt("c_now_bcb") == 0){%>
<a href="change_mode.jsp?c_mode=c_now_bcb&c_value=1&c_project_no=<%=c_no%>"><font color=blue>Waiting</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_bcb") == 1){%>
<a href="change_mode.jsp?c_mode=c_now_bcb&c_value=2&c_project_no=<%=c_no%>"><font color=red>Proceeding</font></a>
<%}%>
<%if(rs_sub.getInt("c_now_bcb") == 2){%>
<a href="change_mode.jsp?c_mode=c_now_bcb&c_value=0&c_project_no=<%=c_no%>">End</a>
<%}%>
</b>
&nbsp;&nbsp;
* You can change it by clicking on the status.
<%}else{%>
<font color=red>* If the project is closed, it is not possible to change the status.
<%}%>
</tr>
<tr bgcolor=ffffff>
<td height=40 width=10% align=center style="font-weight:bold;"> The whole period </td>
<td style="padding:5px;">
<b><%=rs_sub.getString("c_bcb_s_date").substring(0,10)%> ~ <%=rs_sub.getString("c_bcb_e_date").substring(0,10)%></b>
&nbsp;<font color=red>* PIf you edit eriod, it will change automatically.</font>
</tr>
<tr height=40 bgcolor=ffffff>
<td align=center style="font-weight:bold;"> Period </td>
<td style="padding:10px;">
<span id="d21">
<b>Total <%=rs_sub.getInt("c_bcb_period")%> Period</b>
<%if(rs_sub.getInt("c_now") < 2 && rs_sub.getInt("c_now_bcb") < 2){%>
<a href="#none" onclick="none_block('d21','d22')"><font color=blue><b>[Edit]</b></font></a>
<%}%>
</span>
<span id="d22" style="display:none">
<%
String d21 = rs_sub.getString("c_bcb_s_date").substring(0,10);
String d22 = rs_sub.getString("c_bcb_e_date").substring(0,10);
int m22 = rs_sub.getInt("c_bcb_period");
%>
<script>
function go_bcb(){
ok = 0;
s_p = Number(document.bcb2.c_bcb_period.value);
for(i=1;i<s_p+1;i++){
if(ok == 0){
if(document.getElementById("c_s_" + i).value == ""){
alert( i + " Please register the start date of the period.")
document.getElementById("c_s_" + i).focus()
ok = 1
}
}
if(ok == 0){
if(document.getElementById("c_e_" + i).value == ""){
alert( i + " Please register the end date of the period.")
document.getElementById("c_e_" + i).focus()
ok = 1
}
}
}
if(ok == 0){
for(i=1;i<s_p+1;i++){
if(ok == 0){
t1 = dateDiff(document.getElementById("c_s_" + i).value,document.getElementById("c_e_" + i).value)
if(t1 < 0){
alert( i + " The period's end date is before the start date.\nPlease check.")
document.getElementById("c_e_" + i).focus()
ok = 1
}
}
}
}
if(ok == 0){
for(i=2;i<s_p+1;i++){
if(ok == 0){
t = i - 1
t1 = dateDiff(document.getElementById("c_e_" + t).value,document.getElementById("c_s_" + i).value)
if(t1 != 1){
alert( i + " The start date of the period must be set to the next day of the "+ t +" period.\nPlease check.")
document.getElementById("c_s_" + i).focus()
ok = 1
}
}
}
}
if(ok == 0){
document.bcb2.action="period_set.jsp"
document.bcb2.method="post"
document.bcb2.submit()
}
}
function go_next_s(flag,flag2){
alert(flag + "/" + flag2)
}
function let_sub( flag ){
<%for(int i = 1; i < 11; i ++){%>
document.getElementById("pr<%=i%>").style.display = "none";
<%}%>
for(ii=1;ii<Number(flag) +1;ii=ii+1){
document.getElementById("pr" + ii).style.display = "block";
}
}
function dateDiff(_date1, _date2) {
var diffDate_1 = _date1 instanceof Date ? _date1 : new Date(_date1);
var diffDate_2 = _date2 instanceof Date ? _date2 : new Date(_date2);
diffDate_1 = new Date(diffDate_1.getFullYear(), diffDate_1.getMonth()+1, diffDate_1.getDate());
diffDate_2 = new Date(diffDate_2.getFullYear(), diffDate_2.getMonth()+1, diffDate_2.getDate());
var diff = diffDate_2.getTime() - diffDate_1.getTime();
// var diff = Math.abs(diffDate_2.getTime() - diffDate_1.getTime());
diff = Math.ceil(diff / (1000 * 3600 * 24));
return diff;
}
</script>
<table cellpadding=0 cellspacing=0>
<form name="bcb2">
<input name="c_project_no" value="<%=c_no%>" type="hidden">
<tr><td style="padding:10px">
<b>Period Setting</b>
<select name="c_bcb_period" style="height:24px" onchange="let_sub(this.value)">
<%for(int i = 1; i < 11; i ++){%>
<option value="<%=i%>" <%if(i ==rs_sub.getInt("c_bcb_period") ){%>selected<%}%>><%=i%></option>
<%}%>
</select>
</td></tr>
<tr><td >
<table cellpadding=0 cellspacing=1 bgcolor="#cdcdcd">
<tr bgcolor="#efefef">
<td align=center style="padding:5px"> Period Date </td>
</tr>
<% String sql_pr = "select * from tbl_project_plan_bcb_period where c_project_no = "+ c_no +" order by c_period_no asc ";
ResultSet rs_pe = stmt.executeQuery(sql_pr);
int c_p_no = 0;
while(rs_pe.next()){
c_p_no = c_p_no + 1;
%>
<tr bgcolor="#ffffff" id="pr<%=c_p_no%>">
<td align=center style="padding:5px">
<b><%=rs_pe.getInt("c_period_no")%>.</b>
&nbsp;
<input name="c_s_<%=c_p_no%>" id="c_s_<%=c_p_no%>" value="<%=rs_pe.getString("c_s_date")%>" class="date-picker" type="text" style="width:80px" readonly>
&nbsp; ~ &nbsp;
<input name="c_e_<%=c_p_no%>" id="c_e_<%=c_p_no%>" value="<%=rs_pe.getString("c_e_date")%>" class="date-picker" type="text" style="width:80px" readonly onchange="go_next_s(<%=c_p_no%>,this.value)">
</td>
</tr>
<%
}
rs_pe.close();
%>
<%for(int i = c_p_no + 1;i<11;i++){
%>
<tr bgcolor="#ffffff" id="pr<%=i%>" style="display:none">
<td align=center style="padding:5px">
<b><%=i%>.</b>
&nbsp;
<input name="c_s_<%=i%>" id="c_s_<%=i%>" value="" class="date-picker" type="text" style="width:80px" readonly>
&nbsp; ~ &nbsp;
<input name="c_e_<%=i%>" id="c_e_<%=i%>" value="" class="date-picker" type="text" style="width:80px" readonly >
</td>
</tr>
<%}%>
</table>
</td></tr>
<tr><td style="padding:10px" align=center>
<br>
<a href="#none" onclick="go_bcb()"><b><font color=blue>[Edit]</font></b></a>
<a href="#none" onclick="none_block('d22','d21')"><b>[Cancel]</b></a>
</td></tr>
</form>
</table>
</span>
</tr>
<%}else{%>
<tr height=40 bgcolor=ffffff>
<td align=center style="font-weight:bold;"> BMC Schedulr </td>
<td colspan=2 align=center style="padding:5px;">
Not Use
</tr>
<%}%>
</table>
<!---------------------------------------------------------------------------------------->
<!--
<table width="100%">
<tr>
<td height="35" align="right" colspan="5" style="padding-bottom:10px;padding-top:10px;font-weight:bold;">
<a href="#none" onclick="go()" style="width: 50px; line-height: 26px; text-align: center;display: inline-block; background: #5e7cc4; border: 1px solid #555; border-radius: 5px; color: #ffffff;">Edit</a>
<a href="" style="width: 50px; line-height: 26px; text-align: center;display: inline-block; background: #ededed; border: 1px solid #555; border-radius: 5px; color: #000000;">취소</a>
</td>
</tr>
</table>
-->
</td>
</tr>
</table>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>
<iframe name="exec" width=0 height=0 src=""></iframe>
<%
}
rs_sub.close();
}
rs_up.close();
}%>
<%@include file="/field_manager/include/manager_bottom.jsp"%>