order 테이블에 주문금액 등 기록되도록 수정

This commit is contained in:
chicpro
2013-09-10 15:55:58 +09:00
parent 3d4ccc4505
commit b5313b7bde
21 changed files with 385 additions and 631 deletions

View File

@ -27,21 +27,9 @@ if (G4_HTTPS_DOMAIN) {
// 테이블 a 는 주문서 ($g4[shop_order_table])
// 테이블 b 는 장바구니 ($g4[shop_cart_table])
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 + a.od_send_cost2) 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_amount + a.od_receipt_point) as receiptamount, /* 입금합계 */
(a.od_refund_amount + a.od_cancel_card) as receiptcancel, /* 입금취소 */
(
(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 + a.od_send_cost2 - a.od_send_coupon) -
(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_amount + a.od_receipt_point) +
(a.od_refund_amount + a.od_cancel_card) -
(SUM(b.cp_amount) + a.od_coupon)
) as misu /* 미수금 = 주문합계 - 주문취소 - DC - 입금합계 + 입금취소 - 쿠폰합계 */");
( od_cart_amount + od_send_cost + od_send_cost2 - od_cart_coupon - od_coupon - od_send_coupon - od_receipt_amount - od_cancel_amount ) as misu,
( od_cart_coupon + od_coupon + od_send_coupon ) as couponamount
");
//------------------------------------------------------------------------------
// 쇼핑몰 상수 모음 끝
//------------------------------------------------------------------------------
@ -59,6 +47,13 @@ define('G4_SHOP_SKIN_URL', G4_URL .'/'.G4_SKIN_DIR.'/shop/'.$default['de_shop_
define('G4_MSHOP_SKIN_PATH', G4_MOBILE_PATH.'/'.G4_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
define('G4_MSHOP_SKIN_URL', G4_MOBILE_URL .'/'.G4_SKIN_DIR.'/shop/'.$default['de_shop_mobile_skin']);
// 주문상태 상수
define('G4_OD_STATUS_ORDER' , '입금확인중');
define('G4_OD_STATUS_SETTLE' , '결제완료');
define('G4_OD_STATUS_READY' , '배송준비중');
define('G4_OD_STATUS_DELIVERY' , '배송중');
define('G4_OD_STATUS_FINISH' , '배송완료');
//==============================================================================
// 쇼핑몰 필수 실행코드 모음 끝
//==============================================================================

View File

@ -474,4 +474,14 @@ if(!sql_query(" select de_settle_min_point from {$g4['shop_default_table']} ", f
ADD `de_settle_point_unit` int(11) NOT NULL DEFAULT '0' AFTER `de_settle_max_point`,
DROP `de_point_per` ", true);
}
// 주문 금액 등의 필드 추가
if(!sql_query(" select od_cart_count from {$g4['shop_order_table']} limit 1 ", false)) {
sql_query(" ALTER TABLE `{$g4['shop_order_table']}`
ADD `od_cart_count` int(11) NOT NULL DEFAULT '0' AFTER `od_memo`,
ADD `od_cart_amount` int(11) NOT NULL DEFAULT '0' AFTER `od_cart_count`,
ADD `od_cart_coupon` int(11) NOT NULL DEFAULT '0' AFTER `od_cart_amount`,
ADD `od_cancel_amount` int(11) NOt NULL DEFAULT '0' AFTER `od_receipt_amount`,
ADD `od_status` varchar(255) NOT NULL DEFAULT '' AFTER `od_mod_history` ", true);
}
?>