미완료주문 처리 추가

This commit is contained in:
chicpro
2016-04-27 10:43:14 +09:00
parent b38e0f19ca
commit f1cd96dc39
10 changed files with 1132 additions and 15 deletions

View File

@ -14,6 +14,7 @@ $menu['menu400'] = array (
array('400610', '상품유형관리', G5_ADMIN_URL.'/shop_admin/itemtypelist.php', 'scf_item_type'),
array('400500', '상품옵션재고관리', G5_ADMIN_URL.'/shop_admin/optionstocklist.php', 'scf_item_option'),
array('400800', '쿠폰관리', G5_ADMIN_URL.'/shop_admin/couponlist.php', 'scf_coupon'),
array('400750', '추가배송비관리', G5_ADMIN_URL.'/shop_admin/sendcostlist.php', 'scf_sendcost', 1)
array('400750', '추가배송비관리', G5_ADMIN_URL.'/shop_admin/sendcostlist.php', 'scf_sendcost', 1),
array('400410', '미완료주문', G5_ADMIN_URL.'/shop_admin/inorderlist.php', 'scf_inorder', 1),
);
?>

View File

@ -363,11 +363,8 @@ tfoot td {font-weight:bold;text-align:center}
/* 공통 */
.td_addr {text-align:left !important}
.td_alignc {text-align:center}
.td_addr_line {line-height:2em}
.td_amount {width:70px;text-align:center}
.td_auth {width:100px;text-align:center}
.td_auth_mbnick {width:200px}
@ -435,10 +432,11 @@ td.td_grpset {width:160px;border-left:1px solid #e9ecee;text-align:center}
.td_category1{width:130px;text-align:center}
.td_category2{width:100px;text-align:center}
.td_category3{width:80px;text-align:center}
.td_time{text-align:center;width:130px}
.td_center{text-align:center;}
.txt_true {color:#e8180c}
.txt_false {color:#ccc}
.txt_succeed {color:#40b300}
.txt_fail {color:#ce4242}
@ -943,3 +941,9 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
#processing p{font-size:1.2em}
.check_processing {width:300px;height:300px;margin:0 auto;background:url(../img/check.png) no-repeat 50% 50% }
#processing button{background:#ff3061;border:none;color:#fff;padding: 15px;width:150px;margin-top:15px}
/*미완료 주문*/
#inorderlist .td_name{text-align:center !important}
#anc_sodr_pay .btn_confirm{margin-top:30px}
#anc_sodr_pay .btn_confirm .btn_submit{width:300px;height:40px;font-size:14px;}

View File

@ -0,0 +1,503 @@
<?php
$sub_menu = '400410';
include_once('./_common.php');
auth_check($auth[$sub_menu], "w");
$g5['title'] = "미완료주문 내역";
include_once(G5_ADMIN_PATH.'/admin.head.php');
//------------------------------------------------------------------------------
// 주문서 정보
//------------------------------------------------------------------------------
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
$od = sql_fetch($sql);
if (!$od['od_id']) {
alert("해당 주문번호로 미완료 주문서가 존재하지 않습니다.");
}
// 주문정보
$data = unserialize(base64_decode($od['dt_data']));
$sql_common = " from {$g5['g5_shop_cart_table']} where od_id = '{$od['cart_id']}' and ct_status = '쇼핑' and ct_select = '1' ";
// 주문금액
$sql = " select SUM(IF(io_type = 1, io_price, (ct_price + io_price)) * ct_qty) as od_price, COUNT(distinct it_id) as cart_count $sql_common ";
$row = sql_fetch($sql);
$tot_ct_price = $row['od_price'];
$cart_count = $row['cart_count'];
$tot_od_price = $tot_ct_price;
// 쿠폰금액
$tot_cp_price = 0;
if($od['mb_id']) {
// 상품쿠폰
$tot_it_cp_price = $tot_od_cp_price = 0;
$it_cp_cnt = count($data['cp_id']);
$arr_it_cp_prc = array();
for($i=0; $i<$it_cp_cnt; $i++) {
$cid = $data['cp_id'][$i];
$it_id = $data['it_id'][$i];
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '$cid'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method IN ( 0, 1 ) ";
$cp = sql_fetch($sql);
if(!$cp['cp_id'])
continue;
// 사용한 쿠폰인지
if(is_used_coupon($od['mb_id'], $cp['cp_id']))
continue;
// 분류할인인지
if($cp['cp_method']) {
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$row2 = sql_fetch($sql2);
if(!$row2['it_id'])
continue;
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
continue;
} else {
if($cp['cp_target'] != $it_id)
continue;
}
// 상품금액
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price $sql_common and it_id = '$it_id' ";
$ct = sql_fetch($sql);
$item_price = $ct['sum_price'];
if($cp['cp_minimum'] > $item_price)
continue;
$dc = 0;
if($cp['cp_type']) {
$dc = floor(($item_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($item_price < $dc)
continue;
$tot_it_cp_price += $dc;
$arr_it_cp_prc[$it_id] = $dc;
}
$tot_od_price -= $tot_it_cp_price;
// 주문쿠폰
if($data['od_cp_id']) {
$sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '{$data['od_cp_id']}'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method = '2' ";
$cp = sql_fetch($sql);
// 사용한 쿠폰인지
$cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
$dc = 0;
if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
if($cp['cp_type']) {
$dc = floor(($tot_od_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
$tot_od_cp_price = $dc;
$tot_od_price -= $tot_od_cp_price;
}
}
$tot_cp_price = $tot_it_cp_price + $tot_od_cp_price;
}
// 배송비
$od_send_cost = get_sendcost($od['cart_id']);
$tot_sc_cp_price = 0;
if($od['mb_id'] && $od_send_cost > 0) {
// 배송쿠폰
if($data['sc_cp_id']) {
$sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '{$data['sc_cp_id']}'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method = '3' ";
$cp = sql_fetch($sql);
// 사용한 쿠폰인지
$cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
$dc = 0;
if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
if($cp['cp_type']) {
$dc = floor(($send_cost * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($dc > $send_cost)
$dc = $send_cost;
$tot_sc_cp_price = $dc;
}
}
}
// 추가배송비
$od_send_cost2 = (int)$data['od_send_cost2'];
// 포인트
$od_temp_point = (int)$data['od_temp_point'];
$order_price = $tot_od_price + $od_send_cost + $od_send_cost2 - $tot_sc_cp_price - $od_temp_point;
// 상품목록
$sql = " select it_id, it_name, ct_notax, ct_send_cost, it_sc_type $sql_common group by it_id order by ct_id ";
$result = sql_query($sql);
$pg_anchor = '<ul class="anchor">
<li><a href="#anc_sodr_list">주문상품 목록</a></li>
<li><a href="#anc_sodr_orderer">주문하신 분</a></li>
<li><a href="#anc_sodr_taker">받으시는 분</a></li>
</ul>';
?>
<section id="anc_sodr_list">
<h2 class="h2_frm">주문상품 목록</h2>
<?php echo $pg_anchor; ?>
<div class="local_desc02 local_desc">
<p>
주문일시 <strong><?php echo substr($od['dt_time'],0,16); ?> (<?php echo get_yoil($od['dt_time']); ?>)</strong>
|
주문합계 <strong><?php echo number_format($order_price); ?></strong>원
</p>
</div>
<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>
<th scope="col">소계</th>
<th scope="col">쿠폰</th>
<th scope="col">포인트</th>
<th scope="col">배송비</th>
<th scope="col">포인트반영</th>
<th scope="col">재고반영</th>
</tr>
</thead>
<tbody>
<?php
for($i=0; $row=sql_fetch_array($result); $i++) {
// 상품이미지
$image = get_it_image($row['it_id'], 50, 50);
// 상품의 옵션정보
$sql = " select ct_id, it_id, ct_price, ct_point, ct_qty, ct_option, ct_status, cp_price, ct_stock_use, ct_point_use, ct_send_cost, io_type, io_price $sql_common and it_id = '{$row['it_id']}' order by io_type asc, ct_id asc ";
$res = sql_query($sql);
$rowspan = sql_num_rows($res);
// 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price, SUM(ct_qty) as qty $sql_common and it_id = '{$row['it_id']}' ";
$sum = sql_fetch($sql);
// 배송비
switch($row['ct_send_cost'])
{
case 1:
$ct_send_cost = '착불';
break;
case 2:
$ct_send_cost = '무료';
break;
default:
$ct_send_cost = '선불';
break;
}
// 조건부무료
if($row['it_sc_type'] == 2) {
$sendcost = get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od['cart_id']);
if($sendcost == 0)
$ct_send_cost = '무료';
}
for($k=0; $opt=sql_fetch_array($res); $k++) {
if($opt['io_type'])
$opt_price = $opt['io_price'];
else
$opt_price = $opt['ct_price'] + $opt['io_price'];
// 소계
$ct_price['stotal'] = $opt_price * $opt['ct_qty'];
$ct_point['stotal'] = $opt['ct_point'] * $opt['ct_qty'];
if($k == 0)
$opt_cp_price = (int)$arr_it_cp_prc[$row['it_id']];
else
$opt_cp_price = 0;
?>
<tr>
<?php if($k == 0) { ?>
<td rowspan="<?php echo $rowspan; ?>">
<?php echo $image; ?> <?php echo stripslashes($row['it_name']); ?>
<?php if($od['od_tax_flag'] && $row['ct_notax']) echo '[비과세상품]'; ?>
</td>
<?php } ?>
<td><?php echo $opt['ct_option']; ?></td>
<td class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
<td class="td_num"><?php echo number_format($opt['ct_qty']); ?></td>
<td class="td_num"><?php echo number_format($opt_price); ?></td>
<td class="td_num"><?php echo number_format($ct_price['stotal']); ?></td>
<td class="td_num"><?php echo number_format($opt_cp_price); ?></td>
<td class="td_num"><?php echo number_format($ct_point['stotal']); ?></td>
<td class="td_sendcost_by"><?php echo $ct_send_cost; ?></td>
<td class="td_mngsmall"><?php echo get_yn($opt['ct_point_use']); ?></td>
<td class="td_mngsmall"><?php echo get_yn($opt['ct_stock_use']); ?></td>
</tr>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
</div>
</section>
<section id="anc_sodr_pay">
<h2 class="h2_frm">주문결제 내역</h2>
<?php echo $pg_anchor; ?>
<?php
// 주문금액 = 상품구입금액 + 배송비 + 추가배송비
$amount['order'] = $tot_ct_price + $od_send_cost + $od_send_cost2;
// 입금액
$amount['receipt'] = $od_temp_point;
// 쿠폰금액
$amount['coupon'] = $tot_cp_price + $tot_sc_cp_price;
// 취소금액
$amount['cancel'] = 0;
// 미수금 = 주문금액 - 취소금액 - 입금금액 - 쿠폰금액
$amount['misu'] = $amount['order'] - $amount['receipt'] - $amount['coupon'];
// 결제방법
$s_receipt_way = $data['od_settle_case'];
if($data['od_settle_case'] == '간편결제') {
switch($od['dt_pg']) {
case 'lg':
$s_receipt_way = 'PAYNOW';
break;
case 'inicis':
$s_receipt_way = 'KPAY';
break;
case 'kcp':
$s_receipt_way = 'PAYCO';
break;
default:
$s_receipt_way = $data['od_settle_case'];
break;
}
}
if ($od_temp_point > 0)
$s_receipt_way .= "+포인트";
?>
<div class="tbl_head01 tbl_wrap">
<form name="frmorderform" method="post" action="./inorderformupdate.php" onsubmit="return form_submit(this);">
<input type="hidden" name="od_id" value="<?php echo $od_id; ?>">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<strong class="sodr_nonpay">미수금 <?php echo display_price($amount['misu']); ?></strong>
<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>
<th scope="col">총결제액</th>
<th scope="col">쿠폰</th>
<th scope="col">주문취소</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $od['od_id']; ?></td>
<td class="td_paybybig"><?php echo $s_receipt_way; ?></td>
<td class="td_numbig td_numsum"><?php echo display_price($amount['order']); ?></td>
<td class="td_numbig"><?php echo display_price($od_send_cost + $od_send_cost2); ?></td>
<td class="td_numbig"><?php echo display_point($od_temp_point); ?></td>
<td class="td_numbig td_numincome"><?php echo number_format($amount['receipt']); ?>원</td>
<td class="td_numbig td_numcoupon"><?php echo display_price($amount['coupon']); ?></td>
<td class="td_numbig td_numcancel"><?php echo number_format($amount['cancel']); ?>원</td>
</tr>
</tbody>
</table>
<div class="btn_confirm01 btn_confirm">
<input type="submit" value="주문 복구" class="btn_submit">
</div>
</form>
</div>
</section>
<section>
<h2 class="h2_frm">주문자/배송지 정보</h2>
<?php echo $pg_anchor; ?>
<div class="compare_wrap">
<section id="anc_sodr_orderer" class="compare_left">
<h3>주문하신 분</h3>
<div class="tbl_frm01">
<table>
<caption>주문자/배송지 정보</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><span class="sound_only">주문하신 분 </span>이름</th>
<td><?php echo get_text($data['od_name']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">주문하신 분 </span>전화번호</th>
<td><?php echo get_text($data['od_tel']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">주문하신 분 </span>핸드폰</th>
<td><?php echo get_text($data['od_hp']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">주문하시는 분 </span>주소</th>
<td>
<span><?php echo $data['od_zip']; ?></span>
<span><?php echo get_text($data['od_addr1']); ?></span>
<span><?php echo get_text($data['od_addr2']); ?></span>
<span><?php echo get_text($data['od_addr3']); ?></span>
</td>
</tr>
<tr>
<th scope="row"><span class="sound_only">주문하신 분 </span>E-mail</th>
<td><?php echo get_text($data['od_email']); ?></td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="anc_sodr_taker" class="compare_right">
<h3>받으시는 분</h3>
<div class="tbl_frm01">
<table>
<caption>받으시는 분 정보</caption>
<colgroup>
<col class="grid_4">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><span class="sound_only">받으시는 분 </span>이름</th>
<td><?php echo get_text($data['od_b_name']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">받으시는 분 </span>전화번호</th>
<td><?php echo get_text($data['od_b_tel']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">받으시는 분 </span>핸드폰</th>
<td><?php echo get_text($data['od_b_hp']); ?></td>
</tr>
<tr>
<th scope="row"><span class="sound_only">받으시는 분 </span>주소</th>
<td>
<span><?php echo $data['od_b_zip']; ?></span>
<span><?php echo get_text($data['od_b_addr1']); ?></span>
<span><?php echo get_text($data['od_b_addr2']); ?></span>
<span><?php echo get_text($data['od_b_addr3']); ?></span>
</td>
</tr>
<?php if ($default['de_hope_date_use']) { ?>
<tr>
<th scope="row">희망배송일</th>
<td><?php echo $data['od_hope_date']; ?> (<?php echo get_yoil($data['od_hope_date']); ?>)</td>
</tr>
<?php } ?>
<tr>
<th scope="row">전달 메세지</th>
<td><?php if ($data['od_memo']) echo get_text($data['od_memo'], 1);else echo "없음";?></td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</section>
<script>
function form_submit(f)
{
if (!confirm("현재 미완료 주문을 입금완료 주문건으로 복구하시겠습니까?")) {
return false;
}
return true;
}
function del_confirm()
{
if(confirm("주문서를 삭제하시겠습니까?")) {
return true;
} else {
return false;
}
}
</script>
<?php
include_once(G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,386 @@
<?php
$sub_menu = '400410';
include_once('./_common.php');
check_demo();
if($w == 'd')
auth_check($auth[$sub_menu], "d");
else
auth_check($auth[$sub_menu], "w");
check_admin_token();
//------------------------------------------------------------------------------
// 주문서 정보
//------------------------------------------------------------------------------
$sql = " select * from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
$od = sql_fetch($sql);
if (!$od['od_id']) {
alert("해당 주문번호로 미완료 주문서가 존재하지 않습니다.");
}
if($w == 'd') {
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' ";
sql_query($sql, true);
goto_url("./inorderlist.php?$qstr");
}
// 주문정보
$data = unserialize(base64_decode($od['dt_data']));
$sql_common = " from {$g5['g5_shop_cart_table']} where od_id = '{$od['cart_id']}' and ct_status = '쇼핑' and ct_select = '1' ";
// 주문금액
$sql = " select SUM(IF(io_type = 1, io_price, (ct_price + io_price)) * ct_qty) as od_price, COUNT(distinct it_id) as cart_count $sql_common ";
$row = sql_fetch($sql);
$tot_ct_price = $row['od_price'];
$cart_count = $row['cart_count'];
$tot_od_price = $tot_ct_price;
$i_price = (int)$data['od_price'];
$i_send_cost = (int)$data['od_send_cost'];
$i_send_cost2 = (int)$data['od_send_cost2'];
$i_send_coupon = (int)$data['od_send_coupon'];
$i_temp_point = (int)$data['od_temp_point'];
// 쿠폰금액
$tot_cp_price = 0;
if($od['mb_id']) {
// 상품쿠폰
$tot_it_cp_price = $tot_od_cp_price = 0;
$it_cp_cnt = count($data['cp_id']);
$arr_it_cp_prc = array();
for($i=0; $i<$it_cp_cnt; $i++) {
$cid = $data['cp_id'][$i];
$it_id = $data['it_id'][$i];
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '$cid'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method IN ( 0, 1 ) ";
$cp = sql_fetch($sql);
if(!$cp['cp_id'])
continue;
// 사용한 쿠폰인지
if(is_used_coupon($od['mb_id'], $cp['cp_id']))
continue;
// 분류할인인지
if($cp['cp_method']) {
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
from {$g5['g5_shop_item_table']}
where it_id = '$it_id' ";
$row2 = sql_fetch($sql2);
if(!$row2['it_id'])
continue;
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
continue;
} else {
if($cp['cp_target'] != $it_id)
continue;
}
// 상품금액
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price $sql_common and it_id = '$it_id' ";
$ct = sql_fetch($sql);
$item_price = $ct['sum_price'];
if($cp['cp_minimum'] > $item_price)
continue;
$dc = 0;
if($cp['cp_type']) {
$dc = floor(($item_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($item_price < $dc)
continue;
$tot_it_cp_price += $dc;
$arr_it_cp_prc[$it_id] = $dc;
}
$tot_od_price -= $tot_it_cp_price;
// 주문쿠폰
if($data['od_cp_id']) {
$sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '{$data['od_cp_id']}'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method = '2' ";
$cp = sql_fetch($sql);
// 사용한 쿠폰인지
$cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
$dc = 0;
if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
if($cp['cp_type']) {
$dc = floor(($tot_od_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
$tot_od_cp_price = $dc;
$tot_od_price -= $tot_od_cp_price;
}
}
$tot_cp_price = $tot_it_cp_price + $tot_od_cp_price;
}
// 배송비
$od_send_cost = get_sendcost($od['cart_id']);
$tot_sc_cp_price = 0;
if($od['mb_id'] && $od_send_cost > 0) {
// 배송쿠폰
if($data['sc_cp_id']) {
$sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g5['g5_shop_coupon_table']}
where cp_id = '{$data['sc_cp_id']}'
and mb_id IN ( '{$od['mb_id']}', '전체회원' )
and cp_method = '3' ";
$cp = sql_fetch($sql);
// 사용한 쿠폰인지
$cp_used = is_used_coupon($od['mb_id'], $cp['cp_id']);
$dc = 0;
if(!$cp_used && $cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
if($cp['cp_type']) {
$dc = floor(($send_cost * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($dc > $send_cost)
$dc = $send_cost;
$tot_sc_cp_price = $dc;
}
}
}
// 추가배송비
$od_send_cost2 = (int)$data['od_send_cost2'];
// 포인트
$od_temp_point = (int)$data['od_temp_point'];
$i_price = $i_price + $i_send_cost + $i_send_cost2 - $i_temp_point - $i_send_coupon;
$order_price = $tot_od_price + $od_send_cost + $od_send_cost2 - $tot_sc_cp_price - $od_temp_point;
if ($od['mb_id']) {
$mb = get_member($od['mb_id']);
$od_pwd = $mb['mb_password'];
} else {
$od_pwd = get_encrypt_string($data['od_pwd']);
}
$od_escrow = 0;
// 복합과세 금액
$od_tax_mny = round($i_price / 1.1);
$od_vat_mny = $i_price - $od_tax_mny;
$od_free_mny = 0;
if($default['de_tax_flag_use']) {
$od_tax_mny = (int)$data['comm_tax_mny'];
$od_vat_mny = (int)$data['comm_vat_mny'];
$od_free_mny = (int)$data['comm_free_mny'];
}
$od_pg = $default['de_pg_service'];
if($data['od_settle_case'] == 'KAKAOPAY')
$od_pg = 'KAKAOPAY';
$od_email = get_email_address($data['od_email']);
$od_name = clean_xss_tags($data['od_name']);
$od_tel = clean_xss_tags($data['od_tel']);
$od_hp = clean_xss_tags($data['od_hp']);
$od_zip = preg_replace('/[^0-9]/', '', $data['od_zip']);
$od_zip1 = substr($od_zip, 0, 3);
$od_zip2 = substr($od_zip, 3);
$od_addr1 = clean_xss_tags($data['od_addr1']);
$od_addr2 = clean_xss_tags($data['od_addr2']);
$od_addr3 = clean_xss_tags($data['od_addr3']);
$od_addr_jibeon = preg_match("/^(N|R)$/", $data['od_addr_jibeon']) ? $data['od_addr_jibeon'] : '';
$od_b_name = clean_xss_tags($data['od_b_name']);
$od_b_tel = clean_xss_tags($data['od_b_tel']);
$od_b_hp = clean_xss_tags($data['od_b_hp']);
$od_b_addr1 = clean_xss_tags($data['od_b_addr1']);
$od_b_addr2 = clean_xss_tags($data['od_b_addr2']);
$od_b_addr3 = clean_xss_tags($data['od_b_addr3']);
$od_b_addr_jibeon = preg_match("/^(N|R)$/", $data['od_b_addr_jibeon']) ? $data['od_b_addr_jibeon'] : '';
$od_memo = clean_xss_tags($data['od_memo']);
$od_deposit_name = clean_xss_tags($data['od_deposit_name']);
$od_tax_flag = $default['de_tax_flag_use'];
$od_receipt_price = $tot_ct_price + $od_send_cost + $od_send_cost2 - ($od_temp_point + $tot_cp_price + $tot_sc_cp_price);
$od_receipt_point = $od_temp_point;
$od_receipt_time = $od['dt_time'];
$od_misu = 0;
$od_status = '입금';
// 주문서에 입력
$sql = " insert {$g5['g5_shop_order_table']}
set od_id = '$od_id',
mb_id = '{$od['mb_id']}',
od_pwd = '$od_pwd',
od_name = '$od_name',
od_email = '$od_email',
od_tel = '$od_tel',
od_hp = '$od_hp',
od_zip1 = '$od_zip1',
od_zip2 = '$od_zip2',
od_addr1 = '$od_addr1',
od_addr2 = '$od_addr2',
od_addr3 = '$od_addr3',
od_addr_jibeon = '$od_addr_jibeon',
od_b_name = '$od_b_name',
od_b_tel = '$od_b_tel',
od_b_hp = '$od_b_hp',
od_b_zip1 = '$od_b_zip1',
od_b_zip2 = '$od_b_zip2',
od_b_addr1 = '$od_b_addr1',
od_b_addr2 = '$od_b_addr2',
od_b_addr3 = '$od_b_addr3',
od_b_addr_jibeon = '$od_b_addr_jibeon',
od_deposit_name = '$od_deposit_name',
od_memo = '$od_memo',
od_cart_count = '$cart_count',
od_cart_price = '$tot_ct_price',
od_cart_coupon = '$tot_it_cp_price',
od_send_cost = '$od_send_cost',
od_send_coupon = '$tot_sc_cp_price',
od_send_cost2 = '$od_send_cost2',
od_coupon = '$tot_od_cp_price',
od_receipt_price = '$od_receipt_price',
od_receipt_point = '$od_receipt_point',
od_bank_account = '$od_bank_account',
od_receipt_time = '$od_receipt_time',
od_misu = '$od_misu',
od_pg = '$od_pg',
od_tno = '$od_tno',
od_app_no = '$od_app_no',
od_escrow = '$od_escrow',
od_tax_flag = '$od_tax_flag',
od_tax_mny = '$od_tax_mny',
od_vat_mny = '$od_vat_mny',
od_free_mny = '$od_free_mny',
od_status = '$od_status',
od_shop_memo = '',
od_hope_date = '{$data['od_hope_date']}',
od_time = '{$od['dt_time']}',
od_ip = '{$data['od_ip']}',
od_settle_case = '{$data['od_settle_case']}',
od_test = '{$data['od_test']}'
";
$result = sql_query($sql, true);
$sql_card_point = "";
if ($od_receipt_price > 0 && !$default['de_card_point']) {
$sql_card_point = " , ct_point = '0' ";
}
$sql = "update {$g5['g5_shop_cart_table']}
set od_id = '$od_id',
ct_status = '입금'
$sql_card_point
where od_id = '{$od['cart_id']}'
and ct_select = '1' ";
$result = sql_query($sql, true);
// 회원이면서 포인트를 사용했다면 테이블에 사용을 추가
if ($od['mb_id'] && $od_receipt_point)
insert_point($od['mb_id'], (-1) * $od_receipt_point, "주문번호 $od_id 결제");
// 쿠폰사용내역기록
if($od['mb_id']) {
$it_cp_cnt = count($data['cp_id']);
for($i=0; $i<$it_cp_cnt; $i++) {
$cid = $data['cp_id'][$i];
$cp_it_id = $data['it_id'][$i];
$cp_prc = (int)$arr_it_cp_prc[$cp_it_id];
if(trim($cid)) {
$sql = " insert into {$g5['g5_shop_coupon_log_table']}
set cp_id = '$cid',
mb_id = '{$od['mb_id']}',
od_id = '$od_id',
cp_price = '$cp_prc',
cl_datetime = '{$od['dt_time']}' ";
sql_query($sql);
}
// 쿠폰사용금액 cart에 기록
$cp_prc = (int)$arr_it_cp_prc[$cp_it_id];
$sql = " update {$g5['g5_shop_cart_table']}
set cp_price = '$cp_prc'
where od_id = '$od_id'
and it_id = '$cp_it_id'
and ct_select = '1'
order by ct_id asc
limit 1 ";
sql_query($sql);
}
if($data['od_cp_id']) {
$sql = " insert into {$g5['g5_shop_coupon_log_table']}
set cp_id = '{$data['od_cp_id']}',
mb_id = '{$od['mb_id']}',
od_id = '$od_id',
cp_price = '$tot_od_cp_price',
cl_datetime = '{$od['dt_time']}' ";
sql_query($sql);
}
if($data['sc_cp_id']) {
$sql = " insert into {$g5['g5_shop_coupon_log_table']}
set cp_id = '{$data['sc_cp_id']}',
mb_id = '{$od['mb_id']}',
od_id = '$od_id',
cp_price = '$tot_sc_cp_price',
cl_datetime = '{$od['dt_time']}' ";
sql_query($sql);
}
}
// 주문정보
$info = get_order_info($od_id);
// 미수금 정보 등 반영
$sql = " update {$g5['g5_shop_order_table']}
set od_misu = '{$info['od_misu']}',
od_tax_mny = '{$info['od_tax_mny']}',
od_vat_mny = '{$info['od_vat_mny']}',
od_free_mny = '{$info['od_free_mny']}',
od_status = '$od_status'
where od_id = '$od_id' ";
sql_query($sql);
// 임시 주문정보 삭제
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '$od_id' and dt_pg = '$od_pg' ";
sql_query($sql, true);
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8">'.PHP_EOL;
echo '<script>'.PHP_EOL;
echo 'if(confirm("복구하신 주문 상세페이지로 이동하시겠습니까?"))'.PHP_EOL;
echo 'document.location.href = "./orderform.php?od_id='.$od_id.'";'.PHP_EOL;
echo 'else'.PHP_EOL;
echo 'document.location.href = "./inorderlist.php?'.str_replace('&amp;', '&', $qstr).'";'.PHP_EOL;
echo '</script>'.PHP_EOL;
?>

View File

@ -0,0 +1,176 @@
<?php
$sub_menu = '400410';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$sql_common = " from {$g5['g5_shop_order_data_table']} ";
$sql_search = " where cart_id <> '0' ";
if ($stx) {
$sql_search .= " and ( ";
switch ($sfl) {
case 'od_id' :
$sql_search .= " ({$sfl} = '{$stx}') ";
break;
default :
$sql_search .= " ({$sfl} like '%{$stx}%') ";
break;
}
$sql_search .= " ) ";
}
if (!$sst) {
$sst = "od_id";
$sod = "desc";
}
$sql_order = " order by {$sst} {$sod} ";
$sql = " select count(*) as cnt
{$sql_common}
{$sql_search}
{$sql_order} ";
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
{$sql_common}
{$sql_search}
{$sql_order}
limit {$from_record}, {$rows} ";
$result = sql_query($sql);
$g5['title'] = '미완료주문';
include_once (G5_ADMIN_PATH.'/admin.head.php');
$colspan = 10;
?>
<div class="local_ov01 local_ov">
전체 <?php echo number_format($total_count) ?> 건
</div>
<form name="fsearch" id="fsearch" class="local_sch01 local_sch" method="get">
<select name="sfl" title="검색대상">
<option value="od_id"<?php echo get_selected($_GET['sfl'], "od_id"); ?>>주문번호</option>
</select>
<label for="stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="stx" value="<?php echo $stx ?>" id="stx" required class="required frm_input">
<input type="submit" class="btn_submit" value="검색">
</form>
<form name="finorderlist" id="finorderlist" method="post" action="./inorderlistdelete.php" onsubmit="return finorderlist_submit(this);">
<input type="hidden" name="sst" value="<?php echo $sst; ?>">
<input type="hidden" name="sod" value="<?php echo $sod; ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl; ?>">
<input type="hidden" name="stx" value="<?php echo $stx; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="token" value="">
<div class="tbl_head01 tbl_wrap" id="inorderlist">
<table>
<caption><?php echo $g5['title']; ?> 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">미완료주문 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col"><?php echo subject_sort_link('od_id') ?>주문번호</a></th>
<th scope="col">PG</th>
<th scope="col">주문자</th>
<th scope="col">주문자전화</th>
<th scope="col">받는분</a></th>
<th scope="col">주문금액</a></th>
<th scope="col">결제방법</th>
<th scope="col">주문일시</th>
<th scope="col">관리</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
$data = unserialize(base64_decode($row['dt_data']));
switch($row['dt_pg']) {
case 'inicis':
$pg = 'KG이니시스';
break;
case 'lg':
$pg = 'LGU+';
break;
default:
$pg = 'KCP';
break;
}
// 주문금액
$sql = " select sum(if(io_type = '1', io_price, (ct_price + io_price)) * ct_qty) as price from {$g5['g5_shop_cart_table']} where od_id = '{$row['cart_id']}' and ct_status = '쇼핑' and ct_select = '1' ";
$ct = sql_fetch($sql);
$bg = 'bg'.($i%2);
?>
<tr class="<?php echo $bg; ?>">
<td class="td_chk">
<input type="hidden" id="od_id_<?php echo $i; ?>" name="od_id[<?php echo $i; ?>]" value="<?php echo $row['od_id']; ?>">
<input type="checkbox" id="chk_<?php echo $i; ?>" name="chk[]" value="<?php echo $i; ?>" title="내역선택">
</td>
<td class="td_odrnum2"><?php echo $row['od_id']; ?></td>
<td class="td_center"><?php echo $pg; ?></td>
<td class="td_name"><?php echo get_text($data['od_name']); ?></td>
<td class="td_center"><?php echo get_text($data['od_tel']); ?></td>
<td class="td_name"><?php echo get_text($data['od_b_name']); ?></td>
<td class="td_price"><?php echo number_format($ct['price']); ?></td>
<td class="td_center"><?php echo $data['od_settle_case']; ?></td>
<td class="td_time"><?php echo $row['dt_time']; ?></td>
<td class="td_mngsmall">
<a href="./inorderform.php?od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr; ?>"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
<a href="./inorderformupdate.php?w=d&amp;od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr; ?>" onclick="return delete_confirm(this);"><span class="sound_only"><?php echo $row['od_id']; ?> </span>삭제</a>
</td>
</tr>
<?php
}
if ($i == 0)
echo '<tr><td colspan="'.$colspan.'" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
<div class="btn_list01 btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
<?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<script>
function finorderlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,25 @@
<?php
$sub_menu = '400410';
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
$count = count($_POST['chk']);
if(!$count)
alert('선택삭제 하실 항목을 하나이상 선택해 주세요.');
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = " delete from {$g5['g5_shop_order_data_table']} where od_id = '{$_POST['od_id'][$k]}' ";
sql_query($sql);
}
goto_url('./inorderlist.php');
?>

View File

@ -670,6 +670,8 @@ CREATE TABLE IF NOT EXISTS `g5_shop_order_address` (
DROP TABLE IF EXISTS `g5_shop_order_data`;
CREATE TABLE IF NOT EXISTS `g5_shop_order_data` (
`od_id` bigint(20) unsigned NOT NULL,
`cart_id` bigint(20) unsigned NOT NULL,
`mb_id` varchar(20) NOT NULL DEFAULT '',
`dt_pg` varchar(255) NOT NULL DEFAULT '',
`dt_data` text NOT NULL,
`dt_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',

View File

@ -2200,13 +2200,13 @@ function cart_item_clean()
}
// 모바일 PG 주문 필드 생성
// 임시주문 데이터로 주문 필드 생성
function make_order_field($data, $exclude)
{
$field = '';
foreach($data as $key=>$value) {
if(in_array($key, $exclude))
if(!empty($exclude) && in_array($key, $exclude))
continue;
if(is_array($value)) {
@ -2220,7 +2220,6 @@ function make_order_field($data, $exclude)
return $field;
}
//==============================================================================
// 쇼핑몰 라이브러리 모음 끝
//==============================================================================

View File

@ -94,6 +94,13 @@ if(!sql_query(" select od_test from {$g5['g5_shop_order_table']} limit 1 ", fals
ADD `od_test` tinyint(4) NOT NULL DEFAULT '0' AFTER `od_settle_case` ", true);
}
// 주문정보 임시저장 테이블에 장바구니 ID 필드 추가
if(!sql_query(" select cart_id from {$g5['g5_shop_order_data_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_order_data_table']}`
ADD `cart_id` bigint(20) unsigned NOT NULL AFTER `od_id`,
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `cart_id` ", true);
}
echo '<p>테이블 업그레이드 완료!</p>';
include_once(G5_PATH.'/tail.sub.php');

View File

@ -4,17 +4,29 @@ include_once('./_common.php');
if(empty($_POST))
die('정보가 넘어오지 않았습니다.');
if(isset($_POST['pp_id']) && $_POST['pp_id'])
$od_id = get_session('ss_personalpay_id');
else
$od_id = get_session('ss_order_id');
// 일정 기간이 경과된 임시 데이터 삭제
/*
$limit_time = date("Y-m-d H:i:s", (G5_SERVER_TIME - 86400 * 1));
$sql = " delete from {$g5['g5_shop_order_data_table']} where dt_time < '$limit_time' ";
$sql = " delete from {$g5['g5_shop_order_data_table']} where dt_type = '1' and dt_time < '$limit_time' ";
sql_query($sql);
*/
$_POST['sw_direct'] = get_session('ss_direct');
if(isset($_POST['pp_id']) && $_POST['pp_id']) {
$od_id = get_session('ss_personalpay_id');
$cart_id = 0;
} else {
$od_id = get_session('ss_order_id');
$_POST['sw_direct'] = get_session('ss_direct');
$_POST['od_test'] = $default['de_card_test'];
$_POST['od_ip'] = $_SERVER['REMOTE_ADDR'];
if ($_POST['sw_direct']) {
$cart_id = get_session('ss_cart_direct');
}
else {
$cart_id = get_session('ss_cart_id');
}
}
$dt_data = base64_encode(serialize($_POST));
@ -26,6 +38,8 @@ if($row['cnt'])
$sql = " insert into {$g5['g5_shop_order_data_table']}
set od_id = '$od_id',
cart_id = '$cart_id',
mb_id = '{$member['mb_id']}',
dt_pg = '{$default['de_pg_service']}',
dt_data = '$dt_data',
dt_time = '".G5_TIME_YMDHIS."' ";