|
@@ -0,0 +1,28 @@
|
|
|
+#统计每个月的财务报表
|
|
|
+
|
|
|
+SELECT order_sn,pay_sn,buyer_id,buyer_name,FROM_UNIXTIME(payment_time,'%Y-%d-%m'),order_amount,pd_amount,order_amount-pd_amount,payment_code,trade_no
|
|
|
+from lrlz_order WHERE order_state in (20,30,40)
|
|
|
+ AND refund_state = 0
|
|
|
+ AND payment_time > unix_timestamp(DATE('2016-07-01'))
|
|
|
+ AND payment_time < unix_timestamp(DATE('2016-08-01'));
|
|
|
+
|
|
|
+#统计单月订单
|
|
|
+SELECT sum(order_amount)
|
|
|
+from lrlz_order WHERE order_state in (20,30,40)
|
|
|
+ AND refund_state = 0
|
|
|
+ AND payment_time > unix_timestamp(DATE('2016-07-01'))
|
|
|
+ AND payment_time < unix_timestamp(DATE('2016-08-01'));
|
|
|
+
|
|
|
+#统计各个品牌的数量
|
|
|
+
|
|
|
+SELECT count(distinct CONCAT(goods_commonid)),brand_name AS nc_count
|
|
|
+FROM lrlz_goods as g,lrlz_brand as b
|
|
|
+WHERE g.brand_id = b.brand_id and g.goods_state = '1' AND g.goods_verify = '1'
|
|
|
+group by g.brand_id
|
|
|
+
|
|
|
+#统计库存总价和卖出的商品总价
|
|
|
+SELECT sum(goods_salenum*goods_marketprice),sum(goods_storage * goods_marketprice) FROM `lrlz_goods` WHERE goods_state = '1' AND goods_verify = '1'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|