Merge branch 'master' of github.com:gnuboard/yc5
This commit is contained in:
@ -27,14 +27,15 @@ if ($search != "") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql_search .= " $where od_status = '배송' ";
|
||||||
|
|
||||||
if ($sel_ca_id != "") {
|
if ($sel_ca_id != "") {
|
||||||
$sql_search .= " $where ca_id like '$sel_ca_id%' ";
|
$sql_search .= " $where ca_id like '$sel_ca_id%' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sel_field == "") $sel_field = "od_id";
|
if ($sel_field == "") $sel_field = "od_id";
|
||||||
|
|
||||||
$sql_common = " from {$g5['g5_shop_order_table']}
|
$sql_common = " from {$g5['g5_shop_order_table']} $sql_search ";
|
||||||
$sql_search ";
|
|
||||||
|
|
||||||
// 테이블의 전체 레코드수만 얻음
|
// 테이블의 전체 레코드수만 얻음
|
||||||
if ($chk_misu) {
|
if ($chk_misu) {
|
||||||
@ -119,7 +120,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
<li><a href="<?php echo title_sort("od_invoice", 1) . "&$qstr1"; ?>">운송장번호<span class="sound_only"> 순 정렬</span></a></li>
|
<li><a href="<?php echo title_sort("od_invoice", 1) . "&$qstr1"; ?>">운송장번호<span class="sound_only"> 순 정렬</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form name="fdeliverylistupate" method="post" action="./deliverylistupdate.php" autocomplete="off">
|
<form name="fdeliverylist" method="post" onsubmit="return fdeliverylist_submit(this);" autocomplete="off">
|
||||||
<input type="hidden" name="sel_ca_id" value="<?php echo $sel_ca_id; ?>">
|
<input type="hidden" name="sel_ca_id" value="<?php echo $sel_ca_id; ?>">
|
||||||
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
<input type="hidden" name="sel_field" value="<?php echo $sel_field; ?>">
|
||||||
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
<input type="hidden" name="search" value="<?php echo $search; ?>">
|
||||||
@ -130,6 +131,10 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
<table id="sdeli_proc">
|
<table id="sdeli_proc">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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">주문번호</th>
|
<th scope="col">주문번호</th>
|
||||||
<th scope="col">주문자</th>
|
<th scope="col">주문자</th>
|
||||||
<th scope="col">주문액</th>
|
<th scope="col">주문액</th>
|
||||||
@ -143,8 +148,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php
|
<?php
|
||||||
$sql = " select *
|
$sql = " select * $sql_common ";
|
||||||
$sql_common ";
|
|
||||||
if ($chk_misu)
|
if ($chk_misu)
|
||||||
$sql .= " where od_misu <= 0 ";
|
$sql .= " where od_misu <= 0 ";
|
||||||
$sql .= " order by $sort1 $sort2
|
$sql .= " order by $sort1 $sort2
|
||||||
@ -167,7 +171,12 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" name="od_id[<?php echo $i; ?>]" value="<?php echo $row['od_id']; ?>">
|
<input type="hidden" name="od_id[<?php echo $i ?>]" value="<?php echo $row['od_id'] ?>" id="od_id_<?php echo $i ?>">
|
||||||
|
<label for="chk_<?php echo $i; ?>" class="sound_only">주문번호 <?php echo $row['od_id']; ?></label>
|
||||||
|
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<!-- <input type="hidden" name="od_id[<?php echo $i; ?>]" value="<?php echo $row['od_id']; ?>"> -->
|
||||||
<input type="hidden" name="od_tno[<?php echo $i; ?>]" value="<?php echo $row['od_tno']; ?>">
|
<input type="hidden" name="od_tno[<?php echo $i; ?>]" value="<?php echo $row['od_tno']; ?>">
|
||||||
<input type="hidden" name="od_escrow[<?php echo $i; ?>]" value="<?php echo $row['od_escrow']; ?>">
|
<input type="hidden" name="od_escrow[<?php echo $i; ?>]" value="<?php echo $row['od_escrow']; ?>">
|
||||||
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a>
|
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a>
|
||||||
@ -209,7 +218,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="btn_confirm">
|
<div class="btn_confirm">
|
||||||
<input type="submit" value="일괄수정" class="btn_submit" accesskey="s">
|
<input type="submit" value="선택수정" class="btn_submit" onclick="document.pressed=this.value">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@ -218,6 +227,20 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
|
|
||||||
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&page="); ?>
|
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&page="); ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function fdeliverylist_submit(f)
|
||||||
|
{
|
||||||
|
if (!is_checked("chk[]")) {
|
||||||
|
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
f.action = "./deliverylistupdate.php";
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
include_once (G5_ADMIN_PATH.'/admin.tail.php');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -220,7 +220,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form name="forderlist" id="forderlist" action="./orderlistupdate.php" onsubmit="return forderlist_submit(this);" method="post">
|
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post">
|
||||||
|
|
||||||
<table id="sodr_list">
|
<table id="sodr_list">
|
||||||
<thead>
|
<thead>
|
||||||
@ -345,10 +345,19 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
|
|||||||
<option value="">선택하세요</option>
|
<option value="">선택하세요</option>
|
||||||
<option value="주문">주문</option>
|
<option value="주문">주문</option>
|
||||||
<option value="입금">입금</option>
|
<option value="입금">입금</option>
|
||||||
|
<option value="준비">준비</option>
|
||||||
<option value="배송">배송</option>
|
<option value="배송">배송</option>
|
||||||
<option value="완료">완료</option>
|
<option value="완료">완료</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<input type="hidden" name="od_settle_case" value="<?php echo $_GET['od_settle_case']; ?>">
|
||||||
|
<input type="hidden" name="od_misu" value="<?php echo $_GET['od_misu']; ?>">
|
||||||
|
<input type="hidden" name="od_cancel_price" value="<?php echo $_GET['od_cancel_price']; ?>">
|
||||||
|
<input type="hidden" name="od_receipt_price" value="<?php echo $_GET['od_receipt_price']; ?>">
|
||||||
|
<input type="hidden" name="od_receipt_point" value="<?php echo $_GET['od_receipt_point']; ?>">
|
||||||
|
<input type="hidden" name="od_receipt_coupon" value="<?php echo $_GET['od_receipt_coupon']; ?>">
|
||||||
|
<input type="hidden" name="page" value="<?php echo $_GET['page']; ?>">
|
||||||
|
|
||||||
<input type="submit" value="선택수정" onclick="document.pressed=this.value">
|
<input type="submit" value="선택수정" onclick="document.pressed=this.value">
|
||||||
|
|
||||||
<p>"무통장"인 경우에만 "주문"에서 "입금"으로 변경됩니다. 가상계좌는 입금시 자동으로 "입금" 처리됩니다.</p>
|
<p>"무통장"인 경우에만 "주문"에서 "입금"으로 변경됩니다. 가상계좌는 입금시 자동으로 "입금" 처리됩니다.</p>
|
||||||
@ -415,6 +424,8 @@ function forderlist_submit(f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f.action = "./orderlistupdate.php";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -2,35 +2,169 @@
|
|||||||
$sub_menu = '400400';
|
$sub_menu = '400400';
|
||||||
include_once('./_common.php');
|
include_once('./_common.php');
|
||||||
|
|
||||||
// 주문상태변경 처리
|
|
||||||
function change_order_status($od_status1, $od_status2, $od)
|
// 상품옵션별재고 또는 상품재고에 더하기
|
||||||
|
function add_io_stock($it_id, $ct_qty, $io_id="", $io_type="")
|
||||||
{
|
{
|
||||||
global $g5;
|
global $g5;
|
||||||
|
|
||||||
// 원래 주문상태와 바뀔 주문상태가 같다면 처리하지 않음
|
if($io_id) {
|
||||||
if ($od_status1 == $od_status2) return '';
|
$sql = " update {$g5['g5_shop_item_option_table']}
|
||||||
|
set io_stock_qty = io_stock_qty + '{$ct_qty}'
|
||||||
$od_id = $od['od_id'];
|
where it_id = '{$it_id}'
|
||||||
|
and io_id = '{$io_id}'
|
||||||
if ($od_status1 == '주문') {
|
and io_type = '{$io_type}' ";
|
||||||
if ($od_status2 == '입금') {
|
} else {
|
||||||
if ($od['od_settle_case'] != '무통장') return '';
|
$sql = " update {$g5['g5_shop_item_table']}
|
||||||
$sql = " update {$g5['g5_shop_order_table']}
|
set it_stock_qty = it_stock_qty + '{$ct_qty}'
|
||||||
set od_status = '입금',
|
where it_id = '{$it_id}' ";
|
||||||
od_receipt_price = od_misu,
|
|
||||||
od_misu = 0
|
|
||||||
where od_id = '$od_id' ";
|
|
||||||
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);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_r2($_POST);
|
|
||||||
|
// 상품옵션별재고 또는 상품재고에서 빼기
|
||||||
|
function subtract_io_stock($it_id, $ct_qty, $io_id="", $io_type="")
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
if($io_id) {
|
||||||
|
$sql = " update {$g5['g5_shop_item_option_table']}
|
||||||
|
set io_stock_qty = io_stock_qty - '{$ct_qty}'
|
||||||
|
where it_id = '{$it_id}'
|
||||||
|
and io_id = '{$io_id}'
|
||||||
|
and io_type = '{$io_type}' ";
|
||||||
|
} else {
|
||||||
|
$sql = " update {$g5['g5_shop_item_table']}
|
||||||
|
set it_stock_qty = it_stock_qty - '{$ct_qty}'
|
||||||
|
where it_id = '{$it_id}' ";
|
||||||
|
}
|
||||||
|
return sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 주문과 장바구니의 상태를 변경한다.
|
||||||
|
function change_status($od_id, $current_status, $change_status)
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
$sql = " update {$g5['g5_shop_order_table']} set od_status = '{$change_status}' where od_id = '{$od_id}' and od_status = '{$current_status}' ";
|
||||||
|
sql_query($sql, true);
|
||||||
|
|
||||||
|
$sql = " update {$g5['g5_shop_cart_table']} set ct_status = '{$change_status}' where od_id = '{$od_id}' and ct_status = '{$current_status}' ";
|
||||||
|
sql_query($sql, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//print_r2($_POST);
|
||||||
|
|
||||||
|
// 주문상태변경 처리
|
||||||
|
function change_order_status($current_staus, $change_status, $od)
|
||||||
|
{
|
||||||
|
global $g5;
|
||||||
|
|
||||||
|
// 현재 주문상태와 바뀔 주문상태가 같다면 처리하지 않음
|
||||||
|
if ($current_staus == $change_status) return;
|
||||||
|
|
||||||
|
$od = sql_fetch(" select od_settle_case from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
||||||
|
if (!$od) return;
|
||||||
|
|
||||||
|
switch ($current_staus)
|
||||||
|
{
|
||||||
|
case '주문' :
|
||||||
|
|
||||||
|
if ($change_status != '입금') return;
|
||||||
|
if ($od['od_settle_case'] != '무통장') return;
|
||||||
|
|
||||||
|
$sql = " update {$g5['g5_shop_order_table']}
|
||||||
|
set od_receipt_price = od_misu,
|
||||||
|
od_misu = 0,
|
||||||
|
od_receipt_time = '".G5_TIME_YMDHIS."'
|
||||||
|
where od_id = '$od_id' and od_status = '주문' ";
|
||||||
|
sql_query($sql, true);
|
||||||
|
|
||||||
|
change_status($od_id, '주문', '입금');
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '입금' :
|
||||||
|
|
||||||
|
if ($change_status != '준비') return;
|
||||||
|
|
||||||
|
change_status($od_id, '입금', '준비');
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '준비' :
|
||||||
|
|
||||||
|
if ($change_status != '배송') return;
|
||||||
|
|
||||||
|
change_status($od_id, '준비', '배송');
|
||||||
|
|
||||||
|
$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;
|
||||||
|
// 재고에 다시 더한다.
|
||||||
|
add_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 재고 오류로 인한 수정
|
||||||
|
if ($ct_status == '배송' || $ct_status == '완료')
|
||||||
|
{
|
||||||
|
$stock_use = 1;
|
||||||
|
// 재고에서 뺀다.
|
||||||
|
subtract_io_stock($row['it_id'], $row['ct_qty'], $row['io_id'], $row['io_type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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;
|
||||||
|
|
||||||
|
case '배송' :
|
||||||
|
|
||||||
|
if ($change_status != '완료') return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 주문정보
|
||||||
|
$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<count($_POST['chk']); $i++)
|
for ($i=0; $i<count($_POST['chk']); $i++)
|
||||||
{
|
{
|
||||||
@ -38,10 +172,22 @@ for ($i=0; $i<count($_POST['chk']); $i++)
|
|||||||
$k = $_POST['chk'][$i];
|
$k = $_POST['chk'][$i];
|
||||||
|
|
||||||
$od_id = $_POST['od_id'][$k];
|
$od_id = $_POST['od_id'][$k];
|
||||||
$od = sql_fetch(" select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ");
|
|
||||||
|
change_order_status($od['od_status'], $_POST['od_status'], $od_id);
|
||||||
change_order_status($od['od_status'], $_POST['od_status'], $od);
|
|
||||||
|
|
||||||
|
|
||||||
echo $od_id . "<br>";
|
echo $od_id . "<br>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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");
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user