| | |
| | | : "ROUND(o.settlement_amount_sum * (:rate_level+0), 2) AS settlement_amount_sum, ROUND(o.settled_amount_sum * (:rate_level+0), 2) AS settled_amount_sum"; |
| | | $sql = "SELECT o.date, o.order_count, o.settlement_amount_sum + O.settled_amount_sum AS amount_sum, 0 AS refund_order, 0.00 AS refund_amount_sum,".$amout. |
| | | " FROM (SELECT *, FROM_UNIXTIME(createtime, '%Y年%m月') AS date, |
| | | count(orderid) AS order_count, |
| | | SUM(CASE WHEN settlement_state = 0 THEN amount ELSE 0 END) AS settlement_amount_sum, |
| | | SUM(CASE WHEN settlement_state = 1 THEN amount ELSE 0 END) AS settled_amount_sum |
| | | COUNT(CASE WHEN type = 3 THEN 1 END) AS order_count, |
| | | SUM(CASE WHEN settlement_state = 0 AND type = 3 THEN amount ELSE 0 END) AS settlement_amount_sum, |
| | | SUM(CASE WHEN settlement_state = 1 AND type = 3 THEN amount ELSE 0 END) AS settled_amount_sum |
| | | FROM ims_site_store_order |
| | | WHERE buyerid IN (SELECT uid FROM ims_users WHERE invitation_code = :invitationCode) AND type = 3 |
| | | ORDER BY date) AS o |