if(f.grade_commission_rate is not null,f.grade_commission_rate,'100') as '22' <!--职级率-->,
sum(case when drop_option_code ='C01' then f.referral_amount else null end) as '23' <!--首年销售佣金-->,
sum(case when drop_option_code ='C04' then f.calculation_rate else '' end) as '24' <!--'经纪人月销售加码奖金%'-->,
sum(case when drop_option_code ='C04' then f.referral_amount else '' end) as '25' <!--经纪人月销售加码奖金-->,
sum(case when drop_option_code ='C02' then f.referral_amount else null end) as '26' <!--续年销售佣金-->,
CONVERT(sum(case when drop_option_code ='C01' then f.referral_amount else null end),CHAR) as '23' <!--首年销售佣金-->,
CONVERT(sum(case when drop_option_code ='C04' then f.calculation_rate else '' end),CHAR) as '24' <!--'经纪人月销售加码奖金%'-->,
CONVERT(sum(case when drop_option_code ='C04' then f.referral_amount else '' end),CHAR) as '25' <!--经纪人月销售加码奖金-->,
CONVERT(sum(case when drop_option_code ='C02' then f.referral_amount else null end),CHAR) as '26' <!--续年销售佣金-->,
(SELECT group_concat(a.name)
from ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner a on a.customer_id = t.customer_id
...
...
@@ -865,8 +865,8 @@
and t.id in <foreachcollection="list1"item="item"open="("separator=","close=")">#{item,jdbcType=BIGINT}</foreach>
) as '108' <!-- 'S3育成金额'-->,
sum(case when drop_option_code ='C14' then f.calculation_rate else null end) as '109' <!-- 'C14直接销售加码佣金率'-->,
sum(case when drop_option_code ='C14' then f.referral_amount else null end) as '110' <!-- 'C14直接销售加码佣金'-->,
CONVERT(sum(case when drop_option_code ='C14' then f.calculation_rate else null end),CHAR) as '109' <!-- 'C14直接销售加码佣金率'-->,
CONVERT(sum(case when drop_option_code ='C14' then f.referral_amount else null end),CHAR) as '110' <!-- 'C14直接销售加码佣金'-->,
case(
IF(f.rule_id is null, if(o.settlement_rule_type=1,'简单基本法','标准基本法'),
(select (case settlement_rule_type when 1 then '简单基本法' when 2 then '标准基本法' when 3 then '特殊结算' when 4 then if(o.settlement_rule_type=1,'简单基本法','标准基本法') end)
...
...
@@ -874,7 +874,7 @@
) WHEN '标准基本法' THEN IF((SELECT m.code_code FROM ag_md_code m WHERE m.code_type ='v_3.1_202307' AND o.underwriting_date >= m.code_code) IS NULL , '标准基本法', '2024标准基本法')
WHEN '简单基本法' THEN '简单基本法' WHEN '特殊结算' THEN '特殊结算'
end as '111' <!-- '基本法属性'-->,
sum(case when drop_option_code ='R02' then f.referral_amount else null end) as '112' <!-- 'R02-续年度直接销售拥金(旧)'-->,
CONVERT(sum(case when drop_option_code ='R02' then f.referral_amount else null end),CHAR) as '112' <!-- 'R02-续年度直接销售拥金(旧)'-->,
(SELECT group_concat(t.practitioner_id) from ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner a ON a.customer_id = t.customer_id
WHERE drop_option_code ='R03' AND order_id=f.order_id AND sale_practitioner_id = l.practitioner_id AND a.id=l.mentor_id
...
...
@@ -905,7 +905,7 @@
and t.id in <foreachcollection="list1"item="item"open="("separator=","close=")">#{item,jdbcType=BIGINT}</foreach>
) as '117' <!-- 'R04-S2续期绩效奖金 (2021.06.30以前)'-->,
sum(case when drop_option_code ='S01' then f.referral_amount else null end) as '118' <!-- 'S01-首年度销售佣金'-->,
CONVERT(sum(case when drop_option_code ='S01' then f.referral_amount else null end),CHAR) as '118' <!-- 'S01-首年度销售佣金'-->,
(SELECT GROUP_CONCAT(referral_amount)
FROM ag_acl_customer_fortune t
LEFT JOIN ag_acl_practitioner a ON a.customer_id = t.customer_id
...
...
@@ -913,16 +913,17 @@
and t.id in <foreachcollection="list1"item="item"open="("separator=","close=")">#{item,jdbcType=BIGINT}</foreach>
) as '119' <!-- 'S03-首年度辅导奖金'-->,
sum(case when drop_option_code ='C95' then f.referral_amount else null end) as '120' <!-- '其它税前加扣款1'-->,
sum(case when drop_option_code ='C96' then f.referral_amount else null end) as '121' <!-- '其它税前加扣款2'-->,
sum(case when drop_option_code ='C97' then f.referral_amount else null end) as '122' <!-- '其它税前加扣款3'-->,
sum(case when drop_option_code ='C98' then f.referral_amount else null end) as '123' <!-- '其它税前加扣款4'-->,
sum(case when drop_option_code ='C99' then f.referral_amount else null end) as '124' <!-- '其它'-->,
sum(case when drop_option_code ='C11' then f.referral_amount else null end) as '125' <!-- 'C11-独立经纪人展业津贴'-->,
sum(case when drop_option_code ='D01' then f.referral_amount else null end) as '126' <!-- 'D01-首年渠道服务费'-->,
sum(case when drop_option_code ='D02' then f.referral_amount else null end) as '127' <!-- 'D02-续年渠道服务费'-->,
sum(case when drop_option_code ='D91' then f.referral_amount else null end) as '128' <!-- 'D91-渠道加扣款1'-->,
sum(case when drop_option_code ='D92' then f.referral_amount else null end) as '129' <!-- 'D92-渠道加扣款2'-->,
CONVERT(sum(case when drop_option_code ='C95' then f.referral_amount else null end),CHAR) as '120' <!-- '其它税前加扣款1'-->,
CONVERT(sum(case when drop_option_code ='C96' then f.referral_amount else null end),CHAR) as '121' <!-- '其它税前加扣款2'-->,
CONVERT(sum(case when drop_option_code ='C97' then f.referral_amount else null end),CHAR) as '122' <!-- '其它税前加扣款3'-->,
CONVERT(sum(case when drop_option_code ='C98' then f.referral_amount else null end),CHAR) as '123' <!-- '其它税前加扣款4'-->,
CONVERT(sum(case when drop_option_code ='C99' then f.referral_amount else null end),CHAR) as '124' <!-- '其它'-->,
CONVERT(sum(case when drop_option_code ='C11' then f.referral_amount else null end),CHAR) as '125' <!-- 'C11-独立经纪人展业津贴'-->,
CONVERT(sum(case when drop_option_code ='D01' then f.referral_amount else null end),CHAR) as '126' <!-- 'D01-首年渠道服务费'-->,
CONVERT(sum(case when drop_option_code ='D02' then f.referral_amount else null end),CHAR) as '127' <!-- 'D02-续年渠道服务费'-->,
CONVERT(sum(case when drop_option_code ='D91' then f.referral_amount else null end),CHAR) as '128' <!-- 'D91-渠道加扣款1'-->,
CONVERT(sum(case when drop_option_code ='D92' then f.referral_amount else null end),CHAR) as '129' <!-- 'D92-渠道加扣款2'-->,