Commit c1eae854 by jianan

4and5-保单发佣明细报表12

parent 1e09f12d
......@@ -468,8 +468,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' /*个人推荐奖¥*/,
sum(case when drop_option_code ='C15' then f.calculation_rate else null end) '33' /*体系推荐率*/,
sum(case when drop_option_code ='C15' then f.referral_amount else null end) '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.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' /*体系推荐奖金¥*/,
l.mentor_id '35' /*一代辅导人*/,
l.mentor_level '36' /*一代辅导人职级*/,
......@@ -589,10 +589,16 @@
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
) '59' /*S3团队长辅导津贴*/,
l.raise_id '60' /*育成人*/,
l.raise_level '61' /*育成人职级*/,
(SELECT group_concat(calculation_rate) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and practitioner_id = l.raise_id) '62' /*育成奖金率*/,
(SELECT group_concat(referral_amount) from ag_acl_customer_fortune where drop_option_code ='C09' and order_id=f.order_id and practitioner_id = l.raise_id) '63' /*育成金额*/,
(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(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' /*育成金额*/,
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直接销售加码佣金*/,
......@@ -603,8 +609,14 @@
sum(case when drop_option_code ='R01' then f.referral_amount else null end) '69' /*R01-首年度直接销售佣金(旧)*/,
sum(case when drop_option_code ='R02' then f.referral_amount else null end) '70' /*R02-续年度直接销售拥金(旧)*/,
sum(case when drop_option_code ='R03' then f.referral_amount else null end) '71' /*R03-续年度辅导佣金(旧)*/,
sum(case when drop_option_code ='R04' then f.referral_amount else null end) '72' /*R04-续年度绩效奖金(旧)*/,
(SELECT group_concat(CONCAT_WS('-', t.practitioner_id, calculation_rate))
from ag_acl_customer_fortune t
where t.drop_option_code ='R03' and order_id=f.order_id and t.practitioner_id=l.mentor_id
) '71' /*R03-续年度辅导佣金(旧)*/,
(SELECT group_concat(CONCAT_WS('-', t.practitioner_id, calculation_rate))
from ag_acl_customer_fortune t
where t.drop_option_code ='R04' and order_id=f.order_id and t.sale_practitioner_id=l.practitioner_id
) '72' /*R04-续年度绩效奖金(旧)*/,
f.order_id,
l.customer_id
......
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