|
@@ -1,6 +1,6 @@
|
|
|
-select ifnull(t2.sa_promotionid,0) sa_promotionid,sum(t1.amount) sumamount from sa_orderitems t1
|
|
|
+select ifnull(t2.sa_promotionid,0) sa_promotionid,sum(if(t2.status='手工关闭',ifnull(t1.deliedqty,0)*t1.price,t1.amount)) sumamount from sa_orderitems t1
|
|
|
inner join sa_order t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid
|
|
|
left join sa_promotion t3 on t2.sa_promotionid=t3.sa_promotionid and t2.siteid=t3.siteid
|
|
|
- where t1.siteid=$siteid$ and t2.`status` in('审核','关闭') and t2.sys_enterpriseid=$sys_enterpriseid$
|
|
|
+ where t1.siteid=$siteid$ and t2.`status` in('审核','关闭','手工关闭') and t2.sys_enterpriseid=$sys_enterpriseid$
|
|
|
AND DATE_FORMAT( t3.enddate, '%Y-%m-%d' )>= DATE_FORMAT( t2.submitdate, '%Y-%m-%d' )
|
|
|
AND DATE_FORMAT( t3.begdate, '%Y-%m-%d' )<= DATE_FORMAT( t2.submitdate, '%Y-%m-%d' ) group by ifnull(t2.sa_promotionid,0)
|