Merge branch 'master' of github.com:gnuboard/yc4s

This commit is contained in:
gnuboard
2013-06-10 18:00:09 +09:00
12 changed files with 148 additions and 25 deletions

View File

@ -100,7 +100,8 @@ $total_order = $row['sum_order'];
// 상품목록
$sql = " select it_id,
it_name
it_name,
cp_amount
from {$g4['shop_cart_table']}
where uq_id = '{$od['uq_id']}'
and ct_num = '0'
@ -215,6 +216,7 @@ $pg_anchor = '<ul class="anchor">
</li>
<?
$t_cp_amount += $row['cp_amount']; // 쿠폰사용금액
$t_ct_amount['합계'] += $ct_amount['소계'];
$t_ct_point['합계'] += $ct_point['소계'];
}
@ -247,8 +249,11 @@ $pg_anchor = '<ul class="anchor">
// 입금액 = 무통장(가상계좌, 계좌이체 포함) + 신용카드 + 휴대폰 + 포인트
$amount['입금'] = $od['od_receipt_bank'] + $od['od_receipt_card'] + $od['od_receipt_hp'] + $od['od_receipt_point'];
// 미수금 = (주문금액 - DC + 환불액) - (입금액 - 신용카드승인취소)
$amount['미수'] = ($amount['정상'] - $od['od_dc_amount'] + $od['od_refund_amount']) - ($amount['입금'] - $od['od_cancel_card']);
// 쿠폰금액
$amount['쿠폰'] = $t_cp_amount + $od['od_coupon'];
// 미수금 = (주문금액 - DC + 환불액) - (입금액 - 신용카드승인취소) - 쿠폰금액
$amount['미수'] = ($amount['정상'] - $od['od_dc_amount'] + $od['od_refund_amount']) - ($amount['입금'] - $od['od_cancel_card']) - $amount['쿠폰'];
// 결제방법
$s_receipt_way = $od['od_settle_case'];
@ -267,6 +272,7 @@ $pg_anchor = '<ul class="anchor">
<th scope="col">주문총액</th>
<th scope="col">포인트결제</th>
<th scope="col">총결제액</th>
<th scope="col">쿠폰</th>
<th scope="col">DC</th>
<th scope="col">환불액</th>
<th scope="col">주문취소</th>
@ -279,6 +285,7 @@ $pg_anchor = '<ul class="anchor">
<td class="td_bignum"><?php echo display_price($amount['정상']); ?></td>
<td class="td_bignum"><?php echo display_point($od['od_receipt_point']); ?></td>
<td class="td_bignum"><?php echo number_format($amount['입금']); ?>원</td>
<td class="td_bignum"><?php echo display_price($amount['쿠폰']); ?></td>
<td class="td_bignum"><?php echo display_price($od['od_dc_amount']); ?></td>
<td class="td_bignum"><?php echo display_price($od['od_refund_amount']); ?></td>
<td class="td_bignum"><?php echo number_format($t_ct_amount['취소']); ?>원</td>

View File

@ -161,6 +161,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
$tot_dc_amount += $row['od_dc_amount'];
$tot_receiptamount += $row['receiptamount'];
$tot_receiptcancel += $row['receiptcancel'];
$tot_couponamount += $row['couponamount'];
$tot_misu += $row['misu'];
?>
<li>
@ -200,6 +201,8 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<dd class="sodr_pay_1"><?php echo number_format($row['od_dc_amount']); ?></dd>
<dt class="sodr_pay_1">입금합계</dt>
<dd class="sodr_pay_1"><?php echo number_format($row['receiptamount']); ?></dd>
<dt>쿠폰사용</dt>
<dd><?php echo number_format($row['couponamount']); ?></dd>
<dt>주문취소</dt>
<dd><?php echo number_format($row['ordercancel']); ?></dd>
<dt>입금취소</dt>
@ -300,6 +303,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<tr>
<th scope="col">주문건수</th>
<th scope="col">주문액</th>
<th scope="col">쿠폰</th>
<th scope="col">취소</th>
<th scope="col">DC</th>
<th scope="col">입금완료</th>
@ -311,6 +315,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<tr>
<td><?php echo (int)$tot_itemcount; ?>건</td>
<td><?php echo number_format($tot_orderamount); ?></td>
<td><?php echo number_format($tot_couponamount); ?></td>
<td><?php echo number_format($tot_ordercancel); ?></td>
<td><?php echo number_format($tot_dc_amount); ?></td>
<td><?php echo number_format($tot_receiptamount); ?></td>

View File

@ -33,6 +33,7 @@ define(_MISU_QUERY_, "
count(distinct a.od_id) as ordercount, /* 주문서건수 */
count(b.ct_id) as itemcount, /* 상품건수 */
(SUM(IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)) + a.od_send_cost) as orderamount, /* 주문합계 */
(SUM(b.cp_amount) + a.od_coupon) as couponamount, /* 쿠폰합계*/
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', (IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)), 0))) as ordercancel, /* 주문취소 */
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_hp + a.od_receipt_point) as receiptamount, /* 입금합계 */
(a.od_refund_amount + a.od_cancel_card) as receiptcancel, /* 입금취소 */
@ -41,8 +42,9 @@ define(_MISU_QUERY_, "
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', (IF(b.io_type = 1, b.io_price * b.ct_qty, (b.ct_price + b.io_price) * b.ct_qty)), 0))) -
a.od_dc_amount -
(a.od_receipt_bank + a.od_receipt_card + a.od_receipt_hp + a.od_receipt_point) +
(a.od_refund_amount + a.od_cancel_card)
) as misu /* 미수금 = 주문합계 - 주문취소 - DC - 입금합계 + 입금취소 */");
(a.od_refund_amount + a.od_cancel_card) -
(SUM(b.cp_amount) + a.od_coupon)
) as misu /* 미수금 = 주문합계 - 주문취소 - DC - 입금합계 + 입금취소 - 쿠폰합계 */");
//------------------------------------------------------------------------------
// 쇼핑몰 상수 모음 끝
//------------------------------------------------------------------------------

View File

@ -265,4 +265,13 @@ if(!$result) {
ADD `od_coupon` INT(11) NOT NULL DEFAULT '0' AFTER `od_dc_amount`,
ADD `od_send_coupon` INT(11) NOT NULL DEFAULT '0' AFTER `od_send_cost` ", false);
}
// 쿠폰사용정보필드추가
$sql = " select od_id from {$g4['shop_coupon_table']} limit 1 ";
$result = sql_query($sql, false);
if(!$result) {
sql_query(" ALTER TABLE `{$g4['shop_coupon_table']}`
ADD `od_id` BIGINT(20) UNSIGNED NOT NULL AFTER `cp_maximum`,
ADD `cp_used_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `cp_used` ", false);
}
?>

View File

@ -153,7 +153,9 @@ CREATE TABLE IF NOT EXISTS `shop_coupon` (
`cp_trunc` INT(11) NOT NULL DEFAULT '0',
`cp_minimum` INT(11) NOT NULL DEFAULT '0',
`cp_maximum` INT(11) NOT NULL DEFAULT '0',
`od_id` bigint(20) unsigned NOT NULL,
`cp_used` TINYINT(4) NOT NULL DEFAULT '0',
`cp_used_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`cp_datetime` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`cp_no`),
UNIQUE KEY `cp_id` (`cp_id`),

View File

@ -42,6 +42,7 @@ $count = mysql_num_rows($result);
<li>
<input type="hidden" name="o_cp_id[]" value="<?php echo $row['cp_id']; ?>">
<input type="hidden" name="o_cp_amt[]" value="<?php echo $dc; ?>">
<input type="hidden" name="o_cp_subj[]" value="<?php echo $row['cp_subject']; ?>">
<span><?php echo get_text($row['cp_subject']); ?></span>
<span><?php echo number_format($dc); ?></span>
<span><button type="button" class="od_cp_apply">적용</button></span>

View File

@ -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;
@ -994,9 +1000,16 @@ $(function() {
var $el = $(this).closest("li");
var cp_id = $el.find("input[name='o_cp_id[]']").val();
var amount = parseInt($el.find("input[name='o_cp_amt[]']").val());
var subj = $el.find("input[name='o_cp_subj[]']").val();
var od_amount = parseInt($("input[name=org_od_amount]").val());
var send_cost = $("input[name=org_send_cost]").val();
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
return false;
}
}
$("input[name=od_send_cost]").val(send_cost);
$("input[name=sc_cp_id]").val("");
@ -1038,8 +1051,15 @@ $(function() {
var $el = $(this).closest("li");
var cp_id = $el.find("input[name='s_cp_id[]']").val();
var amount = parseInt($el.find("input[name='s_cp_amt[]']").val());
var subj = $el.find("input[name='s_cp_subj[]']").val();
var send_cost = parseInt($("input[name=org_send_cost]").val());
if(parseInt(amount) == 0) {
if(!confirm(subj+"쿠폰의 할인 금액은 "+amount+"원입니다.\n쿠폰을 적용하시겠습니까?")) {
return false;
}
}
$("input[name=od_send_cost]").val(send_cost - amount);
$("input[name=sc_cp_id]").val(cp_id);
calculate_order_amount();
@ -1224,7 +1244,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") {

View File

@ -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' ";

View File

@ -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>

View File

@ -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">

View File

@ -45,6 +45,15 @@ $sql = " select b.it_sell_email,
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 합계금액 계산
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(ct_point * ct_qty) as point,
SUM(ct_qty) as qty
from {$g4['shop_cart_table']}
where it_id = '{$row['it_id']}'
and uq_id = '$tmp_uq_id' ";
$sum = sql_fetch($sql);
// 옵션정보
$sql2 = " select ct_option, ct_qty
from {$g4['shop_cart_table']}
@ -68,6 +77,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
$list[$i]['it_simg'] = get_it_image($row['it_id'], $default['de_simg_width'], $default['de_simg_height']);
$list[$i]['it_name'] = $row['it_name'];
$list[$i]['it_opt'] = $options;
$list[$i]['ct_price'] = $sum['price'];
$subject = $config['cf_title'].' - 주문 알림 메일 (주문자 '.$od_name.'님)';
ob_start();

View File

@ -46,6 +46,7 @@ $count = mysql_num_rows($result);
<li>
<input type="hidden" name="s_cp_id[]" value="<?php echo $row['cp_id']; ?>">
<input type="hidden" name="s_cp_amt[]" value="<?php echo $dc; ?>">
<input type="hidden" name="s_cp_subj[]" value="<?php echo $row['cp_subject']; ?>">
<span><?php echo get_text($row['cp_subject']); ?></span>
<span><?php echo number_format($dc); ?></span>
<span><button type="button" class="sc_cp_apply">적용</button></span>