|
|
@@ -171,7 +171,11 @@ public class salestargetstatistics extends Controller {
|
|
|
int befyear = year - 1;
|
|
|
Long sa_saleareaid = content.getLongValue("sa_saleareaid");
|
|
|
|
|
|
- Rows arearows = dbConnect.runSqlQuery("SELECT t1.*,t3.`enterprisename` hospitalname,t2.sa_customersid FROM view_areas t1 " + " INNER JOIN sa_customers t2 ON t2.sa_saleareaid=t1.sa_saleareaid " + " INNER JOIN sys_enterprise t3 ON t3.sys_enterpriseid=t2.sys_enterpriseid " + " WHERE t1.siteid='" + siteid + "' AND t1.parentid= " + sa_saleareaid + " " + " ORDER BY t1.parentid,t1.sa_saleareaid ");
|
|
|
+ Rows arearows = dbConnect.runSqlQuery("SELECT t1.*,t3.`enterprisename` hospitalname,t2.sa_customersid,t4.name salernames FROM view_areas t1 "
|
|
|
+ + " INNER JOIN sa_customers t2 ON t2.sa_saleareaid=t1.sa_saleareaid "
|
|
|
+ + " INNER JOIN sys_enterprise t3 ON t3.sys_enterpriseid=t2.sys_enterpriseid "
|
|
|
+ + " LEFT JOIN sys_datateam t4 ON t4.ownertable='sa_customers' and t4.ownerid=t2.sa_customersid and t4.isleader=1 "
|
|
|
+ + " WHERE t1.siteid='" + siteid + "' AND t1.parentid= " + sa_saleareaid + " " + " ORDER BY t1.parentid,t1.sa_saleareaid ");
|
|
|
|
|
|
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "按医院分组统计订单");
|
|
|
@@ -223,7 +227,14 @@ public class salestargetstatistics extends Controller {
|
|
|
int befyear = year - 1;
|
|
|
Long sa_saleareaid = content.getLongValue("sa_saleareaid");
|
|
|
|
|
|
- Rows arearows = dbConnect.runSqlQuery("SELECT t1.*,t3.enterprisename,t2.sa_agentsid FROM view_areas t1 " + " INNER JOIN sys_enterprise_tradefield t2 ON t2.sa_saleareaid=t1.sa_saleareaid " + " INNER JOIN sys_enterprise t3 ON t3.sys_enterpriseid=t2.sys_enterpriseid " + " WHERE t1.siteid='" + siteid + "' AND t1.parentid= " + sa_saleareaid + " " + " ORDER BY t1.parentid,t1.sa_saleareaid ");
|
|
|
+ Rows arearows = dbConnect.runSqlQuery("SELECT DISTINCT t1.*,t3.enterprisename,t2.sa_agentsid,GROUP_CONCAT(DISTINCT t5.name) salernames FROM view_areas t1 "
|
|
|
+ + " INNER JOIN sys_enterprise_tradefield t2 ON t2.sa_saleareaid=t1.sa_saleareaid "
|
|
|
+ + " INNER JOIN sys_enterprise t3 ON t3.sys_enterpriseid=t2.sys_enterpriseid "
|
|
|
+ + " INNER JOIN sa_agents t4 ON t4.sa_agentsid=t2.sa_agentsid "
|
|
|
+ + " LEFT JOIN sys_hr t5 ON t5.hrid=t2.hrid "
|
|
|
+ + " WHERE t1.siteid='" + siteid + "' AND t1.parentid= " + sa_saleareaid + " and t4.status='启用'"
|
|
|
+ + " GROUP BY t1.sa_saleareaid,t1.parentid,t1.parentareaname,t1.areaname,t1.siteid,t3.enterprisename,t2.sa_agentsid "
|
|
|
+ + " ORDER BY t1.parentid,t1.sa_saleareaid ");
|
|
|
|
|
|
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "按经销商分组统计订单");
|