Files
KIN/approval/doc_commute_print.asp
2025-09-29 17:55:08 +09:00

513 lines
21 KiB
Plaintext

<!-- #include virtual = "lib/config.asp" -->
<%
'Response.Expires = 0
dim doc_type : doc_type = "doc_commute_print"
dim tmpstr
dim Query
dim i, j
dim user_name(4) '현재 사용자,0:사원코드, 1:이름,2:직급,3:전화번호, 4:부서코드(명)
dim Max_Width
dim title
dim target_name '발급대상자 이름
dim Curr_date '오늘날짜
dim Company(6)
dim krc_no
dim Gap()
dim Max_Repare_Day_Cnt
dim print_type '1:보기, 2:진짜프린트
dim db_table_name
db_table_name = "문서내용"
title="출퇴근보고서"
Max_Width =750
Curr_date = year(date) & "년 " & zeroformat(month(date),2) & "월 " & zeroformat(day(date),2) & "일"
Max_Repare_Day_Cnt = 5
redim Gap(Max_Repare_Day_Cnt,6) 'x:순번, y:1:날짜, 2:system 출근시각, 3:system 퇴근시각, 4:보고사유, 5:출근조정시각, 6:퇴근조정시각
for i=1 to Max_Repare_Day_Cnt
gap(i, 1) = request("txt_date_" & cstr(i))
gap(i, 2) = request("txt_in_time_1_" & cstr(i))
gap(i, 3) = request("txt_out_time_1_" & cstr(i))
gap(i, 4) = Unescape(request("txt_reason_" & cstr(i)))
gap(i, 5) = request("txt_in_time_2_" & cstr(i))
gap(i, 6) = request("txt_out_time_2_" & cstr(i))
next
for i=1 to Max_Repare_Day_Cnt
for j=1 to 6
if trim(gap(i, j)) = "" then
gap(i, j) = "&nbsp;"
end if
if trim(gap(i, j)) = "?" then
gap(i, j) = "&nbsp;"
end if
next
next
print_type = request("print_type")
set rsm = server.CreateObject("ADODB.RECORDSET")
''//===============
''회사 회사명, 사업자등록번호, 대표자명, 주소 가져오기
Query = "select * from company"
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
Company(1) = adors("com_name")
Company(2) = adors("사업자등록번호")
Company(3) = adors("대표자명")
Company(4) = adors("주소")
Company(5) = adors("법인등록번호")
Company(6) = adors("회사대표전화번호")
adoRs.close
''///===============
''로그인 사용자 정보
user_name(0) = Session("User_Number")
Query = "SELECT p_name, p_team_name, p_rank_name, p_tel3 FROM project2.dbo.V_Person WHERE p_no = '" & user_name(0) & "'"
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
user_name(1) = adoRs("p_name") '이름
user_name(2) = adoRs("p_rank_name") '직위 코드
user_name(3) = adoRs("p_tel3") '직통 전화
user_name(4) = adoRs("p_team_name") '부서코드
adoRs.close
tmp_txt1 = request("tmp_txt1")
if tmp_txt1 = "" then
tmp_txt1 = request("tmp_txt1_tmp")
end if
tmp_txt2 = request("tmp_txt2")
tmp_txt3 = request("tmp_txt3")
tmp_txt4 = request("tmp_txt4")
tmp_txt5 = request("tmp_txt5")
tmp_txt6 = request("tmp_txt6")
tmp_txt7 = request("tmp_txt7")
tmp_txt8 = request("tmp_txt8")
tmp_txt9 = request("tmp_txt9")
tmp_txt10 = request("tmp_txt10")
if cint(print_type) = 2 then
'먼저 출퇴근보고서의 문서번호 생성
''///===============
''문서번호 정보
Query = "select 문서번호 as krc_no from " & db_table_name
query = query & " where 문서제목 = '" & replace(title, " ", "") & "' "
query = query & " and substring(문서번호,5,4) = '" & year(date) & "' "
query = query & " order by 문서번호"
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
if adoRs.recordcount <= 0 then
krc_no = 0
else
adoRs.movelast
tmpstr = split(trim(adoRs("krc_no")),"-")
krc_no = tmpstr(3)
end if
adoRs.close
krc_no = int(krc_no) + 1
tmpstr = "KRC-" & year(date) & "-"
tmpstr = tmpstr & "M-"
krc_no = tmpstr & ZeroFormat(krc_no,5)
target97 = user_name(1) & "^^" & user_name(2) & "^^" & user_name(3) & "^^" & user_name(4)
target98 = Company(1) & "^^" & Company(2) & "^^" & Company(3) & "^^" & Company(4) & "^^" & Company(5) & "^^" & Company(6)
'====================================================================
%>
<!-- #include file = "inc_payapproval.asp" -->
<!-- #include file = "inc_payapproval_line.asp" -->
<!-- #include file = "inc_preapproval.asp" -->
<%
target99 = tmp_txt1 & "^^" & tmp_txt2 & "^^" & tmp_txt3 & "^^" & tmp_txt4 & "^^" & tmp_txt5
target100 = tmp_txt6 & "^^" & tmp_txt7 & "^^" & tmp_txt8 & "^^" & tmp_txt9 & "^^" & tmp_txt10
'Document table에 삽입
query = "INSERT INTO Document "
query = query & " (d_no, d_name, d_write_name, d_write_date, d_flag, d_type, "
query = query & " d_order_cnt, d_orders,"
query = query & " d_order1, d_order2, d_order3, d_order4, d_order5, "
query = query & " d_order6, d_order7, d_order8, d_order9, d_order10, "
query = query & " d_view, d_delok) "
query = query & "VALUES "
query = query & " ('" & krc_no & "', '출퇴근보고서', '" & Session("loginuser") & "', '" & date() & "', '4', '" & d_type & "', "
query = query & " '" & d_order_cnt & "', '" & d_orders & "', "
query = query & " '" & d_order1 & "', '" & d_order2 & "', '" & d_order3 & "', '" & d_order4 & "', '" & d_order5 & "', "
query = query & " '" & d_order6 & "', '" & d_order7 & "', '" & d_order8 & "', '" & d_order9 & "', '" & d_order10 & "', "
query = query & " 'Y', 'N') "
'response.Write query & "<BR>"
adoconn.execute query
'====================================================================
'//========================
'내용 저장하기
query = "insert into " & db_table_name & " (문서번호, 문서제목, "
for i=1 to Max_Repare_Day_Cnt
query = query & "target" & trim((i)) & ", "
next
query = query & " target97, target98, target99, target100, "
query = query & " 발급일, 발급시각, login_p_no, login_이름,login_ip) values ( "
query = query & "'" & krc_no & "', "
query = query & "'" & replace(title, " ", "") & "', "
for i=1 to Max_Repare_Day_Cnt
query = query & "'" & gap(i, 1) & "^^" & gap(i, 2) & "^^" & gap(i, 3) & "^^" & replace(gap(i, 4),"&nbsp;","") & "^^" & gap(i, 5) & "^^" & gap(i, 6) & "', "
next
query = query & "'" & target97 & "', "
query = query & "'" & target98 & "', "
query = query & "'" & target99 & "', "
query = query & "'" & target100 & "', "
query = query & "'" & year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2) & "', "
query = query & "'" & time() & "', "
query = query & "'" & user_name(0) & "', "
query = query & "'" & user_name(1) & "', "
query = query & "'" & Session("USERIP") & "') "
'response.Write query & "<br>"
adoconn.execute query
''로그저장
query = "insert into " & db_table_name & "_log (문서번호, 문서제목, 대상자_p_no, 대상자_이름, 내용,"
query = query & " 발급일, 발급시각, 발급자_p_no, 발급자_이름, 발급자_ip) values ( "
query = query & "'" & krc_no & "', "
query = query & "'" & replace(title, " ", "") & "', "
query = query & "'" & user_name(0) & "', "
query = query & "'" & user_name(1) & "', "
query = query & "'" & replace(title, " ", "") & "인쇄', "
query = query & "'" & year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2) & "', "
query = query & "'" & time() & "', "
query = query & "'" & user_name(0) & "', "
query = query & "'" & user_name(1) & "', "
query = query & "'" &Session("USERIP") & "')"
adoconn.execute query
if d_order_cnt = 77 then
p_no = user_name(0) ''결재 상신자 사번
p_name = user_name(1) '결재 상신자 이름
line_cnt = Max_Repare_Day_Cnt '몇줄인가
for i=1 to line_cnt
for j=1 to 6
gap(i,j) = replace(gap(i,j),"&nbsp;","")
gap(i,j) = replace(gap(i,j),"&#160;","")
next
if not isEmpty(gap(i,5)) and not isnull(gap(i,5)) and gap(i,5) <> "&#160;" and trim(gap(i,5)) <> "" then
query = "insert into login (name, p_no, [date], [time], real_time, login_out, ip, edit_reason) values ("
query = query & "'" & p_name & "', "
query = query & "'" & p_no & "', "
query = query & "'" & gap(i,1) & "', "
query = query & "'" & replace(gap(i,5),":","") & "', "
query = query & "'" & FormatDateTime(date,0) & " " & FormatDateTime(time,4) & "', "
query = query & "'login-출퇴근보고서', "
query = query & "'" & Request.ServerVariables("remote_host") & "', "
query = query & "'" & gap(i,4) & "-" & session("User_Number") & "') "
'Response.Write query & "<BR>"
adoConn.Execute query
end if
if not isEmpty(gap(i,6)) and not isnull(gap(i,6)) and gap(i,6) <> "&#160;" and trim(gap(i,6)) <> "" then
query = "insert into login (name, p_no, [date], [time], real_time, login_out, ip, edit_reason) values ("
query = query & "'" & p_name & "', "
query = query & "'" & p_no & "', "
if mid(gap(i,6),1,2) >= 00 and mid(gap(i,6),1,2) < 06 then ''00시부터 07시 이전 퇴근이면 날짜를 1일 더하여 저
query = query & "'" & cdate(gap(i,1)) + 1 & "', "
else
query = query & "'" & gap(i,1) & "', "
end if
query = query & "'" & replace(gap(i,6),":","") & "', "
query = query & "'" & FormatDateTime(date,0) & " " & FormatDateTime(time,4) & "', "
query = query & "'login-출퇴근보고서', "
query = query & "'" & Request.ServerVariables("remote_host") & "', "
query = query & "'" & gap(i,4) & "-" & session("User_Number") & "') "
'Response.Write query & "<BR>"
adoConn.Execute query
end if
next
end if
end if
%>
<html>
<head>
<title><%=GNB_TITLE%></title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<link rel="stylesheet" type="text/css" href="/css/basic.css">
</head>
<script language=javascript>
function win_close()
{
window.close();
}
function subit()
{
var url = "doc_commute_print.asp?";
url = url + "print_type=2";
document.frm_in_out_time.action=url;
document.frm_in_out_time.submit();
}
function print_ie()
{
//
if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1){ // Chrome Browser Detected?
window.PPClose = false; // Clear Close Flag
window.onbeforeunload = function(){ // Before Window Close Event
if(window.PPClose === false){ // Close not OK?
return 'Leaving this page will block the parent window!\nPlease select "Stay on this Page option" and use the\nCancel button instead to close the Print Preview Window.\n';
}
}
window.print(); // Print preview
window.PPClose = true; // Set Close Flag to OK.
}else{
window.print();
window.close();
}
}
function clsit()
{
alert('결재요청 되었습니다');
opener.location.href = "doc_list.asp?title=출퇴근보고서";
self.close();
}
//-->
</script>
<body topmargin="10" leftmargin="10" <%if cint(print_type) = 2 then%> onLoad="clsit();" <% end if %>>
<form method='post' name='frm_in_out_time'>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td >
<table cellpadding="0" cellspacing="0" border="0">
<%if cint(print_type) = 1 then%>
<tr>
<td style="padding:0 0 5 0;">
<img src="/images/common/btn_approve.jpg" onClick="subit()" style="CURSOR:pointer;">
<img src="/images/common/btn_cancel.jpg" onClick="win_close();" style="CURSOR:pointer;">
</td>
</tr>
<%end if%>
<tr>
<td><img src="/images/approval/docbg_top.jpg"></td>
</tr>
<tr>
<td width="710" align="center" style="padding:10;border-left:1px solid #dedede;border-right:1px solid #dedede;">
<table width="95%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" style="padding:0 0 10 0">
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
<tr>
<td width="255"><img src="/images/approval/doc_stit12.jpg"></td>
<td>
<table width="100%" cellpadding="0" cellspacing="1" border="0" style="border-collapse:collapse;" bgcolor="#d8d8d8">
<%if cdate(formatdatetime(date,2)) > "2014-01-07" then
tmp_title = "대표이사"
else
tmp_title = "부회장"
end if%>
<tr>
<td colspan="5" class="k_small" align="center" bgcolor="#F1F1F1">기안/승인(소속부서)</td>
<td colspan="4" class="k_small" align="center" bgcolor="#F1F1F1">검토/승인(관리부서)</td>
</tr>
<tr>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">본인</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">팀장</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">부서장</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">임원</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1"><%=tmp_title%></td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">담당</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">부서장</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1">임원</td>
<td width="11%" class="k_small" align="center" bgcolor="#F1F1F1"><%=tmp_title%></td>
</tr>
<%
'my_pos = "3"
'response.Write "my_pos : " & my_pos & "<BR>"
'tmp_txt = "<p style='line-height:11pt;font-size:9pt;'>" & Session("loginuser") & "<BR>" & replace(date(), "-","") & "<BR>" & FormatDateTime(time,4)
tmp_txt = Session("loginuser") & "<BR>" & replace(date(), "-","") & "<BR>" & Session("User_Number")
'tmp_txt = "<img src='/images/sign/" & Session("loginuser") & "_" & Session("User_Number") & ".jpg' border=0 width=80 height=80>"
if my_pos = 5 then '임원(본부장)
tmp_txt1 = "전결"
tmp_txt2 = "전결"
tmp_txt3 = "전결"
tmp_txt4 = tmp_txt
tmp_txt5 = " "
tmp_txt6 = "/"
tmp_txt7 = "/"
tmp_txt8 = "/"
tmp_txt9 = month(now()) & " / " & day(now())
tmp_txt10 = "/"
elseif my_pos = 3 or my_pos = 4 then '팀장(부서장)
tmp_txt1 = "전결"
tmp_txt2 = "전결"
tmp_txt3 = tmp_txt
tmp_txt4 = " "
tmp_txt5 = " "
tmp_txt6 = "/"
tmp_txt7 = "/"
tmp_txt8 = month(now()) & " / " & day(now())
tmp_txt9 = "/"
tmp_txt10 = "/"
elseif my_pos = 0 or my_pos = 1 then '팀원
tmp_txt1 = tmp_txt
tmp_txt2 = "전결"
tmp_txt3 = " "
tmp_txt4 = " "
tmp_txt5 = " "
tmp_txt6 = month(now()) & " / " & day(now())
tmp_txt7 = "/"
tmp_txt8 = "/"
tmp_txt9 = "/"
tmp_txt10 = "/"
end if
%>
<tr height="35">
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt1%>&nbsp;</td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt2%>&nbsp;</td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt3%>&nbsp;</td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt4%>&nbsp;</td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt5%>&nbsp;</td>
<td bgcolor="#FFFFFF" align="center" class="k_small"></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"></td>
</tr>
<tr height="18">
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt6%></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt7%></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt8%></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt9%></td>
<td bgcolor="#FFFFFF" align="center" class="k_small"><%=tmp_txt10%></td>
<td bgcolor="#FFFFFF" align="center" class="k_small">/</td>
<td bgcolor="#FFFFFF" align="center" class="k_small">/</td>
<td bgcolor="#FFFFFF" align="center" class="k_small">/</td>
<td bgcolor="#FFFFFF" align="center" class="k_small">/</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#d8d8d8" height="1"></td>
</tr>
<tr>
<td width="20%" style="padding:7 0 7 20"><b>결&nbsp;의&nbsp;일&nbsp;자</b></td>
<td width="80%" class="tahoma"><%=Curr_date%></td>
</tr>
<tr>
<td colspan="2" bgcolor="#d8d8d8" height="1"></td>
</tr>
<tr>
<td width="20%" style="padding:7 0 7 20"><b>성&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;명</b></td>
<td width="80%"><%=user_name(1)%></td>
</tr>
<tr>
<td colspan="2" bgcolor="#d8d8d8" height="1"></td>
</tr>
<tr>
<td width="20%" style="padding:7 0 7 20"><b>소&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;속</b></td>
<td width="80%"><%=user_name(4)%></td>
</tr>
<tr>
<td colspan="2" bgcolor="#d8d8d8" height="1"></td>
</tr>
<tr>
<td width="20%" style="padding:7 0 7 20"><b>직&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;급</b></td>
<td width="80%"><%=user_name(2)%></td>
</tr>
<tr>
<td colspan="2" bgcolor="#d8d8d8" height="1"></td>
</tr>
<tr>
<td colspan="2" align="center" style="padding:20 0 10 0;font-size:14;font-family:dotum;"><b>상기 본인의 출퇴근 사항에 대하여 다음과 같이 보고하오니 재가하여 주시기 바랍니다.</b></td>
</tr>
<tr>
<td colspan="2" align="center" style="padding:10 0 0 0">
<table width="100%" cellpadding="5" cellspacing="0" border="0" style="border-collapse:collapse;">
<tr >
<td rowspan=2 class="tit4" align="center">일자</td>
<td colspan=2 class="tit4" align="center">System상</td>
<td rowspan=2 class="tit4" align="center" style="width:300px;">보고사유</td>
<td rowspan=2 class="tit4" align="center">출근<br>조정시각</td>
<td rowspan=2 class="tit4" align="center">퇴근<br>조정시각</td>
</tr>
<tr>
<td class="tit4" align="center">출근</td>
<td class="tit4" align="center">퇴근</td>
</tr>
<%for i=1 to Max_Repare_Day_Cnt%>
<tr height=30>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,1)%></font></td>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,2)%></font></td>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,3)%></font></td>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,4)%></font></td>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,5)%></font></td>
<td class="tit7" align="center"><font class="tahoma"><%=gap(i,6)%></font></td>
</tr>
<%next%>
<%for i=Max_Repare_Day_Cnt + 1 to 8%>
<tr height=30>
<td colspan=6 class="tahoma">&nbsp;</td>
</tr>
<%next%>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="padding:20 0 0 0" align="right">
<pre><font class="tahoma"> 신 청 일 : <%=Curr_date%></font></pre>
<pre><font class="tahoma"> 신 청 인 : <%=user_name(1)%> (印)</font></pre>
</td>
</tr>
<tr>
<td colspan="2" align="center" style="padding:15 0 5 0"><!-- #include virtual= "approval/inc_logo.asp" --></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="/images/approval/docbg_btm.jpg"></td>
</tr>
</table>
</td>
</tr>
</table>
<input type=hidden name="txt_Max_Repare_Day_Cnt" value="<%=Max_Repare_Day_Cnt%>">
<%for i=1 to Max_Repare_Day_Cnt%>
<input type=hidden name="txt_date_<%=i%>" value="<%=gap(i,1)%>">
<input type=hidden name="txt_in_time_1_<%=i%>" value="<%=gap(i,2)%>">
<input type=hidden name="txt_out_time_1_<%=i%>" value="<%=gap(i,3)%>">
<input type=hidden name="txt_reason_<%=i%>" value="<%=gap(i,4)%>">
<input type=hidden name="txt_in_time_2_<%=i%>" value="<%=gap(i,5)%>">
<input type=hidden name="txt_out_time_2_<%=i%>"value="<%=gap(i,6)%>">
<%next%>
<input type="hidden" name="tmp_txt1" value="<%=tmp_txt1%>">
<input type="hidden" name="tmp_txt1_tmp" value="<%=tmp_txt1%>">
<input type="hidden" name="tmp_txt2" value="<%=tmp_txt2%>">
<input type="hidden" name="tmp_txt3" value="<%=tmp_txt3%>">
<input type="hidden" name="tmp_txt4" value="<%=tmp_txt4%>">
<input type="hidden" name="tmp_txt5" value="<%=tmp_txt5%>">
<input type="hidden" name="tmp_txt6" value="<%=tmp_txt6%>">
<input type="hidden" name="tmp_txt7" value="<%=tmp_txt7%>">
<input type="hidden" name="tmp_txt8" value="<%=tmp_txt8%>">
<input type="hidden" name="tmp_txt9" value="<%=tmp_txt9%>">
<input type="hidden" name="tmp_txt10" value="<%=tmp_txt10%>">
</form>
</body>
</html>