Files
KIN/business/busi_list.asp
Choins e0b87ee2ab 2026년 그룹운영비 임시예산 반영
- <식대와 교통비>, <회식비와 기타항목> 통합
 - 디지털서비스본부는 그룹별 예산이 아닌 본부예산으로 통합
2026-02-02 17:05:00 +09:00

1203 lines
48 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<!-- #include virtual = "include/holiday_count.asp" -->
<%
dim conyear, conmonth, conweek
dim selweekRange, stdate, eddate, chkday
conyear = iif(request("conyear") = "", year(date), request("conyear"))
conmonth = iif(request("conmonth") = "", month(date), request("conmonth"))
ym = conyear & "-" & RIGHT("0" & conmonth, 2)
%>
<!-- 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">
<table width="1400px" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="settingForm">
<select name="conyear" class="dateSelect">
<% For i=year(date)-2 To year(date)+1 %>
<% if i >= 2020 Then %>
<option value="<%= i%>" <%= iif(cint(conyear) = i, "selected", "") %>><%= i%>년</option>
<% End if %>
<% Next %>
</select>
<select name="conmonth" class="dateSelect">
<% For i=1 To 12 %>
<option value="<%= i%>" <%= iif(cint(conmonth) = i, "selected", "") %>><%= i%>월</option>
<% Next %>
</select>
<select name="p_no" class="personSelect">
<option value=''>인원 선택</option>
</select>
</td>
<td align="right" class="settingForm">
<input type="button" value="0 / 194" id="legend2_btn" />
<input type="button" value="범례 보기" id="legend_btn"/>
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<span class='discript'>스케쥴바에 마우스를 올리면 업무시간, 업무내용 형태로 표시됩니다.</span>
<div id="busi_div">
<table id="calendarTb">
<thead>
<tr>
<td class="cal_head">Mon</td>
<td class="cal_head">Tue</td>
<td class="cal_head">Wed</td>
<td class="cal_head">Thu</td>
<td class="cal_head">Fri</td>
<td class="cal_head">Sat</td>
<td class="cal_head">Sun</td>
<td class="app_head"></td>
</tr>
</thead>
<%
Dim week_i, day_i, date_i, date_last, week_i_num
Dim dayClass
date_i = 1
date_last = DateAdd("d", -1, DateAdd("m", 1, cDate(ym & "-01")))
'response.write weekday_mon("2022-04-01")
%>
<% For week_i = 1 To 6
week_i_num = getWeeknum(conyear, conmonth, date_i) '//-- week_num_new
'response.write week_i_num
%>
<tr>
<% For day_i = 1 To 8 %>
<% if day_i <> 8 Then %>
<td class="cal_day">
<% if (date_i > 1 AND date_i <= day(date_last)) OR (date_i = 1 AND day_i = weekday_mon(ym & "-01")) Then %>
<%'=day_i &" = "& weekday_mon(ym & "-01") &" = "& day(date_last) %>
<%
dayClass = "d_nor"
if day_i = 7 Then
dayClass = "d_sun"
elseif day_i = 6 Then
dayClass = "d_sat"
End if
Call day_off_chk_only(conyear, conmonth, date_i)
if day_off = "true" Then
dayClass = "d_sun"
End if
%>
<div class='dayLabel <%=dayClass%>' data-date='<%= ym & "-" & RIGHT("0" & date_i, 2)%>' data-weeki='<%=week_i %>' data-weeki-num='<%=week_i_num %>' ><%= date_i%></div>
<% date_i = date_i + 1 %>
<% End if %>
<%'=dayClass %>
</td>
<% else %>
<td class="weekDetail" data-weeknum="<%=week_i%>" data-weeki='<%=week_i %>' data-weeki-num='<%=week_i_num %>' ><div class="wd_contents"></div><div class="wd_contents_time"></div></td>
<% end if %>
<% Next %>
<%
if date_i > day(date_last) Then
Exit For
End if
%>
</tr>
<% Next %>
</table>
</div>
<div id="legend_dialog"></div>
<div id="approval_dialog"></div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<!-- REQUIRED SCRIPTS -->
<%
dim perQuery, groupQuery, jobQuery, loginQuery
dim p_no_arr : p_no_arr = ""
' response.write "----------"& Session("teamplace")
perQuery = ""
perQuery = perQuery & " SELECT p_no, p_name "
perQuery = perQuery & " FROM Person "
perQuery = perQuery & " WHERE p_ip IS NOT NULL AND LEFT(krc_in_date, 7) <= '" & ym & "' AND ( krc_out_date = '' OR krc_out_date LIKE '" & ym & "%' ) "
If Session("teamplace") = 6 Then '대표이사
if Session("User_Number") = "20080101" then
perQuery = perQuery & " AND ( p_position_now = 5 OR p_no in ('20191202', '20220901', '20190601', '20210405', '20031102','20210107') ) " '조기혜 대체 박미선
else '2024-06-17 (20211001, 20210105, 20230905) 퇴사로 삭제
perQuery = perQuery & " AND ( p_position_now = 5 OR p_no in ('20191202', '20220901', '20190601', '20210405', '20031102','20210107','20150302') ) " '최환그룹장 1차상위자 대표님으로 변경
end if
ElseIf (Session("teamplace") = 3 OR Session("teamplace") = 2) and Session("User_Number") <> "20200103" and Session("User_Number") <> "20210405" and Session("User_Number") <> "20181009" Then '총괄 그룹장 / 그룹장 , din 김희정 그룹장이 결재 가능
' If Session("N_depart") & Session("N_team") = "S301" Then ' 채주희 그룹장님 전용
' perQuery = perQuery & " and (p_no not in ('20240701','20240702') ) " '이서윤 제외 401키위 공석으로 포함시킴 2024-07-09
' perQuery = perQuery & " AND (p_depart_now = 'S' AND p_team_now in ('401') OR (p_no in ('20160203', '20210302'))" '솔루션개발, 백성희, 박채원
If Session("User_Number") = "20210302" THEN '박채원
perQuery = perQuery & " AND (p_depart_now = 'S' AND p_team_now in ('501')"
ElseIf Session("User_Number") = "20250301" THEN '최남식
perQuery = perQuery & " AND (p_depart_now = 'S' AND p_team_now in ('401')"
ElseIf Session("User_Number") = "20160203" THEN '백성희
perQuery = perQuery & " AND (p_depart_now = 'S' AND p_team_now in ('301')"
perQuery = perQuery & " and (p_no not in ('20240701','20240702') ) " '이서윤 제외 401키위 공석으로 포함시킴 2024-07-09
' ElseIf Session("User_Number") = "20200103" THEN '조민아
' perQuery = perQuery & " AND (p_no in ('20200807', '20220407' ,'20240901' ,'20241102') "
' ElseIf Session("User_Number") = "20210405" THEN '김희정
' perQuery = perQuery & " AND (p_no in ('20191104', '20200301','20240501') "
' ElseIf Session("User_Number") = "20181009" THEN '공미애
' perQuery = perQuery & " AND (p_no in ('20200106') "
ElseIf Session("User_Number") = "20160301" THEN '최혜원
perQuery = perQuery & " AND ((p_depart_now = '" & Session("N_depart") & "' AND p_team_now = '" & Session("N_team") & "') "
perQuery = perQuery & " and (p_no not in ('20230906') ) " '마케팅1그룹 남관우 위원 제외 250122 jelee
' ElseIf Session("N_depart") & Session("N_team") = "S101" Then '//-- 실사일때는 실사,QC 다 나오게 변경 2020-10-13
' perQuery = perQuery & " AND ((p_depart_now = 'S' AND p_team_now in ('101', '201')) "
' elseif session("User_Number") = "20140804" Then '송유근 - P2
' perQuery = perQuery & " and ( p_no not in ('20150302') ) " '최환 제외
' perQuery = perQuery & " AND ((p_depart_now = '" & Session("N_depart") & "' AND p_team_now = '" & Session("N_team") & "') "
' elseif session("User_Number") = "20190601" Then '이혜진 - M1 부재로 대체 /// 일단 M1, M2 둘다 관리해야하므로 하드코딩으로 변경 2024-08-21
' perQuery = perQuery & " and ( p_no not in ('20230906') ) " '남관우 제외
' perQuery = perQuery & " AND ((p_depart_now = '" & Session("N_depart") & "' AND p_team_now in ('701', '702')) "
Else
perQuery = perQuery & " AND ((p_depart_now = '" & Session("N_depart") & "' AND p_team_now = '" & Session("N_team") & "') "
End if
perQuery = perQuery & " OR p_no = '" & Session("User_Number") & "' "
perQuery = perQuery & " ) AND p_position_now <> 5 "
Else
perQuery = perQuery & " AND ( p_no = '" & Session("User_Number") & "' "
' if session("User_Number") = "20250201" Then '조기혜 대체 박미선
' perQuery = perQuery & " OR p_no in ('20210403', '20220504', '20240401') "
' End if
if session("User_Number") = "20191202" Then '김현정
perQuery = perQuery & " OR p_no in ('20231201', '20240208','20240401','20250602','20250702') "
End if
' if session("User_Number") = "20220901" Then '이서윤
' perQuery = perQuery & " OR p_no in ('20230402', '20241103') "
' End if
if session("User_Number") = "20210801" Then '서강신
perQuery = perQuery & " OR p_no in ('20210905') "
End if
' if session("User_Number") = "20210801" Then '서강신 - 여론조사센터 250122 jelee
' perQuery = perQuery & " OR p_no in ('20160205', '20210107', '20240205') "
' End if
If session("User_Number") = "20190601" Then '이혜진 - 마케팅 1,2,3 그룹장
perQuery = perQuery & " OR (p_depart_now = 'R' AND p_team_now in ('701','702','703') AND p_position_now = 3 ) OR p_no in ('20230906','20230705','20250103','20250901') "'마케팅2그룹장 공석(이혜진상무 직무대행) -> 윤인주,서보화,오수연 추가
End If
if session("User_Number") = "20031102" Then '채주희 - DCO 본부장
perQuery = perQuery & " OR (p_depart_now = 'S' AND p_team_now IN ('301','401','501','601','801') AND p_position_now = 3) "
' perQuery = perQuery & " OR (p_depart_now = 'S' AND p_team_now in ('401')) " '솔루션 개발 그룹장 대리 250122 jelee
End if
if session("User_Number") = "20210405" Then '최정심 - DIN 본부장 -> 김희정 그룹장으로 변경
perQuery = perQuery & " OR (p_depart_now = 'S' AND p_team_now IN ('101','201')) "
End if
if session("User_Number") = "20160205" Then '박지훈 - 퍼블릭 본부 250121 jelee
perQuery = perQuery & " OR (p_depart_now IN ('R') AND p_team_now IN ('601','602','603','604','606') AND p_position_now = 3) "
End if
if session("User_Number") = "20210107" Then '신상욱 - 퍼블릭 R&D센터 센터장
perQuery = perQuery & " OR p_no in ('20220602','20230205','20230801') "
perQuery = perQuery & " OR (p_depart_now IN ('R') AND p_team_now IN ('605') AND p_position_now = 3) "
End if
perQuery = perQuery & " ) "
End If
perQuery = perQuery & " ORDER BY CASE WHEN p_no = '" & Session("User_Number") & "' THEN 0 ELSE 1 END, p_depart_now, p_team_now, "
perQuery = perQuery & " CASE WHEN p_position_now = 10 THEN -1 ELSE p_position_now END DESC, p_job_now, "
perQuery = perQuery & " CASE WHEN p_rank_now = 10 THEN 24 WHEN p_rank_now = 16 THEN 0 WHEN p_rank_now = 11 THEN 31 ELSE p_rank_now END, krc_in_date "
if( Request.ServerVariables("REMOTE_ADDR") = "10.10.13.81" or Request.ServerVariables("REMOTE_ADDR") = "10.10.13.186" or Request.ServerVariables("REMOTE_ADDR") = "::1")then
response.write "------ REMOTE_ADDR : "& Request.ServerVariables("REMOTE_ADDR") &"-------<br>"
response.write "------ User_Number : "& Session("User_Number") &"-------<br>"
response.write "------ teamplace : "& Session("teamplace") &"-------<br>"
response.write "------ Depart_Code : "& Session("Depart_Code") &"-------<br>"
response.write "------ N_depart : "& Session("N_depart") &"-------<br>"
response.write "------ N_team : "& Session("N_team") &"-------<br>"
'response.write perQuery
end if
Rs.Open perQuery, adoConn, 1
if Rs.recordCount > 0 Then
Do While Not Rs.Eof
p_no_arr = p_no_arr & "'" & Rs("p_no") & "',"
Rs.MoveNext
Loop
p_no_arr = mid(p_no_arr, 1, len(p_no_arr)-1)
End if
Rs.Close
groupQuery = ""
groupQuery = groupQuery & " SELECT VGC.cost_date, VGC.p_no, VGC.txt_pjt, ISNULL(TPM.p_subject, '일반업무') AS p_subject, VGC.txt_hangmok, VGC.contents, VGC.cost "
groupQuery = groupQuery & " , (DATEPART(DAY, cost_date) - DATEPART(WEEKDAY, cost_date) + 13) / 7 AS weekNum "
groupQuery = groupQuery & " , ( SELECT TOP 1 weeknum FROM project2.dbo.login_weeknum with(nolock) WHERE VGC.cost_date BETWEEN sdate and edate ) AS weekNum_new "
groupQuery = groupQuery & " FROM V_GROUP_COST_NEW VGC LEFT JOIN T_PROJECT_METHOD TPM ON VGC.txt_pjt = TPM.p_child_sn "
groupQuery = groupQuery & " WHERE VGC.p_no IN (" & p_no_arr & ") "
groupQuery = groupQuery & " AND VGC.cost_date LIKE '" & ym & "%' "
response.write groupQuery
jobQuery = ""
jobQuery = jobQuery & " SELECT JL.p_no "
jobQuery = jobQuery & " , (DATEPART(DAY, JL.j_date) - DATEPART(WEEKDAY, JL.j_date) + 13) / 7 AS weekNum "
jobQuery = jobQuery & " , ( SELECT TOP 1 weeknum FROM project2.dbo.login_weeknum with(nolock) WHERE JL.j_date BETWEEN sdate and edate ) AS weekNum_new "
jobQuery = jobQuery & " , JL.j_date, "
jobQuery = jobQuery & " JL.j_p_sn, ISNULL(VPM.p_subject, '일반/행정') AS p_subject, "
jobQuery = jobQuery & " JL.j_contents, ISNULL(JC.j_name, j_contents_nm) AS j_contents_nm, "
jobQuery = jobQuery & " JL.j_time, ISNULL(JL.j_approval, '') AS j_approval, ISNULL(D.d_order_cnt, '') AS d_order_cnt, ISNULL(D.d_orders, '') AS d_orders, "
jobQuery = jobQuery & " ISNULL(CA.cost_code, '') AS cost_code, ISNULL(CC.cost_name, '') AS cost_name, ISNULL(CA.cost_money, '') AS cost_money, "
jobQuery = jobQuery & " ISNULL(CA.cost_member, '') AS cost_member, ISNULL(CA.cost_remark, '') AS cost_remark "
jobQuery = jobQuery & " FROM V_Job_List JL LEFT JOIN cost_account CA "
jobQuery = jobQuery & " ON JL.j_date = CA.job_date AND JL.p_no = CA.user_code "
jobQuery = jobQuery & " AND JL.j_p_sn = CA.p_sn AND JL.j_contents = CA.job_code AND CA.flag = '1' "
jobQuery = jobQuery & " LEFT JOIN V_PROJECT_METHOD VPM ON JL.j_p_sn = VPM.p_child_sn "
jobQuery = jobQuery & " LEFT JOIN Document D ON JL.j_approval = D.d_no "
jobQuery = jobQuery & " LEFT JOIN Job_Code JC ON JL.j_contents = JC.j_code "
jobQuery = jobQuery & " LEFT JOIN cost_category CC ON CA.cost_code = CC.cost_code "
jobQuery = jobQuery & " WHERE p_no IN (" & p_no_arr & ") AND JL.j_date LIKE '" & ym & "%' "
response.write "<br>"& jobquery
loginQuery = ""
loginQuery = loginQuery & " SELECT p_no, ymd, login_time, logout_time, gap_time "
loginQuery = loginQuery & " , gap_time2 "
'loginQuery = loginQuery & " , (CASE WHEN 3600 < gap_time3 THEN gap_time3 - 3600 ELSE gap_time3 end) as gap_time3 "
loginQuery = loginQuery & " , (CASE WHEN 3600 < gap_time3 THEN "
loginQuery = loginQuery & " CASE WHEN login_time < '12:30' THEN gap_time3 - 3600 ELSE gap_time3 end "
loginQuery = loginQuery & " ELSE gap_time3 end) as gap_time3 "
loginQuery = loginQuery & " , (CASE WHEN 1 < gap_time THEN gap_time - 1 ELSE gap_time end) as gap_time4 "
loginQuery = loginQuery & " FROM V_LOGIN_TIME "
loginQuery = loginQuery & " WHERE p_no IN (" & p_no_arr & ") AND ymd LIKE '" & ym & "%' "
loginQuery = loginQuery & " ORDER BY ymd "
'response.write loginQuery
%>
<style>
.discript{
color: #a70000;
font-weight: bold;
font-size: 12px !important;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
#topTb *{
font-size: 13px;
letter-spacing: 0px;
}
.settingForm{
background-color: #eaeaea;
padding: 10px 10px;
}
.menuTitle{
font-weight: bold;
font-size: 20px !important;
height: 35px;
}
.dateSelect{
margin-right: 10px;
padding: 2px;
}
.personSelect{
margin: 4px 10px 3px 0px;
padding: 2px;
}
#legend_btn{
padding: 5px 25px;
font-size: 15px;
font-weight: bold;
cursor:pointer;
display:none;
}
#legend2_btn{
padding: 5px 25px;
font-size: 15px;
font-weight: bold;
cursor:pointer;
display:;
}
#busi_div{
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome and Opera */
}
#calendarTb{
margin-top: 10px;
border-collapse: collapse;
width: 100%;
table-layout: fixed;
}
#calendarTb .cal_head{
font-size: 16px;
text-align: center;
border: 1px solid #cacaca;
}
#calendarTb .app_head{
font-size: 15px;
text-align: center;
/* border: 1px solid #cacaca; */
}
#calendarTb .cal_day{
height: 120px;
border: 1px solid #cacaca;
position: relative;
}
#calendarTb .cal_day .dayLabel{
text-align: right;
right: 3px;
top: 3px;
position: absolute;
}
#calendarTb .cal_day .loginOutTime{
font-size: 11px;
font-weight: bold;
position: absolute;
bottom: 0;
right: 5px;
color: #8700bf;
}
#calendarTb .cal_day .d_nor{
color:#000000;
}
#calendarTb .cal_day .d_sun{
color:#ff0000;
}
#calendarTb .cal_day .d_sat{
color:#0000ff;
}
#calendarTb .cal_day .scheduleBar{
height: 2px;
margin-top: 2px;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail{
padding: 2px 6px;
width: 174px;
font-size:12px;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail:not(:empty){
cursor:help;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail .job_time{
display: none;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail .job_contents{
display: none;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail.on{
position:absolute;
z-index:10;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail.on .job_time{
display: inline-block;
width: 20px;
}
#calendarTb .cal_day .scheduleBar .scheduleDetail.on .job_contents{
display: inline-block;
width: 100px;
letter-spacing: -1px;
}
#calendarTb .weekDetail{
height: 120px;
/* border: 1px solid #cacaca; */
}
#calendarTb .weekDetail .wd_contents {
text-align: center;
}
#calendarTb .weekDetail .wd_contents_time{
text-align: center;
width: 100%;
/*border: 1px solid #cccccc;*/
font-weight: bold;
font-size: 15px;
padding: 5px;
display: inline-block;
cursor: pointer;
}
#calendarTb .weekDetail .wd_contents .approval_ok{
width: 100px;
color:#3db300;
font-weight: bold;
font-size: 15px;
padding: 5px;
display: inline-block;
}
#calendarTb .weekDetail .wd_contents .submit_ok{
width: 100px;
color:#000fbd;
font-weight: bold;
font-size: 15px;
padding: 5px;
display: inline-block;
}
#calendarTb .weekDetail .wd_contents .detail_btn{
width: 80px;
border: 1px solid #cccccc;
font-weight: bold;
font-size: 15px;
padding: 5px;
display: inline-block;
cursor: pointer;
word-break:keep-all;
}
#calendarTb .weekDetail .wd_contents .go_write_btn{
width: 80px;
border: 1px solid #cccccc;
font-weight: bold;
font-size: 15px;
padding: 5px;
display: inline-block;
cursor: pointer;
}
#legend_dialog{
font-size: 13px;
letter-spacing: 0px;
overflow-y:scroll;
}
#legend_dialog .legend_prj{
cursor:help;
padding: 3px 0;
}
#legend_dialog .legend_prj .legend_p_sub{
display:inline-block;
width: calc(100% - 25px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#legend_dialog .legend_prj .legend_thumb{
display: inline-block;
width: 17px;
height: 17px;
margin-left: 7px;
}
#approval_dialog *{
font-size: 13px;
letter-spacing: 0px;
box-sizing: border-box;
}
#approval_dialog{
overflow-y:scroll;
}
#approval_dialog .detail_title{
text-align: center;
font-size: 17px;
font-weight: bold;
margin-top: 14px;
}
#approval_dialog #jobDetail{
width: 100%;
padding: 0 15px;
box-sizing: border-box;
}
#approval_dialog #jobDetail_tb{
width: 100%;
border-collapse: collapse;
margin-top:10px;
}
#approval_dialog #jobDetail_tb thead td{
text-align: center;
font-weight: bold;
font-size: 14px;
padding: 2px 3px;
border: 1px solid#cccccc;
background-color: #eaeaea;
}
#approval_dialog #jobDetail_tb tbody td{
padding: 4px 5px;
border: 1px solid #cccccc;
font-size:13px;
text-align: center;
}
#approval_dialog #jobDetail_tb tbody td .p_subject_span{
width: 385px;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: left;
}
#approval_dialog #jobDetail_tb tfoot td{
padding: 4px 5px;
border: 1px solid #cccccc;
text-align: center;
font-weight:bold;
}
#approval_dialog #groupfeeDetail{
width: 100%;
padding: 0 15px;
box-sizing: border-box;
}
#approval_dialog #groupfeeDetail_tb{
width: 100%;
border-collapse: collapse;
margin-top:10px;
}
#approval_dialog #groupfeeDetail_tb thead td{
text-align: center;
font-weight: bold;
font-size: 14px;
padding: 2px 3px;
border: 1px solid#cccccc;
background-color: #eaeaea;
}
#approval_dialog #groupfeeDetail_tb tbody td{
padding: 4px 5px;
border: 1px solid #cccccc;
text-align: center;
}
#approval_dialog #groupfeeDetail_tb tfoot td{
padding: 4px 5px;
border: 1px solid #cccccc;
text-align: center;
font-weight:bold;
}
#approval_div{
margin-top: 30px;
text-align: center;
}
#approval_div #approval_ok_btn{
padding: 5px 25px;
font-size: 15px;
font-weight: bold;
cursor:pointer;
}
</style>
<script>
var p_no = "<%=Session("User_Number") %>";
var groupfeeArr = <%=queryToJson(groupQuery)%>;
var jobArr = <%= queryToJson(jobQuery)%>;
var loginArr = <%=queryToJson(loginQuery) %>;
var weekApproval = uniq(jobArr, ["p_no", "j_approval", "d_order_cnt", "d_orders", "weekNum", "weekNum_new"]);
var vacationCodes = [8,10,11,18,12,14,15,16,17,9,20,21,19]; //휴가 관련 코드들
//-- 20220519 hwkim
var full_month_time = $(".d_nor").length;
//-- ((해당월일수/7일)*12시간)
var full_month_time2 = Math.floor(($(".dayLabel").length / 7)*12);
console.log( " full_month_time2 = "+ full_month_time2 + ", "+ Math.floor(($(".dayLabel").length / 7)*12) );
var full_month_sum = 0;
full_month_sum = full_month_time * 8;
full_month_sum += full_month_time2
console.log( " full_month_time = "+ full_month_time + ", full_month_sum = "+ full_month_sum );
var colorArr = [
"#633b3a", "#8d42e4", "#474c55", "#4f0365", "#5cb5cf",
"#d82699", "#de605b", "#d34b77", "#23373a", "#42c633",
"#b11d51", "#426aa0", "#d8f671", "#cf98a0", "#327d16",
"#111869", "#5cfae2", "#f3a683", "#786fa6", "#f7d794",
"#f8a5c2", "#778beb", "#63cdda", "#e77f67", "#596275",
"#cf6a87", "#f19066", "#574b90", "#f5cd79", "#f78fb3",
"#546de5", "#3dc1d3", "#e15f41", "#c44569", "#303952",
"#e66767", "#d1d8e0", "#0fb9b1", "#4b7bec", "#45aaf2",
"#eb3b5a", "#fd9644", "#f7b731", "#26de81", "#a5b1c2",
"#000000", "#000000", "#000000", "#000000", "#000000",
"#000000", "#000000", "#000000", "#000000", "#000000",
"#000000", "#000000", "#000000", "#000000", "#000000",
"#000000", "#000000", "#000000", "#000000", "#000000",
"#000000", "#000000", "#000000", "#000000", "#000000",
"#000000", "#000000", "#000000", "#000000", "#000000"
];
var legend_dialog = $("#legend_dialog").dialog({
autoOpen: false,
modal: false,
resizable: true,
height: 500,
width: 470,
title: '프로젝트 범례'
}).dialogExtend({
"minimizable" : true,
"collapsable" : true,
"dblclick" : "collapse"
});
legend_dialog.dialog("option", "position", {
my: 'center',
at: 'center',
of: window
});
var approval_dialog = $("#approval_dialog").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 720,
width: 1100,
title: '상세보기 및 승인',
close: function(){
$("#approval_dialog").html("");
}
});
approval_dialog.dialog("option", "position", {
my: 'center',
at: 'center',
of: window
});
function changeWeek(){
var conyear = $("select[name=conyear] option:selected").val();
var conmonth = $("select[name=conmonth] option:selected").val();
location.href="./busi_list.asp?conyear="+conyear+"&conmonth="+conmonth;
}
function drawSchedule(p_jobArr, p_groupfeeArr, p_weekApproval){
console.log("p_weekApproval");
console.log(p_weekApproval);
$.each(p_weekApproval, function(idx, obj){
var tmpHTML = "";
//-- weeknum 변경
var weeknum_eachnow = $(".weekDetail[data-weeki-num='"+ obj.weekNum_new +"']").data("weeknum");
obj.weekNum = weeknum_eachnow;
//-- 로그인 본인이면
if(obj.p_no == p_no){
console.log("p_weekApproval 001 => "+ obj.d_order_cnt + " "+ obj.weekNum + "주차 "+ weeknum_eachnow + " 주차 "+ obj.weekNum_new +" num");
if(obj.d_order_cnt == "77"){
tmpHTML = "<div class='approval_ok'>승인 완료</div><div class='detail_btn'>" + obj.weekNum + "주차 상세</div>";
}else if(+obj.d_order_cnt != 0 && +obj.d_order_cnt != 77){
tmpHTML = "<div class='submit_ok'>제출 완료</div><div class='detail_btn'>" + obj.weekNum + "주차 상세</div>";
}else if(+obj.d_order_cnt == 0){
tmpHTML = "<div class='go_write_btn'>" + obj.weekNum + "주차<br>작성하기</div>";
}
}else{
console.log("p_weekApproval 002 => "+ obj.d_order_cnt + " "+ obj.weekNum + "주차 "+ weeknum_eachnow + " 주차 "+ obj.weekNum_new +" num");
if(obj.d_order_cnt == "77"){
tmpHTML = "<div class='approval_ok'>승인 완료</div><div class='detail_btn'>" + obj.weekNum + "주차 상세</div>";
}else if(+obj.d_order_cnt != 0 && obj.d_orders == p_no){
tmpHTML = "<div class='detail_btn'>" + obj.weekNum + "주차 상세<br>(승인)</div>";
}
}
//console.log( obj.weekNum +" >> "+ obj.weekNum_new +" >> p_weekApproval => "+ tmpHTML);
//$(".weekDetail[data-weeknum='" + obj.weekNum + "'] .wd_contents").html(tmpHTML);
$(".weekDetail[data-weeki-num='" + obj.weekNum_new + "'] .wd_contents").html(tmpHTML);
});
if(p_no == $("select[name=p_no]").children("option:selected").val()){
$.each($.grep($(".weekDetail[data-weeknum]"), function(obj, idx){
//console.log(" ohj : "+ $(obj).data("weeki-num") + " = ohj : "+ $(obj).data("weeknum"));
////console.log( $("select[name='conmonth'] option:selected").val()*10 + +$(obj).data("weeknum") );
////console.log( (new Date().getMonth()+1)*10 + getWeekNum(new Date()) );
////console.log(" ohj2 : "+ $(obj).children(".wd_contents:empty") );
//return $("select[name='conmonth'] option:selected").val()*10 + +$(obj).data("weeknum") <= (new Date().getMonth()+1)*10 + getWeekNum(new Date())
//&& $(obj).children(".wd_contents:empty").length > 0 }), function(i, o){
//$(o).children(".wd_contents").html("<div class='go_write_btn'>" + $(o).data("weeknum") + "주차<br>작성하기</div>");
return $(obj).children(".wd_contents:empty").length > 0 }) , function(i, o){
//console.log("...... ohj : "+ $(o).data("weeki-num") + " = ohj : "+ $(o).data("weeknum") + "주차<br>작성하기</div>");
//$(o).children(".wd_contents").html("<div class='go_write_btn'>" + $(o).data("weeknum") + "주차<br>작성하기</div>");
$(".weekDetail[data-weeki-num='" + $(o).data("weeki-num") + "'] .wd_contents").html("<div class='go_write_btn'>" + $(o).data("weeknum") + "주차<br>작성하기</div>");
});
}
$(".detail_btn").on("click", function(){
approval_dialog.dialog("open");
var weekNum = $(this).parents(".weekDetail").data("weeknum");
var weekNum_new = $(this).parents(".weekDetail").data("weeki-num");
drawDetailJob(weekNum, p_jobArr, p_groupfeeArr, p_weekApproval, weekNum_new); //-- 승인 모달창
});
$(".go_write_btn").on("click",function(){
//var weekNum = $(this).parents(".weekDetail").data("weeknum");
var weekNum = $(this).parents(".weekDetail").data("weeki-num");
var conyear = $("select[name='conyear'] option:selected").val();
var conmonth = $("select[name='conmonth'] option:selected").val();
location.href="./busi_write.asp?conyear=" + conyear + "&conmonth=" + conmonth + "&conweek=" + weekNum;
});
if(p_jobArr.length == 0){
return false;
}
var dayPrjArr = groupBySum(p_jobArr, ["j_date", "j_p_sn", "p_subject"]);
var prjArr = uniq(dayPrjArr, "j_p_sn");
var tmpHTML = $.map(prjArr, function(p_sn){ return "<div class='scheduleBar' data-p_sn='" + p_sn + "'><div class='scheduleDetail'></div></div>"; }).join("");
$(".dayLabel").after(tmpHTML);
$.each(groupBySum(dayPrjArr, ["j_p_sn", "p_subject"]), function(idx, obj){
$("#legend_dialog").append(
"<div class='legend_prj' data-p_sn='" + obj.j_p_sn + "'>"+
"<span class='legend_p_sub'>[" + obj.j_p_sn + "] " + obj.p_subject + "</span>"+
"<span class='legend_thumb' style='background-color:" + colorArr[prjArr.indexOf(obj.j_p_sn)] + ";'></span>"+
"</div>"
);
});
$.each(dayPrjArr, function(idx, obj){
var dayJob = groupBySum($.grep(p_jobArr, function(o, i){ return o.j_date == obj.j_date && o.j_p_sn == obj.j_p_sn; }), ["j_contents","j_contents_nm", "j_time"]);
//console.log(dayJob);
var tmpHTML = $.map(dayJob, function(o){
//-- 20220520 hwkim
//console.log(" j_contents ----------- "+ o.j_contents)
var j_contents_val = "";
//-- wd_contents_time add time
var weeki_num = $(".dayLabel[data-date='" + obj.j_date + "']").attr("data-weeki");
//console.log(" .dayLabel weeki_num = "+ weeki_num);
if( o.j_contents == "8" || o.j_contents == "9" || o.j_contents == "10" || o.j_contents == "11" ){
j_contents_val = "<span class='j_contents_val' data-date='" + obj.j_date + "' data-week='" + weeki_num + "' style='display: none;' >" + o.j_time + "</span>";
}
return "<div><span class='job_time'>" + o.j_time + "</span>"+j_contents_val+"<span class='job_contents'>" + o.j_contents_nm + "</span></div>";
}).join("");
$(".dayLabel[data-date='" + obj.j_date + "']").nextAll(".scheduleBar[data-p_sn='" + obj.j_p_sn + "']").children(".scheduleDetail").css("background-color", colorArr[prjArr.indexOf(obj.j_p_sn)]);
$(".dayLabel[data-date='" + obj.j_date + "']").nextAll(".scheduleBar[data-p_sn='" + obj.j_p_sn + "']").children(".scheduleDetail").css("color", contrast(colorArr[prjArr.indexOf(obj.j_p_sn)]));
$(".dayLabel[data-date='" + obj.j_date + "']").nextAll(".scheduleBar[data-p_sn='" + obj.j_p_sn + "']").children(".scheduleDetail").html(tmpHTML);
});
}
function deleteSchedule(){
$(".scheduleBar").remove();
$(".weekDetail .wd_contents").html("");
}
function drawDetailJob(weekNum, p_jobArr, p_groupfeeArr, p_weekApproval, weekNum_new){
var selWeekJobArr = $.grep(p_jobArr, function(obj, idx){ return obj.weekNum_new == weekNum_new; });
//console.log(selWeekJobArr)
var selWeekGroupfeeArr = $.grep(p_groupfeeArr, function(obj, idx){ return obj.weekNum_new == weekNum_new; });
//console.log(p_weekApproval)
var weekAppObj = $.grep(p_weekApproval, function(obj, idx){ return obj.weekNum_new == weekNum_new; })[0];
//console.log(weekAppObj)
var jobContentsArr = groupBySum(selWeekJobArr, ["j_date", "j_p_sn", "p_subject", "j_contents", "j_contents_nm", "j_time"]);
var tmpHTML = "";
tmpHTML += "<div id='jobDetail'>";
tmpHTML += "<div class='detail_title'>업무내용(비용) 상세</div>";
tmpHTML += "<table id='jobDetail_tb'>";
tmpHTML += "<thead>";
tmpHTML += "<tr><td>날짜</td><td>프로젝트</td><td>업무내용</td><td>업무시간(h)</td><td>비용항목</td><td>금액(원)</td><td>비고</td></tr>";
tmpHTML += "</thead>";
tmpHTML += "<tbody>";
$.each(jobContentsArr, function(idx, obj){
tmpHTML += "<tr>";
tmpHTML += "<td rowspan='" + obj.groupByCount + "' style='width:90px;'>" + obj.j_date + "</td>";
tmpHTML += "<td rowspan='" + obj.groupByCount + "' style='width:400px;'><span class='p_subject_span'>[" + obj.j_p_sn + "] " + obj.p_subject + "</span></td>";
tmpHTML += "<td rowspan='" + obj.groupByCount + "' style='width:120px;'>" + obj.j_contents_nm + "</td>";
tmpHTML += "<td rowspan='" + obj.groupByCount + "' style='width:85px;'>" + obj.j_time + "</td>";
var tmpJobCost = $.grep(selWeekJobArr, function(o, i){
return o.j_date == obj.j_date && o.j_p_sn == obj.j_p_sn && o.j_contents == obj.j_contents && o.j_time == obj.j_time;
});
$.each(tmpJobCost, function(i, o){
if(i > 0){
tmpHTML += "</tr><tr>";
}
tmpHTML += "<td style='width:160px;'>" + o.cost_name + (o.cost_member != "" ? "<br>(" + o.cost_member + ")" : "") + "</td>";
tmpHTML += "<td style='width:85px;'>" + (o.cost_money == "0" ? "" : commify(o.cost_money)) + "</td>";
tmpHTML += "<td>" + o.cost_remark + "</td>";
});
tmpHTML += "</tr>";
});
tmpHTML += "</tbody>";
var sumCostMoney = groupBySum(selWeekJobArr, ["weekNum"], ["cost_money"])[0].cost_money;
if(sumCostMoney != "0"){
tmpHTML += "<tfoot>";
tmpHTML += "<tr>";
tmpHTML += "<td colspan='5'>비용 합계</td><td>" + commify(sumCostMoney) + "</td><td></td>";
tmpHTML += "</tr>";
tmpHTML += "</tfoot>";
}
tmpHTML += "</table>";
tmpHTML += "</div>";
if(selWeekGroupfeeArr.length > 0){
tmpHTML += "<div id='groupfeeDetail'>";
tmpHTML += "<div class='detail_title'>그룹운영비 상세</div>";
tmpHTML += "<table id='groupfeeDetail_tb'>";
tmpHTML += "<thead>";
tmpHTML += "<tr><td>날짜</td><td>프로젝트</td><td>구분</td><td>내용</td><td>금액(원)</td></tr>";
tmpHTML += "</thead>";
tmpHTML += "<tbody>";
$.each(selWeekGroupfeeArr, function(idx, obj){
tmpHTML += "<tr>";
tmpHTML += "<td>" + obj.cost_date + "</td><td style='text-align:left;'>[" + obj.txt_pjt + "] " + obj.p_subject + "</td><td>" + obj.txt_hangmok + "</td><td>" + obj.contents + "</td><td>" + commify(obj.cost) + "</td>";
tmpHTML += "</tr>";
});
var sumGroupfee = groupBySum(selWeekGroupfeeArr, ["weekNum"], ["cost"]);
tmpHTML += "</tbody>";
tmpHTML += "<tfoot>";
tmpHTML += "<tr>";
tmpHTML += "<td colspan='4'>비용 합계</td><td>" + commify(sumGroupfee[0].cost) + "</td>";
tmpHTML += "</tr>";
tmpHTML += "</tfoot>";
tmpHTML += "</table>";
tmpHTML += "</div>";
}
tmpHTML += "<div id='approval_div'>";
tmpHTML += "<input type='button' value='승인하기' id='approval_ok_btn' />";
tmpHTML += "</div>";
$("#approval_dialog").html(tmpHTML);
if(weekAppObj.d_order_cnt == "77" || weekAppObj.d_orders != p_no){
$("#approval_ok_btn").css("display", "none");
}
$("#approval_ok_btn").on("click", function(){
if(confirm(weekNum + "주차 업무를 승인하시겠습니까?")){
var paramObj = {
"d_no" : weekAppObj.j_approval
};
var retVal = approvalConfirm(paramObj);
if(retVal == "1"){
alert("승인이 완료되었습니다.");
$("#approval_ok_btn").css("display", "none");
$.each(weekApproval, function(idx, obj){
if(obj.weekNum == weekNum && obj.p_no == $("select[name=p_no]").children("option:selected").val()){
obj.d_order_cnt = "77";
}
});
$(".weekDetail[data-weeknum='" + weekNum + "'] .wd_contents").prepend("<div class='approval_ok'>승인완료</div>")
$(".weekDetail[data-weeknum='" + weekNum + "'] .wd_contents .detail_btn").html(weekNum + "주차 상세");
approval_dialog.dialog("close");
}else{
console.log(obj.p_no, $("select[name=p_no]").children("option:selected").val())
alert("승인 중 오류가 발생하였습니다.\n관리부서에 문의해주세요.");
}
}
});
}
function approvalConfirm(param){
var retVal = 0;
$.ajax({
url: "./busi_approval_ok.asp",
data: {"data": JSON.stringify(param)},
method: "POST",
async: false,
success: function(res){
retVal = res;
}
});
return retVal;
}
function drawLoginTime(p_no){
$(".loginOutTime").remove();
var p_loginArr = $.grep(loginArr, function(obj, idx){ return obj.p_no == p_no; });
var pre_week = 0;
var now_week = 0;
var week_sum = 0;
var month_sum = 0;
$.each(p_loginArr, function(idx, obj){
//j_contents_val
var j_contents_val = $(".j_contents_val[data-date='" + obj.ymd + "']").text();
//console.log( " j_contents_val = "+ j_contents_val );
//console.log( obj.p_no );
//console.log( obj.gap_time3 );
var gap_time_sum_se = Number(obj.gap_time3);
/*
if( gap_time_sum_se > 3600 ){
gap_time_sum_se = gap_time_sum_se - 3600;
}*/
//gap_time_sum_se += (3600 * j_contents_val); //-- 휴가 시간 적용
//console.log(" secondsToTime("+gap_time_sum_se+") : "+ secondsToTime(gap_time_sum_se) );
//console.log(" gap_time_sum_se : "+ gap_time_sum_se);
//-- wd_contents_time add time
var weeki_num = $(".dayLabel[data-date='" + obj.ymd + "']").attr("data-weeki-num");
//console.log(" weeki_num = "+ weeki_num);
$(".dayLabel[data-date='" + obj.ymd + "']").after("<div class='loginOutTime'>" + obj.login_time + " ~ " + obj.logout_time + " (<span class='day_num gap_time' data-date='"+obj.ymd+"' data-val='" + gap_time_sum_se + "' data-week='" + weeki_num + "' >"+ secondsToTime(gap_time_sum_se) +"</span>)" + "</div>");
var gap_time = Number(gap_time_sum_se);
/*
if(pre_week == 0 ){ pre_week = weeki_num; }
if(now_week == 0 ){ now_week = weeki_num; }
if(now_week < weeki_num ){
//console.log(" check it~ ");
pre_week = now_week;
now_week = weeki_num;
week_sum = 0;
}
week_sum += gap_time;
month_sum += gap_time;
console.log(" pre_week = "+ pre_week +" , now_week = "+ now_week +" , week_sum = "+ week_sum +" , gap_time = "+ gap_time );
console.log( secondsToTime(week_sum) );
$(".weekDetail[data-weeknum='" + now_week + "'] .wd_contents_time").html( "<span style='' > "+ secondsToTime(week_sum) +" </span>" );
*/
});
//console.log("------ 주간 합계--------------------------------------");
//-- 주간 합계
// var j_contents_val = $(".j_contents_val[data-date='" + obj.ymd + "']").text();
// console.log( " j_contents_val = "+ j_contents_val );
$.each( $(".dayLabel"), function(idx, obj){
var now_date_val = $(obj).attr("data-date");
//console.log( " ** start date : "+ now_date_val);
var weeki_num = $(".dayLabel[data-date='" + now_date_val + "']").attr("data-weeki-num");
var gap_time = 0;
gap_time = $(".gap_time[data-date='" + now_date_val + "']").attr("data-val");
gap_time = gap_time ? Number(gap_time) : 0;
//console.log(gap_time);
//-- 휴가 적용
var j_contents_val = $(".j_contents_val[data-date='" + now_date_val + "']").text();
j_contents_val = j_contents_val ? Number(j_contents_val) * 3600 : 0;
//console.log(" j_contents_val = "+ j_contents_val);
gap_time += j_contents_val
if(pre_week == 0 ){ pre_week = weeki_num; }
if(now_week == 0 ){ now_week = weeki_num; }
if(now_week < weeki_num ){
//console.log(" check it~ ");
pre_week = now_week;
now_week = weeki_num;
week_sum = 0;
}
week_sum += gap_time;
month_sum += gap_time;
//console.log(" pre_week = "+ pre_week +" , now_week = "+ now_week +" , week_sum = "+ week_sum +" , gap_time = "+ gap_time );
//console.log( secondsToTime(week_sum) );
$(".weekDetail[data-weeki-num='" + now_week + "'] .wd_contents_time").html( "<span style='' > "+ secondsToTime(week_sum) +" </span>" );
});
//console.log(" month_sum = "+ month_sum);
$("#legend2_btn").val(" "+ secondsToTime(month_sum) +" 시간 / "+ full_month_sum +" 시간 ");
}
function secondsToTime(secs)
{
secs = Math.round(secs);
var hours = Math.floor(secs / (60 * 60));
var divisor_for_minutes = secs % (60 * 60);
var minutes = Math.floor(divisor_for_minutes / 60);
var divisor_for_seconds = divisor_for_minutes % 60;
var seconds = Math.ceil(divisor_for_seconds);
if (hours < 10) {hours = "0"+hours;}
if (minutes < 10) {minutes = "0"+minutes;}
if (seconds < 10) {seconds = "0"+seconds;}
var obj = {
"h": hours,
"m": minutes,
"s": seconds
};
var t = hours+":"+minutes; //+":"+ss;
return t;
}
function fnc_timeset(sec){
//var tDate = new Date('1900-01-01 00:00:00'); //-- 업무시간 SET
//tDate.setMinutes(tDate.getMinutes() + Number(sec));
//return tDate;
var seconds = sec;
// multiply by 1000 because Date() requires miliseconds
var date = new Date(seconds * 1000);
var hh = date.getUTCHours();
var mm = date.getUTCMinutes();
var ss = date.getSeconds();
// If you were building a timestamp instead of a duration, you would uncomment the following line to get 12-hour (not 24) time
// if (hh > 12) {hh = hh % 12;}
// These lines ensure you have two-digits
if (hh < 10) {hh = "0"+hh;}
if (mm < 10) {mm = "0"+mm;}
if (ss < 10) {ss = "0"+ss;}
// This formats your string to HH:MM:SS
var t = hh+":"+mm; //+":"+ss;
return t
}
$(function(){
$(".dateSelect").on("change", function(){
changeWeek();
});
$("select[name=p_no]").on("change", function(){
deleteSchedule();
$("#legend_dialog").html("");
var sel_p_no = $(this).children("option:selected").val();
////-- 출퇴근체크
//drawLoginTime(sel_p_no);
if(sel_p_no != ""){
$("#legend_btn").show();
var p_groupfeeArr = $.grep(groupfeeArr, function(obj, idx){ return obj.p_no == sel_p_no; });
//console.log(jobArr);
var p_jobArr = $.grep(jobArr, function(obj, idx){
//console.log(" sel_p_no = "+ sel_p_no);
//console.log(" obj.p_no = "+ obj.p_no + " obj.j_approval = "+ obj.j_approval);
return obj.p_no == sel_p_no && (obj.j_approval != '' || sel_p_no == p_no); });
var p_weekApproval = $.grep(weekApproval, function(obj, idx){ return obj.p_no == sel_p_no; });
//console.log(1);
//console.log(" 1.sel_p_no = "+ sel_p_no);
//console.log(p_jobArr);
//console.log(p_groupfeeArr);
//console.log(p_weekApproval);
drawSchedule(p_jobArr, p_groupfeeArr, p_weekApproval);
//console.log(2);
}else{
$("#legend_btn").hide();
}
//-- 출퇴근체크
drawLoginTime(sel_p_no);
});
$(document).on("mouseenter", "#calendarTb .cal_day .scheduleBar .scheduleDetail:not(:empty)", function(){
$(".scheduleBar[data-p_sn='" + $(this).parent().data("p_sn") + "']").children(".scheduleDetail:not(:empty)").addClass("on");
});
$(document).on("mouseleave", "#calendarTb .cal_day .scheduleBar .scheduleDetail:not(:empty)", function(){
$(".scheduleBar[data-p_sn='" + $(this).parent().data("p_sn") + "']").children(".scheduleDetail:not(:empty)").removeClass("on");
});
$(document).on("mouseenter", "#legend_dialog .legend_prj", function(){
$(".scheduleBar[data-p_sn='" + $(this).data("p_sn") + "']").children(".scheduleDetail:not(:empty)").addClass("on");
});
$(document).on("mouseleave", "#legend_dialog .legend_prj", function(){
$(".scheduleBar[data-p_sn='" + $(this).data("p_sn") + "']").children(".scheduleDetail:not(:empty)").removeClass("on");
});
$("#legend_btn").on("click", function(){
legend_dialog.dialog("open");
});
var personArr = <%= queryToJson(perQuery)%>;
console.log("personArr : " + personArr)
$.each(personArr, function(idx, obj){
$("select[name=p_no]").append("<option value='" + obj.p_no + "'>" + obj.p_name + "</option>");
});
$("select[name=p_no]").val(p_no);
$("select[name=p_no]").trigger("change");
if(personArr.length == 1){
if(personArr[0].p_no == p_no){
$("select[name=p_no]").css("display", "none");
}
}
});
function uniq(arr, item){
var retArr = [];
if(Array.isArray(item) == true){
retArr = $.unique($.map(arr, function(obj){
var tmpArr = [];
for(var i=0; i<item.length; i++){
tmpArr.push(obj[item[i]]);
}
return tmpArr.join("|");
}).sort());
retArr = $.map(retArr, function(obj){
var tmpObj = {};
var tmpVal = obj.split("|");
for(var i=0; i<item.length; i++){
tmpObj[item[i]] = tmpVal[i];
}
return tmpObj;
});
return retArr;
}else{
retArr = $.unique($.map(arr, function(obj){ return obj[item]; }).sort());
}
return retArr;
}
function groupBySum(jsonArr, groupArr, sumArr_opt){
var sumArr = sumArr_opt || [];
var newJsonArr = uniq(jsonArr, groupArr);
$.each(newJsonArr, function(i, obj){
$.each(sumArr, function(idx, sumCol){
obj[sumCol] = 0;
});
obj["groupByCount"] = 0;
});
$.each(newJsonArr, function(idx, obj){
$.each($.grep(jsonArr, function(o, i){
var nStr = "";
var pStr = "";
$.each(groupArr, function(ix, groupCol){
nStr += obj[groupCol] + "|";
pStr += o[groupCol] + "|";
});
return nStr == pStr;
}), function(i, o){
$.each(sumArr, function(ix, sumCol){
obj[sumCol] += +o[sumCol];
});
obj["groupByCount"]++;
});
});
return newJsonArr;
}
function getWeekNum(condate){
var date = condate ? new Date(condate) : new Date();
return parseInt((date.getDate() - date.getDay() + 12) / 7);
}
function rgbToYIQ(rgb) {
return ((rgb.r * 299) + (rgb.g * 587) + (rgb.b * 114)) / 1000;
}
function hexToRgb(hex) {
if (!hex || hex === undefined || hex === '') return undefined;
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : undefined;
}
function contrast(colorHex, threshold) {
if(!threshold) threshold = 128;
if (colorHex === undefined) return '#000';
const rgb = hexToRgb(colorHex);
if (rgb === undefined) return '#000';
return rgbToYIQ(rgb) >= threshold ? '#000' : '#fff';
}
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->