$sub_menu = '500140';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g4['title'] = '보관함현황';
include_once (G4_ADMIN_PATH.'/admin.head.php');
if (!$to_date) $to_date = date("Ymd", time());
if ($sort1 == "") $sort1 = "it_id_cnt";
if ($sort2 == "") $sort2 = "desc";
$sql = " select a.it_id,
b.it_name,
COUNT(a.it_id) as it_id_cnt
from {$g4['shop_wish_table']} a, {$g4['shop_item_table']} b ";
$sql .= " where a.it_id = b.it_id ";
if ($fr_date && $to_date)
{
$fr = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $fr_date);
$to = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $to_date);
$sql .= " and a.wi_time between '$fr 00:00:00' and '$to 23:59:59' ";
}
if ($sel_ca_id)
{
$sql .= " and b.ca_id like '$sel_ca_id%' ";
}
$sql .= " group by a.it_id, b.it_name
order by $sort1 $sort2 ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$rank = ($page - 1) * $rows;
$sql = $sql . " limit $from_record, $rows ";
$result = sql_query($sql);
$qstr = "page=$page&sort1=$sort1&sort2=$sort2";
$qstr1 = "fr_date=$fr_date&to_date=$to_date&sel_ca_id=$sel_ca_id";
?>
|
| 순위 |
|
상품명 |
건수 |
|
for ($i=0; $row=mysql_fetch_array($result); $i++)
{
$s_mod = icon("수정", "./itemqaform.php?w=u&iq_id={$row['iq_id']}&$qstr");
$s_del = icon("삭제", "javascript:del('./itemqaupdate.php?w=d&iq_id={$row['iq_id']}&$qstr');");
$href = G4_SHOP_URL."/item.php?it_id={$row['it_id']}";
$num = $rank + $i + 1;
$list = $i%2;
echo "
| $num |
".get_it_image($row['it_id'].'_s', 50, 50)." |
".cut_str($row['it_name'],30)." |
$row[it_id_cnt] |
|
";
}
if ($i == 0) {
echo "| 자료가 한건도 없습니다. |
\n";
}
?>
|
| |
=get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&page=");?> |
* 수량을 합산하여 순위를 출력합니다.
include_once (G4_ADMIN_PATH.'/admin.tail.php');
?>