<?php

	 include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
	 include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';

	$PageNo =$_REQUEST['pageno'];
	if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}

	$PageSize=10; //목록개수설정
	$pagestartpoint=($PageNo-1)*$PageSize;

	$sql = "where a.ds_delind='N'";
	$orderby = "order by a.cd_car desc";
	
	if($_REQUEST[ds_main] =="Y"){
		$sql = $sql. "	and a.ds_main='$ds_main'";
	}
	
	if($searchword != ""){
		if($searchtype=="" || $searchtype==null){
			$sql = $sql. "	and (b.nm_model like '%$searchword%' or c.nm_grade  like '%$searchword%' or a.nm_number  like '%$searchword%')";
		}else{
			$sql = $sql. " and $searchtype like '%$searchword%' ";
		}
	}
	
	$cd_category = $_REQUEST[cd_category];
	if(!$cd_category) $cd_category='1';
//	$sql = $sql. "	and cd_category='$cd_category'";
	
	$totalrows = @mysql_result(mysql_query("select count(*) from car_master a left outer join car_model b on (a.cd_model = b.cd_model) left outer join car_grade c on (a.cd_grade = c.cd_grade) $sql"),0,0);
?>
<?
//Menu Setting
$lMenu = 2;
$mMenu = 0;
?>

<!-- s : top -->
<? include("../inc/inc_top.html"); ?>
<!-- // e : top -->

<!-- s : header -->
<? include("../inc/inc_header.html"); ?>
<!-- // e : header -->

<section id="contents">
	<h2>매입통합 리스트</h2>

<form id="frmSearch" name="frmSearch" method="post" action="list.php">
	<table class="tbl_search">
		<colgroup>
			<col width="10%">
			<col width="38%">
			<col width="10%">
			<col width="*">
		</colgroup>
		<tr>
			<th>검색어</th>
			<td colspan="3">
				<span class="select2" style="margin-right:5px;width:100px;">
					<select id="searchtype" name="searchtype">
						<option value=""></option>
					</select>
				</span>
				<input type="text" id="searchword" name="searchword" class="inp_txt" style="width:60%;">
			</td>
		</tr>
		<tr>
			<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>
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio4"><i></i><label for="radio4">비회원</label></span>
				</div>
			</td>
			<th>가입승인</th>
			<td>
				<div class="radio_chk">
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio11"><i></i><label for="radio11">전체</label></span>
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio12"><i></i><label for="radio12">승인</label></span>
					<span class="check_wrap"><input type="radio" name="radiobutton" id="radio13"><i></i><label for="radio13">미승인</label></span>
				</div>
				<input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
			</td>
		</tr>
	</table>
</form>

	<h3><em>▶</em> 매입통합관리</h3>
	<div class="tbl_wrap">
		<table class="tbl_list ty2">
			<colgroup>
				<col width="7%">
				<col width="11%">
				<col width="*">
				<col width="9%">
				<col width="11%">
				<col width="8%">
				<col width="8%">
				<col width="9%">
				<col width="9%">
				<col width="13%">
			</colgroup>
			<thead>
			<tr>
				<th>번호</th>
				<th>판매자</th>
				<th>차종</th>
				<th>차량번호</th>
				<th>주행거리</th>
				<th>색상</th>
				<th>변속기</th>
				<th>판매지역</th>
				<th>판매상태</th>
				<th>등록일</th>
			</tr>
			</thead>
<?
if($totalrows>0) {

$r = mysql_query("SELECT 
						a.* 
						, b.nm_model 
						, c.nm_grade 
						, getCode('car_master','ds_type',a.ds_type) as nm_type 
						, getCode('car_master','ds_open',a.ds_open) as nm_open 
						, getCode('car_master','ds_sales',a.ds_sales) as nm_sales 
						FROM car_master a 
							left outer join car_model b 
							on (a.cd_model = b.cd_model)
							left outer join car_grade c 
							on (a.cd_grade = c.cd_grade) $sql $orderby LIMIT $pagestartpoint,$PageSize");
	
$i=1;
while($col = mysql_fetch_array($r)) { 

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

?>

			<tr>
				<td>10</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_bold">승인대기</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>9</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>8</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>7</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>6</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>5</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>4</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>3</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>2</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
			<tr>
				<td>1</td>
				<td>이도령</td>
				<td>벤츠 c-class</td>
				<td>23부1234</td>
				<td>80,000km</td>
				<td>검정</td>
				<td>오토</td>
				<td>서울</td>
				<td><em class="txt_blue">입찰중</em></td>
				<td>2018.09.10</td>
			</tr>
<?
	$i++;
}
}else{
?>
			<tr>
				<td>등록된 정보가 없습니다.</td>
			</tr>
<?
}
?>
		</table>
	</div>

	<div class="paging">
		<?
		$url = "./list.php?searchtype=$searchtype&searchword=$searchword&cd_category=$cd_category";
		ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
		?>
		<span>
			<a href="#" class="first">맨처음</a>
			<a href="#" class="prev">이전</a>
		</span>
		<strong>1</strong>
		<a href="#">2</a>
		<a href="#">3</a>
		<a href="#">4</a>
		<a href="#">5</a>
		<span>
			<a href="#" class="next">다음</a>
			<a href="#" class="last">맨마지막</a>
		</span>
	</div>
</section>

<!-- s : footer -->
<? include("../inc/inc_footer.html"); ?>
<!-- // e : footer -->

<!-- s : bottom -->
<? include("../inc/inc_bottom.html"); ?>
<!-- // e : bottom -->
