미수 쿼리를 변경된 옵션기능에 맞게 수정

This commit is contained in:
chicpro
2013-05-28 13:20:23 +09:00
parent 3df6a6e890
commit 185a1ea6ab

View File

@ -32,13 +32,13 @@ if (G4_HTTPS_DOMAIN) {
define(_MISU_QUERY_, "
count(distinct a.od_id) as ordercount, /* 주문서건수 */
count(b.ct_id) as itemcount, /* 상품건수 */
(SUM(b.ct_price * b.ct_qty) + a.od_send_cost) as orderamount , /* 주문합계 */
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_price * b.ct_qty, 0))) as ordercancel, /* 주문취소 */
(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(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, /* 입금취소 */
(
(SUM(b.ct_price * b.ct_qty) + a.od_send_cost) -
(SUM(IF(b.ct_status = '취소' OR b.ct_status = '반품' OR b.ct_status = '품절', b.ct_price * b.ct_qty, 0))) -
(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) -
(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)