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

341 lines
28 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<%
tmp_year = request("tmp_year")
p_depart = request("p_depart")
if tmp_year = "" then
tmp_year = "0000"
end if
if p_depart = "" then
p_depart = session("depart_Code")
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">
<form name='team_project_count' method='post'>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;" class="p-2">
<tr>
<td>
<select name=tmp_year>
<%
Dim temp_minus_yyyy
temp_minus_yyyy = 0
%>
<%for i=cint(year(date)+temp_minus_yyyy) to 2021 step -1 %>
<OPTION value='<%=i%>' <%if cint(i) = cint(tmp_year) then%> selected<%end if%> ><%=i%></OPTION>
<%next%>
</SELECT>
<button type="button" class='btn btn-sm btn-primary' onclick='goView();'>조회</button>
</td>
</tr>
<!-------------------1. 계약 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<tr><td>1. 계약실적</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="16%" class="text-center">월</td>
<td width="21%" class="text-center">수주실적</td>
<td width="21%" class="text-center">수행실적</td>
<td width="21%" class="text-center">예상직접비</td>
<td width="21%" class="text-center">예상공헌이익</td>
</tr>
<% '1. 계약실적 쿼리문
query = ""
query = query & " SELECT team_name, team_cd, "&VbCrlf
query = query & " CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END as p_date, "&VbCrlf
query = query & " SUM(p_total_cost) as p_total_cost, "&VbCrlf
query = query & " SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "&VbCrlf
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "&VbCrlf
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "&VbCrlf
query = query & " SUM(benefit) as benefit "&VbCrlf
query = query & " FROM "&VbCrlf
query = query & " ( "&VbCrlf
query = query & " SELECT team_name, team_cd, p_sn, "&VbCrlf
query = query & " case when LEFT(p_sn, 2) = '" &RIGHT(tmp_year, 2)-1& "' Then case when SUM(p_total_cost)='0' Then SUM(p_cont_cost) else SUM(p_total_cost) end else SUM(p_total_cost) end as p_total_cost "&VbCrlf '##### 이월 프로젝트의 수주실적 총 합계 -> 0원이면 수주실적 = 수행실적 (2018-10-24)
query = query & " , p_decide_date "&VbCrlf
query = query & " , weeknum "&VbCrlf
query = query & " , SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "&VbCrlf
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "&VbCrlf
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "&VbCrlf
query = query & " SUM(benefit) as benefit "&VbCrlf
query = query & " FROM #statistics_next "&VbCrlf
query = query & " WHERE 1=1 "&VbCrlf
query = query & " AND ( substring(p_decide_date, 1,4) = '" & tmp_year & "' OR ( substring(p_decide_date, 1,4) = '" & tmp_year - 1 & "' AND p_statistics = '" & tmp_year & "')) "&VbCrlf
query = query & " AND (hd_cd = '"& p_depart &"' or team_cd = '"& p_depart &"') "&VbCrlf
query = query & " GROUP BY team_name, team_cd, p_sn, p_decide_date, weeknum "&VbCrlf
query = query & " ) T "&VbCrlf
query = query & " GROUP BY team_name, team_cd "&VbCrlf
query = query & " , CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END "&VbCrlf
query = query & " ORDER BY team_name "&VbCrlf
query = query & " , CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END "&VbCrlf
'Response.Write query & "<br>"
'adminView("<br>1. 계약실적 쿼리문<br>")
'adminView(query)
If tmp_year <> "0000" then
adors.Open query, adoconn,adOpenStatic,adLockReadOnly
if adors.RecordCount > 0 then
sum_total_cost = 0
sum_cont_cost = 0
sum_est_money = 0
sum_benefit = 0
Do while Not adors.Eof
%>
<tr>
<td class="text-center"><a href="javascript:detailView('<%=adors("p_date")%>', '<%=adors("team_cd")%>', 1, '<%=tmp_year%>')"><%=adors("p_date") %></a></td>
<td class="text-right"><%=formatnumber(adors("p_total_cost"),0) %></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(adors("benefit"),0) %></td>
</tr>
<%
sum_total_cost = sum_total_cost + cdbl(adors("p_total_cost"))
sum_cont_cost = sum_cont_cost + cdbl(adors("p_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">합 계</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' if adors.RecordCount > 0 then
adors.Close
End if
%>
</table>
</td>
</tr>
<!-------------------1. 계약 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-------------------2. 진행 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<tr><td>2. 진행실적</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="16%" class="text-center">월</td>
<td width="21%" class="text-center">수행실적</td>
<td width="21%" class="text-center">예상직접비</td>
<td width="21%" class="text-center">실제직접비+진행비</td>
<td width="21%" class="text-center">예상공헌이익</td>
</tr>
<% '2. 진행실적 쿼리문
query = ""
query = query & " SELECT team_name, team_cd, "
query = query & " CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END as p_date, "
query = query & " SUM(p_total_cost) as p_total_cost, "
query = query & " SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "
query = query & " SUM(benefit) as benefit "
query = query & " FROM "
query = query & " ( "
query = query & " SELECT team_name, team_cd, p_sn, p_total_cost, p_decide_date, "
query = query & " SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "
query = query & " SUM(benefit) as benefit "
query = query & " FROM #statistics_next "
query = query & " WHERE 1=1 "
query = query & " AND (substring(p_sn, 1,2) = '" & right(tmp_year, 2) & "' OR (substring(p_sn, 1,2) = '" & right(tmp_year, 2) - 1 & "' AND p_statistics = '" & tmp_year & "')) "
query = query & " AND (hd_cd = '"& p_depart &"' or team_cd = '"& p_depart &"') "
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 진행 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " AND p_progress_status = '008' AND complete_yn = '0' "
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ↑↑ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " GROUP BY team_name, team_cd, p_sn, p_total_cost, p_decide_date "
query = query & " ) T "
query = query & " GROUP BY team_name, team_cd, "
query = query & " CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END "
query = query & " ORDER BY team_name, CASE WHEN substring(p_decide_date, 3,2) = '" & cstr(cint(RIGHT(tmp_year, 2)) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE '20' + substring(p_decide_date, 3,2) + '-' + substring(p_decide_date, 6,2) END "
'Response.Write query & "<br>"
If tmp_year <> "0000" then
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"><a href="javascript:detailView('<%=adors("p_date")%>', '<%=p_depart%>', 2, '<%=tmp_year%>')"><%=adors("p_date") %></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">합 계</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' if adors.RecordCount > 0 then
adors.Close
End if
%>
</table>
</td>
</tr>
<!-------------------2. 진행 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
<!-------------------3. 종료 실적 시작------------------------------------------------------------------------------------------------------------------------------------------------------>
<tr><td>3. 종료실적</td></tr>
<tr>
<td>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td width="16%" class="text-center">월</td>
<td width="21%" class="text-center">수행실적</td>
<td width="21%" class="text-center">예상직접비</td>
<td width="21%" class="text-center">실제직접비+진행비</td>
<td width="21%" class="text-center">공헌이익</td>
</tr>
<% '3. 종료 실적 쿼리문
query = ""
query = query & " SELECT team_name, team_cd, "
query = query & " CASE WHEN LEFT(p_con_date_end, 4) = '" & cstr(cint(tmp_year) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE p_con_date_end END as p_date, "
query = query & " SUM(p_total_cost) as p_total_cost, "
query = query & " SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "
query = query & " SUM(benefit) as benefit "
query = query & " FROM "
query = query & " ( "
query = query & " SELECT LEFT(p_con_date_end, 7) as p_con_date_end, team_name, team_cd, p_sn, p_total_cost, "
query = query & " SUM(p_cont_cost) as p_cont_cost, SUM(est_money) as est_money, "
query = query & " SUM(act_money) as act_money, SUM(cost_money) as cost_money, "
query = query & " SUM(entertain_money) as entertain_money, SUM(tf_money) as tf_money, "
query = query & " SUM(benefit) as benefit "
query = query & " FROM #statistics_next "
query = query & " WHERE p_statistics = '" & tmp_year & "' "
query = query & " AND (hd_cd = '"& p_depart &"' or team_cd = '"& p_depart &"') "
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 종료 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " AND complete_yn = '1' "
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ↑↑ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
query = query & " GROUP BY LEFT(p_con_date_end, 7), team_name, team_cd, p_sn, p_total_cost "
query = query & " ) T "
query = query & " GROUP BY team_name, team_cd, "
query = query & " CASE WHEN LEFT(p_con_date_end, 4) = '" & cstr(cint(tmp_year) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE p_con_date_end END "
query = query & " ORDER BY team_name, CASE WHEN LEFT(p_con_date_end, 4) = '" & cstr(cint(tmp_year) - 1) & "' THEN '"& cstr(cint(tmp_year) - 1) &"년 이월' ELSE p_con_date_end END "
'Response.Write query & "<br>"
If tmp_year <> "0000" then
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"><a href="javascript:detailView('<%=adors("p_date")%>', '<%=p_depart%>', 3, '<%=tmp_year%>')"><%=adors("p_date") %></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">합 계</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' if adors.RecordCount > 0 then
adors.Close
End if
%>
</table>
</td>
</tr>
<!-------------------3. 종료 실적 종료------------------------------------------------------------------------------------------------------------------------------------------------------>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<!-- REQUIRED SCRIPTS -->
<script>
function goView() {
var tmp_year = document.team_project_count.tmp_year.value;
var url = "team_project_popup.asp?tmp_year=" + tmp_year + "&p_depart=<%=p_depart%>";
document.team_project_count.action = url;
document.team_project_count.submit();
}
function detailView(date, depart, gubun, currentYear){
var url = "team_project_count_detail.asp"
var param = "?date=" + date;
param = param + "&depart=" + depart;
param = param + "&gubun=" + gubun;
param = param + "&currentYear=" + currentYear;
param = param + "&command=" + "popup";
window.open(url+param,"","left=50 ,top=0, menubar=no, location=no ,status=no ,toolbar=no ,width=1060, height=650 ,scrollbars=yes ,resizable=yes");
}
$(function(){
cutmenu();
});
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->