浏览代码

Merge branch 'develop' into develop2

hu 1 年之前
父节点
当前提交
a73c4611b4

+ 5 - 1
src/custom/restcontroller/sale/salestarget/SQL/企业-业绩目标完成列表.sql

@@ -63,4 +63,8 @@ from sa_salestarget m
          LEFT JOIN sa_agents t2 on t1.sys_enterpriseid=t2.sys_enterpriseid and t1.siteid=t2.siteid
          LEFT JOIN sys_enterprise_tradefield t3 on t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid
          LEFT JOIN sa_salearea t4 on t3.sa_saleareaid=t4.sa_saleareaid and t3.siteid=t4.siteid
-ORDER BY m.year desc
+         left join (select * from(select  sys_enterpriseid,siteid,DATE_FORMAT(checkdate,'%Y') date,sum(amount) sumamount_year from sa_cashbill where type=1 group by sys_enterpriseid,siteid,DATE_FORMAT(checkdate,'%Y')) t
+                    where  DATE_FORMAT(NOW(), '%Y')=date) t5 on t1.sys_enterpriseid=t5.sys_enterpriseid and t1.siteid=t5.siteid
+         left join (select * from(select  sys_enterpriseid,siteid,DATE_FORMAT(checkdate,'%Y-%m') date,sum(amount) sumamount_currentmonth from sa_cashbill where type=1 group by sys_enterpriseid,siteid,DATE_FORMAT(checkdate,'%Y-%m')) t
+                    where  DATE_FORMAT(NOW(), '%Y-%m')=date) t6 on t1.sys_enterpriseid=t6.sys_enterpriseid and t1.siteid=t6.siteid
+ORDER BY m.year desc,ROUND(ifnull(t6.sumamount_currentmonth,0)/10000,2) desc

+ 1 - 1
src/custom/restcontroller/webmanage/sale/databoard/SQL/销售额统计查询_月份.sql

@@ -1,2 +1,2 @@
-select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,cast(ifnull(sum(if(t2.isclose,t2.deliedqty*t2.price,t2.amount)),0) AS DECIMAL(16,6)) typestatistics  from sa_order t1 inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.siteid=$siteid$ and t1.status not in('新建','提交') and $where$ and t1.checkdate >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)  group by  DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')
+select  DATE_FORMAT(t1.checkdate,'%Y') y,DATE_FORMAT(t1.checkdate,'%m') m,cast(ifnull(sum(if(t2.isclose,t2.deliedqty*t2.price,t2.amount)),0) AS DECIMAL(16,6)) typestatistics  from sa_order t1 inner join sa_orderitems t2 on t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid where t1.siteid=$siteid$ and t1.status not in('新建','提交') and $where$ and year(t1.checkdate) >= year(DATE_SUB(CURDATE(), INTERVAL 1 YEAR))  group by  DATE_FORMAT(t1.checkdate,'%Y'),DATE_FORMAT(t1.checkdate,'%m')