orderinquiryview에 할인액(포인트)이 표시되지않습니다
본문
현재 사이트는 포인트를 할인 금액으로 잡고 활용하고 있습니다. 헌데 주문서를 출력할때 포인트를 얼마만치 활용했는지 0원으로만 나옵니다. 원래는 이 금액이 적용되지 않아서 문서를 약간 수정해서 보이는 것에 계산이 되어 보이게는 한번 바꿔보았는데요. 저 부분은 계속 할인액부분이 보여지지 않습니다.
어디에서 잘못되었는지 알 수 있을까요? 아래는 해당문서 전문입니다.
<?php
include_once('./_common.php');
if (G5_IS_MOBILE) {
include_once(G5_MSHOP_PATH.'/orderinquiryview2.php');
return;
}
// 불법접속을 할 수 없도록 세션에 아무값이나 저장하여 hidden 으로 넘겨서 다음 페이지에서 비교함
$token = md5(uniqid(rand(), true));
set_session("ss_token", $token);
if (!$is_member) {
if (get_session('ss_orderview_uid') != $_GET['uid'])
alert("직접 링크로는 주문서 조회가 불가합니다.\\n\\n주문조회 화면을 통하여 조회하시기 바랍니다.", G5_SHOP_URL);
}
$sql = "select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
if($is_member && !$is_admin)
$sql .= " and mb_id = '{$member['mb_id']}' ";
$od = sql_fetch($sql);
if (!$od['od_id'] || (!$is_member && md5($od['od_id'].$od['od_time'].$od['od_ip']) != get_session('ss_orderview_uid'))) {
alert("조회하실 주문서가 없습니다.", G5_SHOP_URL);
}
// 결제방법
$settle_case = $od['od_settle_case'];
$g5['title'] = '주문상세내역';
include_once('./_head.php');
// LG 현금영수증 JS
if($od['od_pg'] == 'lg') {
if($default['de_card_test']) {
echo '<script language="JavaScript" src="'.PHP_EOL">http://pgweb.uplus.co.kr:7085/WEB_SERVER/js/receipt_link.js"></script>'.PHP_EOL;
} else {
echo '<script language="JavaScript" src="'.PHP_EOL">http://pgweb.uplus.co.kr/WEB_SERVER/js/receipt_link.js"></script>'.PHP_EOL;
}
}
?>
<!--인쇄스크립트 시작-->
<script language="JavaScript">
var initBody
function beforePrint(){
initBody = document.body.innerHTML;
document.body.innerHTML = idPrint.innerHTML;
}
function afterPrint(){
document.body.innerHTML = initBody;
}
function printArea() {
window.print();
}
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint;
function printArea1(){
if (flag == false){
initBody = document.body.innerHTML;
document.body.innerHTML = idPrint1.innerHTML;
flag = true;
} else {
document.body.innerHTML = initBody;
flag = false;
}
}
</script>
<!--인쇄 스크립트 끝-->
<input type=button border=0 align=absmiddle value="출력하기" onclick="printArea();">
<div id="idPrint"> <!-- //프린트출력 -->
<!-- 주문상세내역 시작 { -->
<div id="sod_fin">
<div id="sod_fin_no">주문번호 <strong><?php echo $od_id; ?></strong></div>
<section id="sod_fin_list">
<h2>주문하신 상품</h2>
<?php
$st_count1 = $st_count2 = 0;
$custom_cancel = false;
$sql = " select it_id, it_name, ct_send_cost, it_sc_type
from {$g5['g5_shop_cart_table']}
where od_id = '$od_id'
group by it_id
order by ct_id ";
$result = sql_query($sql);
?>
<div class="tbl_head02 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col" rowspan="2">이미지</th>
<th scope="col" colspan="7" id="th_itname">상품명</th>
</tr>
<tr>
<th scope="col" id="th_itopt">옵션명</th>
<th scope="col" id="th_itqty">수량</th>
<th scope="col" id="th_itprice">판매가</th>
<th scope="col" id="th_itsum">소계</th>
<th scope="col" id="th_itpt">할인액</th>
<th scope="col" id="th_itpt">배송비</th>
<th scope="col" id="th_itst">상태</th>
</tr>
</thead>
<tbody>
<?php
for($i=0; $row=sql_fetch_array($result); $i++) {
$image = get_it_image($row['it_id'], 70, 70);
$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, ct_msg, ct_file, c_opt
from {$g5['g5_shop_cart_table']}
where od_id = '$od_id'
and it_id = '{$row['it_id']}'
order by io_type asc, ct_id asc ";
$res = sql_query($sql);
$rowspan = mysql_num_rows($res) + 1;
// 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_qty) as qty
from {$g5['g5_shop_cart_table']}
where it_id = '{$row['it_id']}'
and od_id = '$od_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_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'];
$sell_price = $opt_price * $opt['ct_qty'];
$point = $opt['ct_point'] * $opt['ct_qty'];
if($k == 0) {
?>
<tr>
<td rowspan="<?php echo $rowspan; ?>" class="td_imgsmall"><?php echo $image; ?></td>
<td headers="th_itname" colspan="7"><a href="./item.php?it_id=<?php echo $row['it_id']; ?>"><?php echo $row['it_name']; ?></a></td>
</tr>
<?php } ?>
<tr>
<td headers="th_itopt"><?php echo $opt['ct_option']; ?></td>
<td headers="th_itqty" class="td_mngsmall"><?php echo number_format($opt['ct_qty']); ?></td>
<td headers="th_itprice" class="td_numbig"><?php echo number_format($opt_price); ?></td>
<td headers="th_itsum" class="td_numbig"><?php echo number_format($sell_price); ?></td>
<td headers="th_itpt" class="td_num"><?php echo number_format($od_receipt_point); ?></td>
<td headers="th_itpt" class="td_dvr"><?php echo $ct_send_cost; ?></td>
<td headers="th_itst" class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
</tr>
<?php
$tot_point += $point;
$st_count1++;
if($opt['ct_status'] == '주문')
$st_count2++;
$add_msg = $opt['ct_msg'];
$add_file = $opt['ct_file'];
$add_copt = $opt['c_opt'];
}
if($add_msg || $add_file) {
?>
<tr>
<th>추가작업내용</th>
<td colspan="2" class="td_mngsmall"><?php echo stripslashes($add_msg); ?></td>
<th>서체선택</th>
<td colspan="1" class="td_mngsmall"><?php echo stripslashes($add_copt); ?></td>
<th>첨부파일</th>
<td colspan="1" class="td_mngsmall"><a href="<?php echo G5_DATA_URL."/odfile/".$add_file?>" target="_blank">다운받기</a></td>
</tr>
<?php
}
}
// 주문 상품의 상태가 모두 주문이면 고객 취소 가능
if($st_count1 > 0 && $st_count1 == $st_count2)
$custom_cancel = true;
?>
</tbody>
</table>
</div>
<?php
// 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인 - 배송비할인
$tot_price = $od['od_cart_price'] + $od['od_send_cost'] + $od['od_send_cost2']
- $od['od_cart_coupon'] - $od['od_coupon'] - $od['od_send_coupon']
- $od['od_cancel_price'] - $od['od_receipt_point'];
?>
<dl id="sod_bsk_tot">
<dt class="sod_bsk_dvr">주문총액</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_price']); ?> 원</strong></dd>
<?php if($od['od_cart_coupon'] > 0) { ?>
<dt class="sod_bsk_dvr">개별상품 쿠폰할인</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_coupon']); ?> 원</strong></dd>
<?php } ?>
<?php if($od['od_coupon'] > 0) { ?>
<dt class="sod_bsk_dvr">주문금액 쿠폰할인</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_coupon']); ?> 원</strong></dd>
<?php } ?>
<?php if ($od['od_send_cost'] > 0) { ?>
<dt class="sod_bsk_dvr">배송비</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_cost']); ?> 원</strong></dd>
<?php } ?>
<?php if($od['od_send_coupon'] > 0) { ?>
<dt class="sod_bsk_dvr">배송비 쿠폰할인</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_coupon']); ?> 원</strong></dd>
<?php } ?>
<?php if ($od['od_send_cost2'] > 0) { ?>
<dt class="sod_bsk_dvr">추가배송비</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_cost2']); ?> 원</strong></dd>
<?php } ?>
<?php if ($od['od_cancel_price'] > 0) { ?>
<dt class="sod_bsk_dvr">취소금액</dt>
<dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cancel_price']); ?> 원</strong></dd>
<?php } ?>
<dt class="sod_bsk_cnt">총계</dt>
<dd class="sod_bsk_cnt"><strong><?php echo number_format($tot_price); ?> 원</strong></dd>
<dt class="sod_bsk_point">할인액</dt>
<dd class="sod_bsk_point"><strong><?php echo number_format($tot_point); ?> 점</strong></dd>
</dl>
</section>
<div id="sod_fin_view">
<h2>결제/배송 정보</h2>
<?php
$receipt_price = $od['od_receipt_price']
+ $od['od_receipt_point'];
$cancel_price = $od['od_cancel_price'];
$misu = true;
$misu_price = $tot_price - $receipt_price - $cancel_price;
if ($misu_price == 0 && ($od['od_cart_price'] > $od['od_cancel_price'])) {
$wanbul = " (완불)";
$misu = false; // 미수금 없음
}
else
{
$wanbul = display_price($receipt_price);
}
// 결제정보처리
if($od['od_receipt_price'] > 0)
$od_receipt_price = display_price($od['od_receipt_price']);
else
$od_receipt_price = '아직 입금되지 않았거나 입금정보를 입력하지 못하였습니다.';
$app_no_subj = '';
$disp_bank = true;
$disp_receipt = false;
if($od['od_settle_case'] == '신용카드') {
$app_no_subj = '승인번호';
$app_no = $od['od_app_no'];
$disp_bank = false;
$disp_receipt = true;
} else if($od['od_settle_case'] == '휴대폰') {
$app_no_subj = '휴대폰번호';
$app_no = $od['od_bank_account'];
$disp_bank = false;
$disp_receipt = true;
} else if($od['od_settle_case'] == '가상계좌' || $od['od_settle_case'] == '계좌이체') {
$app_no_subj = '거래번호';
$app_no = $od['od_tno'];
}
?>
<section id="sod_fin_orderer">
<h3>주문하신 분</h3>
<div class="tbl_head01 tbl_wrap">
<table>
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">이 름</th>
<td><?php echo get_text($od['od_name']); ?></td>
<td></td>
</tr>
<tr>
<th scope="row">전화번호</th>
<td><?php echo get_text($od['od_tel']); ?></td>
</tr>
<tr>
<th scope="row">핸드폰</th>
<td><?php echo get_text($od['od_hp']); ?></td>
</tr>
<tr>
<th scope="row">주 소</th>
<td><?php echo get_text(sprintf("(%s%s)", $od['od_zip1'], $od['od_zip2']).' '.print_address($od['od_addr1'], $od['od_addr2'], $od['od_addr3'], $od['od_addr_jibeon'])); ?></td>
</tr>
<tr>
<th scope="row">E-mail</th>
<td><?php echo get_text($od['od_email']); ?></td>
</tr>
<tr>
<th scope="row">전하실 말씀</th>
<td><?php echo conv_content($od['od_memo'], 0); ?></td>
</tr>
</tbody>
</table>
</div>
</section>
<section id="sod_fin_receiver">
<h3>받으시는 분</h3>
<div class="tbl_head01 tbl_wrap">
<table>
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">이 름</th>
<td><?php echo get_text($od['od_b_name']); ?></td>
</tr>
<tr>
<th scope="row">전화번호</th>
<td><?php echo get_text($od['od_b_tel']); ?></td>
</tr>
<tr>
<th scope="row">핸드폰</th>
<td><?php echo get_text($od['od_b_hp']); ?></td>
</tr>
<tr>
<th scope="row">주 소</th>
<td><?php echo get_text(sprintf("(%s%s)", $od['od_b_zip1'], $od['od_b_zip2']).' '.print_address($od['od_b_addr1'], $od['od_b_addr2'], $od['od_b_addr3'], $od['od_b_addr_jibeon'])); ?></td>
</tr>
<?php
// 희망배송일을 사용한다면
if ($default['de_hope_date_use'])
{
?>
<tr>
<th scope="row">희망배송일</th>
<td><?php echo substr($od['od_hope_date'],0,10).' ('.get_yoil($od['od_hope_date']).')' ;?></td>
</tr>
<?php }
if ($od['od_memo'])
{
?>
<?php } ?>
</tbody>
</table>
</div>
</section>
<section id="sod_fin_pay">
<h3>결제정보</h3>
<div class="tbl_head01 tbl_wrap">
<table>
<colgroup>
<col class="grid_3">
<col>
</colgroup>
<tbody>
<tr>
<th scope="row">주문번호</th>
<td><?php echo $od_id; ?></td>
<td><th scope="row">주문일시</th>
<td><?php echo $od['od_time']; ?></td></td>
</tr>
<tr>
<th scope="row">결제방식</th>
<td><?php echo $od['od_settle_case']; ?></td>
<td>
<th scope="row">결제금액</th>
<td><?php echo $od_receipt_price; ?></td>
</td>
</tr>
<?php
if($od['od_receipt_price'] > 0)
{
?>
<tr>
<th scope="row">결제일시</th>
<td><?php echo $od['od_receipt_time']; ?></td>
<td>
</tr>
<?php
}
// 승인번호, 휴대폰번호, 거래번호
if($app_no_subj)
{
?>
<tr>
<th scope="row"><?php echo $app_no_subj; ?></th>
<td><?php echo $app_no; ?></td>
</tr>
<?php
}
// 계좌정보
if($disp_bank)
{
?>
<tr>
<th scope="row">입금자명</th>
<td><?php echo get_text($od['od_deposit_name']); ?></td>
<td> <th scope="row">입금계좌</th>
<td><?php echo get_text($od['od_bank_account']); ?></td></td>
</tr>
<?php
}
if($disp_receipt) {
?>
<tr>
<th scope="row">영수증</th>
<td>
<?php
if($od['od_settle_case'] == '휴대폰')
{
if($od['od_pg'] == 'lg') {
require_once G5_SHOP_PATH.'/settle_lg.inc.php';
$LGD_TID = $od['od_tno'];
$LGD_MERTKEY = $config['cf_lg_mert_key'];
$LGD_HASHDATA = md5($LGD_MID.$LGD_TID.$LGD_MERTKEY);
$hp_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');';
} else {
$hp_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');';
}
?>
<a href="javascript:;" onclick="<?php echo $hp_receipt_script; ?>"><font size="3" color="red"><strong>영수증 출력</font></strong></a>
<?php
}
if($od['od_settle_case'] == '신용카드')
{
if($od['od_pg'] == 'lg') {
require_once G5_SHOP_PATH.'/settle_lg.inc.php';
$LGD_TID = $od['od_tno'];
$LGD_MERTKEY = $config['cf_lg_mert_key'];
$LGD_HASHDATA = md5($LGD_MID.$LGD_TID.$LGD_MERTKEY);
$card_receipt_script = 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');';
} else {
$card_receipt_script = 'window.open(\''.G5_BILL_RECEIPT_URL.'card_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=470,height=815,scrollbars=yes,resizable=yes\');';
}
?>
<a href="javascript:;" onclick="<?php echo $card_receipt_script; ?>"><font size="3" color="red"><strong>영수증 출력</font></strong></a>
<?php
}
?>
<td>
<th scope="row">할인 적용</th>
<td><?php echo display_point($od['od_receipt_point']); ?></td>
</td>
</tr>
<?php
}
if ($od['od_receipt_point'] > 0)
{
?>
<?php
}
if ($od['od_refund_price'] > 0)
{
?>
<tr>
<th scope="row">환불 금액</th>
<td><?php echo display_price($od['od_refund_price']); ?></td>
</tr>
<?php
}
// 현금영수증 발급을 사용하는 경우에만
if ($default['de_taxsave_use']) {
// 미수금이 없고 현금일 경우에만 현금영수증을 발급 할 수 있습니다.
if ($misu_price == 0 && $od['od_receipt_price'] && ($od['od_settle_case'] == '무통장' || $od['od_settle_case'] == '계좌이체' || $od['od_settle_case'] == '가상계좌')) {
?>
<tr>
<th scope="row">현금영수증</th>
<td>
<?php
if ($od['od_cash'])
{
if($od['od_pg'] == 'lg') {
require_once G5_SHOP_PATH.'/settle_lg.inc.php';
switch($od['od_settle_case']) {
case '계좌이체':
$trade_type = 'BANK';
break;
case '가상계좌':
$trade_type = 'CAS';
break;
default:
$trade_type = 'CR';
break;
}
$cash_receipt_script = 'javascript:showCashReceipts(\''.$LGD_MID.'\',\''.$od['od_id'].'\',\''.$od['od_casseqno'].'\',\''.$trade_type.'\',\''.$CST_PLATFORM.'\');';
} else {
require_once G5_SHOP_PATH.'/settle_kcp.inc.php';
$cash = unserialize($od['od_cash_info']);
$cash_receipt_script = 'window.open(\''.G5_CASH_RECEIPT_URL.$default['de_kcp_mid'].'&orderid='.$od_id.'&bill_yn=Y&authno='.$cash['receipt_no'].'\', \'taxsave_receipt\', \'width=360,height=647,scrollbars=0,menus=0\');';
}
?>
<a href="javascript:;" onclick="<?php echo $cash_receipt_script; ?>" class="btn_frmline">현금영수증 확인하기</a>
<?php
}
else
{
?>
<a href="javascript:;" onclick="window.open('<?php echo G5_SHOP_URL; ?>/taxsave.php?od_id=<?php echo $od_id; ?>', 'taxsave', 'width=550,height=400,scrollbars=1,menus=0');" class="btn_frmline">현금영수증을 발급하시려면 클릭하십시오.</a>
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</section>
<!--
<section id="sod_fin_cancel">
<h2>주문취소</h2>
<?php
// 취소한 내역이 없다면
if ($cancel_price == 0) {
if ($custom_cancel) {
?>
<button type="button" onclick="document.getElementById('sod_fin_cancelfrm').style.display='block';">주문 취소하기</button>
<div id="sod_fin_cancelfrm">
<form method="post" action="./orderinquirycancel.php" onsubmit=