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

478 lines
20 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<style>
button.ui-datepicker-current {
display: none;
}
</style>
<!-- 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">
<%
'//-- 20210705 hwkim
set rsc2 = server.CreateObject("ADODB.RECORDSET")
web_position = "문서결재 : 문서작성"
dim title
dim Query
dim tmpstr
dim tmpstr2
dim i
dim max_cnt '문서내용 테이블에서 원하는 문서를 가져온 갯수
dim Max_Width
dim db_table_name
dim Currdate
dim sel_month
Currdate = year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2)
db_table_name = "문서내용"
Max_Width =750
title=request("title")
sel_month = request("sel_month")
if trim(sel_month) = "" then
sel_month = mid(date,1,7)
end If
tmp_button = "결재취소"
tmp_btn_name = "approval/btn_approval_cancel"
web_position = "문서결재 : 진행문서"
x = "1"
%>
<script language=javascript>
function view_del(z,x,y)
{
if (confirm("<%=tmp_button%> 하시겠습니까?"))
{
document.frm_select.action = "view_del4_ok.asp?d_no="+z+"&x="+x+"&y="+y;
document.frm_select.submit();
}
}
function change_month(title)
{
var url;
var sel_month;
var neakeun_myun;
sel_month = document.frm_select.sel_month.value;
neakeun_myun = document.frm_select.neakeun_myun[0].checked;
if (neakeun_myun) {
url = "doc_myun_pay.asp?title=" + title;
} else {
url = "doc_myun2_pay.asp?title=" + title;
}
url = url + "&sel_month=" + sel_month;
document.frm_select.action=url;
document.frm_select.submit();
}
function change_title(pay_type, p_sn, printType, d_no, sv){
var sel_month = document.frm_select.sel_month.value;
var not_confirm_cnt = document.frm_confirm.not_confirm_cnt.value;
var user_NotSeting_cnt = document.frm_confirm.user_NotSeting_cnt.value;
var approval_progress_flag = true;
var url = "doc_myun_pay_print.asp"
var param = "?pay_type=" + pay_type;
param = param + "&p_sn_c=" + p_sn;
param = param + "&work_month=" + sel_month;
param = param + "&print_type=" + printType;
param = param + "&d_no=" + d_no;
param = param + "&sv=" + sv;
if(not_confirm_cnt > 0){
approval_progress_flag = false;
if (user_NotSeting_cnt > 0) {
alert("담당자가 미정인 프로젝트 내역이 존재 합니다.\n담당자가 세팅되기 전까지는 결재를 상신할 수 없습니다.");
return;
} else {
alert("결재 하려는 문서에 컨펌하지 않은 수당 자료가 있습니다.\n확인하시고 지출결의서 결재 하십시오.");
return;
}
}
if(approval_progress_flag == true){
if(d_no != ""){
url = "../ess/doc_myun_pay_print.asp?d_no="+d_no+"&view_chk=1&x=1";
window.open(url,"","left=50 ,top=0, menubar=no, location=no ,status=no ,toolbar=no ,width=850, height=800 ,scrollbars=yes ,resizable=yes");
}else{
window.open(url+param,"","left=50 ,top=0, menubar=no, location=no ,status=no ,toolbar=no ,width=850, height=800 ,scrollbars=yes ,resizable=yes");
}
}
}
function nm_chg(val) {
if (val == "1") {
document.getElementById("sel_month").style.visibility = "visible";
document.getElementById("sel_month_str").style.visibility = "visible";
} else {
document.getElementById("sel_month").style.visibility = "hidden";
document.getElementById("sel_month_str").style.visibility = "hidden";
}
}
</script>
<td width="100%" valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<!-- 확인 -->
</tr>
<tr>
<td colspan="2" style="padding:20;">
<form name='frm_select' method='post' style="TEXT-ALIGN: left" >
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="brown">
<font class="k_darkorange">
※ 수당 지출결의서의 기존 입력 자료를 보여줍니다.<br />
</font>
</td>
</tr>
<tr>
<td style="padding:10 0 0 0;">
<table width="100%" height="37" cellpadding="0" cellspacing="1" border="0" bgcolor="#c0c0c0">
<tr>
<td bgcolor="#DFDFDF" style="padding:0 0 0 20"><span id="sel_month_str">월별 보기</span>&nbsp;
<input type="text" name='sel_month' id="sel_month" readonly style="width:120px;text-align:center;" value="<%=sel_month%>" style="CURSOR:pointer;">
<input type = "radio" name="neakeun_myun" value="1" checked="checked" onclick="nm_chg('1')"/>내근직
<input type = "radio" name="neakeun_myun" value="2" onclick="nm_chg('2')"/>면접원
<img src="/images/common/btn_smallsrch.gif" align="absmiddle" onClick="change_month('<%=title%>');" style="CURSOR:pointer;">
<img src="/images/approval/btn_doclist.gif" align="absmiddle" onClick="history.back(-1);" style="CURSOR:pointer;">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:10 0 0 0">
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td align="center" >선택</td>
<td align="center" >문서번호</td>
<td align="center" >담당자</td>
<td align="center" >수당구분</td>
<td align="center" >수당</td>
<td align="center" >추가수당1</td>
<td align="center" >추가수당2</td>
<td align="center" >문서상태</td>
</tr>
<%
set adors2 = server.CreateObject("ADODB.RECORDSET")
max_cnt = 0
i = 0
Dim total_pay, total_lunch, total_dinner
total_pay = 0
total_lunch = 0
total_dinner = 0
Query = " select d_no, p_sn, pay_type, SUM(pay) as pay, isnull(SUM(lunch), 0) as lunch, isnull(SUM(dinner), 0) as dinner, sv "
Query = Query & " from ( "
Query = Query & " select isnull(A.attribute05,'') as d_no, p_sn, "
Query = Query & " s_gubun, pay_type, LEFT(work_dt, 7) as work_dt, "
Query = Query & " CASE WHEN s_gubun <> '추가수당1' and s_gubun <> '추가수당2' THEN isnull(SUM(s_sum), 0) ELSE 0 END as pay, "
Query = Query & " CASE WHEN s_gubun = '추가수당1' THEN isnull(sum(s_sum), 0) END as lunch, "
Query = Query & " CASE WHEN s_gubun = '추가수당2' THEN isnull(sum(s_sum), 0) END as dinner, "
Query = Query & " p_sv_no as sv "
Query = Query & " from (select tn.*, nw.in_time, nw.out_time, nw.p_sebu_code, nw.p_sv_no from T_NEAKEUN_PAY tn left outer join neakeun_work nw on tn.attribute01 = nw.id) as A "
if sel_month = "2022-04" Then
Query = Query & " where ((work_dt between '" & sel_month & "-01' and '" & sel_month & "-25' AND A.in_time + A.out_time + A.p_sebu_code <> '000000004') OR "
Query = Query & " (work_dt between '" & sel_month & "-16' and cast(DATEADD(m,1,cast('" & sel_month & "-05' as date)) as varchar) "
elseif sel_month > "2022-04" Then
Query = Query & " where ((work_dt between cast(DATEADD(m,-1,cast('" & sel_month & "-26' as date))as varchar) and '" & sel_month & "-25' AND A.in_time + A.out_time + A.p_sebu_code <> '000000004') OR "
Query = Query & " (work_dt between '" & sel_month & "-06' and cast(DATEADD(m,1,cast('" & sel_month & "-05' as date)) as varchar) "
else
Query = Query & " where ((LEFT(work_dt, 7) = '" & sel_month & "' AND A.in_time + A.out_time + A.p_sebu_code <> '000000004') OR "
Query = Query & " (work_dt between '" & sel_month & "-16' and cast(DATEADD(m,1,cast('" & sel_month & "-15' as date)) as varchar) "
end if
Query = Query & " AND A.in_time + A.out_time + A.p_sebu_code = '000000004')) "
If (Session("Depart_Code") = 12) or (Session("Depart_Code") = 17) And Session("teamplace") < 3 Then
Query = Query & " and p_sv_no = '" & Session("User_Number") & "' "
end if
Query = Query & " group by A.attribute05, p_sn, s_gubun, pay_type, LEFT(work_dt, 7), p_sv_no "
Query = Query & " ) as T "
Query = Query & " group by d_no, p_sn, pay_type, sv "
'response.write Query
adors.open Query, adoconn, adopenstatic, adlockreadonly
If adors.recordCount > 0 Then
For z = 1 To adors.recordCount
max_cnt = max_cnt + 1
Dim approval_flag
approval_flag = 1
If Trim(adoRs("d_no")) <> "" Then
approval_flag = 0
End if
%>
<tr>
<%
Dim pay_apply_username
pay_apply_username = ""
query = "select p_name from person where p_no = '" & adoRs("sv") & "' "
adors2.open query, adoconn, adopenstatic, adlockreadonly
If adors2.recordCount > 0 Then
pay_apply_username = adors2("p_name")
End If
adors2.close
Dim document_no, document_status
document_no = ""
document_status = ""
document_no = Trim(adoRs("d_no"))
query = "SELECT * "
query = query & " FROM 문서내용 as a "
query = query & " INNER JOIN Document as b on a.문서번호 = b.d_no "
query = query & " WHERE a.문서번호='" & document_no & "' "
query = query & " AND b.d_delok = 'N' "
rsc.Open query, adoConn, 1
if rsc.RecordCount > 0 Then
If rsc("d_order_cnt") = "77" Then
document_status = "결재완료"
ElseIf rsc("d_order_cnt") = "99" Then
document_status = "반려"
Else
document_status = "결재중"
End If
Else
document_no = ""
approval_flag = 1
End If
rsc.close
'//-- 20210705 hwkim
Dim project_name_list : project_name_list = ""
if adoRs("p_sn") = "99999" then
tmp_value = tmp_value & "일반업무"
Else
if len(adoRs("p_sn") ) < 5 then
'///=========================
'///=========================
'2013.1.2 김제열 추가 : 임시프로젝트를 올해뿐만 아니라 전해 것에서도 찾도록 함
' 임시로 해야할지 말아야 할지 고민해야 함
query = "select * from project2_pre where p_sn_tmp = '" & adoRs("p_sn") & "'" & _
" and (substring(write_date, 1, 4) = '" & left(date(), 4) & "' " & _
" OR substring(write_date, 1, 4) = '" & left(date(), 4) - 1 & "') "
'Response.Write "query : " & query & "<br>"
rsc2.Open query,adoconn,1
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc2("p_subject_tmp")
rsc2.Close
elseif len(adoRs("p_sn") ) > 9 Then
query = "select * from t_project_method where p_child_sn = '" & adoRs("p_sn") & "'"
'Response.Write "query : " & query & "<br>"
rsc2.Open query,adoconn,1
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc2("p_subject")
rsc2.Close
Else
'query = "select p_subject from V_PROJECT where p_sn = '" & rsc("p_sn") & "'"
query = "select p_subject from V_PROJECT where p_sn = '" & adoRs("p_sn") & "'"
'Response.Write "query : " & query & "<br>"
rsc2.Open query, adoConn, 1
If rsc2.RecordCount > 0 Then
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc2("p_subject") & ", "
End if
rsc2.Close
end if
end if
%>
<td align="center">
<input type="radio" class="none" name='opt_print' value='문서번호' onclick="change_title('<%=adoRs("pay_type")%>','<%=adoRs("p_sn")%>','<%=approval_flag%>', '<%=document_no%>','<%=adoRs("sv")%>');" id=radio4 name=radio4>
</td>
<td align="left"><%=document_no %> &nbsp; &nbsp; <%=project_name_list %></td>
<td align="center"><%=pay_apply_username%></td>
<td align="center"><% If adoRs("pay_type") = 1 then %> 내근직수당 <% Else %> 면접원수당 <% End if %></td>
<td align="center"><%=FormatNumber(CDbl(adoRs("pay")), 0)%></td>
<td align="center"><%=FormatNumber(CDbl(adoRs("lunch")), 0)%></td>
<td align="center"><%=FormatNumber(CDbl(adoRs("dinner")), 0)%></td>
<td align="center">
<% If document_status = "결재중" Then %>
<img src="/images/<%=tmp_btn_name%>.gif" align="absmiddle" onClick="view_del('<%=document_no%>','<%=x%>', '<%=sel_month%>')" style="CURSOR:pointer;">
<% Else %>
<%=document_status%>
<% End If %>
</td>
<%
total_pay = total_pay + CDbl(adoRs("pay"))
total_lunch = total_lunch + CDbl(adoRs("lunch"))
total_dinner = total_dinner + CDbl(adoRs("dinner"))
%>
</tr>
<%
adors.moveNext
next
End if
adoRs.close
max_cnt = max_cnt + 1
%>
<tr>
<td align="center" colspan="4">합계</td>
<td align="center"><%=FormatNumber(total_pay, 0)%></td>
<td align="center"><%=FormatNumber(total_lunch, 0)%></td>
<td align="center"><%=FormatNumber(total_dinner, 0)%></td>
<td align="center"><%=FormatNumber((total_pay+total_lunch+total_dinner), 0)%></td>
</tr>
<tr>
<td colspan="10" bgcolor="#d5d5d5" height="1"></td>
</tr>
</table>
</td>
</tr>
</table>
<input type=hidden name=txt_krc_no size=50 value=''>
<input type=hidden name=txt_max_cnt size=50 value='<%=max_cnt%>'>
<input type=hidden name=txt_title size=50 value='<%=title%>'>
<input type=hidden name=txt_curr_date size=50 value='<%=date()%>'>
</form>
<br/><br/><br/>
<form name='frm_confirm' method='post' style="TEXT-ALIGN: left" >
<table width="100%" cellpadding="2" cellspacing="0" border="0" style="border-collapse:collapse;">
<tr>
<td class="brown">
<font class="k_darkorange">
※ 면접원 & 내근직 수당 정보 컨펌 현황 입니다.<br>
</font>
<img src="/images/common/blank.gif" width="18" height="1" align="absmiddle">
※ 컨펌하지 않은 데이터를 나타내며, 컨펌 하지 않은 데이터는 지출결의서 상에 포함되지 않습니다.<br>
</td>
</tr>
</table>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors">
<tr>
<td align="center" >번호</td>
<td align="center" >수당구분</td>
<td align="center" >수당 일자</td>
<td align="center" >프로젝트코드</td>
<td align="center" >컴펌 안된 갯수</td>
<td align="center" >담당자</td>
</tr>
<%
query = " select 1 as pay_type, date, A.p_child_sn, "
query = query & " case when P.p_name is null then '담당자미정' else P.p_name end as p_name, COUNT(*) as count "
query = query & " from neakeun_work as A "
query = query & " left outer join person as P on A.p_sv_no = P.p_no "
if sel_month = "2022-04" Then
query = query & " where date between '"&sel_month&"-01' and '"&sel_month&"-25' "
elseif sel_month > "2022-04" Then
query = query & " where date between cast(DATEADD(m,-1,cast('"&sel_month&"-26' as date))as varchar) and '"&sel_month&"-25' "
else
query = query & " where date like '" & sel_month & "%' "
end if
query = query & " and (job_confirm_yn <> 'Y' or job_confirm_yn is null) "
query = query & " and A.in_time + A.out_time <> '00000000' "
query = query & " group by date, A.p_child_sn, P.p_name "
query = query & " order by date "
'response.Write query
adoRs.open query, adoconn, adopenstatic, adlockreadonly
Dim project_apply_username
Dim not_confirm_cnt
Dim user_NotSeting_cnt
not_confirm_cnt = 0 '##### 컨펌 'N' or is null의 갯수 (2018-02-26 김종휘)
user_NotSeting_cnt = 0
If adors.recordCount > 0 Then
For i = 1 To adors.recordCount
project_apply_username = adoRs("p_name")
Dim view_flag
view_flag = True
If (Session("Depart_Code") = 12 or Session("Depart_Code") = 17) And Session("teamplace") < 3 Then
If project_apply_username <> session("loginuser") Then
view_flag = false
End If
End If
If view_flag = True Then
not_confirm_cnt = not_confirm_cnt + 1
%>
<tr>
<td align="center"><%=i%></td>
<td align="center"><% If adoRs("pay_type") = 1 then %> 내근직수당 <% Else %> 면접원수당 <% End if %></td>
<td align="center"><%=adoRs("date")%></td>
<td align="center"><%=adoRs("p_child_sn")%></td>
<td align="center"><%=adoRs("count")%></td>
<td align="center"><%=project_apply_username%></td>
<input type="hidden" name="pay_type" value='<%=adoRs("pay_type")%>'>
<input type="hidden" name="pay_date" value='<%=adoRs("date")%>'>
</tr>
<%
End if
adors.moveNext
next
End if
adoRs.close
%>
<input type="hidden" name="not_confirm_cnt" value='<%=not_confirm_cnt%>'>
<input type="hidden" name="user_NotSeting_cnt" value='<%=user_NotSeting_cnt%>'>
<tr>
<td colspan="11" bgcolor="#d5d5d5" height="1"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<!-- REQUIRED SCRIPTS -->
<script>
$(function(){
$("#sel_month").datepicker({
dateFormat: 'mm-yy',
changeMonth: true,
changeYear: true,
showButtonPanel: true,
onClose: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).val($.datepicker.formatDate('yy-mm', new Date(year, month, 1)));
}
});
$("#sel_month").focus(function () {
$(".ui-datepicker-calendar").hide();
$("#ui-datepicker-div").position({
my: "center top",
at: "center bottom",
of: $(this)
});
});
$("#sel_month").on('click', function () {
var selDate = new Date($("#sel_month").val());
$("#ui-datepicker-div .ui-datepicker-year option[value='" + selDate.getFullYear() + "']").prop("selected", true);
$("#ui-datepicker-div .ui-datepicker-month option[value='" + selDate.getMonth() + "']").prop("selected", true);
});
});
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->