518 lines
16 KiB
PHP
518 lines
16 KiB
PHP
<?php
|
|
$sub_menu = '400000';
|
|
include_once('./_common.php');
|
|
|
|
$max_limit = 7; // 몇행 출력할 것인지?
|
|
|
|
$g5['title'] = ' 쇼핑몰관리';
|
|
include_once (G5_ADMIN_PATH.'/admin.head.php');
|
|
|
|
$pg_anchor = '<ul class="anchor">
|
|
<li><a href="#anc_sidx_ord">주문현황</a></li>
|
|
<li><a href="#anc_sidx_rdy">입금완료미배송내역</a></li>
|
|
<li><a href="#anc_sidx_wait">미입금주문내역</a></li>
|
|
<li><a href="#anc_sidx_ps">사용후기</a></li>
|
|
<li><a href="#anc_sidx_qna">상품문의</a></li>
|
|
</ul>';
|
|
|
|
// 주문상태에 따른 합계 금액
|
|
function get_order_status_sum($status)
|
|
{
|
|
global $g5;
|
|
|
|
$sql = " select count(*) as cnt,
|
|
sum(od_cart_price + od_send_cost + od_send_cost2 - od_cancel_price - od_cart_coupon - od_coupon - od_send_coupon) as price
|
|
from {$g5['g5_shop_order_table']}
|
|
where od_status = '$status' ";
|
|
$row = sql_fetch($sql);
|
|
|
|
$info = array();
|
|
$info['count'] = (int)$row['cnt'];
|
|
$info['price'] = (int)$row['price'];
|
|
$info['href'] = './orderlist.php?od_status='.$status;
|
|
|
|
return $info;
|
|
}
|
|
|
|
// 일자별 주문 합계 금액
|
|
function get_order_date_sum($date)
|
|
{
|
|
global $g5;
|
|
|
|
$sql = " select sum(od_cart_price + od_send_cost + od_send_cost2 - od_cart_coupon - od_coupon - od_send_coupon) as orderprice,
|
|
sum(od_cancel_price) as cancelprice
|
|
from {$g5['g5_shop_order_table']}
|
|
where SUBSTRING(od_time, 1, 10) = '$date' ";
|
|
$row = sql_fetch($sql);
|
|
|
|
$info = array();
|
|
$info['order'] = (int)$row['orderprice'];
|
|
$info['cancel'] = (int)$row['cancelprice'];
|
|
|
|
return $info;
|
|
}
|
|
|
|
function get_max_value($arr)
|
|
{
|
|
foreach($arr as $key => $val)
|
|
{
|
|
if(is_array($val))
|
|
{
|
|
$arr[$key] = get_max_value($val);
|
|
}
|
|
}
|
|
|
|
sort($arr);
|
|
|
|
return array_pop($arr);
|
|
}
|
|
?>
|
|
|
|
<section id="anc_sidx_act">
|
|
<h2>처리해야할 주문</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div id="sidx_take_act">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>상태변경</th>
|
|
<th>건수</th>
|
|
<th>금액</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<?php
|
|
$info = get_order_status_sum('주문');
|
|
?>
|
|
<th>주문 -> 입금</th>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
$info = get_order_status_sum('입금');
|
|
?>
|
|
<th>입금 -> 준비</th>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
$info = get_order_status_sum('준비');
|
|
?>
|
|
<th>준비 -> 배송</th>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
|
</tr>
|
|
<tr>
|
|
<?php
|
|
$info = get_order_status_sum('배송');
|
|
?>
|
|
<th>배송 -> 완료</th>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['count']); ?></a></td>
|
|
<td><a href="<?php echo $info['href']; ?>"><?php echo number_format($info['price']); ?></a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="anc_sidx_ord">
|
|
<h2>주문현황</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<?php
|
|
$arr_order = array();
|
|
$x_val = array();
|
|
for($i=6; $i>=0; $i--) {
|
|
$date = date('Y-m-d', strtotime('-'.$i.' days', G5_SERVER_TIME));
|
|
|
|
$x_val[] = $date;
|
|
$arr_order[] = get_order_date_sum($date);
|
|
}
|
|
|
|
$max_y = get_max_value($arr_order);
|
|
$max_y = ceil(($max_y) / 1000) * 1000;
|
|
$y_val = array();
|
|
$y_val[] = $max_y;
|
|
|
|
for($i=4; $i>=1; $i--) {
|
|
$y_val[] = $max_y * (($i * 2) / 10);
|
|
}
|
|
|
|
$max_height = 240;
|
|
$h_val = array();
|
|
$js_val = array();
|
|
$offset = 10; // 금액이 상대적으로 작아 높이가 0일 때 기본 높이로 사용
|
|
foreach($arr_order as $val) {
|
|
if($val['order'] > 0)
|
|
$h1 = intval(($max_height * $val['order']) / $max_y) + $offset;
|
|
else
|
|
$h1 = 0;
|
|
|
|
if($val['cancel'] > 0)
|
|
$h2 = intval(($max_height * $val['cancel']) / $max_y) + $offset;
|
|
else
|
|
$h2 = 0 ;
|
|
|
|
$h_val['order'][] = $h1;
|
|
$h_val['cancel'][] = $h2;
|
|
}
|
|
?>
|
|
|
|
<div id="sidx_graph">
|
|
<ul id="sidx_graph_price">
|
|
<?php
|
|
foreach($y_val as $val) {
|
|
?>
|
|
<li><?php echo number_format($val); ?></li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
<ul id="sidx_graph_area">
|
|
<?php
|
|
for($i=0; $i<count($x_val); $i++) {
|
|
$order_title = date("n월 j일", strtotime($x_val[$i])).' 주문: '.display_price($arr_order[$i]['order']);
|
|
$cancel_title = date("n월 j일", strtotime($x_val[$i])).' 취소: '.display_price($arr_order[$i]['cancel']);
|
|
?>
|
|
<li>
|
|
<div class="graph order" title="<?php echo $order_title; ?>"></div>
|
|
<div class="graph cancel" title="<?php echo $cancel_title; ?>"></div>
|
|
</li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
<ul id="sidx_graph_date">
|
|
<?php
|
|
foreach($x_val as $val) {
|
|
?>
|
|
<li><?php echo substr($val, 5, 5); ?></li>
|
|
<?php
|
|
}
|
|
?>
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
|
|
<script>
|
|
$(function() {
|
|
graph_draw();
|
|
|
|
$("#sidx_graph_area div").hover(
|
|
function() {
|
|
if($(this).is(":animated"))
|
|
return false;
|
|
|
|
var title = $(this).attr("title");
|
|
if(title && $(this).data("title") == undefined)
|
|
$(this).data("title", title);
|
|
var left = parseInt($(this).css("left")) + 10;
|
|
var bottom = $(this).height() + 5;
|
|
|
|
$(this)
|
|
.attr("title", "")
|
|
.parent()
|
|
.append("<div id=\"price_tooltip\"><div></div></div>");
|
|
$("#price_tooltip")
|
|
.find("div")
|
|
.html(title)
|
|
.end()
|
|
.css({ left: left+"px", bottom: bottom+"px" })
|
|
.show(200);
|
|
},
|
|
function() {
|
|
if($(this).is(":animated"))
|
|
return false;
|
|
|
|
$(this).attr("title", $(this).data("title"));
|
|
$("#price_tooltip").remove();
|
|
}
|
|
);
|
|
});
|
|
|
|
function graph_draw()
|
|
{
|
|
var g_h1 = new Array("<?php echo implode('", "', $h_val['order']); ?>");
|
|
var g_h2 = new Array("<?php echo implode('", "', $h_val['cancel']); ?>");
|
|
var duration = 600;
|
|
|
|
var $el = $("#sidx_graph_area li");
|
|
var h1, h2;
|
|
var $g1, $g2;
|
|
|
|
$el.each(function(index) {
|
|
h1 = g_h1[index];
|
|
h2 = g_h2[index];
|
|
|
|
$g1 = $(this).find(".order");
|
|
$g2 = $(this).find(".cancel");
|
|
|
|
$g1.animate({ height: h1+"px" }, duration);
|
|
$g2.animate({ height: h2+"px" }, duration);
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<?php /*
|
|
<section id="anc_sidx_ord">
|
|
<h2>주문현황</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div class="local_desc01 local_desc">
|
|
<ul>
|
|
<?php
|
|
$sql = " select count(*) as cnt from {$g5['g5_shop_order_table']} where od_status = '주문' ";
|
|
$row = sql_fetch($sql);
|
|
echo "<li><a href=\"./orderlist.php?od_status=주문\">주문 : ".$row['cnt']."</a></li>";
|
|
?>
|
|
|
|
<?php
|
|
$sql = " select count(*) as cnt from {$g5['g5_shop_order_table']} where od_status = '입금' ";
|
|
$row = sql_fetch($sql);
|
|
echo "<li><a href=\"./orderlist.php?od_status=입금\">입금 : ".$row['cnt']."</a></li>";
|
|
?>
|
|
|
|
<?php
|
|
$sql = " select count(*) as cnt from {$g5['g5_shop_order_table']} where od_status = '준비' ";
|
|
$row = sql_fetch($sql);
|
|
echo "<li><a href=\"./orderlist.php?od_status=준비\">준비 : ".$row['cnt']."</a></li>";
|
|
?>
|
|
|
|
<?php
|
|
$sql = " select count(*) as cnt from {$g5['g5_shop_order_table']} where od_status = '배송' ";
|
|
$row = sql_fetch($sql);
|
|
echo "<li><a href=\"./orderlist.php?od_status=배송\">배송 : ".$row['cnt']."</a></li>";
|
|
?>
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="anc_sidx_rdy">
|
|
<h2>입금완료 미배송내역</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div class="tbl_head01 tbl_wrap">
|
|
<table>
|
|
<caption>입금완료 미배송내역</caption>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">주문번호</th>
|
|
<th scope="col">주문자</th>
|
|
<th scope="col">입금액</th>
|
|
<th scope="col">결제방법</th>
|
|
<th scope="col">수정</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
// 미수금이 없고 운송장번호가 없는 자료를 구함
|
|
$sql = " select *
|
|
from {$g5['g5_shop_order_table']}
|
|
where od_receipt_price > 0 and od_misu <= 0 and od_invoice = ''
|
|
order by od_id desc
|
|
limit $max_limit ";
|
|
$result = sql_query($sql);
|
|
for ($i=0; $row=sql_fetch_array($result); $i++)
|
|
{
|
|
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
|
$row1 = sql_fetch($sql1);
|
|
|
|
$name = get_sideview($row['mb_id'], get_text($row['od_name']), $row1['mb_email'], $row1['mb_homepage']);
|
|
|
|
$settle_method = "";
|
|
if ($row['od_settle_case'])
|
|
{
|
|
$settle_method = $row['od_settle_case'];
|
|
}
|
|
else
|
|
{
|
|
$settle_method .= '미입력';
|
|
if ($row['od_receipt_point']) $settle_method .= '포인트';
|
|
}
|
|
?>
|
|
<tr>
|
|
<td class="td_odrnum2"><?php echo $row['od_id']; ?></td>
|
|
<td class="td_name"><?php echo $name; ?></td>
|
|
<td class="td_numsmall"><?php echo display_price($row['od_receipt_price']); ?></td>
|
|
<td class="td_payby"><?php echo $settle_method; ?></td>
|
|
<td class="td_mngsmall"><a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>">수정</a></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
if ($i == 0) echo '<tr><td colspan="5" class="empty_table">자료가 없습니다.</td></tr>';
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn_list03 btn_list">
|
|
<a href="./deliverylist.php?sort1=od_invoice&sort2=asc&chk_misu=1">입금완료 미배송내역 더보기</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="anc_sidx_wait">
|
|
<h2>미입금 주문내역</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div class="tbl_head01 tbl_wrap">
|
|
<table>
|
|
<caption>미입금 주문내역</caption>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">주문번호</th>
|
|
<th scope="col">주문자</th>
|
|
<th scope="col">주문액</th>
|
|
<th scope="col">결제방법</th>
|
|
<th scope="col">수정</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
// 미수금이 있고 송장번호가 없는 자료를 구함
|
|
$sql = " select *
|
|
from {$g5['g5_shop_order_table']}
|
|
where od_misu > 0
|
|
order by od_id desc
|
|
limit $max_limit ";
|
|
$result = sql_query($sql);
|
|
for ($i=0; $row=sql_fetch_array($result); $i++)
|
|
{
|
|
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
|
$row1 = sql_fetch($sql1);
|
|
|
|
$name = get_sideview($row['mb_id'], get_text($row['od_name']), $row1['mb_email'], $row1['mb_homepage']);
|
|
|
|
$settle_method = "";
|
|
if ($row['od_settle_case'])
|
|
{
|
|
$settle_method = $row['od_settle_case'];
|
|
}
|
|
else
|
|
{
|
|
$settle_method .= '미입력';
|
|
if ($row['od_receipt_point']) $settle_method .= '포인트';
|
|
}
|
|
?>
|
|
<tr>
|
|
<td class="td_odrnum2"><a href="./orderstatuslist.php?sort1=od_id&sel_field=od_id&search=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a></td>
|
|
<td class="td_name"><?php echo $name; ?></td>
|
|
<td class="td_numsmall"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
|
|
<td class="td_payby"><?php echo $settle_method; ?></td>
|
|
<td class="td_mngsmall"><a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>">수정</a></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
if ($i == 0) echo '<tr><td colspan="5" class="empty_table">자료가 없습니다.</td></tr>';
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn_list03 btn_list">
|
|
<a href="./orderlist.php?sort1=od_receipt_price&sort2=asc">미입금 주문내역 더보기</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="anc_sidx_ps">
|
|
<h2>사용후기</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div class="tbl_head01 tbl_wrap">
|
|
<table>
|
|
<caption>사용후기 목록</caption>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">회원명</th>
|
|
<th scope="col">제목</th>
|
|
<th scope="col">수정</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$sql = " select * from {$g5['g5_shop_item_use_table']}
|
|
where is_confirm = 0
|
|
order by is_id desc
|
|
limit $max_limit ";
|
|
$result = sql_query($sql);
|
|
for ($i=0; $row=sql_fetch_array($result); $i++)
|
|
{
|
|
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
|
$row1 = sql_fetch($sql1);
|
|
|
|
$name = get_sideview($row['mb_id'], get_text($row['is_name']), $row1['mb_email'], $row1['mb_homepage']);
|
|
?>
|
|
<tr>
|
|
<td class="td_name"><?php echo $name; ?></td>
|
|
<td><?php echo cut_str($row['is_subject'],40); ?></td>
|
|
<td class="td_mngsmall"><a href="./itemuseform.php?w=u&is_id=<?php echo $row['is_id']; ?>"><img src="./img/icon_mod.jpg" alt="<?php cut_str($row['is_subject'],40); ?> 수정"></a></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
if ($i == 0) echo '<tr><td colspan="3" class="empty_table">자료가 없습니다.</td></tr>';
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn_list03 btn_list">
|
|
<a href="./itemuselist.php?sort1=is_confirm&sort2=asc">사용후기 더보기</a>
|
|
</div>
|
|
</section>
|
|
|
|
<section id="anc_sidx_qna">
|
|
<h2>상품문의</h2>
|
|
<?php echo $pg_anchor; ?>
|
|
|
|
<div class="tbl_head01 tbl_wrap">
|
|
<table>
|
|
<caption>상품문의 목록</caption>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">회원명</th>
|
|
<th scope="col">제목</th>
|
|
<th scope="col">수정</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$sql = " select * from {$g5['g5_shop_item_qa_table']}
|
|
where iq_answer = ''
|
|
order by iq_id desc
|
|
limit $max_limit ";
|
|
$result = sql_query($sql);
|
|
for ($i=0; $row=sql_fetch_array($result); $i++)
|
|
{
|
|
$sql1 = " select * from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
|
|
$row1 = sql_fetch($sql1);
|
|
|
|
$name = get_sideview($row['mb_id'], get_text($row['iq_name']), $row1['mb_email'], $row1['mb_homepage']);
|
|
?>
|
|
<tr>
|
|
<td class="td_name"><?php echo $name; ?></td>
|
|
<td><?php echo cut_str($row['iq_subject'],40); ?></td>
|
|
<td class="td_mng"><a href="./itemqaform.php?w=u&iq_id=<?php echo $row['iq_id']; ?>">수정</a></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
if ($i == 0)
|
|
echo '<tr><td colspan="3" class="empty_table">자료가 없습니다.</td></tr>';
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="btn_list03 btn_list">
|
|
<a href="./itemqalist.php?sort1=iq_answer&sort2=asc">상품문의 더보기</a>
|
|
</div>
|
|
</section>
|
|
*/ ?>
|
|
|
|
<?php
|
|
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
|
?>
|