- 정보공유
[영카트팁] 무통장입금확인 후 주문목록에서 바로 입금완료처리 기능 추가하기
주문목록 적당한곳에 추가.
<?php if ($s_receipt_way == '무통장' && $row['od_misu'] > 0) {?>
<div><button type="button" class="btn_frmline" onclick="receipt_bank('<?php echo $row['od_id'];?>');">입금완료처리</button></div>
<?php } ?>
javascript
<script type="text/javascript">
function receipt_bank(od_id) {
if (!confirm("바로 입금처리하시겠습니까?")) {
return;
}
var token = get_ajax_token();
$.ajax({
url: "./orderlistreceiptupdate.php",
type: "POST",
data: {
"token": token,
"od_id": od_id
},
dataType: "json",
async: false,
cache: false,
success: function(req) {
var rescd = req.rescd;
var restx = req.restx;
alert(restx);
location.reload();
}
});
}
</script>
orderlistreceiptupdate.php
<?php
$sub_menu = '400400';
include_once('./_common.php');
include_once('./admin.shop.lib.php');
include_once(G5_LIB_PATH.'/mailer.lib.php');
auth_check($auth[$sub_menu], "w");
check_admin_token();
$sql = " select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
$od = sql_fetch($sql);
if(!$od['od_id'])
die('{"rescd":"98","restx":"주문자료가 존재하지 않습니다."}');
$od_receipt_price = $od['od_misu'];
$od_receipt_time = G5_TIME_YMDHIS;
$od_hp = $od['od_hp'];
$od_name = $od['od_name'];
$od_deposit_name = $od['od_deposit_name'];
$od_bank_account = $od['od_bank_account'];
// 결제정보 반영
$sql = " update {$g5['g5_shop_order_table']}
set od_receipt_price = '{$od_receipt_price}',
od_receipt_time = '{$od_receipt_time}'
where od_id = '$od_id' ";
sql_query($sql);
// 주문정보
$info = get_order_info($od_id);
if(!$info)
die('{"rescd":"99","restx":"주문자료가 존재하지 않습니다."}');
$od_status = '입금';
$od_misu = 0;
// 미수금 정보 등 반영
$sql = " update {$g5['g5_shop_order_table']}
set od_misu = '$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 = " update {$g5['g5_shop_cart_table']}
set ct_status = '$od_status'
where od_id = '$od_id' and ct_status = '주문' ";
sql_query($sql);
// 메일발송
define("_ORDERMAIL_", true);
include "./ordermail.inc.php";
// SMS 문자전송
define("_ORDERSMS_", true);
include "./ordersms.inc.php";
die('{"rescd":"00","restx":"처리가 완료되었습니다."}');