Files
KIN/management/person_loginList.asp
2025-09-29 17:55:08 +09:00

250 lines
8.4 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- #include virtual = "lib/config.asp" -->
<!-- #include file = "../include/top_menu.asp" -->
<%
SET rsp = server.CreateObject("ADODB.RECORDSET")
sel_year = request("sel_year")
If sel_year = "" Then
sel_year = year(date)
End If
sel_month = request("sel_month")
If sel_month = "" Then
sel_month = month(date)
End If
sel_month = right("0" & sel_month, 2)
nowDate = now()
%>
<script src="../js/sort-table.js" type="text/javascript"></script>
<style>
.filterSelect{
margin-right:10px;
}
#rsTb > table{
border-collapse: collapse;
}
#rsTb > table td{
padding:2px;
word-break: keep-all;
}
#rsTb > table > thead > tr > td{
cursor:pointer;
}
#rsTb > table > tbody > tr:nth-child(2n+1){
background-color:#dbe9f2;
}
#rsTb > table > tbody > tr:hover{
border: 1px solid #682dff;
}
</style>
<script>
<%
query = ""
query = query & " SELECT p_name, p_depart_name, p_team_name, p_rank_name, p_position_name, " & vbCrLf
query = query & " ymd, login_time, logout_time, gap_time " & vbCrLf
query = query & " FROM V_LOGIN_TIME TTT " & vbCrLf
query = query & " LEFT JOIN project2.dbo.V_Person P " & vbCrLf
query = query & " ON TTT.p_no = P.p_no " & vbCrLf
query = query & " WHERE P.p_resign='0' " & vbCrLf
query = query & " AND LEFT(ymd, 7) = '" & sel_year & "-" & sel_month & "' " & vbCrLf
query = query & " ORDER BY ymd, login_time, p_depart_name, p_team_name, p_rank_name " & vbCrLf
'response.write query
rsp.Open query, adoConn, 1
jsonRs = "["
if rsp.RecordCount > 0 then
for i = 1 To rsp.RecordCount
jsonRs = jsonRs & "{"
jsonRs = jsonRs & """p_name"":""" & rsp("p_name") & ""","
jsonRs = jsonRs & """p_depart_name"":""" & rsp("p_depart_name") & ""","
jsonRs = jsonRs & """p_team_name"":""" & rsp("p_team_name") & ""","
jsonRs = jsonRs & """p_rank_name"":""" & rsp("p_rank_name") & ""","
jsonRs = jsonRs & """p_position_name"":""" & rsp("p_position_name") & ""","
jsonRs = jsonRs & """ymd"":""" & rsp("ymd") & ""","
jsonRs = jsonRs & """login_time"":""" & rsp("login_time") & ""","
jsonRs = jsonRs & """logout_time"":""" & rsp("logout_time") & ""","
jsonRs = jsonRs & """gap_time"":""" & rsp("gap_time") & """"
jsonRs = jsonRs & "}"
rsp.MoveNext
if not rsp.Eof then
jsonRs = jsonRs & ","
end if
Next
End if
rsp.Close
jsonRs = jsonRs & "]"
%>
//
var jsonRS = <%=jsonRs%>;
var filterCol = ["p_team_name", "p_name", "ymd"]; // Filter <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.
var filterColKor = ["<22>׷<EFBFBD>", "<22><><EFBFBD><EFBFBD>", "<22>Ϻ<EFBFBD>"]; // Filter <20><><EFBFBD>ɿ<EFBFBD><C9BF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ѱ<EFBFBD>.
var filterObj = new Object();
function tbDraw(colArr, valArr){
var jsonFilter = jsonRS;
if(colArr != undefined && valArr != undefined && colArr.length == valArr.length){
$.each(colArr, function(idx, obj){
if(valArr[idx] != ""){
jsonFilter = $.grep(jsonFilter, function(o, i){ return o[obj] == valArr[idx]; });
}
});
}
$.each(filterCol, function(idx, col){
filterObj[col] = new Array(); // <20>迭<EFBFBD><E8BFAD> <20>ʱ<EFBFBD>ȭ
});
$("#rsTb > table > tbody").html("");
$(".tbFilter").html("");
$.each(jsonFilter, function(idx, obj){
var tmpHTML = '';
var tmpClass = "";
tmpHTML = tmpHTML + '<tr class="' + tmpClass + '">';
tmpHTML = tmpHTML + '<td align="center" >' + obj.ymd + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.p_name + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.p_team_name + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.p_rank_name + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.login_time + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.logout_time + '</td>';
tmpHTML = tmpHTML + '<td align="center" >' + obj.gap_time + '</td>';
tmpHTML = tmpHTML + '</tr>';
$("#rsTb > table > tbody").append(tmpHTML);
$.each(filterCol, function(i, col){
filterObj[col].push(obj[col]);
});
});
$.each(filterObj, function(idx, arr){
arr = $.unique(arr.sort());
var tmpSelect = "";
tmpSelect = tmpSelect + "<select class='filterSelect' id='f_" + idx + "'>";
tmpSelect = tmpSelect + "<option value='' " + (valArr != undefined ? (valArr[$.inArray(idx, colArr)] == "" ? "selected" : "") : "") + ">" + filterColKor[$.inArray(idx, filterCol)] + "(<28><>ü)</option>";
$.each(arr, function(i, txt){
tmpSelect = tmpSelect + "<option value='" + txt + "' " + (valArr != undefined ? (valArr[$.inArray(idx, colArr)] == txt ? "selected" : "") : "") + ">" + txt + "</option>";
});
tmpSelect = tmpSelect + "</select>";
$(".tbFilter").append(tmpSelect);
});
}
$(function(){
$(document).off("change", ".filterSelect").on("change", ".filterSelect", function(){
var colArr = new Array();
var valArr = new Array();
$.each($(".filterSelect"), function(idx, obj){
colArr.push($(obj).attr("id").substr($(obj).attr("id").indexOf("_")+1, 100));
valArr.push($(obj).val());
});
tbDraw(colArr, valArr);
});
tbDraw();
$("#btnExport").click(function(e) {
var a = document.createElement('a');
var data_type = 'data:application/vnd.ms-excel;charset=euc-kr';
var table_html = encodeURIComponent($("#rsTb").html());
a.href = data_type + ', ' + table_html;
a.download = '<27><><EFBFBD><EFBFBD><EFBFBD>ٽð<D9BD><C3B0><EFBFBD>ȸ_'+ $("#sel_year > option:selected").val() +'-' + ($("#sel_month > option:selected").val().length == 1 ? '0' : '') + $("#sel_month > option:selected").val() + '.xls';
a.click();
e.preventDefault();
});
$(".submitFilter select").on("change", function(){
location.href="./person_loginList.asp?sel_year=" + $("#sel_year > option:selected").val() + "&sel_month=" + $("#sel_month > option:selected").val();
});
$("#sel_year").val("<%=sel_year%>");
$("#sel_month").val("<%=sel_month%>"*1);
});
</script>
<form name="logTimefrm" method="post">
<td width="100%" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<!-- Ȯ<><C8AE> -->
</tr>
<tr>
<td colspan="2" style="padding:20;">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding: 0 0 5 0;">
<span style="font-size: 12pt; font-weight: bold;"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ð<EFBFBD><C3B0><EFBFBD>ȸ</span>
</td>
</tr>
<tr>
<td>
<font class="brown"> Filter <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><CFBC><EFBFBD>.</font>
</font>
</td>
</tr>
<tr>
<td style="padding:5 0 0 0">
<table width="100%" height="37" cellpadding="0" cellspacing="1" border="0" bgcolor="#c0c0c0">
<tr>
<td bgcolor="#DFDFDF" class="submitFilter tahoma_blk" style="padding-left:10px;width:130px;">
<select id="sel_year" style="width:50px;">
<%
For i = year(date) To year(date) - 3 Step -1
%>
<option value="<%= i %>"><%= i %></option>
<%
Next
%>
</select><3E><> &nbsp;
<select id="sel_month">
<%
For i = 1 To 12
%>
<option value="<%= i %>"><%= i %></option>
<%
Next
%>
</select><3E><>
</td>
<td bgcolor="#DFDFDF" class="tbFilter tahoma_blk" style="padding-left:10px;"></td>
<td bgcolor="#DFDFDF" style="padding-left:10px;"></td>
<td bgcolor="#DFDFDF" align="right" style="padding-right:10px;">
<input type="button" id="btnExport" value="Excel Download"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:10 0 0 0">
<div style="width:100%;height:650px;overflow-y:scroll;" id="rsTb">
<table width="100%" class="js-sort-table">
<thead>
<tr>
<td align="center" class="js-sort-string tit_left" style="width: 13%"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td>
<td align="center" class="js-sort-string tit_left" style="width: 13%"><3E><><EFBFBD><EFBFBD></td>
<td align="center" class="js-sort-string tit_left" style="width: 21%"><3E>׷<EFBFBD><D7B7><EFBFBD></td>
<td align="center" class="js-sort-string tit_left" style="width: 23%"><3E><><EFBFBD><EFBFBD></td>
<td align="center" class="js-sort-string tit_left" style="width: 10%"><3E><><EFBFBD>ٽð<D9BD></td>
<td align="center" class="js-sort-string tit_left" style="width: 10%"><3E><><EFBFBD>ٽð<D9BD></td>
<td align="center" class="js-sort-number tit_left" style="width: 10%"><3E>ٹ<EFBFBD><D9B9>ð<EFBFBD></td>
</tr>
</thead>
<tbody></tbody>
<tfoot>
<tr>
<td colspan="15" bgcolor="#d5d5d5" height="1"></td>
</tr>
</tfoot>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</form>