Commit 566bef77 authored by stone's avatar stone

【fix】租金催收

parent 35808f49
...@@ -80,12 +80,18 @@ ...@@ -80,12 +80,18 @@
p_calc_date => SYSDATE, p_calc_date => SYSDATE,
p_user_id => -1) business_due_days, p_user_id => -1) business_due_days,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) (SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id WHERE ccc.contract_id = cc.contract_id
AND ccc.overdue_status = 'Y' AND ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8,250) AND ccc.cf_item IN (1, 8, 250)
AND ccc.write_off_flag <> 'FULL') business_due_amount, --营业逾期总金额 AND trunc(ccc.due_date) <= trunc(SYSDATE)) -
nvl((SELECT SUM(nvl(cwo.write_off_due_amount, 0))
FROM csh_write_off cwo
WHERE cwo.reversed_flag = 'N'
AND cwo.contract_id = cc.contract_id
AND cwo.cf_item IN (1, 8, 250)),
0) business_due_amount, --营业逾期总金额
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0)) (SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc FROM con_contract_cashflow ccc
...@@ -151,11 +157,12 @@ ...@@ -151,11 +157,12 @@
cc.contract_status cc.contract_status
FROM con_contract cc FROM con_contract cc
WHERE EXISTS WHERE
(SELECT 1 EXISTS (SELECT 1
FROM con_contract_cashflow ccw FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id WHERE ccw.contract_id = cc.contract_id
AND ccw.overdue_status = 'Y' AND TRUNC(ccw.due_date)<=TRUNC(SYSDATE)
AND ccw.due_amount>ccw.received_amount
AND ccw.write_off_flag <> 'FULL') AND ccw.write_off_flag <> 'FULL')
AND ('Y' = 'Y' AND EXISTS AND ('Y' = 'Y' AND EXISTS
(SELECT 1 (SELECT 1
......
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