Commit 91a4c6c8 by jianan

新单跟进v2

parent 12cf4403
......@@ -68,8 +68,8 @@
else 0
end as paidRatio,
case when ifnull(sum(ef.hkd_amount), 0) > 0
then round(ifnull(sum(ef.unpaid_amount), 0) / ifnull(sum(ef.hkd_amount), 0) * 100, 2)
else 0
then round(100 - (ifnull(sum(ef.paid_amount), 0) / ifnull(sum(ef.hkd_amount), 0) * 100), 2)
else 100
end as unpaidRatio,
MAX(first_broker.broker_name) as broker,
DATE_ADD(DATE_ADD(MAX(p.effective_date), INTERVAL 2 MONTH), INTERVAL (ef.fortune_period - 1) YEAR) as payoutDate
......@@ -120,8 +120,8 @@
else 0
end as paidRatio,
case when ifnull(ef.hkd_amount, 0) > 0
then round(ifnull(ef.unpaid_amount, 0) / ifnull(ef.hkd_amount, 0) * 100, 2)
else 0
then round(100 - (ifnull(ef.paid_amount, 0) / ifnull(ef.hkd_amount, 0) * 100), 2)
else 100
end as unpaidRatio,
ef.broker as broker,
ef.payout_date as payoutDate
......
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