<!--#include virtual="/manager/common/file/member_top.asp"-->
<!--#include file="config.asp"-->
<script type="text/javascript" src="/common/js/03member.js"></script>
<%
prepage = Request.ServerVariables("path_info") & "?" & Request.ServerVariables("query_string")
' 테이블 기본 환경설정 ********************************************************************************

table			= "change_log"	' 테이블명
idx_field		= "idx"		' 기본키
oreder_filed	= "reg_date DESC, idx desc"	' 정렬기준 필드
Query_Fields	= "idx, m_id, reg_date, changeVal, field_type, write_id, write_ip, afterVal"	' 불러올 필드

v_pagesize		= 20				' 목록개수
v_block			= 10				' 페이지개수
' ****************************************************************************************************



' ---------------조합 쿼리문------------------------------------
v_search = inputvalue(request("p_search"))
v_keyword = inputvalue(request("p_keyword"))
Query_Where = ""	'기본 검색

If v_keyword <> "" then
	Query_Where = Query_Where & " and "&v_search&" like '%"&v_keyword&"%'"
End If
'' 조건 있을때 여기에 계속 추가

If Query_Where<>"" Then
	Query_Where2 = " WHERE " & Mid(Query_Where,5)
End If

Query_OrderBy = " ORDER BY "&oreder_filed

' ---------------------------------------------------------------



' ---------------------전체 레코드 수 뽑기----------------------------------------
sql = "select count("& idx_field &") as "& idx_field &" from "& table & Query_Where2
Set Rs = Dbcon.Execute (sql)
recordcount = rs(0)	'이 전체레코드갯수를 이용해서 페이지갯수를 뽑아 낼것이다.
rs.close : Set rs = nothing
' ---------------------------------------------------------------------------------


v_totalpage	= int((recordcount-1)/v_pagesize)+1		'전체덩어리갯수 
v_page		= request("p_page")
If v_page="" Then
	v_page = 0
Else
	v_page = Int(v_page)
End if

If v_page = "" then
	v_page = 1
ElseIf v_page < 1 then
	v_page = 1
ElseIf v_page > v_totalpage then
	v_page = v_totalpage
End If


' -----------------------------리스트 출력 쿼리문 생성-----------------------------
strSQL = " SELECT TOP "& v_pagesize &" "& Query_Fields &" FROM "& table &" WHERE "& idx_field &" NOT IN "
strSQL = strSQL & " ( SELECT  TOP "& v_pagesize*(v_page-1) &" "& idx_field &" FROM "& table & Query_Where2 & Query_OrderBy &" ) "
strSQL = strSQL & Query_Where &" "& Query_OrderBy 
Set rs = Dbcon.execute(strSQL)
If Not rs.eof Then
	vData = rs.getrows()
	vCnt = UBound(vData,2)
Else
	vCnt = -1
End If
rs.close : Set rs = Nothing
' ---------------------------------------------------------------------------------



%>
		<!-- 내용영역 -->
		<div id="contents">

			<div id="contents_head"> 
				<div id="contents_title">
					<img src="/manager/img/tit_ic03.gif" width="22" height="21" class="<%=skin%> center" alt="" /> <h1><span>충전내역</span></h1>
				</div>
				<div id="location">
					<a href="/manager/" tabindex="<%=getTabIndex()%>">Home</a> &gt; <a href="change_log.asp" class="now" tabindex="<%=getTabIndex()%>">충전내역</a>
				</div>
			</div>

			<!-- 내용들어가는곳 -->
			<div id="contents_area">

				

					<h2 class="<%=skin%>">충전된 내역</h2>


					<div class="write_info">

						<div class="write_form pt7">
							<form id="frm_sch" action="list.asp"  method="get">

							<ul>
							<li class="search"><label for="p_search">검색</label> :</li>
							<li><select id="p_search" name="p_search" title="검색형태 선택" tabindex="<%=getTabIndex()%>">
								<option value="m_id" <%if v_search = "m_id" Then response.write "selected='selected'" End if %>>대상자ID</option>
								<option value="write_id" <%if v_search = "write_id" Then response.write "selected='selected'" End If %>>작업자ID</option>
								<option value="reg_date" <%if v_search = "reg_date" Then response.write "selected='selected'" End If %>>충전일</option>
							</select></li>
							<li><input type="text" size="54" title="검색어를 입력하세요" id="p_keyword" name="p_keyword" class="input_box input" onfocus="focus_on1_<%=skin%>(this);" onblur="focus_off1(this);" value="<%=v_keyword%>" tabindex="<%=getTabIndex()%>" /></li>
							<li><div id="<%=skin%>_bt"><span class="button"><input type="submit" value="검색" tabindex="<%=getTabIndex()%>"/></span></div></li>
							<li><div id="w01_bt"><span class="button"><input type="button" value="전체보기" onclick="page_go1('list.asp');" tabindex="<%=getTabIndex()%>"/></span></div></li>
							<li><div id="w01_bt"><span class="button"><input type="button" value="엑셀다운로드" onclick="page_go1('excel.asp');" tabindex="<%=getTabIndex()%>"/></span></div></li>
							</ul>

							</form>
						</div>

					</div>

					<div class="list_count" style="height:20px">
						전체 <strong><%=recordcount%></strong>개 (페이지 <strong class="orange"><%=v_page%></strong>/<%=v_totalpage%>)
					</div>


				<form id= "frm_list" action=""  method='post'>
					<div>
						
						<input type="hidden" name="status" />
						<input type="hidden" name="m_level" />
						<input type="hidden" name="m_num" />
						<input type="hidden" id="chk_all" name="chk_all" />
						
					</div>


					<fieldset>
						<legend>회원관리 수정/삭제/보기</legend>
						<table cellspacing="0" class="bbs_<%=skin%>" summary="사이트의 회원을 관리합니다.">
						<caption>회원관리 서식</caption>
						<colgroup>
						<col width="50" />
						<col />
						<col width="100"/>
						<col width="100"/>
						<col />
						<col width="150" />
						</colgroup>

						<thead>
						<tr>
							<th scope="col">번호</th>
							<th scope="col">대상자</th>
							<th scope="col">충전건수</th>
							<th scope="col">충전후 보유건수</th>
							<th scope="col">충전일시</th>
							<th scope="col">작업자</th>
						</tr>
						</thead>

						<tbody>

<%
If vCnt > -1 then        ' ------ 내용이 있으면 리스트 출력

	If v_page = 1 then
		num = recordcount
	else
		num = recordcount - ((v_page - 1) * v_pagesize)
	End If


	For i=0 To vCnt

		Call arr2Value(Query_Fields, "vData", i)
		If isnull(afterVal) Then
			afterVal = "기록없음"
		Else
			afterVal = FormatNumber(afterVal,0) & "건"
		End if


%>

						<tr>
							<td scope="row" class="center"><%=num%></td>
							<td scope="row" class="center"><%=get_name(m_id) & " (" & m_id & ")"%></td>
							<td scope="row" style="text-align:right;padding-right:5px;"><%=FormatNumber(changeVal,0)%>건</td>
							<td scope="row" style="text-align:right;padding-right:5px;"><%=afterVal%></td>
							<td scope="row" class="center"><%=reg_date%></td>
							<td scope="row" class="center">
								<%=get_name(write_id) & " (" & write_id & ")"%>
							<%
							If write_ip <> "" Then
								Response.write "<br />IP:" & write_ip
							End if
							%>
							</td>
						</tr>

<%
		num = num - 1
	next


else ' 게시할 목록이 없다면
%>

						<tr>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
							<td scope="row" class="center"></td>
						</tr>
						
<%
End if
%>
						</tbody>
						</table>
					</fieldset>

					
					

					<!-- 페이징 -->
					<div class="paginate">
						<%page("change_log.asp")%>
					</div>
					<!-- //페이징 -->


				</form>

			</div>
			<!-- 내용들어가는곳 -->

		</div>
		<!-- //내용영역 -->


<!--#include virtual="/manager/common/file/sub_bottom.asp"-->
