#209 PC 및 관리자 쿠폰 기능 추가
This commit is contained in:
@ -929,6 +929,12 @@ $(function() {
|
||||
var subj = $el.find("input[name='f_cp_subj[]']").val();
|
||||
var sell_amount;
|
||||
|
||||
if(parseInt(amount) == 0) {
|
||||
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 이미 사용한 쿠폰이 있는지
|
||||
var cp_dup = false;
|
||||
var cp_dup_idx;
|
||||
@ -1224,7 +1230,8 @@ function forderform_check(f)
|
||||
}
|
||||
|
||||
var tot_amount = <?php echo (int)$tot_amount; ?>;
|
||||
var max_point = parseInt(f.max_temp_point.value);
|
||||
if (typeof(f.max_temp_point) != "undefined")
|
||||
var max_point = parseInt(f.max_temp_point.value);
|
||||
|
||||
var temp_point = 0;
|
||||
if (typeof(f.od_temp_point) != "undefined") {
|
||||
|
||||
@ -69,14 +69,14 @@ if($is_member) {
|
||||
// 상품쿠폰
|
||||
$tot_it_cp_amount = $tot_od_cp_amount = 0;
|
||||
$it_cp_cnt = count($_POST['cp_id']);
|
||||
$arr_it_cp_amt = array();
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = $_POST['cp_id'][$i];
|
||||
$it_id = $_POST['it_id'][$i];
|
||||
$sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
|
||||
$sql = " select cp_id, cp_method, cp_target, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
|
||||
from {$g4['shop_coupon_table']}
|
||||
where cp_id = '$cid'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and cp_target = '$it_id'
|
||||
and cp_start <= '".G4_TIME_YMD."'
|
||||
and cp_end >= '".G4_TIME_YMD."'
|
||||
and cp_used = '0'
|
||||
@ -85,6 +85,23 @@ if($is_member) {
|
||||
if(!$cp['cp_id'])
|
||||
continue;
|
||||
|
||||
// 분류할인인지
|
||||
if($cp['cp_method']) {
|
||||
$sql2 = " select it_id, ca_id, ca_id2, ca_id3
|
||||
from {$g4['shop_item_table']}
|
||||
where it_id = '$it_id' ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
if(!$row2['it_id'])
|
||||
continue;
|
||||
|
||||
if($row2['ca_id'] != $cp['cp_target'] && $row2['ca_id2'] != $cp['cp_target'] && $row2['ca_id3'] != $cp['cp_target'])
|
||||
continue;
|
||||
} else {
|
||||
if($cp['cp_target'] != $it_id)
|
||||
continue;
|
||||
}
|
||||
|
||||
// 상품금액
|
||||
$sql = " select SUM( IF(io_type = '1', io_price * ct_qty, (ct_price + io_price) * ct_qty)) as sum_price
|
||||
from {$g4['shop_cart_table']}
|
||||
@ -107,6 +124,7 @@ if($is_member) {
|
||||
$dc = $cp['cp_maximum'];
|
||||
|
||||
$tot_it_cp_amount += $dc;
|
||||
$arr_it_cp_amt[$it_id] = $dc;
|
||||
}
|
||||
|
||||
$tot_od_amount = $tot_ct_amount - $tot_it_cp_amount;
|
||||
@ -166,7 +184,7 @@ if ($default['de_send_cost_case'] == "없음") {
|
||||
}
|
||||
|
||||
$tot_sc_cp_amount = 0;
|
||||
if($is_member) {
|
||||
if($is_member && $send_cost > 0) {
|
||||
// 배송쿠폰
|
||||
if($_POST['sc_cp_id']) {
|
||||
$sql = " select cp_id, cp_type, cp_amount, cp_trunc, cp_minimum, cp_maximum
|
||||
@ -372,6 +390,8 @@ $sql = " insert {$g4['shop_order_table']}
|
||||
od_deposit_name = '$od_deposit_name',
|
||||
od_memo = '$od_memo',
|
||||
od_send_cost = '$od_send_cost',
|
||||
od_send_coupon = '$tot_sc_cp_amount',
|
||||
od_coupon = '$tot_od_cp_amount',
|
||||
od_temp_bank = '$od_temp_bank',
|
||||
od_temp_card = '$od_receipt_card',
|
||||
od_temp_hp = '$od_receipt_hp',
|
||||
@ -448,17 +468,31 @@ if($is_member) {
|
||||
$it_cp_cnt = count($_POST['cp_id']);
|
||||
for($i=0; $i<$it_cp_cnt; $i++) {
|
||||
$cid = $_POST['cp_id'][$i];
|
||||
$cp_it_id = $_POST['it_id'][$i];
|
||||
$sql = " update {$g4['shop_coupon_table']}
|
||||
set cp_used = '1'
|
||||
set od_id = '$od_id',
|
||||
cp_used = '1',
|
||||
cp_used_time = '".G4_TIME_YMDHIS."'
|
||||
where cp_id = '$cid'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and cp_method IN ( 0, 1 ) ";
|
||||
sql_query($sql);
|
||||
|
||||
// 쿠폰사용금액 cart에 기록
|
||||
$cp_amt = (int)$arr_it_cp_amt[$cp_it_id];
|
||||
$sql = " update {$g4['shop_cart_table']}
|
||||
set cp_amount = '$cp_amt'
|
||||
where uq_id = '$tmp_uq_id'
|
||||
and it_id = '$cp_it_id'
|
||||
and ct_num = '0' ";
|
||||
sql_query($sql);
|
||||
}
|
||||
|
||||
if($_POST['od_cp_id']) {
|
||||
$sql = " update {$g4['shop_coupon_table']}
|
||||
set cp_used = '1'
|
||||
set od_id = '$od_id',
|
||||
cp_used = '1',
|
||||
cp_used_time = '".G4_TIME_YMDHIS."'
|
||||
where cp_id = '{$_POST['od_cp_id']}'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and cp_method = '2' ";
|
||||
@ -467,7 +501,9 @@ if($is_member) {
|
||||
|
||||
if($_POST['sc_cp_id']) {
|
||||
$sql = " update {$g4['shop_coupon_table']}
|
||||
set cp_used = '1'
|
||||
set od_id = '$od_id',
|
||||
cp_used = '1',
|
||||
cp_used_time = '".G4_TIME_YMDHIS."'
|
||||
where cp_id = '{$_POST['sc_cp_id']}'
|
||||
and mb_id = '{$member['mb_id']}'
|
||||
and cp_method = '3' ";
|
||||
|
||||
@ -13,6 +13,7 @@ if (!defined("_ORDERINQUIRY_")) exit; // 개별 페이지 접근 불가
|
||||
<th scope="col">주문일시</th>
|
||||
<th scope="col">상품수</th>
|
||||
<th scope="col">주문금액</th>
|
||||
<th scope="col">쿠폰</th>
|
||||
<th scope="col">입금액</th>
|
||||
<th scope="col">미입금액</th>
|
||||
</tr>
|
||||
@ -40,6 +41,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
|
||||
<td><?php echo substr($row['od_time'],0,16); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
|
||||
<td class="td_bignum"><?php echo $row['itemcount']; ?></td>
|
||||
<td class="td_bignum"><?php echo display_price($row['orderamount']); ?></td>
|
||||
<td class="td_bignum"><?php echo display_price($row['couponamount']); ?></td>
|
||||
<td class="td_bignum"><?php echo display_price($row['receiptamount']); ?></td>
|
||||
<td class="td_bignum"><?php echo display_price($row['misu']); ?></td>
|
||||
</tr>
|
||||
|
||||
@ -56,7 +56,7 @@ if(openwin != null) {
|
||||
<dd>상품 배송이 완료되었습니다.</dd>
|
||||
</dl>
|
||||
<?php
|
||||
$sql = " select it_id, it_name
|
||||
$sql = " select it_id, it_name, cp_amount
|
||||
from {$g4['shop_cart_table']}
|
||||
where uq_id = '$uq_id'
|
||||
and ct_num = '0'
|
||||
@ -124,36 +124,63 @@ if(openwin != null) {
|
||||
</table>
|
||||
</li>
|
||||
<?php
|
||||
$tot_cp_amount += $row['cp_amount'];
|
||||
}
|
||||
|
||||
$send_cost = $od['od_send_cost'];
|
||||
$send_coupon = $od['od_send_coupon'];
|
||||
$org_send_cost = $send_cost + $send_coupon;
|
||||
?>
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
// 배송비가 0 보다 크다면 (있다면)
|
||||
if ($send_cost > 0)
|
||||
{
|
||||
// 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인
|
||||
$od_coupon = $od['od_coupon'];
|
||||
$tot_amount = $tot_sell_amount + $send_cost - $tot_cp_amount - $od_coupon;
|
||||
?>
|
||||
|
||||
<div id="sod_bsk_dvr" class="sod_bsk_tot">
|
||||
<span>배송비</span>
|
||||
<strong><?php echo number_format($send_cost); ?> 원</strong>
|
||||
<span>주문총액</span>
|
||||
<strong><?php echo number_format($tot_sell_amount); ?> 원</strong>
|
||||
</div>
|
||||
|
||||
<?php if($tot_cp_amount > 0) { ?>
|
||||
<div id="sod_bsk_dvr" class="sod_bsk_tot">
|
||||
<span>상품할인</span>
|
||||
<strong><?php echo number_format($tot_cp_amount); ?> 원</strong>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
// 총계 = 주문상품금액합계 + 배송비
|
||||
$tot_amount = $tot_sell_amount + $send_cost;
|
||||
if ($tot_amount > 0) {
|
||||
?>
|
||||
<?php if($od_coupon > 0) { ?>
|
||||
<div id="sod_bsk_dvr" class="sod_bsk_tot">
|
||||
<span>결제할인</span>
|
||||
<strong><?php echo number_format($od_coupon); ?> 원</strong>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($org_send_cost > 0) { ?>
|
||||
<div id="sod_bsk_dvr" class="sod_bsk_tot">
|
||||
<span>배송비</span>
|
||||
<strong><?php echo number_format($org_send_cost); ?> 원</strong>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($send_coupon > 0) { ?>
|
||||
<div id="sod_bsk_dvr" class="sod_bsk_tot">
|
||||
<span>배송비할인</span>
|
||||
<strong><?php echo number_format($send_coupon); ?> 원</strong>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div id="sod_bsk_cnt" class="sod_bsk_tot">
|
||||
<span>총계</span>
|
||||
<strong><?php echo number_format($tot_amount); ?> 원 <?php echo number_format($tot_point); ?> 점</strong>
|
||||
<strong><?php echo number_format($tot_amount); ?> 원</strong>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<div id="sod_bsk_cnt" class="sod_bsk_tot">
|
||||
<span>포인트</span>
|
||||
<strong><?php echo number_format($tot_point); ?> 점</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div id="sod_fin_view">
|
||||
|
||||
Reference in New Issue
Block a user