Files
KIN/approval/doc_expense_approval_depart.asp
2026-02-03 11:46:57 +09:00

798 lines
41 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<%
dim Query
dim i, j
dim title
dim Max_length '입력가능 줄수정의
dim Gap()
dim cost_type(2) ''지출방법 구분
dim sel_date, sel_date_st, sel_date_ed, now_month
dim depart_cost_type
cost_type(0) = "선택"
cost_type(1) = "개인법인카드"
cost_type(2) = "현금/개인카드"
sel_date = request("txt_date")
sel_date_st = request("sel_date_st")
sel_date_ed = request("sel_date_ed")
now_month = request("now_month")
'response.write now_month
depart_cost_type = request("depart_cost_type") ' 1:그룹활동비, 2:그룹장활동비
if depart_cost_type = "" Then
if session("Depart_Code") = "0" Then
depart_cost_type = "2"
Else
depart_cost_type = "1"
end if
End if
title="부서비신청서"
if sel_date <> "" Then
Max_length=5
Else
Max_length=13
End if
redim gap(Max_length,6) 'x:순서, y:1:일자, 2:프로젝트명, 3:세부항목, 4:금액,5:프로젝트코드, 6:지출방법, (0,0) : 총액
%>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<style>
#mainTb *{
font-size: 13px;
letter-spacing: 0px;
box-sizing: border-box;
}
#mainTb{
border-collapse:collapse;
}
#mainTb > tbody > tr:nth-child(2) > td{
background-color: #eaeaea;
border: 1px solid #cacaca;
color: #000;
}
#mainTb > tbody > tr:nth-child(n + 3) > td{
padding: 2px 1px;
}
#mainTb > tbody > tr:nth-last-child(2) > td{
background-color: #eaeaea;
border: 1px solid #c8ccc8;
color: black;
}
#topTb{
margin-bottom: 5px;
border-collapse: collapse;
}
#topTb > tbody > tr:first-child > td{
background-color: #eaeaea;
color: black;
border: 1px solid #d5d5d5;
}
#topTb > tbody > tr:nth-child(n + 2) > td{
background-color: #fefefe;
color: black;
border: 1px solid #d5d5d5;
}
#topTb > tbody > tr > td > input[type=text]{
width:100%;
border: none;
}
#topTb > tbody > tr > td{
padding: 5px 2px;
}
#print_btn{
padding: 5px 25px;
font-size: 15px;
font-weight: bold;
cursor:pointer;
}
.prj_row_select{
width: 100%;
}
.prj_row_select:disabled, .job_content_select:disabled{
color: #0047b1;
cursor:not-allowed !important;
}
#prj_div{
height: 600px;
width: 600px;
overflow-x: hidden;
overflow-y: scroll;
position: absolute;
background-color: #fff;
border: 3px solid #eaeaea;
padding: 2px;
box-sizing: border-box;
box-shadow: 2px 2px 3px 0px #bdbdbd;
z-index:10;
display:none;
}
#prj_list{
list-style: none;
padding-left: 0px;
}
#prj_list li{
white-space: nowrap;
cursor: pointer;
padding: 1px 0px 3px 6px;
-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 */
}
#prj_list li:hover{
background-color: #d6e1f9;
}
#prj_list li.prj_selected{
background-color: #172f59;
color: white;
}
#prj_list li.prj_selected:hover{
background-color: #3e5a8a;
}
</style>
<!-- Main content -->
<!-- 업무일지 - 그룹운영비 - 테이블 25년 물품구입비&기타 -->
<div class="content-body p-0">
<div class="content pb-3">
<div class="container-fluid">
<div class="row row-0">
<div class="col-12">
<form method='post' name='frm_money_clean'>
<input type="hidden" name="cutmenu" value="1" />
<input type="hidden" name="txt_Max_length" value="<%=Max_length%>">
<table width="700" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding:10 0 0 0">
<table width="100%" cellpadding="0" cellspacing="0" border="0" id="mainTb">
<tr>
<td colspan="5">
<input type="button" value="참여 프로젝트 ▼" id="prj_setting_btn" style="display:none;" />
<div id="prj_div">
<ul id="prj_list">
</ul>
</div>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors" id="topTb">
<tr>
<td width="20%" align="center"><%=now_month %></td>
<td width="13%" align="center">구분</td>
<!-- <td width="11%" align="center">식대</td>-->
<!-- <td width="11%" align="center">교통비</td>-->
<!-- <td width="11%" align="center">회식비</td>-->
<!-- <td width="11%" align="center">물품구입비</td>-->
<!-- <td width="11%" align="center">주차비</td>-->
<!-- <td width="11%" align="center">기타</td>-->
<td width="20%" align="center">식대 및 교통비</td>
<td width="20%" style="text-align:center;">회식비 및 기타</td>
<td width="20%" align="center">합계</td>
</tr>
<%
Dim depart_cd_string
Dim total_est, total_use, total_res
Dim hang1_res_cost, hang2_res_cost, hang3_res_cost, hang4_res_cost, hang5_res_cost, hang6_res_cost, hang7_res_cost, hang8_res_cost, hang9_res_cost
depart_cd_string = ""
total_est = 0
total_use = 0
total_res = 0
over_hang = ""
'2023-05-15 서성완 파트너는 관리하는 팀 그룹비 & 사용내역 제공 (단 그룹비는 2개 팀 이상일 경우 합산해서 제공)
' ex) msbu1,2 = 이혜진 상무 msbu3,4 = 김다슬 전무, psbu1,4 = 원성훈 부사장, psbu2, aibd = 신상욱 상무, dco = 서지원 상무
'2023-05-31 서성완
' 최정심 상무님 [ Session("User_Number") = "20151203" ]은 파트너가 아니지만 억지로 파트너로 만듬 V_GROUP_COST_NEW 뷰 테이블에 하드코딩 되어 있음
' 채주희 본부장님 [ Session("User_Number") = "20031102" ]은 파트너가 아니지만 억지로 파트너로 만듬 V_GROUP_COST_NEW 뷰 테이블에 하드코딩 되어 있음
Query = ""
If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then
Query = Query & " Select 'GROUP_SUM' as depart_nm "
Query = Query & " ,''''+STRING_AGG(depart_cd,''',''')+'''' as depart_cd_string "
Query = Query & " ,ISNULL(SUM(hang1_cost),0) as hang1_cost "
Query = Query & " ,ISNULL(SUM(hang2_cost),0) as hang2_cost "
Query = Query & " ,ISNULL(SUM(hang3_cost),0) as hang3_cost "
Query = Query & " ,ISNULL(SUM(hang4_cost),0) as hang4_cost "
Query = Query & " ,ISNULL(SUM(hang5_cost),0) as hang5_cost "
Query = Query & " ,ISNULL(SUM(hang6_cost),0) as hang6_cost "
Query = Query & " ,ISNULL(SUM(hang7_cost),0) as hang7_cost "
Query = Query & " ,ISNULL(SUM(hang8_cost),0) as hang8_cost "
Query = Query & " ,ISNULL(SUM(hang9_cost),0) as hang9_cost "
Query = Query & " ,ISNULL(SUM(hang1_use_cost),0) as hang1_use_cost "
Query = Query & " ,ISNULL(SUM(hang2_use_cost),0) as hang2_use_cost "
Query = Query & " ,ISNULL(SUM(hang3_use_cost),0) as hang3_use_cost "
Query = Query & " ,ISNULL(SUM(hang4_use_cost),0) as hang4_use_cost "
Query = Query & " ,ISNULL(SUM(hang5_use_cost),0) as hang5_use_cost "
Query = Query & " ,ISNULL(SUM(hang6_use_cost),0) as hang6_use_cost "
Query = Query & " ,ISNULL(SUM(hang7_use_cost),0) as hang7_use_cost "
Query = Query & " ,ISNULL(SUM(hang8_use_cost),0) as hang8_use_cost "
Query = Query & " ,ISNULL(SUM(hang9_use_cost),0) as hang9_use_cost "
Query = Query & " from( "
END IF
Query = Query & " SELECT GCE.depart_nm, GCE.depart_cd, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대' THEN VGC.cost ELSE 0 END), 0) AS hang1_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '교통비' THEN VGC.cost ELSE 0 END), 0) AS hang2_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비' THEN VGC.cost ELSE 0 END), 0) AS hang3_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '물품구입비' THEN VGC.cost ELSE 0 END), 0) AS hang4_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '주차비' THEN VGC.cost ELSE 0 END), 0) AS hang5_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '기타' THEN VGC.cost ELSE 0 END), 0) AS hang6_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대 및 교통비' THEN VGC.cost ELSE 0 END), 0) AS hang7_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비 및 기타' THEN VGC.cost ELSE 0 END), 0) AS hang8_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '활동비' THEN VGC.cost ELSE 0 END), 0) AS hang9_use_cost "
Query = Query & " FROM GROUP_COST_EST GCE LEFT JOIN V_GROUP_COST_NEW VGC "
Query = Query & " ON VGC.d_code IN ( "
Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S301' ELSE GCE.depart_cd END, "
Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S401' ELSE GCE.depart_cd END, "
Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S501' ELSE GCE.depart_cd END, "
Query = Query & " CASE WHEN GCE.depart_cd = 'S801' THEN 'S601' ELSE GCE.depart_cd END "
Query = Query & " ) "
Query = Query & " AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date "
Query = Query & " WHERE use_yn = '1' "
'박준성 2023-05-02 파트너들 한도 추가
If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then
Query = Query & " AND GCE.partner_no = '" & Session("User_Number") & "' "
Else
If Session("N_depart") = "S" And (Session("N_team") = "301" Or Session("N_team") = "401" Or Session("N_team") = "501" Or Session("N_team") = "601") Then
Query = Query & " AND GCE.depart_cd = 'S801' "
ElseIf Session("N_depart") = "S" And (Session("N_team") = "101" Or Session("N_team") = "201") Then
Query = Query & " AND GCE.depart_cd = 'S101S201' "
Else
Query = Query & " AND GCE.depart_cd = '" & Session("N_depart") & Session("N_team") & "' "
END IF
End If
Query = Query & " AND '" & now_month & "-01' BETWEEN GCE.st_date AND GCE.ed_date "
Query = Query & " GROUP BY GCE.depart_nm, GCE.depart_cd, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost "
'2023-05-15 서성완 파트너는 관리하는 팀 그룹비 & 사용내역 제공 (단 그룹비는 2개 팀 이상일 경우 합산해서 제공)
If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then
Query = Query & " ) GROUP_COST "
END IF
'Response.Write Query
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
if adoRs.recordCount > 0 Then
If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then
depart_cd_string = adoRs("depart_cd_string")
END IF
total_est = adoRs("hang1_cost") + adoRs("hang2_cost") + adoRs("hang3_cost") + adoRs("hang4_cost") + adoRs("hang5_cost") + adoRs("hang6_cost") + adoRs("hang7_cost") + adoRs("hang8_cost")
total_use = adoRs("hang1_use_cost") + adoRs("hang2_use_cost") + adoRs("hang3_use_cost") + adoRs("hang4_use_cost") + adoRs("hang5_use_cost") + adoRs("hang6_use_cost") + adoRs("hang7_use_cost") + adoRs("hang8_use_cost")
total_res = total_est - total_use
hang1_res_cost = adoRs("hang1_cost") - adoRs("hang1_use_cost")
hang2_res_cost = adoRs("hang2_cost") - adoRs("hang2_use_cost")
hang3_res_cost = adoRs("hang3_cost") - adoRs("hang3_use_cost")
hang4_res_cost = adoRs("hang4_cost") - adoRs("hang4_use_cost")
hang5_res_cost = adoRs("hang5_cost") - adoRs("hang5_use_cost")
hang6_res_cost = adoRs("hang6_cost") - adoRs("hang6_use_cost")
hang7_res_cost = adoRs("hang7_cost") - adoRs("hang7_use_cost")
hang8_res_cost = adoRs("hang8_cost") - adoRs("hang8_use_cost")
hang9_res_cost = adoRs("hang9_cost") - adoRs("hang9_use_cost")
%>
<tr>
<td align="center" rowspan="3">
<input type="hidden" name="sel_date" id="sel_date" value="<%= sel_date%>" />
<%
if Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") <> "0" OR Session("N_Depart") = "E" then
%>
<input type="button" id="departDetail_btn" value="사용내역 보기" style="cursor:pointer;"/>
<div id="departDetail_dialog">
</div>
<% end if %>
</td>
<td align="center" >예산</td>
<td align="center" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(adoRs("hang7_cost"), 0) %>" readonly /></td>
<td style="text-align:center;" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(adoRs("hang8_cost"), 0) %>" readonly /></td>
<td align="center" ><input type="text" class="number" style="width:78px; font-size:12px; text-align:right;" value="<%= FormatNumber(total_est, 0) %>" readonly /></td>
</tr>
<tr>
<td align="center" >사용</td>
<td align="center" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(adoRs("hang7_use_cost"), 0) %>" readonly /></td>
<td style="text-align:center;" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(adoRs("hang8_use_cost"), 0) %>" readonly /></td>
<td align="center" ><input type="text" class="number" style="width:78px; font-size:12px; text-align:right;" value="<%= FormatNumber(total_use, 0) %>" readonly /></td>
</tr>
<tr>
<td align="center" >잔여</td>
<td align="center" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(hang7_res_cost, 0) %>" readonly /></td>
<td style="text-align:center;" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(hang8_res_cost, 0) %>" readonly /></td>
<td align="center" ><input type="text" class="number" style="width:78px; font-size:12px; text-align:right;" value="<%= FormatNumber(total_res, 0) %>" readonly /></td>
</tr>
<%
End if
adoRs.close
%>
</table>
<!-- 2023-05-15 서성완 파트너로 로그인 시 파트너 할동비 보이게 -->
<%If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then %>
<table class="table table-sm table-sm2 table-bordered table-head tr-colors" id="topTb">
<tr>
<td width="10%" align="center"><%=now_month %></td>
<td width="13%" align="center">구분</td>
<!-- <td width="11%" align="center">식대</td>-->
<!-- <td width="11%" align="center">교통비</td>-->
<!-- <td width="11%" align="center">회식비</td>-->
<!-- <td width="11%" align="center">물품구입비</td>-->
<!-- <td width="11%" align="center">주차비</td>-->
<!-- <td width="11%" align="center">기타</td>-->
<td width="11%" style="text-align:center;">활동비</td>
<td width="11%" align="center">합계</td>
</tr>
<%
Dim total_est2, total_use2, total_res2
Dim hang1_res_cost2, hang2_res_cost2, hang3_res_cost2, hang4_res_cost2, hang5_res_cost2, hang6_res_cost2, hang7_res_cost2, hang8_res_cost2
total_est2 = 0
total_use2 = 0
total_res2 = 0
over_hang = ""
Query = ""
Query = Query & " SELECT GCE.depart_nm, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대' THEN VGC.cost ELSE 0 END), 0) AS hang1_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '교통비' THEN VGC.cost ELSE 0 END), 0) AS hang2_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비' THEN VGC.cost ELSE 0 END), 0) AS hang3_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '물품구입비' THEN VGC.cost ELSE 0 END), 0) AS hang4_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '주차비' THEN VGC.cost ELSE 0 END), 0) AS hang5_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '기타' THEN VGC.cost ELSE 0 END), 0) AS hang6_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '식대 및 교통비' THEN VGC.cost ELSE 0 END), 0) AS hang7_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '회식비 및 기타' THEN VGC.cost ELSE 0 END), 0) AS hang8_use_cost, "
Query = Query & " ISNULL(SUM(CASE WHEN VGC.txt_hangmok = '활동비' THEN VGC.cost ELSE 0 END), 0) AS hang9_use_cost "
Query = Query & " FROM GROUP_COST_EST GCE LEFT JOIN V_GROUP_COST_NEW VGC "
IF Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" THEN
Query = Query & " ON VGC.d_code = 'E101' AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date "
END IF
'IF Session("User_Number") = "20000201" OR Session("User_Number") = "20160205" THEN '박준성 2023-05-02 원성훈 부사장님은 특별취급 E102로 고정
' Query = Query & " ON VGC.d_code = 'E101' AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date "
'ELSE
' Query = Query & " ON CHARINDEX(VGC.d_code, GCE.depart_cd) > 0 AND VGC.cost_date BETWEEN GCE.st_date AND GCE.ed_date "
'END IF
Query = Query & " AND VGC.p_no = '" & Session("User_Number") & "' "
Query = Query & " WHERE use_yn = '1' "
Query = Query & " AND GCE.depart_cd='" & Session("User_Number") & "'"
Query = Query & " AND '" & now_month & "-01' BETWEEN GCE.st_date AND GCE.ed_date "
Query = Query & " GROUP BY GCE.depart_nm, hang1_cost, hang2_cost, hang3_cost, hang4_cost, hang5_cost, hang6_cost, hang7_cost, hang8_cost, hang9_cost "
'Response.Write Query
adoRs.open Query, adoconn,adopenstatic, adlockreadonly
if adoRs.recordCount > 0 Then
'total_est2 = adoRs("hang1_cost") + adoRs("hang2_cost") + adoRs("hang3_cost") + adoRs("hang4_cost") + adoRs("hang5_cost") + adoRs("hang6_cost") + adoRs("hang7_cost") + adoRs("hang8_cost")
'total_use2 = adoRs("hang1_use_cost") + adoRs("hang2_use_cost") + adoRs("hang3_use_cost") + adoRs("hang4_use_cost") + adoRs("hang5_use_cost") + adoRs("hang6_use_cost") + adoRs("hang7_use_cost") + adoRs("hang8_use_cost")
total_est2 = adoRs("hang9_cost")
total_use2 = adoRs("hang9_use_cost")
total_res2 = total_est2 - total_use2
'hang1_res_cost2 = adoRs("hang1_cost") - adoRs("hang1_use_cost")
'hang2_res_cost2 = adoRs("hang2_cost") - adoRs("hang2_use_cost")
'hang3_res_cost2 = adoRs("hang3_cost") - adoRs("hang3_use_cost")
'hang4_res_cost2 = adoRs("hang4_cost") - adoRs("hang4_use_cost")
'hang5_res_cost2 = adoRs("hang5_cost") - adoRs("hang5_use_cost")
'hang6_res_cost2 = adoRs("hang6_cost") - adoRs("hang6_use_cost")
'hang7_res_cost2 = adoRs("hang7_cost") - adoRs("hang7_use_cost")
'hang8_res_cost2 = adoRs("hang8_cost") - adoRs("hang8_use_cost")
hang9_res_cost2 = adoRs("hang9_cost") - adoRs("hang9_use_cost")
hang9_res_cost = adoRs("hang9_cost") - adoRs("hang9_use_cost")
%>
<tr>
<td align="center" rowspan="3" class="align-middle">
본부장<br>활동비
<input type="hidden" name="sel_date" id="sel_date" value="<%= sel_date%>" />
<%
if Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") <> "0" then
%>
<!--<input type="button" id="departDetail_btn" value="사용내역 보기" style="cursor:pointer;"/>-->
<div id="departDetail_dialog">
</div>
<% end if %>
</td>
</tr>
<tr>
<td align="center" >사용</td>
<td style="text-align:center;" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(adoRs("hang9_use_cost"), 0) %>" readonly /></td>
<td align="center" ><input type="text" class="number" style="width:78px; font-size:12px; text-align:right;" value="<%= FormatNumber(total_use2, 0) %>" readonly /></td>
</tr>
<tr>
<td align="center" >잔여</td>
<td style="text-align:center;" ><input type="text" class="number" style="width:70px; font-size:12px; text-align:right;" value="<%= FormatNumber(hang9_res_cost2, 0) %>" readonly /></td>
<td align="center" ><input type="text" class="number" style="width:78px; font-size:12px; text-align:right;" value="<%= FormatNumber(total_res2, 0) %>" readonly /></td>
</tr>
<%
End if
adoRs.close
%>
</table>
<% End if%>
</td>
</tr>
<tr height="24">
<td align="center" >증빙일자</td>
<td align="center" >프로젝트</td>
<td align="center" >항목</td>
<td style="text-align:center;" >세부항목</td>
<td align="center" >금액</td>
</tr>
<!-- loop start -->
<%for i=1 to Max_length%>
<tr>
<td align="center" >
<% if sel_date <> "" Then %>
<%=sel_date %>
<input type="hidden" name="txt_date" value="<%=sel_date %>" />
<% else %>
<select name="txt_date" style="width:100px;">
<option value="">선택</option>
<% for j = cdate(sel_date_st) To cdate(sel_date_ed) %>
<option value="<%=j%>"><%=j%></option>
<% next %>
</select>
<% End if %>
</td>
<td align="center" id="exap_td_<%=i %>" >
<!-- <input type="text" style="width:200;padding-left:4px;" name="txt_pjt" value="" />-->
</td>
<td align="center" >
<select name="txt_HangMok" style="width:100px;">
<option value="">선택</option>
<!-- <option value="식대">식대</option> -->
<!-- <option value="교통비">교통비</option> -->
<!-- <option value="회식비">회식비</option> -->
<!-- <option value="물품구입비">물품구입비</option> -->
<!-- <option value="주차비">주차비</option> -->
<!-- <option value="기타">기타</option> -->
<!-- 본부장일 경우 활동비 그외에는 식대 및 교통비/회식비 및 기타 -->
<%If Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR Session("N_Depart") = "E" Then %>
<option value="활동비">활동비</option>
<% else %>
<option value="식대 및 교통비">식대 및 교통비</option>
<option value="회식비 및 기타">회식비 및 기타</option>
<% End if %>
</select>
</td>
<td align="center" >
<input type="text" style="width:100;padding-left:4px;" name="txt_bigo" value="" />
</td>
<td align="center" >
<input type="text" style="width:80;text-align:right;padding-right:4px;" name="txt_cost" onkeyup="OnlyNumber(this);check_comma(this.value,'<%=i%>');" value="" />
</td>
<td align="center" style="display:none;" >
<input type="hidden" name="cost_type" value="개인법인카드" >
<!-- <select name="cost_type"><! --== 지출방법 ==-- >
<%for j=0 to ubound(cost_type)%>
<option value="<%=cost_type(j)%>"><%=cost_type(j)%></option>
<%next%>
</select> -->
</td>
</tr>
<%next%>
<!-- loop end -->
<tr>
<td align="center" colspan="4">합 계</td>
<td align="center" >
<input type="text" class="gray" value="" style="width:80;text-align:right;" name="txt_cost_sum" readonly />
</td>
</tr>
<tr>
<td colspan="5" align="center">
<input type="button" class="mt-2" id="print_btn" onclick="goPrint();" value="등 록" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<%
dim timeQuery, prjQuery, prevSaveQuery, foodQuery, preCostQuery, preGroupfeeQuery
prjQuery = ""
prjQuery = prjQuery & " SELECT VPM.p_child_sn, p_subject, CASE WHEN JP.p_child_sn IS NOT NULL THEN '1' ELSE '0' END AS user_sel "
prjQuery = prjQuery & " FROM V_PROJECT_METHOD VPM LEFT JOIN "
prjQuery = prjQuery & " (SELECT DISTINCT p_child_sn, p_user FROM Job_ProjectList) JP "
prjQuery = prjQuery & " ON VPM.p_child_sn = JP.p_child_sn AND JP.p_user = '" & Session("User_Number") & "' "
prjQuery = prjQuery & " WHERE ISNULL(VPM.p_child_sn, '') > '" & RIGHT(cstr(year(date)-2), 2) & "' "
prjQuery = prjQuery & " AND (p_research_complete IS NULL OR p_field_complete IS NULL OR p_dp_complete IS NULL) "
prjQuery = prjQuery & " AND VPM.p_progress_status > '001' "
prjQuery = prjQuery & " ORDER BY VPM.p_child_sn "
preGroupfeeQuery = ""
preGroupfeeQuery = preGroupfeeQuery & " SELECT d_no, hangmok, gubun, cost_date, txt_pjt , txt_hangmok, contents, cost "
preGroupfeeQuery = preGroupfeeQuery & " ,depart, depart_cd, write_name "
preGroupfeeQuery = preGroupfeeQuery & " FROM V_GROUP_COST_NEW "
preGroupfeeQuery = preGroupfeeQuery & " where 1=1 "
preGroupfeeQuery = preGroupfeeQuery & " AND left(cost_date,7) = '" & now_month & "' " '//-- 20220630 hwkim
if session("Depart_Code") = "18" then '//-- 경영문화본부 & 데이터솔루션 팀 구분
if session("job_code") = "08" then
preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '18' and p_job_part = '08'"
else
preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '18' and p_job_part <> '08' "
end if
Elseif depart_cd_string <> "" then
' 2023-05-15 박준성 파트너들이 각 그룹의 사용내역 볼 수 있게 변경 자기의 사용내역은 못 봄
preGroupfeeQuery = preGroupfeeQuery & " and d_code in (" & depart_cd_string & ") "
Elseif Session("User_Number") = "20151203" OR Session("User_Number") = "20031102" OR session("Depart_Code") = "0" then
preGroupfeeQuery = preGroupfeeQuery & " and p_no = '" & session("User_Number") & "' "
'Elseif session("Depart_Code") = "17" Or session("Depart_Code") = "19" Then
' preGroupfeeQuery = preGroupfeeQuery & " and (depart_cd = '17' OR (depart_cd = '18' and p_job_part = '08') OR depart_cd = '19') "
Else
preGroupfeeQuery = preGroupfeeQuery & " and depart_cd = '" & session("Depart_Code") & "' "
end if
preGroupfeeQuery = preGroupfeeQuery & " order by cost_date asc "
'response.write preGroupfeeQuery
%>
<!-- REQUIRED SCRIPTS -->
<script>
$(function(){
var departDetail_dialog = $("#departDetail_dialog").dialog({
autoOpen: false,
modal: true,
resizable: false,
height: 300,
width: 600,
title: '상세설명'
});
departDetail_dialog.dialog("option", "position", {
my: 'center',
at: 'center',
of: window
});
$("#departDetail_btn").on("click", function(){
departDetail_dialog.dialog("open");
});
$("input[name=depart_cost_type]").on("click", function(){
var depart_cost_type = $(this).val();
var sel_date = "<%=sel_date%>";
var sel_date_st = "<%=sel_date_st%>";
var sel_date_ed = "<%=sel_date_ed%>";
var url = "./doc_expense_approval_depart.asp?cutmenu=1&depart_cost_type=" + depart_cost_type;
if(sel_date != ""){
url += "&txt_date=" + sel_date;
}else{
url += "&sel_date_st=" + sel_date_st + "&sel_date_ed=" + sel_date_ed;
}
location.href = url;
});
});
function goPrint(){
var txt_Max_length = document.frm_money_clean.txt_Max_length.value;
var txt_date = new Array();
var txt_HangMok = new Array();
var txt_cost = new Array();
var cost_type = new Array();
var txt_pjt = new Array();
var txt_bigo = new Array();
var tmp_use_sum = {};
var depart_cost_type = "<%=depart_cost_type %>";
var tmp_cost_sum = document.frm_money_clean.txt_cost_sum.value.replace(/,/gi, "").replace("₩", "");
for (var i=0;i<txt_Max_length; i++){
txt_date[i] = document.frm_money_clean.txt_date[i].value;
txt_HangMok[i] = document.frm_money_clean.txt_HangMok[i].value;
txt_cost[i] = document.frm_money_clean.txt_cost[i].value;
cost_type[i] = document.frm_money_clean.cost_type[i].value;
txt_pjt[i] = document.frm_money_clean.txt_pjt[i].value;
txt_bigo[i] = document.frm_money_clean.txt_bigo[i].value;
if (txt_cost[i] == "") {
txt_date[i] = "";
}
}
for(var i=0;i<txt_Max_length; i++){
if(txt_cost[i] != "" && txt_HangMok[i] == ""){
alert("금액이 있으면 세부항목이 있어야 됩니다.");
document.frm_money_clean.txt_HangMok[i].focus();
return false;
}
if(txt_cost[i] == "" && txt_HangMok[i] != ""){
alert("세부항목이 있으면 금액이 있어야 됩니다.");
document.frm_money_clean.txt_cost[i].focus();
return false;
}
if(txt_date[i] == "" && (txt_cost[i] != "" || txt_HangMok[i] != "")){
alert("날짜를 선택해주세요.");
document.frm_money_clean.txt_date[i].focus();
return false;
}
if(txt_pjt[i] == "" && txt_HangMok[i] != ""){
alert("프로젝트를 선택하세요.");
document.frm_money_clean.txt_pjt[i].focus();
return false;
}
if(txt_bigo[i] == "" && txt_HangMok[i] == "물품구입비"){
alert("물품구입비는 세부항목을 입력하세요.");
document.frm_money_clean.txt_bigo[i].focus();
return false;
}
tmp_use_sum[txt_HangMok[i]] = (tmp_use_sum[txt_HangMok[i]] || 0) + +(txt_cost[i].replace(/,/gi, ""))
}
<%
'20240429 조기혜 팀장 요청으로 부회장님 대표님은 예산 제외없음으로 변경
'20240503 조기혜 팀장 요청으로 부사장님은 예산 제외없음으로 변경
IF Session("User_Number") = "20080101" OR Session("User_Number") = "20190301" OR Session("User_Number") = "20000201" THEN
'20240426 조기혜 팀장 요청으로 본부장님들은 예산 제한 없음에서 총액으로 예산 제한으로 변경
ELSEIf Session("Depart_code") = "0" Then
%>
if(<%= total_res2 %> - ((+tmp_use_sum["식대"] || 0) + (+tmp_use_sum["교통비"] || 0) + (+tmp_use_sum["회식비"] || 0) + (+tmp_use_sum["물품구입비"] || 0) + (+tmp_use_sum["주차비"] || 0) + (+tmp_use_sum["기타"] || 0)) < 0){
alert("예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
<% ELSE %>
if(<%= hang1_res_cost %> - +(tmp_use_sum["식대"] || 0) < 0){
alert("식대 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang2_res_cost %> - +(tmp_use_sum["교통비"] || 0) < 0){
alert("교통비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang3_res_cost %> - +(tmp_use_sum["회식비"] || 0) < 0){
alert("회식비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang4_res_cost %> - +(tmp_use_sum["물품구입비"] || 0) < 0){
alert("물품구입비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang5_res_cost %> - +(tmp_use_sum["주차비"] || 0) < 0){
alert("주차비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang6_res_cost %> - +(tmp_use_sum["기타"] || 0) < 0){
alert("기타 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang7_res_cost %> - +(tmp_use_sum["식대 및 교통비"] || 0) < 0){
alert("식대 및 교통비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang8_res_cost %> - +(tmp_use_sum["회식비 및 기타"] || 0) < 0){
alert("회식비 및 기타 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
if(<%= hang9_res_cost %> - +(tmp_use_sum["활동비"] || 0) < 0){
alert("활동비 항목에 대한 예산을 초과하여 사용하실 수 없습니다.\n");
return false;
}
<% End If %>
if (tmp_cost_sum * 1 == 0) {
alert("비용을 입력하세요.");
return false;
}
var url = "doc_expense_approval_depart_print.asp";
url = url + "?txt_Max_length=" + txt_Max_length;
url = url + "&print_type=1";
url = url + "&depart_cost_type=" + depart_cost_type;
document.frm_money_clean.action=url;
document.frm_money_clean.submit();
}
function check_comma(txt,posi) {
txt=txt.trim();
var txt_cost_sum = 0;
var Max_length = document.frm_money_clean.txt_Max_length.value;
for(var i=0;i<txt.length;i++){
txt = txt.replace(',','')
txt = txt.replace(' ','')
}
document.frm_money_clean.txt_cost[eval(posi)-1].value = commify(txt);
for(i=0; i<Max_length;i++){
var txt_cost = document.frm_money_clean.txt_cost[i].value;
for(var j=0;j<txt_cost.length;j++){
txt_cost = txt_cost.replace(',','')
txt_cost = txt_cost.replace(' ','')
}
if (txt_cost != ""){
txt_cost_sum = eval(txt_cost_sum) + eval(txt_cost);
}
}
document.frm_money_clean.txt_cost_sum.value = "₩" + commify(txt_cost_sum);
}
function addJobRow(rown){
var tmpHTML = "";
tmpHTML += "<select id='prj_row_" + rown + "' class='prj_row_select' name='txt_pjt' style='width:200px;' >";
tmpHTML += "</select>";
$("#exap_td_" + rown).append(tmpHTML);
var tmpHTML = "";
tmpHTML += "<option value=''>선 택</option>";
$.each($("#prj_list li.prj_selected"), function(idx, obj){
tmpHTML += "<option value='" + $(obj).data("p_child_sn") + "'>" + $(obj).text() + "</option>";
});
tmpHTML += "<option value='99999'>일반/행정</option>";
$("#prj_row_" + rown).html(tmpHTML);
}
$(function(){
$("#prj_setting_btn").on("click", function(){
if($(this).val() == "참여 프로젝트 ▼"){
$(this).val("참여 프로젝트 ▲");
$("#prj_div").stop(true, true).fadeIn();
}else{
$(this).val("참여 프로젝트 ▼");
$("#prj_div").stop(true, true).fadeOut();
}
});
var prjJsonArr = <%=queryToJson(prjQuery)%>;
var tmpHTML = "";
$.each(prjJsonArr, function(idx, obj){
tmpHTML += "<li title='" + obj.p_subject + "' data-p_child_sn='" + obj.p_child_sn + "' " + (obj.user_sel == "1" ? "class='prj_selected' " : "") + ">[" + obj.p_child_sn + "] " + obj.p_subject + "</li>";
});
$("#prj_list").html(tmpHTML);
for(var i=1; i<=<%=Max_length %>; i++){
addJobRow(i);
}
var prevGroupfeeArr = <%=queryToJson(preGroupfeeQuery)%>; // 그룹(장)활동비 내역 미리 불러오기
var tmpHTML = "";
if(prevGroupfeeArr.length > 0 ){
//tmpHTML = prevGroupfeeArr;
tmpHTML += "<table style='width: 100%;' class='table table-sm table-sm2 table-bordered table-head tr-colors' > ";
tmpHTML += "<tr>";
tmpHTML += "<th scope='row' class='text-center'>일자</td> ";
tmpHTML += "<th scope='row' class='text-center'>프로젝트</td> ";
tmpHTML += "<th scope='row' class='text-center'>항목</td> ";
tmpHTML += "<th scope='row' class='text-center'>세부항목</td> ";
tmpHTML += "<th scope='row' class='text-center'>금액</td> ";
tmpHTML += "<th scope='row' class='text-center'>작성자</td> ";
tmpHTML += "</tr> ";
}
$.each( prevGroupfeeArr , function(idx, obj){
//console.log(idx, obj);
tmpHTML += "<tr><td class='text-center' style='width:100px;'>";
tmpHTML += obj["cost_date"] + "</td><td class='text-center'>";
tmpHTML += obj["txt_pjt"] + "</td><td class='text-center'>";
tmpHTML += obj["txt_hangmok"] + "</td><td class='text-center'>";
tmpHTML += obj["contents"] + "</td><td class='text-center'>";
tmpHTML += commify(obj["cost"]) + " </td><td class='text-center'>";
tmpHTML += obj["write_name"] + "</td>";
tmpHTML += "</tr> ";
});
tmpHTML += "</table> ";
$("#topTb").after(tmpHTML);
});
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->