Files
KIN/statistics/team_project_count_detail.asp
2025-09-29 17:55:08 +09:00

341 lines
17 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<%
Dim searchDate, tmp_year, tmp_month, team_depart, gubun, currentYear
Dim tmp_p_sn, tmp_p_child_sn, tmp_subject, tmp_method_cd
Dim s_date, e_date, d_count, p_count, sum_count_money
searchDate = request("date")
team_depart = request("depart")
gubun = request("gubun")
currentYear = request("currentYear")
tmp_year = Left(searchDate, 4)
If right(searchDate, 2) = "이월" Then
tmp_year = cstr(cint(tmp_year) + 1)
tmp_month = "0"
Else
tmp_month = right(searchDate, 2)
End if
%>
<!-- #include virtual = "statistics/inc_team_project_next.asp" -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<style>
</style>
<!-- Content Header (Page header) -->
<div class="content-header">
<h1>상세 실적</h1>
</div>
<!-- /.content-header -->
<!-- Main content -->
<div class="content-body">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;" class="p-2">
<!-------------------1. 계약 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<% If CStr(gubun) = "1" Then %>
<tr><td><%=Left(searchDate, 4)&"년 "%><%=right(searchDate, 2)&"월 "%>계약 프로젝트</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="11%" class="text-center">수주일<br>(weeknum)</td>
<td width="11%" class="text-center">프로젝트코드</td>
<td width="30%" class="text-center">프로젝트명</td>
<td width="12%" class="text-center">수주실적</td>
<td width="12%" class="text-center">수행실적</td>
<td width="12%" class="text-center">예상직접비</td>
<td width="12%" class="text-center">예상공헌이익</td>
</tr>
<% '1. 계약실적 쿼리문
query = ""
query = query & " SELECT S.team_name, S.team_cd, S.p_sn, V.p_subject, SUM(S.p_total_cost) as p_total_cost "&VbCrlf
query = query & " , S.p_decide_date "&VbCrlf
query = query & " , S.weeknum "&VbCrlf
query = query & " , SUM(S.p_cont_cost) as p_cont_cost, SUM(S.est_money) as est_money "&VbCrlf
query = query & " , SUM(S.act_money) as act_money, SUM(S.cost_money) as cost_money "&VbCrlf
query = query & " , SUM(S.entertain_money) as entertain_money, SUM(S.tf_money) as tf_money "&VbCrlf
query = query & " , SUM(S.benefit) as benefit "&VbCrlf
query = query & " FROM #statistics_next S LEFT OUTER JOIN V_PROJECT V ON S.p_sn = V.p_sn "&VbCrlf
query = query & " WHERE 1=1 "&VbCrlf
if tmp_month = "0" then
query = query & " AND substring(S.p_decide_date, 1,7) < '" & tmp_year & "-01' AND S.p_statistics = '" & currentYear & "' "&VbCrlf
else
query = query & " AND substring(S.p_decide_date, 1,7) = '" & tmp_year &"-"& tmp_month & "' "&VbCrlf
end if
query = query & " AND (S.hd_cd = '"& team_depart &"' or S.team_cd = '"& team_depart &"') "&VbCrlf
query = query & " GROUP BY S.team_name, S.team_cd, S.p_sn, V.p_subject, S.p_decide_date, S.weeknum "&VbCrlf
query = query & " ORDER BY S.team_name, S.p_decide_date, S.weeknum, S.p_sn "&VbCrlf
'Response.Write query & "<br>"
'adminView("<br>1. 계약실적 쿼리문<br>")
'adminView(query)
adors.Open query, adoconn,adOpenStatic,adLockReadOnly
if adors.RecordCount > 0 then
Dim total_cost
Dim cont_cost
sum_total_cost = 0
sum_cont_cost = 0
sum_est_money = 0
sum_benefit = 0
Do while Not adors.Eof
total_cost = adors("p_total_cost")
cont_cost = adors("p_cont_cost")
If right(searchDate, 2) = "이월" Then'##### 이월된 프로젝트의 수행계획서 인경우 수주실적 = 수행실적(2018-10-24)
If total_cost = 0 Then total_cost = cont_cost
End If
%>
<tr>
<td class="text-center"><%=adors("p_decide_date") %><br>(<%=adors("weeknum") %>)</td>
<td class="text-center"><%=adors("p_sn") %></td>
<td class="text-left"><%=adors("p_subject") %></td>
<td class="text-right"><%=formatnumber(total_cost,0) %></td>
<td class="text-right"><%=formatnumber(cont_cost,0) %></td>
<td class="text-right"><%=formatnumber(adors("est_money"),0) %></td>
<td class="text-right"><%=formatnumber(adors("benefit"),0) %></td>
</tr>
<%
sum_total_cost = sum_total_cost + cdbl(total_cost)
sum_cont_cost = sum_cont_cost + cdbl(cont_cost)
sum_est_money = sum_est_money + cdbl(adors("est_money"))
sum_benefit = sum_benefit + cdbl(adors("benefit"))
adors.MoveNext
Loop
%>
<tr>
<td class="font-weight-bold text-center" colspan="3">합 계</td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_total_cost,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_cont_cost,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_est_money,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_benefit,0) %></td>
</tr>
<%
end if
adors.Close
%>
</table>
</td>
</tr>
<% End If %>
<!-------------------1. 계약 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-------------------2. 진행 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<% If CStr(gubun) = "2" Then %>
<tr><td><%=Left(searchDate, 4)&"년 "%><%=right(searchDate, 2)&"월 "%>진행 프로젝트</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="10%" class="text-center">수주일<br>(weeknum)</td>
<td width="10%" class="text-center">프로젝트코드</td>
<td width="30%" class="text-center">프로젝트명</td>
<td width="10%" class="text-center">수행실적</td>
<td width="10%" class="text-center">예상직접비</td>
<td width="10%" class="text-center">실제직접비<br>+진행비</td>
<td width="10%" class="text-center">예상공헌이익</td>
</tr>
<% '2. 진행실적 쿼리문
query = ""
query = query & " SELECT S.team_name, S.team_cd, S.p_child_sn, V.p_subject, S.p_total_cost, V.p_method_cd, V.p_sub_type "&VbCrlf
query = query & " , S.p_decide_date "&VbCrlf
query = query & " , S.weeknum "&VbCrlf
query = query & " , SUM(S.p_cont_cost) as p_cont_cost, SUM(S.est_money) as est_money "&VbCrlf
query = query & " , SUM(S.act_money) as act_money, SUM(S.cost_money) as cost_money "&VbCrlf
query = query & " , SUM(S.entertain_money) as entertain_money, SUM(S.tf_money) as tf_money "&VbCrlf
query = query & " , SUM(S.benefit) as benefit "&VbCrlf
query = query & " FROM #statistics_next S LEFT OUTER JOIN V_PROJECT_METHOD V ON S.p_child_sn = V.p_child_sn "&VbCrlf
query = query & " WHERE 1=1 "&VbCrlf
if tmp_month = "0" then
query = query & " AND substring(S.p_child_sn, 1,4) < '" & right(tmp_year, 2) & "01' AND S.p_statistics = '" & currentYear & "' "&VbCrlf
else
query = query & " AND substring(S.p_child_sn, 1,4) = '" & right(tmp_year, 2) & tmp_month & "' "&VbCrlf
end if
query = query & " AND (S.hd_cd = '"& team_depart &"' or S.team_cd = '"& team_depart &"') "&VbCrlf
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 진행 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " AND S.p_progress_status = '008' AND S.complete_yn = '0' "&VbCrlf
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ↑↑ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " GROUP BY S.team_name, S.team_cd, S.p_child_sn, V.p_subject, S.p_total_cost, V.p_method_cd, V.p_sub_type "&VbCrlf
query = query & " , S.p_decide_date, S.weeknum "&VbCrlf
query = query & " ORDER BY S.team_name, S.p_child_sn "&VbCrlf
adors.Open query, adoconn,adOpenStatic,adLockReadOnly
if adors.RecordCount > 0 then
sum_cont_cost = 0
sum_est_money = 0
sum_act_money = 0
sum_benefit = 0
Do while Not adors.Eof
%>
<tr>
<td class="text-center"><%=adors("p_decide_date") %><br>(<%=adors("weeknum") %>)</td>
<td class="text-center"><%=adors("p_child_sn") %></td>
<td class="text-left">
<a href="javascript:openit('1','<%=LEFT(adors("p_child_sn"), 7)%>','<%=adors("p_sub_type")%>','<%=adors("p_method_cd")%>','<%=adors("p_child_sn")%>')" class="blue"><%=adors("p_subject") %></a>
</td>
<td class="text-right"><%=formatnumber(adors("p_cont_cost"),0) %></td>
<td class="text-right"><%=formatnumber(adors("est_money"),0) %></td>
<td class="text-right"><%=formatnumber(cdbl(adors("act_money")) + cdbl(adors("cost_money")) + cdbl(adors("entertain_money")) + cdbl(adors("tf_money")),0) %></td>
<td class="text-right"><%=formatnumber(adors("benefit"),0) %></td>
</tr>
<%
sum_cont_cost = sum_cont_cost + cdbl(adors("p_cont_cost"))
sum_est_money = sum_est_money + cdbl(adors("est_money"))
sum_act_money = sum_act_money + cdbl(adors("act_money")) + cdbl(adors("cost_money")) + cdbl(adors("entertain_money")) + cdbl(adors("tf_money"))
sum_benefit = sum_benefit + cdbl(adors("benefit"))
adors.MoveNext
Loop
%>
<tr>
<td class="font-weight-bold text-center" colspan="3">합 계</td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_cont_cost,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_est_money,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_act_money,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_benefit,0) %></td>
</tr>
<%
end if
adors.Close
%>
</table>
</td>
</tr>
<% End If %>
<!-------------------2. 진행 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-------------------3. 종료 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<% If CStr(gubun) = "3" Then %>
<tr><td><%=Left(searchDate, 4)&"년 "%><%=right(searchDate, 2)&"월 "%>종료 프로젝트</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="10%" class="text-center">수주일<br>(weeknum)</td>
<td width="10%" class="text-center">프로젝트코드</td>
<td width="30%" class="text-center">프로젝트명</td>
<td width="10%" class="text-center">수행실적</td>
<td width="10%" class="text-center">예상직접비</td>
<td width="10%" class="text-center">실제직접비<br>+진행비</td>
<td width="10%" class="text-center">공헌이익</td>
</tr>
<% '2. 진행실적 쿼리문
query = ""
query = query & " SELECT LEFT(S.p_con_date_end, 7) as p_con_date_end, S.team_name, S.team_cd, S.p_child_sn, V.p_subject, S.p_total_cost, V.p_method_cd, V.p_sub_type "&vbCrlf
query = query & " , S.p_decide_date "&VbCrlf
query = query & " , S.weeknum "&VbCrlf
query = query & " , SUM(S.p_cont_cost) as p_cont_cost, SUM(S.est_money) as est_money "&vbCrlf
query = query & " , SUM(S.act_money) as act_money, SUM(S.cost_money) as cost_money "&vbCrlf
query = query & " , SUM(S.entertain_money) as entertain_money, SUM(S.tf_money) as tf_money "&vbCrlf
query = query & " , SUM(S.benefit) as benefit "&vbCrlf
query = query & " FROM #statistics_next S LEFT OUTER JOIN V_PROJECT_METHOD V ON S.p_child_sn = V.p_child_sn "&vbCrlf
query = query & " WHERE S.p_statistics = '" & currentYear & "' "&vbCrlf
if tmp_month = "0" then
query = query & " AND LEFT(S.p_con_date_end, 7) < '" & tmp_year & "-01' "&vbCrlf
else
query = query & " AND LEFT(S.p_con_date_end, 7) = '" & tmp_year & "-" & tmp_month & "' "&vbCrlf
end if
query = query & " AND (S.hd_cd = '"& team_depart &"' or S.team_cd = '"& team_depart &"') "&vbCrlf
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 종료 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " AND S.complete_yn = '1' "&vbCrlf
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ↑↑ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " GROUP BY S.p_con_date_end, S.team_name, S.team_cd, S.p_child_sn, V.p_subject, S.p_total_cost, V.p_method_cd, V.p_sub_type "&vbCrlf
query = query & " , S.p_decide_date, S.weeknum "&VbCrlf
query = query & " ORDER BY S.team_name, S.p_child_sn "&vbCrlf
adors.Open query, adoconn,adOpenStatic,adLockReadOnly
if adors.RecordCount > 0 then
sum_cont_cost = 0
sum_est_money = 0
sum_act_money = 0
sum_benefit = 0
Do while Not adors.Eof
%>
<tr>
<td class="text-center"><%=adors("p_decide_date") %><br>(<%=adors("weeknum") %>)</td>
<td class="text-center"><%=adors("p_child_sn") %></td>
<td class="text-left">
<a href="javascript:openit('1','<%=LEFT(adors("p_child_sn"), 7)%>','<%=adors("p_sub_type")%>','<%=adors("p_method_cd")%>','<%=adors("p_child_sn")%>')" class="blue"><%=adors("p_subject") %></a>
</td>
<td class="text-right"><%=formatnumber(adors("p_cont_cost"),0) %></td>
<td class="text-right"><%=formatnumber(adors("est_money"),0) %></td>
<td class="text-right"><%=formatnumber(cdbl(adors("act_money")) + cdbl(adors("cost_money")) + cdbl(adors("entertain_money")) + cdbl(adors("tf_money")),0) %></td>
<td class="text-right"><%=formatnumber(adors("benefit"),0) %></td>
</tr>
<%
sum_cont_cost = sum_cont_cost + cdbl(adors("p_cont_cost"))
sum_est_money = sum_est_money + cdbl(adors("est_money"))
sum_act_money = sum_act_money + cdbl(adors("act_money")) + cdbl(adors("cost_money")) + cdbl(adors("entertain_money")) + cdbl(adors("tf_money"))
sum_benefit = sum_benefit + cdbl(adors("benefit"))
adors.MoveNext
Loop
%>
<tr>
<td class="font-weight-bold text-center" colspan="3">합 계</td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_cont_cost,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_est_money,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_act_money,0) %></td>
<td class="font-weight-bold text-right"><%=formatnumber(sum_benefit,0) %></td>
</tr>
<%
end if
adors.Close
%>
</table>
</td>
</tr>
<% End If %>
<!-------------------3. 종료 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<!-- REQUIRED SCRIPTS -->
<script>
function openit(a, z, x, y, v) {
if (a == 1) {
//옛날 프로젝트인지 확인
if (new_project_2014(z) == 1) {
var url = '../project/project_list2_dep.asp?p_sn=' + z;
}else{
//수행계획서 판단(p_subtype이 없으면 수행계획서가 없다고 판단)
if (x != '') {
var url = '../project/project_list2_dep_2014.asp?p_sn=' + z;
}else{
if(confirm("프로젝트 수행계획이 작성되지 않았습니다.\n제안등록 화면으로 이동하시겠습니까?")){
var url = '../project/project_contact_2014.asp?p_sn=' + z;
}else{
return false;
}
}
}
var tmp_width = 1400;
var tmp_height = 800;
if (v != "") {
url = url + "&p_sub_type=" + x + "&p_method_cd=" + y + "&p_child_sn=" + v;
}else{
url = url + "&p_sub_type=" + x + "&p_method_cd=" + y;
}
}
window.open(url, '', 'left=0,top=0,width=' + tmp_width + ',height=' + tmp_height + ',scrollbars=yes,resizable=yes')
}
$(function(){
cutmenu();
});
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->