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

533 lines
25 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">
<%
web_position = "문서결재 : 문서작성"
dim title
dim Query
dim tmpstr
dim tmpstr2
dim i
dim max_cnt '문서내용 테이블에서 원하는 문서를 가져온 갯수
dim Max_Width
dim txt_date '출퇴근 보고서 작성시 사용되는 시작일자
dim db_table_name
dim Currdate
Currdate = year(date) & "-" & zeroformat(month(date),2) & "-" & zeroformat(day(date),2)
db_table_name = "문서내용"
Max_Width =750
title=request("title")
tmp_title = ""
tmp_query = ""
tmp_title = "면접원 및 내근직 지출결의서"
tmp_query = " and target16 is not null "
txt_date = request("txt_date")
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, startDT, endDT, printType, d_no, sv) {
var url = "doc_myun_pay_print2.asp"
var param = "?pay_type=" + pay_type;
param = param + "&startDT=" + startDT;
param = param + "&endDT=" + endDT;
param = param + "&print_type=" + printType;
param = param + "&d_no=" + d_no;
param = param + "&sv=" + sv;
var user_NotSeting_cnt = document.frm_confirm.user_NotSeting_cnt.value;
var approval_progress_flag = true;
if (approval_progress_flag == true) {
if (d_no != "") {
url = "../ess/doc_myun_pay_print2.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 change_title2(pay_type, p_sn, printType, d_no, sv) {
var url = "doc_myun_pay_print2.asp"
var param = "?pay_type=" + pay_type;
param = param + "&p_sn=" + p_sn;
param = param + "&print_type=" + printType;
param = param + "&d_no=" + d_no;
param = param + "&sv=" + sv;
if (d_no != "") {
url = "../ess/doc_myun_pay_print2.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">
</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" style="visibility:hidden;">월별 보기</span>&nbsp;
<input type="text" name='sel_month' id="sel_month" readonly style="visibility:hidden;width:120px;text-align:center;" value="<%=sel_month%>" style="CURSOR:pointer;">
<input type = "radio" name="neakeun_myun" value="1" onclick="nm_chg('1')" />내근직
<input type = "radio" name="neakeun_myun" value="2" checked 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;">
<%=now() %>
</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" >문서상태</td>
</tr>
<%
set adors2 = server.CreateObject("ADODB.RECORDSET")
max_cnt = 0
i = 0
Dim total_pay
total_pay = 0
mainQuery = " select d_no, p_sn, '2' as pay_type, SUM(pay) as pay, sv "
mainQuery = mainQuery & " from ( "
mainQuery = mainQuery & " select a.attribute05 as d_no, a.p_sn"
mainQuery = mainQuery & " , s_gubun "
mainQuery = mainQuery & " , isnull(SUM(s_sum), 0) as pay "
mainQuery = mainQuery & " , b.p_sv_1 as sv "
mainQuery = mainQuery & " from T_MYUN_PAY as A with(nolock) left outer join (SELECT * FROM V_PROJECT_METHOD with(nolock) WHERE p_field_complete is null) as B on a.p_sn = B.p_child_sn "
mainQuery = mainQuery & " where confirm_yn = 'Y' "
mainQuery = mainQuery & " and A.s_gubun in ('FF','CATI','ETC') "
If Session("Depart_Code") = 12 And Session("teamplace") < 2 Then
mainQuery = mainQuery & " and b.p_sv_1 = '" & Session("User_Number") & "' "
else
mainQuery = mainQuery & " and b.p_child_sn is not null "
End If
mainQuery = mainQuery & " group by a.p_sn, a.attribute05, s_gubun, p_sv_1 "
mainQuery = mainQuery & " ) as T "
mainQuery = mainQuery & " group by d_no, p_sn, sv "
mainQuery = mainQuery & " order by d_no, p_sn "
'--hwkim ''''' response.write mainQuery
adors.open mainQuery, adoconn, adopenstatic, adlockreadonly
If adors.recordCount > 0 Then
For z = 1 To adors.recordCount
'Response.Write "z : " & z &"<BR>"
max_cnt = max_cnt + 1
approval_flag = 1
If Trim(adoRs("d_no")) <> "" Then
approval_flag = 0
End if
%>
<tr>
<%
pay_apply_username = ""
query = "select p_name from person with(nolock) 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 with(nolock) "
query = query & " INNER JOIN Document as b with(nolock) 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 with(nolock) 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>"
rsc.Open query,adoconn,1
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc("p_subject_tmp")
rsc.Close
elseif len(adoRs("p_sn") ) > 9 Then
query = "select * from t_project_method with(nolock) where p_child_sn = '" & adoRs("p_sn") & "'"
'Response.Write "query : " & query & "<br>"
rsc.Open query,adoconn,1
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc("p_subject")
rsc.Close
Else
'query = "select p_subject from V_PROJECT where p_sn = '" & rsc("p_sn") & "'"
query = "select p_subject from V_PROJECT with(nolock) where p_sn = '" & adoRs("p_sn") & "'"
'Response.Write "query : " & query & "<br>"
rsc.Open query, adoConn, 1
If rsc.RecordCount > 0 Then
project_name_list = " ["& adoRs("p_sn") &"] &nbsp;"& rsc("p_subject") & ", "
End if
rsc.Close
end if
end if
%>
<td align="center">
<input type="radio" class="none" name='opt_print' value='문서번호' onclick="change_title2('<%=adoRs("pay_type")%>','<%=adoRs("p_sn")%>','<%=approval_flag%>', '<%=document_no%>','<%=adoRs("sv")%>');">
</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">
<% If document_status = "결재중" Then %> <img src="/images/<%=tmp_btn_name%>.gif" align="absmiddle" onClick="view_del('<%=document_no%>','<%=x%>', '<%=adoRs("p_sn")%>')" style="CURSOR:pointer;">
<% Else %> <%=document_status%> <% End If %> </td>
<!-- <td align="center" class="tahoma_blue"><%="인쇄여부"%></td> -->
<%
total_pay = total_pay + CDbl(adoRs("pay"))
%>
</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></td>
</tr>
<tr>
<td colspan="9" 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/><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>
</tr>
<%
query = " SELECT 2 as pay_type, 'cati' as gubun, T.p_child_sn, T.prj_code, case when isnull(p_name,'') = '' then '담당자미정' else p_name end as p_name FROM "
query = query & " ( "
query = query & " SELECT s.prj_code, P.prj_name, p.intranet_project as p_child_sn, s_client_jumin, s_client as s_client_no, s_client_name, s_date,"
query = query & " c.intranet_pay, C.qc_ok "
'query = query & " FROM new_cati.dbo.Sheet1 s "
query = query & " from ( "
query = query & " select prj_code, s_client, s_tcnt, s_client_jumin, s_client_name, s_date fROM new_cati.dbo.Sheet1 with(nolock) "
query = query & " where s_client_name not in ('Cati_Test', '김일중') "
query = query & " and s_date > '2021-01-01' "
query = query & " ) s "
'query = query & " Left Outer Join new_cati.dbo.T_Inspection_Cati c with(nolock) "
query = query & " Left Outer Join ( SELECT prj_code, tel_client_no, intranet_pay, qc_ok, tel_date, tel_cnt,tel_del_yn FROM new_cati.dbo.T_Inspection_Cati with(nolock) WHERE tel_date > ( getdate() - 365) ) C "
query = query & " ON s.prj_code = c.prj_code AND s.s_client = c.tel_client_no AND s.s_tcnt = c.tel_cnt "
'query = query & " LEFT OUTER JOIN new_cati.dbo.project P with(nolock) "
query = query & " LEFT OUTER JOIN ( SELECT prj_code, prj_name, intranet_project, prj_s_date FROM new_cati.dbo.project with(nolock) WHERE prj_s_date > CONVERT(VARCHAR(10), getdate()-365, 112) ) P "
query = query & " ON S.prj_code = P.prj_code "
query = query & " WHERE c.tel_del_yn = 'N' "
'query = query & " and s.s_client_name not in ('Cati_Test', '김일중') "
'query = query & " AND s.prj_code not in (SELECT prj_code FROM new_cati.dbo.project WHERE intranet_project in (SELECT p_child_sn FROM T_PROJECT_METHOD WHERE p_rsch_dept = '91')) "
query = query & " GROUP BY s.prj_code, P.prj_name, p.intranet_project, s_client_jumin, s_client, s_client_name, s_date, c.intranet_pay, C.qc_ok "
query = query & " ) T "
'query = query & " left outer join T_MYUN_PAY TMP with(nolock) "
query = query & " left outer join ( SELECT id, confirm_yn FROM T_MYUN_PAY with(nolock) WHERE insert_dt > ( getdate() - 365) ) TMP "
query = query & " ON T.intranet_pay = cast(TMP.id as varchar) "
'query = query & " left outer join (SELECT * FROM T_PROJECT_METHOD with(nolock) WHERE p_field_complete is null) tpm "
query = query & " left outer join ( SELECT p_child_sn, p_sv_1, p_field_complete FROM T_PROJECT_METHOD with(nolock) WHERE CONVERT(VARCHAR(10), p_input_dt , 120) > CONVERT(VARCHAR(10), getdate()-365, 120) and p_field_complete is null ) tpm "
query = query & " on T.p_child_sn = tpm.p_child_sn "
query = query & " left outer join person p with(nolock) "
query = query & " on tpm.p_sv_1 = p.p_no "
query = query & " where isnull(TMP.confirm_yn, 'N') = 'N' "
query = query & " and isnull(T.p_child_sn,'') <> '' "
query = query & " and left(T.p_child_sn, 2) > '20' "
query = query & " group by T.p_child_sn, T.prj_code, p_name "
'--hwkim ''''' response.Write query & "<BR><BR><BR>"
query = query & " union all "
query = query & " SELECT 2 as pay_type, 'ff' as gubun, T.p_child_sn, T.prj_code, case when isnull(p_name,'') = '' then '담당자미정' else p_name end as p_name "
query = query & " FROM ( "
query = query & " SELECT (case when (select count(a.p_child_sn) from t_project_method a with(nolock) inner join t_project_fcs b on a.p_sn = b.p_sn and a.p_method_cd = b.p_method_cd where b.p_child_sn = RE.p_sn) = 1 then "
query = query & " (select a.p_child_sn from t_project_method a with(nolock) inner join t_project_fcs b with(nolock) on a.p_sn = b.p_sn and a.p_method_cd = b.p_method_cd where b.p_child_sn = RE.p_sn) else RE.p_sn end) as p_child_sn, RE.p_sn as prj_code, "
query = query & " TPM.p_subject, p_name, isnull(cnt,0) - isnull(s_wan, 0) as cha "
query = query & " FROM "
query = query & " ( "
query = query & " SELECT R.p_sn, COUNT(*) as cnt FROM Res R with(nolock) LEFT OUTER JOIN T_INSPECTION_RES TIR with(nolock) ON R.r_sn = TIR.r_sn "
query = query & " WHERE TIR.pass_stat <> 'ERROR' AND DelGubun='N' AND r_error is null AND s_error is null AND m_error is null GROUP BY R.p_sn "
query = query & " ) RE "
query = query & " LEFT OUTER JOIN "
query = query & " ( "
query = query & " SELECT isnull(prj_code, p_sn) as prj_code, sum(s_wan) as s_wan FROM T_MYUN_PAY with(nolock) WHERE confirm_yn ='Y' AND s_gubun = 'FF' GROUP BY isnull(prj_code, p_sn) "
query = query & " ) TMP "
query = query & " ON RE.p_sn = TMP.prj_code "
query = query & " LEFT OUTER JOIN "
query = query & " ( "
query = query & " select tpm.p_subject, isnull(tpf.p_child_sn, tpm.p_child_sn) as p_child_sn, isnull(tpf.p_sv_1, tpm.p_sv_1) as p_sv_1 "
query = query & " from (SELECT * FROM T_PROJECT_METHOD with(nolock) WHERE p_field_complete is null) tpm inner join T_PROJECT_FCS tpf with(nolock) on tpm.p_sn = tpf.p_sn and tpm.p_method_cd = tpf.p_method_cd union all "
query = query & " select p_subject, p_child_sn, p_sv_1 from T_PROJECT_METHOD with(nolock) where p_field_complete is null "
query = query & " ) TPM "
query = query & " ON RE.p_sn = TPM.p_child_sn "
query = query & " left outer join person p with(nolock) "
query = query & " ON TPM.p_sv_1 = p.p_no "
query = query & " WHERE p_subject is not null "
query = query & " ) T "
query = query & " WHERE cha <> '0' "
query = query & " GROUP BY T.p_child_sn, T.prj_code, p_name "
query = query & " union all "
query = query & " SELECT 2 as pay_type, 'etc' as gubun, TMP.p_sn as p_child_sn, '' as prj_code, case when isnull(p_name,'') = '' then '담당자미정' else p_name end as p_name FROM "
query = query & " T_MYUN_PAY TMP with(nolock) "
query = query & " left outer join (SELECT p_child_sn, p_sv_1 FROM T_PROJECT_METHOD with(nolock) WHERE p_field_complete is null) tpm on TMP.p_sn = tpm.p_child_sn "
query = query & " left outer join person p with(nolock) on tpm.p_sv_1 = p.p_no "
query = query & " where isnull(TMP.confirm_yn, 'N') = 'N' and isnull(TMP.p_sn,'') <> '' and left(TMP.p_sn, 2) > '15' "
query = query & " and s_gubun = 'ETC' "
query = query & " group by TMP.p_sn, p_name "
'--hwkim ''''' response.Write query & "<BR>"
adoRs.open query, adoconn, adopenstatic, adlockreadonly
Dim project_apply_username
Dim user_NotSeting_cnt
user_NotSeting_cnt = 0
'Response.Write "query : " & query &"<BR>"
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 And Session("teamplace") < 2 Then
If project_apply_username <> "담당자미정" And project_apply_username <> session("loginuser") Then
view_flag = false
End If
End If
If view_flag = True Then
%>
<tr>
<td align="center"><%=i%></td>
<td align="center"><% If adoRs("pay_type") = 1 then %> 내근직수당 <% Else %> 면접원수당 <% End if %></td>
<td align="center"><%=adoRs("p_child_sn")%><% if adoRs("gubun") = "cati" or adoRs("gubun") = "ff" then response.Write "(" & adoRs("prj_code") & ")" end if %></td>
<td align="center"><%=project_apply_username%></td>
<input type="hidden" name="pay_type" value='<%=adoRs("pay_type")%>'>
</tr>
<%
End if
adors.moveNext
next
End if
adoRs.close
%>
<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" -->