<?php

	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
	include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
	$mp = "25";	//set top nav

?>
<? include("../inc/inc_top.php") ?>
<? include("../inc/inc_header.php") ?>

<?

	$PageNo =$_REQUEST['pageno'];
	$PageSize =$_REQUEST['PageSize'];
	if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
	if (empty($PageSize)) {
		$PageSize=10; //목록개수설정
	}else{$PageSize=$PageSize;}

	$pagestartpoint=($PageNo-1)*$PageSize;
	$sql = "where ds_delind='N'";	//삭제하지 않은
	$sql = $sql. "	and ds_status = 'W0' "; //활동 중인 - A0:활동,B0:휴면

	//echo $_REQUEST['searchtype'];
	//echo "<BR>";
	$searchtype = $_REQUEST['searchtype'];
	$searchword = $_REQUEST['searchword'];
	$dt_start = $_REQUEST['dt_start'];
	$dt_end = $_REQUEST['dt_end'];

	if($searchword != ""){
		if($searchtype=="" || $searchtype==null){
			$sql = $sql. "	and (nm_name like '$searchword%' or nm_email like '$searchword%') ";
		}else{
			$sql = $sql. "	and $searchtype like '$searchword%'";
		}
	}
	if($dt_start != "" && $dt_end != ""){
		$sql = $sql. "	and dt_insert between '$dt_start' and '$dt_end' ";
	}
	//	echo $sql;
	$totalrows = @mysql_result(mysql_query("select count(*) from sa_master $sql"),0,0);
?>

<section id="contents">
	<h2>SA탈퇴 관리</h2>
	<h3><em>▶</em> 회원검색</h3>

	<table class="tbl_search">
		<colgroup>
			<col width="10%">
			<col width="38%">
			<col width="10%">
			<col width="*">
		</colgroup>
	<form id="frmSearch" name="frmSearch" method="post">
	<input type="hidden" id="PageSize" name="PageSize">
	<input type="hidden" id="searchtype" name="searchtype">
		<tr>
			<th>검색어</th>
			<td colspan=3>
				<span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
					<select>
						<option value="">전체</option>
						<option value="nm_email"<? if($searchtype =="cd_userid"){?> selected<?}?>>아이디</option>
						<!-- <option value="nm_name"<? if($searchtype =="nm_name"){?> selected<?}?>>이름</option> -->
					</select>
				</span>
				<input type="text" class="inp_txt" style="width:60%;" id="searchword" name="searchword" value="<?=$searchword?>">
				<input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
			</td>
			<!-- <th>검색어</th>
			<td>
				<div class="radio_chk">
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio1"><i></i><label for="radio1">전체</label></span>
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio2"><i></i><label for="radio2">관리자삭제</label></span>
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio3"><i></i><label for="radio3">본인탈퇴</label></span>
				</div>
			</td> -->
		</tr>
		<!-- <tr>
			<th>탈퇴일</th>
			<td colspan="3">
				<input type="text" class="inp_txt" style="width:25%;">
				<span class="btn_cal">달력보기</span>
				~
				<input type="text" class="inp_txt" style="width:25%;">
				<span class="btn_cal">달력보기</span>
				<input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
			</td>
		</tr> -->
	</form>
	</table>

	<div class="select_view_type">
		<span class="select" style="width:160px;" id="selBox">
			<select id="page_size">
				<option value="10"<? if($PageSize==10){ ?> selected<? } ?>>10개 보기</option>
				<option value="20"<? if($PageSize==20){ ?> selected<? } ?>>20개 보기</option>
				<option value="30"<? if($PageSize==30){ ?> selected<? } ?>>30개 보기</option>
			</select>
		</span>
	</div>

	<div class="tbl_wrap">
		<table class="tbl_list">
			<colgroup>
				<col width="7%">
				<col width="*">
				<col width="21%">

			</colgroup>
			<thead>
			<tr>
				<th>번호</th>
				<th>아이디</th>
				<th>탈퇴일</th>
			</tr>
			</thead>
<?
		if($totalrows>0) {

			$r = mysqli_query($connect, "SELECT *, getCode('sa_master','ds_company_bp',ds_company_bp) as nm_company_bp, getCode('sa_master','ds_branch',ds_branch) as nm_branch  FROM sa_master $sql ORDER BY cd_user desc  LIMIT $pagestartpoint,$PageSize");
			$i=1;
			while($col = mysqli_fetch_array($r)) {

				$tmpNum =$totalrows-($PageSize*($PageNo-1));
				$no = ($tmpNum - $i)+1;

?>
			<tr>
				<td><?=$no?></td>
				<td><?=$col['cd_userid']?></td>
				<td><?=$col['dt_withdrawal']?></td>
			</tr>

<?
				$i++;
			}
		}else{
?>
			<tr>
				<td colspan="7">데이터가 존재 하지 않습니다.</td>
			</tr>
<?
		}
?>
		</table>
	</div>

	<div class="paging">
		<?
			$url = "./sa_withdrawal.php?searchtype=$searchtype&searchword=$searchword&dt_start=$dt_start&dt_end=$dt_end";
			ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
		?>
	</div>

	<div class="btn_right">
		<!-- <a href="#" class="rnd_btn gray">관리자탈퇴</a> -->
	</div>
</section>

<? include("../inc/inc_footer.php") ?>
<? include("../inc/inc_bottom.php") ?>
<?
mysql_close($connect);
?>
