주문리스트에서 취소금액 표시되지 않는 오류 수정

This commit is contained in:
chicpro
2013-09-12 13:36:18 +09:00
parent 9d342b33f8
commit d674b31814
10 changed files with 120 additions and 42 deletions

View File

@ -119,7 +119,7 @@ $pg_anchor = '<ul class="anchor">
<tr>
<td class="td_odrnum2"><a href="./orderstatuslist.php?sort1=od_id&amp;sel_field=od_id&amp;search=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a></td>
<td class="td_name"><?php echo $name; ?></td>
<td class="td_bignum"><?php echo display_price($row['orderamount']); ?></td>
<td class="td_bignum"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<td class="td_payby"><?php echo $settle_method; ?></td>
<td class="td_smallmng"><a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>">수정</a></td>
</tr>
@ -131,7 +131,7 @@ $pg_anchor = '<ul class="anchor">
</table>
<div class="btn_ft">
<a href="./orderlist.php?sort1=receiptamount&amp;sort2=asc">미입금 주문내역 더보기</a>
<a href="./orderlist.php?sort1=od_receipt_price&amp;sort2=asc">미입금 주문내역 더보기</a>
</div>
</section>

View File

@ -158,6 +158,78 @@ for ($i=0; $i<$cnt; $i++)
sql_query($sql);
}
// 주문정보
$sql = " select * from {$g4['shop_order_table']} where od_id = '$od_id' ";
$od = sql_fetch($sql);
// 주문 합계
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(cp_price) as coupon
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and ct_status IN ( '주문', '준비', '배송', '완료' ) ";
$sum = sql_fetch($sql);
$cart_price = $sum['price'];
$cart_coupon = $sum['coupon'];
// 주문할인 쿠폰
$sql = " select cp_id, cp_type, cp_price, cp_trunc, cp_minimum, cp_maximum
from {$g4['shop_coupon_table']}
where od_id = '$od_id'
and cp_method = '2' ";
$cp = sql_fetch($sql);
if($cp['cp_id']) {
$dc = 0;
$tot_od_price = $cart_price - $cart_coupon;
if($cp['cp_id'] && ($cp['cp_minimum'] <= $tot_od_price)) {
if($cp['cp_type']) {
$dc = floor(($tot_od_price * ($cp['cp_price'] / 100)) / $cp['cp_trunc']) * $cp['cp_trunc'];
} else {
$dc = $cp['cp_price'];
}
if($cp['cp_maximum'] && $dc > $cp['cp_maximum'])
$dc = $cp['cp_maximum'];
if($tot_od_price < $dc)
$dc = $tot_od_price;
}
}
// 배송비
$send_cost = get_sendcost($cart_price, $od_id);
// 취소 합계
$sql = " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
SUM(cp_price) as coupon
from {$g4['shop_cart_table']}
where od_id = '$od_id'
and ct_status IN ( '취소', '반품', '품절' ) ";
$sum = sql_fetch($sql);
$cancel_price = $sum['price'];
$cancel_coupon = $sum['coupon'];
// 배송비가 배송비 쿠폰보다 작다면 쿠폰금액으로 설정
if($send_cost < $od['od_send_coupon'])
$send_cost = $od['od_send_coupon'];
// 미수
$od_misu = $od['od_cart_price'] + $send_cost + $od['od_send_cost2']
- ($od['od_cart_coupon'] + $od['od_coupon'] + $od['od_send_coupon'])
- ($od['od_receipt_price'] + $od['od_receipt_point'])
+ $cancel_coupon
+ ($od['od_coupon'] - $dc);
// 주문정보 반영
$sql = " update {$g4['shop_order_table']}
set od_cancel_price = '$cancel_price',
od_send_cost = '$send_cost',
od_misu = '$od_misu'
where od_id = '$od_id' ";
sql_query($sql);
$qstr = "sort1=$sort1&amp;sort2=$sort2&amp;sel_field=$sel_field&amp;search=$search&amp;page=$page";
$url = "./orderform.php?od_id=$od_id&amp;$qstr";

View File

@ -63,7 +63,8 @@ $total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
$sql = " select *,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
$sql_common
order by $sort1 $sort2
limit $from_record, $rows ";
@ -132,7 +133,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<li><a href="<?php echo title_sort("od_misu", 1)."&amp;$qstr1"; ?>">미수금<span class="sound_only"> 순 정렬</span></a></li>
</ul>
주문상태 :
주문상태 :
<ul id="sort_sodr" class="sort_odr">
<li><a href="<?php $_SERVER['PHP_SELF']; ?>?od_status=<?php echo G4_OD_STATUS_ORDER; ?>"><?php echo G4_OD_STATUS_ORDER; ?></a></li>
<li><a href="<?php $_SERVER['PHP_SELF']; ?>?od_status=<?php echo G4_OD_STATUS_SETTLE; ?>"><?php echo G4_OD_STATUS_SETTLE; ?></a></li>
@ -205,10 +206,10 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
</a>
</td>
<td class="td_sodr_cnt"><b><?php echo $row['od_cart_count']; ?></b>건<?php if($od_cnt) { ?><br>누적 <?php echo $od_cnt; ?>건<?php } ?></td>
<td class="td_sodr_sum"><?php echo number_format($row['od_cart_price']); ?></td>
<td class="td_sodr_sum"><?php echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<td><?php echo number_format($row['od_receipt_price']); ?></td>
<td><?php echo number_format($row['od_cancel_price']); ?></td>
<td class="td_sodr_sum"><?php echo number_format($row['couponamount']); ?></td>
<td class="td_sodr_sum"><?php echo number_format($row['couponprice']); ?></td>
<td class="td_sodr_nonpay"><?php echo number_format($row['od_misu']); ?></td>
<td><?php echo $s_receipt_way; ?></td>
<td class="td_mng">
@ -221,7 +222,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
$tot_orderprice += $row['od_cart_price'];
$tot_ordercancel += $row['od_cancel_price'];
$tot_receiptprice += $row['od_receipt_price'];
$tot_couponamount += $row['couponamount'];
$tot_couponprice += $row['couponprice'];
$tot_misu += $row['od_misu'];
}
mysql_free_result($result);
@ -236,7 +237,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<td><?php echo number_format($tot_orderprice); ?></td>
<td><?php echo number_format($tot_receiptprice); ?></td>
<td><?php echo number_format($tot_ordercancel); ?></td>
<td><?php echo number_format($tot_couponamount); ?></td>
<td><?php echo number_format($tot_couponprice); ?></td>
<td><?php echo number_format($tot_misu); ?></td>
<td colspan="2"></td>
</tr>

View File

@ -37,7 +37,8 @@ $total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select *
$sql = " select *,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
$sql_common
order by $sort1 $sort2
limit $from_record, $rows ";
@ -126,7 +127,7 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
$tot_orderprice += $row['od_cart_price'];
$tot_ordercancel += $row['od_cancel_price'];
$tot_receiptprice += $row['od_receipt_price'];
$tot_couponamount += $row['couponamount'];
$tot_couponprice += $row['couponprice'];
$tot_misu += $row['misu'];
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
@ -161,13 +162,13 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<dl class="sodr_pay">
<dt class="sodr_pay_1">주문합계</dt>
<dd class="sodr_pay_1"><?php echo number_format($row['od_cart_price']); ?></dd>
<dd class="sodr_pay_1"><?php echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></dd>
<dt class="sodr_pay_1">결제수단</dt>
<dd class="sodr_pay_1"><?php echo $s_receipt_way; ?></dd>
<dt class="sodr_pay_1">입금합계</dt>
<dd class="sodr_pay_1"><?php echo number_format($row['od_receipt_price']); ?></dd>
<dt>쿠폰사용</dt>
<dd><?php echo number_format($row['couponamount']); ?></dd>
<dd><?php echo number_format($row['couponprice']); ?></dd>
<dt>주문취소</dt>
<dd><?php echo number_format($row['od_cancel_price']); ?></dd>
<dt>미수금</dt>
@ -279,10 +280,10 @@ if ($search) // 검색렬일 때만 처음 버튼을 보여줌
<tbody>
<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_orderprice); ?></td>
<td><?php echo number_format($tot_couponprice); ?></td>
<td><?php echo number_format($tot_ordercancel); ?></td>
<td><?php echo number_format($tot_receiptamount); ?></td>
<td><?php echo number_format($tot_receiptprice); ?></td>
<td><?php echo number_format($tot_misu); ?></td>
</tr>
</tbody>

View File

@ -37,7 +37,8 @@ $sql = " select od_id,
od_cart_price,
od_cancel_price,
od_misu,
(od_cart_coupon + od_coupon + od_send_coupon) as couponamount
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
from {$g4['shop_order_table']}
where SUBSTRING(od_time,1,10) between '$fr_date' and '$to_date'
order by od_time desc ";
@ -77,9 +78,9 @@ $result = sql_query($sql);
}
$save['ordercount']++;
$save['orderprice'] += $row['od_cart_price'];
$save['orderprice'] += $row['orderprice'];
$save['ordercancel'] += $row['od_cancel_price'];
$save['ordercoupon'] += $row['couponamount'];
$save['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$save['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')
@ -88,9 +89,9 @@ $result = sql_query($sql);
$save['misu'] += $row['od_misu'];
$tot['ordercount']++;
$tot['orderprice'] += $row['od_cart_price'];
$tot['ordercancel'] += $row1['od_cancel_price'];
$tot['ordercoupon'] += $row['couponamount'];
$tot['orderprice'] += $row['orderprice'];
$tot['ordercancel'] += $row['od_cancel_price'];
$tot['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$tot['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')

View File

@ -23,7 +23,7 @@ function print_line($save)
<td><?php echo number_format($save['receiptbank']); ?></td>
<td><?php echo number_format($save['receiptcard']); ?></td>
<td><?php echo number_format($save['receiptpoint']); ?></td>
<td><?php echo number_format($save['receiptcancel']); ?></td>
<td><?php echo number_format($save['ordercancel']); ?></td>
<td><?php echo number_format($save['misu']); ?></td>
</tr>
<?php
@ -38,7 +38,8 @@ $sql = " select od_id,
od_cart_price,
od_cancel_price,
od_misu,
(od_cart_coupon + od_coupon + od_send_coupon) as couponamount
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
from {$g4['shop_order_table']}
where SUBSTRING(od_time,1,7) between '$fr_month' and '$to_month'
order by od_time desc ";
@ -78,9 +79,9 @@ $result = sql_query($sql);
}
$save['ordercount']++;
$save['orderprice'] += $row['od_cart_price'];
$save['orderprice'] += $row['orderprice'];
$save['ordercancel'] += $row['od_cancel_price'];
$save['ordercoupon'] += $row['couponamount'];
$save['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$save['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')
@ -89,9 +90,9 @@ $result = sql_query($sql);
$save['misu'] += $row['od_misu'];
$tot['ordercount']++;
$tot['orderprice'] += $row['od_cart_price'];
$tot['orderprice'] += $row['orderprice'];
$tot['ordercancel'] += $row['od_cancel_price'];
$tot['ordercoupon'] += $row['couponamount'];
$tot['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$tot['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')

View File

@ -18,7 +18,8 @@ $sql = " select od_id,
od_receipt_point,
od_cancel_price,
od_misu,
(od_cart_coupon + od_coupon + od_send_coupon) as couponamount
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
from {$g4['shop_order_table']}
where SUBSTRING(od_time,1,10) = '$date'
order by od_id desc ";
@ -63,8 +64,8 @@ $result = sql_query($sql);
<tr>
<td class="td_odrnum2"><a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>"><?php echo $row['od_id']; ?></a></td>
<td class="td_name"><?php echo $href; ?><?php echo $row['od_name']; ?></a></td>
<td class="td_num"><?php echo number_format($row['od_cart_price']); ?></td>
<td class="td_num"><?php echo number_format($row['couponamount']); ?></td>
<td class="td_num"><?php echo number_format($row['orderprice']); ?></td>
<td class="td_num"><?php echo number_format($row['couponprice']); ?></td>
<td class="td_num"><?php echo number_format($receipt_bank); ?></td>
<td class="td_num"><?php echo number_format($receipt_card); ?></td>
<td class="td_num"><?php echo number_format($row['od_receipt_point']); ?></td>
@ -72,9 +73,9 @@ $result = sql_query($sql);
<td class="td_num"><?php echo number_format($row['od_misu']); ?></td>
</tr>
<?php
$tot['orderprice'] += $row['od_cart_price'];
$tot['ordercancel'] += $row1['od_cancel_price'];
$tot['coupon'] += $row['couponamount'] ;
$tot['orderprice'] += $row['orderprice'];
$tot['ordercancel'] += $row['od_cancel_price'];
$tot['coupon'] += $row['couponprice'] ;
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$tot['receipt_bank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')

View File

@ -18,7 +18,7 @@ function print_line($save)
<td><?php echo number_format($save['receiptbank']); ?></td>
<td><?php echo number_format($save['receiptcard']); ?></td>
<td><?php echo number_format($save['receiptpoint']); ?></td>
<td><?php echo number_format($save['receiptcancel']); ?></td>
<td><?php echo number_format($save['ordercancel']); ?></td>
<td><?php echo number_format($save['misu']); ?></td>
</tr>
<?php
@ -33,7 +33,8 @@ $sql = " select od_id,
od_cart_price,
od_cancel_price,
od_misu,
(od_cart_coupon + od_coupon + od_send_coupon) as couponamount
(od_cart_price + od_send_cost + od_send_cost2) as orderprice,
(od_cart_coupon + od_coupon + od_send_coupon) as couponprice
from {$g4['shop_order_table']}
where SUBSTRING(od_time,1,4) between '$fr_year' and '$to_year'
order by od_time desc ";
@ -73,9 +74,9 @@ $result = sql_query($sql);
}
$save['ordercount']++;
$save['orderprice'] += $row['od_cart_price'];
$save['orderprice'] += $row['orderprice'];
$save['ordercancel'] += $row['od_cancel_price'];
$save['ordercoupon'] += $row['couponamount'];
$save['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$save['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')
@ -84,9 +85,9 @@ $result = sql_query($sql);
$save['misu'] += $row['od_misu'];
$tot['ordercount']++;
$tot['orderprice'] += $row['od_cart_price'];
$tot['ordercancel'] += $row1['od_cancel_price'];
$tot['ordercoupon'] += $row['couponamount'];
$tot['orderprice'] += $row['orderprice'];
$tot['ordercancel'] += $row['od_cancel_price'];
$tot['ordercoupon'] += $row['couponprice'];
if($row['od_settle_case'] == '무통장' || $row['od_settle_case'] == '가상계좌' || $row['od_settle_case'] == '계좌이체')
$tot['receiptbank'] += $row['od_receipt_price'];
if($row['od_settle_case'] == '신용카드')

View File

@ -37,7 +37,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
<a href="<?php echo G4_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid; ?>"><?php echo $row['od_id']; ?></a>
</td>
<td class="td_datetime"><?php echo substr($row['od_time'],0,16); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
<td class="td_bignum"><?php echo display_price($row['od_cart_price'] + $od['od_send_cost'] + $od['od_send_cost2']); ?></td>
<td class="td_bignum"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<td class="td_bignum"><?php echo display_price($row['couponprice']); ?></td>
<td class="td_stat"><?php echo display_price($row['od_receipt_price']); ?></td>
</tr>

View File

@ -41,7 +41,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
</td>
<td><?php echo substr($row['od_time'],0,16); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
<td class="td_num"><?php echo $row['od_cart_count']; ?></td>
<td class="td_bignum"><?php echo display_price($row['od_cart_price'] + $od['od_send_cost'] + $od['od_send_cost2']); ?></td>
<td class="td_bignum"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<td class="td_bignum"><?php echo display_price($row['couponprice']); ?></td>
<td class="td_bignum"><?php echo display_price($row['od_receipt_price']); ?></td>
<td class="td_bignum"><?php echo display_price($row['od_misu']); ?></td>