Files
KIN/business/cost_list.asp
2025-09-29 17:55:08 +09:00

345 lines
20 KiB
Plaintext

<!-- #include virtual = "include/header.asp" -->
<!-- #include virtual = "include/left.asp" -->
<%
dim Query
yyyy = request("yyyy")
mm = request("mm")
if yyyy = "" then
yyyy = year(cdate(now))
end if
if mm = "" then
mm = Right("0" & TransFormat(month(cdate(now))), 2)
end if
%>
<!-- 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="800" id='mainTb'>
<tr>
<td valign="top"><div class="menuTitle"><%=yyyy & "년 " & mm &"월"%> 비용 정산</div></td>
</tr>
<tr>
<td style="padding:0 0 5 0;">
<span class='discript'><%=session("loginuser")%>님의 업무일지 비용정산 자료를 출력하는 화면 입니다.</span>
</td>
</tr>
<tr>
<td class="settingForm">
<select name='biz_date' id="biz_date" onchange="biz_date_change(this.value);">
<% For i = 0 To -7 Step -1 %>
<option value="<%=LEFT(DateAdd("m", i, date), 7) %>" <%If yyyy & "-" & mm = LEFT(DateAdd("m", i, date), 7) Then %> selected <%End If %>><%=LEFT(DateAdd("m", i, date), 7) %></option>
<% Next %>
</select>
</td>
</tr>
<tr>
<td class='contents_body'>
<%
query = ""
query = query & " SELECT rnum, min(job_date) AS min_date, max(job_date) AS max_date, sum(cost_money) AS cost_money, count(*) AS cnt "
query = query & " FROM "
query = query & " ( "
query = query & " SELECT CEILING(ROW_NUMBER() OVER(ORDER BY job_date, p_sn, job_code, cost_code, cost_money) / 12.0) AS rnum, "
query = query & " job_date, ISNULL(cost_money, 0) AS cost_money "
query = query & " FROM V_BUSI_COST "
query = query & " WHERE p_no = '" & session("User_Number") & "' AND job_date LIKE '" & yyyy & "-" & mm & "%' "
query = query & " "
query = query & " ) T "
query = query & " GROUP BY rnum "
adoRs.open query, adoconn, adOpenStatic, adLockReadOnly
if adoRs.RecordCount > 0 Then
%>
<div class='listTitle'>업무일지 비용 집계</div>
<table id='costList_tb'>
<tr>
<td width="30%" >기간</td>
<td width="25%" >금액</td>
<td width="25%" >건수</td>
<td width="20%" >출력</td>
</tr>
<%
Dim sum_money, sum_count
sum_money = 0
sum_count = 0
Do while Not adoRs.Eof
%>
<tr>
<td><%=adoRs("min_date")%> ~ <%=adoRs("max_date")%></td>
<td><%=formatnumber(adoRs("cost_money"), 0)%>원</td>
<td><%=adoRs("cnt")%></td>
<td><input type="button" class="detail_btn" value='상세보기' data-daterange="<%=adoRs("min_date")%>,<%=adoRs("max_date")%>" data-rnum="<%=adoRs("rnum")%>" /></td>
</tr>
<%
sum_money = sum_money + adoRs("cost_money")
sum_count = sum_count + adoRs("cnt")
adors.moveNext
Loop
%>
<%if sum_count > 0 then%>
<tr>
<td>합계</td>
<td><%=formatnumber(sum_money, 0)%>원</td>
<td><%=sum_count%></td>
<td></td>
</tr>
<%end if%>
</table>
<%
End if
adoRs.close
query = ""
query = query & " SELECT gubun, sum(cost) as sum_cost, count(*) as cnt, "
query = query & " min(cost_date) as min_date, max(cost_date) as max_date, min(d_order_cnt) as min_order_cnt "
query = query & " FROM V_GROUP_COST GC LEFT JOIN Document D ON GC.d_no = D.d_no "
query = query & " WHERE cost_date LIKE '" & yyyy & "-" & mm & "%' "
query = query & " AND p_no = '" & session("user_number") & "' "
query = query & " GROUP BY gubun "
'response.Write query
adoRs.open query, adoconn, adOpenStatic, adLockReadOnly
Dim tmp_cost_sum
tmp_cost_sum = 0
if adoRs.recordCount > 0 Then
%>
<div class='listTitle'>그룹운영비 집계</div>
<table id="groupList_tb">
<tr>
<td width="30%" >기간</td>
<td width="25%" >금액</td>
<td width="25%" >건수</td>
<td width="20%" >출력</td>
</tr>
<%
Do while Not adoRs.Eof
%>
<tr>
<td><%= adors("min_date")%> ~ <%= adors("max_date")%></td>
<td><%= formatNumber(adors("sum_cost"), 0)%>원</td>
<td><%= adors("cnt")%></td>
<td>
<input type='button' onclick="detail_cost_all('<%=iif(adors("gubun") = "그룹활동비", "1", "2")%>');" value="그룹운영비 상세" />
</td>
</tr>
<%
adoRs.MoveNext
Loop
%>
</table>
<%
end if
adoRs.Close
query = ""
query = query & " SELECT convert(varchar(10), target3) as doc_date, 문서번호, '마케팅비' as d_name, "
query = query & " convert(money, convert(varchar(30), target4)) as cost_money, login_p_no FROM 문서내용 "
query = query & " WHERE 문서제목 = '접대비보고서' AND del_yes_no='no' "
query = query & " AND convert(varchar(10), target3) like '" & yyyy & "-" & mm & "%' "
query = query & " AND login_p_no = '" & session("user_number") & "' "
'response.Write query
adoRs.open query, adoconn, adOpenStatic, adLockReadOnly
tmp_cost_sum = 0
if adoRs.recordCount > 0 Then
%>
<div class='listTitle'>마케팅비 집계</div>
<table id='marketingList_tb'>
<tr>
<td width="30%" >문서종류</td>
<td width="25%" >문서번호</td>
<td width="25%" >일자</td>
<td width="20%" >비용</td>
</tr>
<tr>
<td colspan="4"><input type='button' onclick="opnMarketing_all();" value="<%=yyyy %>년 <%=mid(adoRs("doc_date"), 6,2) %>월 <%=adoRs("d_name") %> 일괄보기 (출력용)" /></td>
</tr>
<%
Do while Not adoRs.Eof
%>
<tr>
<td><%=adoRs("d_name") %></td>
<td><input type='button' onclick="opnMarketing('<%=adoRs("문서번호") %>');" value="<%=adoRs("문서번호") %>" /></td>
<td><%=adoRs("doc_date") %></td>
<td><%=formatnumber(cDbl(adoRs("cost_money")),0) %>원</td>
</tr>
<%
tmp_cost_sum = tmp_cost_sum + cDbl(adoRs("cost_money"))
adoRs.MoveNext
Loop
%>
<tr>
<td colspan="3">합 계</td>
<td><%=formatnumber(tmp_cost_sum, 0) %>원</td>
</tr>
</table>
<%
end if
adoRs.close
%>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /.content -->
<!-- REQUIRED SCRIPTS -->
<style>
#mainTb * {
font-family: 'Noto Sans CJK KR', sans-serif;
font-size: 13px;
letter-spacing: 0px;
}
#mainTb{
border-collapse: collapse;
}
.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 */
}
.listTitle{
margin-top: 20px;
margin-bottom: 15px;
font-size: 17px !important;
font-weight: bold;
text-align: center;
}
#costList_tb{
border-collapse: collapse;
width:100%;
}
#costList_tb > tbody > tr > td{
border: 1px solid #cccccc;
padding: 3px 5px;
text-align: center;
}
#costList_tb > tbody > tr > td > input[type=button]{
padding: 1px 25px;
cursor:pointer;
}
#costList_tb > tbody > tr:first-child > td{
font-weight:bold;
background-color: #eaeaea;
}
#costList_tb > tbody > tr:last-child > td{
font-weight:bold;
}
#groupList_tb{
border-collapse: collapse;
width:100%;
}
#groupList_tb > tbody > tr > td{
border: 1px solid #cccccc;
padding: 3px 5px;
text-align: center;
}
#groupList_tb > tbody > tr > td > input[type=button]{
padding: 1px 25px;
cursor:pointer;
}
#groupList_tb > tbody > tr:first-child > td{
font-weight:bold;
background-color: #eaeaea;
}
#marketingList_tb{
border-collapse: collapse;
width:100%;
}
#marketingList_tb > tbody > tr > td{
border: 1px solid #cccccc;
padding: 3px 5px;
text-align: center;
}
#marketingList_tb > tbody > tr > td > input[type=button]{
padding: 1px 25px;
cursor:pointer;
}
#marketingList_tb > tbody > tr:first-child > td{
font-weight:bold;
background-color: #eaeaea;
}
#marketingList_tb > tbody > tr:last-child > td{
font-weight:bold;
}
.settingForm{
background-color: #eaeaea;
padding: 10px 10px;
}
.menuTitle{
font-weight: bold;
font-size: 20px !important;
height: 35px;
}
#biz_date{
margin-right: 10px;
padding: 2px;
}
</style>
<script>
var y_m = "<%=yyyy & "-" & mm%>";
function detail_cost(d_no) {
var url;
url = "/ess/doc_entertainment_print.asp?d_no=" + d_no + "&view_chk=1&x=1";
window.open(url, '', 'left=0,top=0,width=800,height=900,scrollbars=yes,resizable=yes');
}
function biz_date_change(sel_date) {
var arr_date = sel_date.split("-"); // arr_date[0] <- 년 , arr_date[1] <- 월
location.href = "./cost_list.asp?yyyy="+arr_date[0]+"&mm="+arr_date[1];
}
function detail_cost_all(div) {
var url = "/business/approval_depart_all_print.asp?print_type=1&depart_div=" + div + "&y_m=" + y_m ;
window.open(url, '', 'left=0,top=0,width=800,height=900,scrollbars=yes,resizable=yes');
}
function opnMarketing(d_no){
url = "/ess/doc_entertainment_print.asp?d_no=" + d_no + "&view_chk=1&x=2";
window.open(url, '', 'left=0,top=0,width=800,height=900,scrollbars=yes,resizable=yes');
}
function opnMarketing_all(){
var url = "/business/approval_entertainment_all_print.asp?print_type=1&y_m=" + y_m ;
window.open(url, '', 'left=0,top=0,width=800,height=900,scrollbars=yes,resizable=yes');
}
$(function(){
if($(".listTitle").length == 0){
$("#biz_date").after("<span class='discript' style='margin-left:15px;'>정산할 비용 항목이 없습니다.</span>");
}
$(".detail_btn").on("click", function(){
var url;
url = "cost_print.asp?print_type=1";
//url = url + "&sel_kikan=" + $(this).data("daterange");
url = url + "&rnum=" + $(this).data("rnum");
url = url + "&ym=" + y_m;
window.open(url,"","left=50 ,top=0, menubar=no, location=no ,status=no ,toolbar=no ,width=850, height=800 ,scrollbars=yes ,resizable=yes");
});
})
</script>
</div>
<!-- /.content-wrapper -->
<!-- #include virtual = "include/footer.asp" -->