where t.drop_option_code ='R03' and order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id
LEFT JOIN ag_po_order_commission c on c.id = t.commission_id
where t.drop_option_code ='R03' and t.order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id and c.commission_status='2'
) '27' /*续期辅导奖*/,
sum(case when drop_option_code ='C04' then f.calculation_rate else null end) '28' /*'经纪人月销售加码奖金%'*/,
...
...
@@ -472,8 +475,8 @@
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C05' and practitioner_id = l.introducer_id) '31' /*个人推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C05' and practitioner_id = l.introducer_id) '32' /*个人推荐奖¥*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.practitioner_id) '33' /*体系推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.practitioner_id) '34' /*体系推荐奖金¥*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s1_team_introducer_id) '33' /*S1体系推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s1_team_introducer_id) '34' /*S1体系推荐奖金¥*/,
l.mentor_id '35' /*一代辅导人*/,
l.mentor_level '36' /*一代辅导人职级*/,
...
...
@@ -486,142 +489,148 @@
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C07' and practitioner_id = l.in_mentor_id) '42' /*二代辅导人岗位津贴*/,
LEFT JOIN ag_acl_practitioner a on a.customer_id = t.customer_id
LEFT JOIN ag_acl_practitioner_setting b on b.practitioner_id = a.id
LEFT JOIN ag_md_drop_options op1 ON op1.id = b.practitioner_level
where t.drop_option_code ='C10' and order_id=f.order_id and op1.drop_option_code='S3' and t.sale_practitioner_id=l.practitioner_id
where t.drop_option_code ='C10' and order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id and a.id=l.s3_team_leader_id
) '59' /*S3团队长辅导津贴*/,
(SELECT group_concat(sale_practitioner_id) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '60' /*育成人*/,
(SELECT group_concat(sale_practitioner_id) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '60' /*S1育成人*/,
(SELECT group_concat(op1.drop_option_name)
from ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner a on a.customer_id = t.customer_id
LEFT JOIN ag_acl_practitioner_setting b on b.practitioner_id = a.id
LEFT JOIN ag_md_drop_options op1 ON op1.id = b.practitioner_level
where t.drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id
) '61' /*育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '62' /*育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '63' /*育成金额*/,
) '61' /*S1育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '62' /*S1育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.practitioner_id) '63' /*S1育成金额*/,
sum(case when drop_option_code ='C14' then f.calculation_rate else null end) '64' /*C14直接销售加码佣金率*/,
sum(case when drop_option_code ='C14' then f.referral_amount else null end) '65' /*C14直接销售加码佣金*/,
where t.drop_option_code ='R04' and order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id
LEFT JOIN ag_po_order_commission c on c.id = t.commission_id
where t.drop_option_code ='R04' and t.order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id and c.commission_status='2'
) '72' /*R04-续年度绩效奖金(旧)*/,
l.s1_team_introducer_id '73' /*S1推荐人*/,
l.s2_team_introducer_id '74' /*S2推荐人*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s2_team_introducer_id) '74' /*S2体系推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s2_team_introducer_id) '75' /*S2体系推荐奖金¥*/,
l.s3_team_introducer_id '77' /*S3推荐人*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s3_team_introducer_id) '78' /*S3体系推荐率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where order_id=f.order_id and drop_option_code ='C15' and sale_practitioner_id = l.s3_team_introducer_id) '79' /*S3体系推荐奖金¥*/,
(SELECT group_concat(sale_practitioner_id) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s2_raise_id) '80' /*S2育成人*/,
l.s2_raise_level '81' /*S2育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s2_raise_id) '82' /*S2育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s2_raise_id) '83' /*S2育成金额*/,
(SELECT group_concat(sale_practitioner_id) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s3_raise_id) '84' /*S3育成人*/,
l.s3_raise_level '85' /*S3育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s3_raise_id) '86' /*S3育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and sale_practitioner_id = l.s3_raise_id) '87' /*S3育成金额*/,
sum(case when drop_option_code ='C95' then f.referral_amount else null end) as '88' /*其它税前加扣款1*/,
sum(case when drop_option_code ='C96' then f.referral_amount else null end) as '89' /*其它税前加扣款2*/,
sum(case when drop_option_code ='C97' then f.referral_amount else null end) as '90' /*其它税前加扣款3*/,
sum(case when drop_option_code ='C98' then f.referral_amount else null end) as '91' /*其它税前加扣款4*/,
sum(case when drop_option_code ='C99' then f.referral_amount else null end) as '92' /*其它*/,