Commit 461c5ad0 by wenyang Committed by akexiu

1.团队成员活动量得分排序【 1:天;2:周;3:月(不传默认2:周)】

2.团队业绩完成率统计根据该团队下经纪人设置的目标fyc计算
parent fd8c3139
...@@ -1001,8 +1001,50 @@ ...@@ -1001,8 +1001,50 @@
</otherwise> </otherwise>
</choose> </choose>
) targetFyc, ) targetFyc,
0 targetFyp, (select ifnull(sum(t.premium),0) from ag_mkt_leads_goals t where t.practitioner_id=p.id and t.goals_type=1 and t.is_active=1
0 targetCount <choose>
<when test="time == 1">
and t.statistic_time_unit=3
and t.current_year=year(now())
and t.seq_time=month(now())
</when>
<when test="time == 3">
and t.statistic_time_unit=3
and t.current_year=year(now())
and quarter(concat(t.current_year,'-',t.seq_time,'-01'))=quarter(now())
</when>
<when test="time == 4">
and t.statistic_time_unit=1
and t.current_year=year(now())-1
</when>
<otherwise>
and t.statistic_time_unit=1
and t.current_year=year(now())
</otherwise>
</choose>
) targetFyp,
(select ifnull(sum(t.pieces),0) from ag_mkt_leads_goals t where t.practitioner_id=p.id and t.goals_type=1 and t.is_active=1
<choose>
<when test="time == 1">
and t.statistic_time_unit=3
and t.current_year=year(now())
and t.seq_time=month(now())
</when>
<when test="time == 3">
and t.statistic_time_unit=3
and t.current_year=year(now())
and quarter(concat(t.current_year,'-',t.seq_time,'-01'))=quarter(now())
</when>
<when test="time == 4">
and t.statistic_time_unit=1
and t.current_year=year(now())-1
</when>
<otherwise>
and t.statistic_time_unit=1
and t.current_year=year(now())
</otherwise>
</choose>
) targetCount
FROM FROM
((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id) ((ag_acl_practitioner_setting s LEFT JOIN ag_acl_practitioner p ON s.practitioner_id = p.id)
INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code in('S01','C01') ) INNER JOIN ag_acl_customer_fortune f ON f.customer_id = p.customer_id and f.drop_option_code in('S01','C01') )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment