최초커밋
This commit is contained in:
269
business/job_cost_total.asp
Normal file
269
business/job_cost_total.asp
Normal file
@@ -0,0 +1,269 @@
|
||||
<!-- #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><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></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_kind = Request("search_kind")
|
||||
|
||||
if command = "excel" Then
|
||||
Response.CacheControl = "public"
|
||||
Response.ContentType = "application/vnd.ms-excel"
|
||||
Response.AddHeader "Content-Disposition","attachment;filename=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_" & job_month & "_" & search_kind & ".xls"
|
||||
end if
|
||||
%>
|
||||
<script>
|
||||
function search(command) {
|
||||
var url = "";
|
||||
var job_month = document.job_cost_total.job_month.value;
|
||||
var search_kind = "";
|
||||
if (document.job_cost_total.search_kind[0].checked == true) {
|
||||
search_kind = "project";
|
||||
} else {
|
||||
search_kind = "personal";
|
||||
}
|
||||
if (job_month == "") {
|
||||
alert("<22><>¥<EFBFBD><C2A5> <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>.");
|
||||
} else {
|
||||
url = "job_cost_total.asp?command=" + command + "&job_month=" + job_month + "&search_kind=" + search_kind;
|
||||
document.job_cost_total.action = url;
|
||||
document.job_cost_total.submit();
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
if ("<%= search_kind%>" != "personal") {
|
||||
document.getElementById("i_project").checked = true;
|
||||
} else {
|
||||
document.getElementById("i_personal").checked = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<form name="job_cost_total" method="post" >
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<%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="center" ><3E><> <20><></td>
|
||||
<td align="left" >
|
||||
<select name="job_month" style="width:100px;">
|
||||
<option value=""> <20><> <20><> </option>
|
||||
<%
|
||||
For i=0 To 24
|
||||
%>
|
||||
<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>
|
||||
<%
|
||||
Next
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
<td align="center" ><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td>
|
||||
<td align="center" >
|
||||
<input type="radio" name="search_kind" id="i_project" value="project"/> <label for="i_project" class='mb-0 mr-2'><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE></label>
|
||||
<input type="radio" name="search_kind" id="i_personal" value="personal" /> <label for="i_personal" class='mb-0'><3E><><EFBFBD>κ<EFBFBD></label>
|
||||
</td>
|
||||
<td align="right">
|
||||
<button type="button" class='btn btn-sm btn-primary' onclick='search("view");'><3E><>ȸ</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:10 0 0 0;">
|
||||
<table style='width:1000px' class="table table-sm table-sm2 table-bordered table-head tr-colors">
|
||||
<%
|
||||
If search_kind = "project" Then
|
||||
query = ""
|
||||
query = query & " SELECT job_date, p_sn, p_subject, cost_name, sum(cost_money) AS cost_money "
|
||||
query = query & " FROM "
|
||||
query = query & " ( "
|
||||
query = query & " SELECT P.p_team_name, P.p_name, T.p_no, LEFT(job_date, 7) AS job_date, "
|
||||
query = query & " ISNULL(VPM.p_subject, ( "
|
||||
query = query & " CASE P.p_depart_now "
|
||||
query = query & " WHEN 'E' THEN p_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " WHEN 'R' THEN P.p_team_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " WHEN 'F' THEN P.p_team_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " ELSE '<27>Ϲ<EFBFBD>/<2F><><EFBFBD><EFBFBD>' END)) AS p_subject, "
|
||||
query = query & " CASE T.p_sn "
|
||||
query = query & " WHEN '99999' THEN "
|
||||
query = query & " CASE P.p_depart_now "
|
||||
query = query & " WHEN 'R' THEN '99990' + CONVERT(varchar, P.p_depart) "
|
||||
query = query & " WHEN 'F' THEN '99990' + CONVERT(varchar, P.p_depart) "
|
||||
query = query & " WHEN 'E' THEN p_name "
|
||||
query = query & " ELSE '99999' END "
|
||||
query = query & " ELSE T.p_sn END AS p_sn, "
|
||||
query = query & " T.cost_code, CC.cost_name, cost_money "
|
||||
query = query & " FROM V_BUSI_COST T LEFT JOIN V_PROJECT_METHOD VPM ON T.p_sn = VPM.p_child_sn "
|
||||
query = query & " LEFT JOIN cost_category CC ON T.cost_code = CC.cost_code "
|
||||
query = query & " LEFT JOIN ( "
|
||||
query = query & " SELECT P.p_no, P.p_name, P.p_depart_now, before_info AS p_depart, D.T_Name AS p_team_name, "
|
||||
query = query & " ISNULL((SELECT TOP 1 change_date FROM Person_Log WHERE p_no = P.p_no AND info_name = 'depart' AND change_date < PL.change_date ORDER BY change_date DESC), krc_in_date) AS log_st, CONVERT(varchar(10), DATEADD(DAY, -1, change_date), 120) AS log_en "
|
||||
query = query & " FROM v_Person P "
|
||||
query = query & " LEFT JOIN Person_Log PL ON P.p_no = PL.p_no AND PL.info_name = 'depart' AND PL.after_info <> '' "
|
||||
query = query & " LEFT JOIN v_Department D ON PL.before_info = D.before_t_cd1 "
|
||||
query = query & " WHERE before_info IS NOT NULL "
|
||||
query = query & " UNION ALL "
|
||||
query = query & " SELECT p_no, p_name, p_depart_now, p_depart, p_team_name, "
|
||||
query = query & " ISNULL((SELECT TOP 1 change_date FROM Person_Log WHERE p_no = P.p_no AND info_name = 'depart' ORDER BY change_date DESC), krc_in_date) AS log_st, '2099-12-31' AS log_en "
|
||||
query = query & " FROM v_Person P "
|
||||
query = query & " ) P ON T.p_no = P.p_no AND T.job_date BETWEEN P.log_st AND P.log_en "
|
||||
query = query & " WHERE job_date LIKE '" & job_month & "%' "
|
||||
query = query & " ) T "
|
||||
query = query & " GROUP BY job_date, p_sn, p_subject, cost_name "
|
||||
'Response.write query
|
||||
Adors.open query, adoconn, adopenstatic, adlockreadonly
|
||||
|
||||
if Adors.RecordCount > 0 Then
|
||||
sum_money = 0
|
||||
%>
|
||||
<tr height=30>
|
||||
<td align="center" style="width:7%;"><3E><><EFBFBD><EFBFBD></td>
|
||||
<td align="center" style="width:13%;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD>ڵ<EFBFBD></td>
|
||||
<td align="center" style="width:50%;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE></td>
|
||||
<td align="center" style="width:23%"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td>
|
||||
<td align="center" style="width:7%"><3E>ݾ<EFBFBD></td>
|
||||
</tr>
|
||||
<%
|
||||
For i=1 to Adors.recordcount
|
||||
%>
|
||||
<tr height=30>
|
||||
<td align="center" ><%=Adors("job_date") %></td>
|
||||
<td align="center" ><%=Adors("p_sn") %></td>
|
||||
<td align="center" ><%=Adors("p_subject")%></td>
|
||||
<td align="center" ><%=Adors("cost_name") %></td>
|
||||
<td align="center" ><%=Formatnumber(Adors("cost_money"), 0) %></td>
|
||||
</tr>
|
||||
<%
|
||||
sum_money = sum_money + CDbl(Adors("cost_money"))
|
||||
adors.movenext
|
||||
next
|
||||
AdoRs.close
|
||||
%>
|
||||
<tr height=30>
|
||||
<td align="center" colspan="4"> <20><> <20><> </td>
|
||||
<td align="center" ><%= Formatnumber(sum_money, 0) %></td>
|
||||
</tr>
|
||||
<%
|
||||
End if
|
||||
End if
|
||||
|
||||
If search_kind = "personal" Then
|
||||
query = ""
|
||||
query = query & " SELECT job_date, p_team_name, p_no, p_name, sum(cost_money) AS cost_money "
|
||||
query = query & " FROM "
|
||||
query = query & " ( "
|
||||
query = query & " SELECT P.p_team_name, P.p_name, T.p_no, LEFT(job_date, 7) AS job_date, "
|
||||
query = query & " ISNULL(VPM.p_subject, ( "
|
||||
query = query & " CASE P.p_depart_now "
|
||||
query = query & " WHEN 'E' THEN p_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " WHEN 'R' THEN P.p_team_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " WHEN 'F' THEN P.p_team_name + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
|
||||
query = query & " ELSE '<27>Ϲ<EFBFBD>/<2F><><EFBFBD><EFBFBD>' END)) AS p_subject, "
|
||||
query = query & " CASE T.p_sn "
|
||||
query = query & " WHEN '99999' THEN "
|
||||
query = query & " CASE P.p_depart_now "
|
||||
query = query & " WHEN 'R' THEN '99990' + CONVERT(varchar, P.p_depart) "
|
||||
query = query & " WHEN 'F' THEN '99990' + CONVERT(varchar, P.p_depart) "
|
||||
query = query & " ELSE '99999' END "
|
||||
query = query & " ELSE T.p_sn END AS p_sn, "
|
||||
query = query & " T.cost_code, CC.cost_name, cost_money "
|
||||
query = query & " FROM V_BUSI_COST T LEFT JOIN V_PROJECT_METHOD VPM ON T.p_sn = VPM.p_child_sn "
|
||||
query = query & " LEFT JOIN cost_category CC ON T.cost_code = CC.cost_code "
|
||||
query = query & " LEFT JOIN ( "
|
||||
query = query & " SELECT P.p_no, P.p_name, P.p_depart_now, before_info AS p_depart, D.T_Name AS p_team_name, "
|
||||
query = query & " ISNULL((SELECT TOP 1 change_date FROM Person_Log WHERE p_no = P.p_no AND info_name = 'depart' AND change_date < PL.change_date ORDER BY change_date DESC), krc_in_date) AS log_st, CONVERT(varchar(10), DATEADD(DAY, -1, change_date), 120) AS log_en "
|
||||
query = query & " FROM v_Person P "
|
||||
query = query & " LEFT JOIN Person_Log PL ON P.p_no = PL.p_no AND PL.info_name = 'depart' AND PL.after_info <> '' "
|
||||
query = query & " LEFT JOIN v_Department D ON PL.before_info = D.before_t_cd1 "
|
||||
query = query & " WHERE before_info IS NOT NULL "
|
||||
query = query & " UNION ALL "
|
||||
query = query & " SELECT p_no, p_name, p_depart_now, p_depart, p_team_name, "
|
||||
query = query & " ISNULL((SELECT TOP 1 change_date FROM Person_Log WHERE p_no = P.p_no AND info_name = 'depart' ORDER BY change_date DESC), krc_in_date) AS log_st, '2099-12-31' AS log_en "
|
||||
query = query & " FROM v_Person P "
|
||||
query = query & " ) P ON T.p_no = P.p_no AND T.job_date BETWEEN P.log_st AND P.log_en "
|
||||
query = query & " WHERE job_date LIKE '" & job_month & "%' "
|
||||
query = query & " ) T "
|
||||
query = query & " GROUP BY job_date, p_team_name, p_no, p_name "
|
||||
'Response.write query
|
||||
Adors.open query, adoconn, adopenstatic, adlockreadonly
|
||||
|
||||
if Adors.RecordCount > 0 Then
|
||||
sum_money = 0
|
||||
%>
|
||||
<tr height=30>
|
||||
<td align="center" style="width:15%;"><3E><><EFBFBD><EFBFBD></td>
|
||||
<td align="center" style="width:25%;"><3E>μ<EFBFBD><CEBC><EFBFBD></td>
|
||||
<td align="center" style="width:20%;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ</td>
|
||||
<td align="center" style="width:20%;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td>
|
||||
<td align="center" style="width:20%;"><3E>ݾ<EFBFBD></td>
|
||||
</tr>
|
||||
<%
|
||||
For i=1 to Adors.recordcount
|
||||
%>
|
||||
<tr height=30 >
|
||||
<td align="center" ><%=Adors("job_date") %></td>
|
||||
<td align="center" ><%=Adors("p_team_name") %></td>
|
||||
<td align="center" ><%=Adors("p_no") %></td>
|
||||
<td align="center" ><%=Adors("p_name") %></td>
|
||||
<td align="center" ><%=Formatnumber(Adors("cost_money"), 0) %></td>
|
||||
</tr>
|
||||
<%
|
||||
sum_money = sum_money + CDbl(Adors("cost_money"))
|
||||
adors.movenext
|
||||
next
|
||||
AdoRs.close
|
||||
%>
|
||||
<tr height=30>
|
||||
<td align="center" colspan="4"> <20><> <20><> </td>
|
||||
<td align="center" ><%= Formatnumber(sum_money, 0) %></td>
|
||||
</tr>
|
||||
<%
|
||||
End if
|
||||
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 %>
|
||||
|
||||
Reference in New Issue
Block a user