199 lines
10 KiB
Plaintext
199 lines
10 KiB
Plaintext
<!-- #include virtual = "include/header.asp" -->
|
|
<%
|
|
dim command
|
|
command = Request("command")
|
|
if command <> "excel" then
|
|
%>
|
|
<!-- #include virtual = "include/left.asp" -->
|
|
<!-- Content Wrapper. Contains page content -->
|
|
<div class="content-wrapper">
|
|
<!-- 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">
|
|
<%
|
|
end if
|
|
|
|
job_month = Request("job_month")
|
|
search_depart = Request("search_depart")
|
|
|
|
if command = "excel" Then
|
|
Response.CacheControl = "public"
|
|
Response.ContentType = "application/vnd.ms-excel"
|
|
Response.AddHeader "Content-Disposition","attachment;filename=그룹운영비용정산_" & job_month & ".xls"
|
|
end if
|
|
%>
|
|
<script>
|
|
function search(command) {
|
|
var url = "";
|
|
var job_month = document.job_cost_total.job_month.value;
|
|
|
|
var search_depart = "";
|
|
if($("select[name='search_depart']").length > 0){
|
|
search_depart = $("select[name='search_depart'] :selected").val();
|
|
}
|
|
if (job_month == "") {
|
|
alert("날짜를 선택하세요.");
|
|
} else {
|
|
url = "job_cost_total_group.asp?command=" + command + "&job_month=" + job_month + "&search_depart=" + search_depart;
|
|
document.job_cost_total.action = url;
|
|
document.job_cost_total.submit();
|
|
}
|
|
}
|
|
</script>
|
|
<form name="job_cost_total" method="post" >
|
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
</tr>
|
|
<%if command <> "excel" then%>
|
|
<tr>
|
|
<td style="padding:10 0 0 0;">
|
|
<table style='width:1000px' class="table table-sm table-sm2 table-bordered table-head tr-colors" >
|
|
<tr>
|
|
<td align="left" >
|
|
<select name="job_month" style="width:100px;letter-spacing:0px;">
|
|
<option value="">월 선택</option>
|
|
<%
|
|
For i=0 To 24
|
|
if LEFT(DateAdd("m", i*(-1), date), 7) > "2021-03" Then
|
|
%>
|
|
<option value="<%=LEFT(DateAdd("m", i*(-1), date), 7) %>" <%if job_month = LEFT(DateAdd("m", i*(-1), date), 7) then %> selected <% end if %>><%=LEFT(DateAdd("m", i*(-1), date), 7) %></option>
|
|
<%
|
|
End If
|
|
Next
|
|
%>
|
|
</select>
|
|
<%
|
|
if Session("depart_code") = "18" or session("teamplace") = "6" Then
|
|
%>
|
|
<select name="search_depart" style="width:120px;">
|
|
<option value="">부서 선택(전체)</option>
|
|
<%
|
|
'query = " SELECT depart, depart_cd FROM V_GROUP_COST_NEW with(nolock) where 1 = 1 AND left(cost_date,7) > '2021-04' group by depart, depart_cd order by depart asc "
|
|
query = " SELECT CASE WHEN depart IN ('개발그룹','온라인서베이운영그룹','데이터분석그룹','디지털COMM그룹') THEN '디지털서비스본부' ELSE depart END AS depart FROM V_GROUP_COST_NEW with(nolock) where 1 = 1 AND left(cost_date,7) > '2021-04' GROUP BY CASE WHEN depart IN ('개발그룹','온라인서베이운영그룹','데이터분석그룹','디지털COMM그룹') THEN '디지털서비스본부' ELSE depart END order by depart asc "
|
|
'Response.write query
|
|
Adors.open query, adoconn, adopenstatic, adlockreadonly
|
|
if Adors.RecordCount > 0 Then
|
|
For i=1 to Adors.recordcount
|
|
%><option value="<%=Adors("depart") %>" <%if(Adors("depart") = search_depart)then%>selected<%end if%>><%=Adors("depart") %></option>
|
|
<%
|
|
adors.movenext
|
|
next
|
|
AdoRs.close
|
|
end if %>
|
|
</select>
|
|
<%
|
|
End If
|
|
%>
|
|
</td>
|
|
<td align="right">
|
|
<button type="button" class='btn btn-sm btn-primary' onclick='search("view");'>조회</button>
|
|
<button type="button" class='btn btn-sm btn-success' onclick='search("excel");'>Excel</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<% end if %>
|
|
<% if command <> "" then %>
|
|
<tr>
|
|
<td style="padding:0 0 0 0;">
|
|
<table style='width:1000px' class="table table-sm table-sm2 table-bordered table-head tr-colors" >
|
|
<%
|
|
query = ""
|
|
'query = query & " SELECT depart , sum(cost) as cost, count(1) as cnt "
|
|
query = query & " SELECT CASE WHEN depart IN ('개발그룹','온라인서베이운영그룹','데이터분석그룹','디지털COMM그룹') THEN '디지털서비스본부' ELSE depart END AS depart, SUM(cost) AS cost, COUNT(1) AS cnt "
|
|
query = query & " FROM V_GROUP_COST_NEW with(nolock) "
|
|
query = query & " where 1 = 1 "
|
|
query = query & " AND left(cost_date,7) = '" & job_month & "' "
|
|
if( search_depart <> "" )then
|
|
'query = query & " and depart = '" & search_depart & "' "
|
|
If search_depart = "디지털서비스본부" Then
|
|
query = query & " AND depart IN ('개발그룹','온라인서베이운영그룹','데이터분석그룹','디지털COMM그룹') "
|
|
Else
|
|
query = query & " AND depart = '" & search_depart & "' "
|
|
End If
|
|
end if
|
|
if session("depart_code") <> "18" and session("teamplace") <> "6" Then
|
|
query = query & " and ((depart_cd = '" & Session("depart_code") & "' "
|
|
query = query & " and depart_cd <> '0') OR "
|
|
query = query & " depart = '" & Session("loginuser") & "') "
|
|
End If
|
|
'query = query & " group by depart "
|
|
query = query & " GROUP BY CASE WHEN depart IN ('개발그룹','온라인서베이운영그룹','데이터분석그룹','디지털COMM그룹') THEN '디지털서비스본부' ELSE depart END "
|
|
query = query & " order by depart asc "
|
|
Adors.open query, adoconn, adopenstatic, adlockreadonly
|
|
|
|
if Adors.RecordCount > 0 Then
|
|
sum_money = 0
|
|
%>
|
|
<tr height=30>
|
|
<td align="center" style="width:10%;">부서</td>
|
|
<td align="center" style="width:10%;">금액</td>
|
|
</tr>
|
|
<%
|
|
For i=1 to Adors.recordcount
|
|
IF list_bgcolor="#FFFFFF" Then
|
|
list_bgcolor="floralwhite"
|
|
Else
|
|
list_bgcolor="#FFFFFF"
|
|
End IF
|
|
%>
|
|
<tr height=30 style="background-color:<%=list_bgcolor%>;" >
|
|
<td align="center" ><%=Adors("depart") %></td>
|
|
<td align="center" ><%=Formatnumber(Adors("cost"), 0) %></td>
|
|
</tr>
|
|
<%
|
|
sum_money = sum_money + CDbl(Adors("cost"))
|
|
adors.movenext
|
|
next
|
|
AdoRs.close
|
|
%>
|
|
<tr height=30>
|
|
<td align="center" > 합 계 </td>
|
|
<td align="center" ><%= Formatnumber(sum_money, 0) %></td>
|
|
</tr>
|
|
<%
|
|
Else
|
|
%>
|
|
<tr height=30>
|
|
<td align="center" style="width:10%;">부서</td>
|
|
<td align="center" style="width:10%;">금액</td>
|
|
</tr>
|
|
<tr height=30 style="background-color:floralwhite;" >
|
|
<td align="center" colspan="2">검색결과가 없습니다</td></td>
|
|
</tr>
|
|
<tr height=30>
|
|
<td align="center" > 합 계 </td>
|
|
<td align="center" >0</td>
|
|
</tr>
|
|
<%
|
|
End if
|
|
%>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<% end if %>
|
|
</table>
|
|
</form>
|
|
<% if command <> "excel" then%>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.content -->
|
|
<!-- REQUIRED SCRIPTS -->
|
|
<script>
|
|
|
|
</script>
|
|
</div>
|
|
<!-- /.content-wrapper -->
|
|
<!-- #include virtual = "include/footer.asp" -->
|
|
<% end if %> |