<?php
$sub_menu = '400450';
include_once('./_common.php');

auth_check($auth[$sub_menu], 'd');

check_admin_token();

$rtid = $_POST['rtSid'];
$odid = str_replace('-','',$_POST['odSid']);
$ordCK = $_POST['ordCK'];

if(!$rtid) alert('등록 하실 항목을 선택해 주세요.');

$sql = "select od_id from {$g5['g5_shop_order_table']} where od_settle_case='무통장' and od_id='{$odid}'";
$row = sql_fetch($sql);
$ppid = $row['od_id'];

if(!$ppid) alert('등록되지 않은 주문번호입니다.');

$sql = "update sp_rtpay set od_id='{$odid}',bstate=1 where rt_id = '{$rtid}' ";
sql_query($sql);

if ($ordCK>0) {
	$sql = "update {$g5['g5_shop_order_table']} set od_receipt_price=od_receipt_price+od_misu,od_misu=0,od_receipt_time=now(),od_status='입금' where od_id = '{$odid}' ";
	sql_query($sql);
}

goto_url('./rtpaylist.php');
?>