From 3483b48d9a71a4a06a1733110962244e67a3573f Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 7 Oct 2013 17:23:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A3=BC=EB=AC=B8=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/shop_admin/orderlist.php | 9 ++ adm/shop_admin/orderlistupdate.php | 167 +++++++++++++++++++++++++---- 2 files changed, 158 insertions(+), 18 deletions(-) diff --git a/adm/shop_admin/orderlist.php b/adm/shop_admin/orderlist.php index c22809014..c2c520029 100644 --- a/adm/shop_admin/orderlist.php +++ b/adm/shop_admin/orderlist.php @@ -345,10 +345,19 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌 + + + + + + + + +

"무통장"인 경우에만 "주문"에서 "입금"으로 변경됩니다. 가상계좌는 입금시 자동으로 "입금" 처리됩니다.

diff --git a/adm/shop_admin/orderlistupdate.php b/adm/shop_admin/orderlistupdate.php index 31a5017fc..369a7cd2b 100644 --- a/adm/shop_admin/orderlistupdate.php +++ b/adm/shop_admin/orderlistupdate.php @@ -2,35 +2,154 @@ $sub_menu = '400400'; include_once('./_common.php'); +//print_r2($_POST); + // 주문상태변경 처리 function change_order_status($od_status1, $od_status2, $od) { global $g5; // 원래 주문상태와 바뀔 주문상태가 같다면 처리하지 않음 - if ($od_status1 == $od_status2) return ''; + if ($od_status1 == $od_status2) return; - $od_id = $od['od_id']; + $od = sql_fetch(" select od_settle_case from {$g5['g5_shop_order_table']} where od_id = '$od_id' "); + if (!$od) return; + + switch ($od_status1) + { + case '주문' : + + if ($od_status2 != '입금') return; + if ($od['od_settle_case'] != '무통장') return; - if ($od_status1 == '주문') { - if ($od_status2 == '입금') { - if ($od['od_settle_case'] != '무통장') return ''; $sql = " update {$g5['g5_shop_order_table']} set od_status = '입금', od_receipt_price = od_misu, - od_misu = 0 - where od_id = '$od_id' "; + od_misu = 0, + od_receipt_time = '".G5_TIME_YMDHIS."' + where od_id = '$od_id' and od_status = '주문' "; sql_query($sql, true); - /* - $sql = " update {$g5['g5_shop_cart_table']} set ct_status = '결제완료' where od_id = '$od_id' and ct_status not in ('취소', '반품', '품절') "; - sql_query($sql); - */ - } - } -} + $sql = " update {$g5['g5_shop_cart_table']} + set ct_status = '입금' + where od_id = '$od_id' and ct_status = '주문' "; + sql_query($sql, true); -print_r2($_POST); + break; + + case '입금' : + + if ($od_status2 != '준비') return; + + $sql = " update {$g5['g5_shop_order_table']} + set od_status = '준비' + where od_id = '$od_id' and od_status = '입금' "; + sql_query($sql, true); + + $sql = " update {$g5['g5_shop_cart_table']} + set ct_status = '준비' + where od_id = '$od_id' and ct_status = '입금' "; + sql_query($sql, true); + + break; + + case '준비' : + + if ($od_status2 != '배송') return; + + $sql = " update {$g5['g5_shop_order_table']} + set od_status = '배송' + where od_id = '$od_id' and od_status = '준비' "; + sql_query($sql, true); + + $sql = " update {$g5['g5_shop_cart_table']} + set ct_status = '배송' + where od_id = '$od_id' and ct_status = '준비' "; + sql_query($sql, true); + + $sql = " select * from {$g5['g5_shop_cart_table']} where od_id = '$od_id' "; + $result = sql_query($sql); + for ($i=0; $row=sql_fetch_array($result); $i++) { + // 재고를 이미 사용했다면 (재고에서 이미 뺐다면) + $stock_use = $row['ct_stock_use']; + if ($row['ct_stock_use']) + { + if ($ct_status == '주문' || $ct_status == '취소' || $ct_status == '반품' || $ct_status == '품절') + { + $stock_use = 0; + // 재고에 다시 더한다. + if($row['io_id']) { + $sql = " update {$g5['g5_shop_item_option_table']} + set io_stock_qty = io_stock_qty + '{$row['ct_qty']}' + where it_id = '{$row['it_id']}' + and io_id = '{$row['io_id']}' + and io_type = '{$row['io_type']}' "; + } else { + $sql = " update {$g5['g5_shop_item_table']} + set it_stock_qty = it_stock_qty + '{$row['ct_qty']}' + where it_id = '{$row['it_id']}' "; + } + + sql_query($sql); + } + } + else + { + // 재고 오류로 인한 수정 + if ($ct_status == '배송' || $ct_status == '완료') + { + $stock_use = 1; + // 재고에서 뺀다. + if($row['io_id']) { + $sql = " update {$g5['g5_shop_item_option_table']} + set io_stock_qty = io_stock_qty - '{$row['ct_qty']}' + where it_id = '{$row['it_id']}' + and io_id = '{$row['io_id']}' + and io_type = '{$row['io_type']}' "; + } else { + $sql = " update {$g5['g5_shop_item_table']} + set it_stock_qty = it_stock_qty - '{$row['ct_qty']}' + where it_id = '{$row['it_id']}' "; + } + + sql_query($sql); + } + } + + $point_use = $row['ct_point_use']; + // 회원이면서 포인트가 0보다 크면 + // 이미 포인트를 부여했다면 뺀다. + if ($od['mb_id'] && $row['ct_point'] && $row['ct_point_use']) + { + $point_use = 0; + delete_point($od['mb_id'], "@delivery", $od['mb_id'], "$od_id,{$row['ct_id']}"); + } + + $sql = " update {$g5['g5_shop_cart_table']} + set ct_point_use = '$point_use', + ct_stock_use = '$stock_use', + ct_status = '$ct_status', + ct_history = CONCAT(ct_history,'$ct_history') + where od_id = '$row['od_id']' "; + sql_query($sql); + } + + break; + } + + // 주문정보 + $info = get_order_info($od_id); + if(!$info) continue; + + $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_send_cost = '{$info['od_send_cost']}' + where od_id = '$od_id' "; + sql_query($sql, true); +} for ($i=0; $i"; } + +$qstr = "sort1=$sort1&sort2=$sort2&sel_field=$sel_field&search=$search"; +$qstr .= "&od_status=$od_status"; +$qstr .= "&od_settle_case=$od_settle_case"; +$qstr .= "&od_misu=$od_misu"; +$qstr .= "&od_cancel_price=$od_cancel_price"; +$qstr .= "&od_receipt_price=$od_receipt_price"; +$qstr .= "&od_receipt_point=$od_receipt_point"; +$qstr .= "&od_receipt_coupon=$od_receipt_coupon"; +//$qstr .= "&page=$page"; + +goto_url("./orderlist.php?$qstr"); +?> \ No newline at end of file