<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

//불러올 장바구니스킨경로
//$cart_skin_path  =  "$g4[path]/skin/cart/basic";

//전체폭
$width = "99%"; // 전체폭 890 에서 작업


$colspan = 8;

?>


<table width="<?=$width?>" height="300" align=center cellpadding=0 cellspacing=0>
<tr>
  <td valign="top">
    <br>
	<!------------조건별 상품검색--------->
	<form name=ifsearch method=get style="margin:0px;">
	<input type='hidden' name='order' value='<?=$order?>'>
    <table width="100%" cellspacing="0" cellpadding="0" border="1">
	<tr><td style='padding-left:10px; height:30px;width=100px'> 조회기간</td>
	    <td style='padding-left:10px;'>
        <select name=fsd>
            <option value='wr_id'>등록순</option>
            <option value='wr_1'>가격순</option>
			<option value='wr_12'>포인트순</option>
			<option value='wr_hit'>조회순</option>
			<option value='wr_good'>추천순</option>
			<script language="JavaScript">document.ifsearch.fsd.value="<?=$fsd?>";</script>
        </select>&nbsp;<input class='ed' type=fss id=fss name='fss' size=8 maxlength=8 minlength=8  
	itemname='시작일' value='<?=$fss?>' readonly >&nbsp;<a href="javascript:win_calendar('fss', document.getElementById('fss').value, '');">달력</a>
	&nbsp;~&nbsp;<input class='ed' type=fse id=fss name='fse' size=8 maxlength=8 minlength=8  
	itemname='종료일' value='<?=$fse?>' readonly >&nbsp;<a href="javascript:win_calendar('fse', document.getElementById('fse').value, '');">달력</a>
	&nbsp;<input type=radio value="1" name="fsr" <?=$f_ch_1?>><span class=w_title>전체</span>
	&nbsp;<input type=radio value="2" name="fsr" <?=$f_ch_2?>><span class=w_title>오늘</span>
	&nbsp;<input type=radio value="3" name="fsr" <?=$f_ch_3?>><span class=w_title>1개월</span>
	&nbsp;<input type=radio value="4" name="fsr" <?=$f_ch_4?>><span class=w_title>2개월</span>
	&nbsp;<input type=radio value="5" name="fsr" <?=$f_ch_5?>><span class=w_title>3개월</span>
	&nbsp;<input type=radio value="6" name="fsr" <?=$f_ch_6?>><span class=w_title>5개월</span>
	&nbsp;<input type=radio value="7" name="fsr" <?=$f_ch_7?>><span class=w_title>1년</span>
	    </td></tr>
	<tr><td style='padding-left:10px; height:30px;width=100px'> 정렬순서</td>
	    <td style='padding-left:10px;'>
        <select name=flv>
            <option value=''>출력수<?=$flv_option?>
			<script language="JavaScript">document.ifsearch.flv.value="<?=$flv?>";</script>
        </select>
        <select name=flw>
            <option value='desc'>내림차순</option>
			<option value='esc'>오름차순</option>
			<script language="JavaScript">document.ifsearch.flw.value="<?=$flw?>";</script>
        </select>
	    </td></tr>
		<tr height="60"><td colspan="2" align="center"><input type=image src="<?=$g4[path]?>/skin/cart/basic/img/search_btn.gif" border=0 align=absmiddle></td></tr>

	</table>
	</form>
	<!----------//조건별 상품검색--------->
    <br>


    <table width="100%" cellspacing="0" cellpadding="0" border="1">
	<tr height="35" align="center">
	    <td width="70">번호</td>
	    <td>상품명</td>
		<td width="90">등록자</td>
		<td width="80">세일단가</td>
		<td width="80">정상단가</td>
		<td width="80">재고수량</td>
		<td width="80">적립포인트</td>
		<td width="110">등록일</td>
	</tr>
    <?
		$i = 0;
    while ($row = sql_fetch_array($result)){

		$product_url  = "$g4[bbs_path]/board.php?bo_table={$bo_table}&wr_id={$row[wr_id]}";

		/*******************************************/

	    //오늘의 시작시간
		$c_start   = date("Y-m-d",time());

		//현재시간
		$c_end     = date("Y-m-d H:i:s",time());

		//오늘날짜의 카운트를 검사한다.

		$c_mct       = " wr_code = '$row[wr_id]' ";
		$c_mct      .= "  and wr_datetime < '$c_end' "; // 오늘 시작일부터 현재시까지 카운트가 있는지 검사
		$cart_sql    =  " select wr_hit from $g4_cart_count where $c_mct ";

		$cart_result = sql_fetch($cart_sql);
        $cart_cnt    = $cart_result[wr_hit];

		if(!$cart_cnt)$cart_cnt=0;

		/*******************************************/


    ?>
	<tr height="25" align="center"><td><?=($i+1)?></td>
	    <td  align="left" style='padding-left:10px;'><a href="<?=$product_url?>"><?=$row[wr_subject]?></a></td>
		<td><?=$row[mb_id]?>[<?=$cart_cnt?>]</td>
		<td align="right"><b><?=number_format($row[wr_1],0)?> 원</b>&nbsp;&nbsp;</td>
		<td align="right"><b><?=number_format($row[wr_11],0)?> 원</b>&nbsp;&nbsp;</td>
		<td align="right"><?=number_format($row[wr_13],0)?>&nbsp;&nbsp;</td>
		<td align="right"><?=number_format($row[wr_12],0)?>&nbsp;&nbsp;</td>
		<td><?=substr($row[wr_datetime],2,14)?></td>
	</tr>
    <?

		$i++;
    }
      

    ?>
    <? if ($order_count == 0) { echo "<tr><td colspan='$colspan' height=100 align=center>자료가 존재하지 않습니다.</td></tr>"; } ?>
    </table>
	<br>
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
	<tr><td align="center"><?=$write_pages?></td></tr>
	</table>

  </td>
</tr>
</table>



