Commit 7b91cc54 authored by wangwei5743's avatar wangwei5743 Committed by 王炜

月结报表

parent 7a2b38d2
...@@ -704,31 +704,61 @@ ...@@ -704,31 +704,61 @@
and ccr.document_type = 'LEASE_CHAG' and ccr.document_type = 'LEASE_CHAG'
and rownum = 1), and rownum = 1),
'否') tenant_change_flag_n, '否') tenant_change_flag_n,
nvl((select '是'
from dual
where not exists (select 1
from con_contract_cashflow ccc
where ccc.cf_item = 1
and ccc.times <= 12
and ccc.contract_id = ct.contract_id
and ccc.write_off_flag != 'FULL'
and ccc.cf_direction = 'INFLOW')
and exists (select 1
from con_contract_cashflow ccc
where ccc.cf_item = 1
and ccc.times = 12
and ccc.contract_id = ct.contract_id
and ccc.write_off_flag = 'FULL'
and ccc.cf_direction = 'INFLOW')),
'否') rental_12_pay_flag,
nvl((select '是' nvl((select '是'
from con_contract_cashflow ccc from con_contract_cashflow ccc
where ccc.cf_item = 1 where ccc.cf_item = 9
and ccc.times = 12 and ccc.cf_direction = 'INFLOW'
and ccc.contract_id = ct.contract_id and ccc.contract_id = ct.contract_id
and ccc.write_off_flag = 'FULL' and (ccc.due_amount > 0 or exists
and ccc.cf_direction = 'INFLOW'), (select 1
'否') rental_12_pay_flag, from CON_CONTRACT_CASE_RECORD cr,
nvl((select '是' CON_CONTRACT_PENALTY_REDUCE pr,
from con_contract_cashflow ccc CON_CONTRACT_PENALTY_INFO pi
where ccc.cf_item = 9 where cr.record_id = pr.record_id
and ccc.cf_direction = 'INFLOW' and pr.penalty_reduce_id = pi.penalty_reduce_id
and ccc.contract_id = ct.contract_id and pr.contract_id = ccc.contract_id
and ccc.due_amount > 0 and pi.penalty_reduce_amount > 0
and rownum = 1), and cr.status = 'APPROVED'))
'否') cf_9_exists_flag, and rownum = 1),
nvl((select '是' '否') cf_9_exists_flag,
from con_contract_cashflow ccc nvl((select '是'
where ccc.cf_item = 9 from con_contract_cashflow ccc
and ccc.cf_direction = 'INFLOW' where ccc.cf_item = 9
and ccc.contract_id = ct.contract_id and ccc.cf_direction = 'INFLOW'
and ccc.due_amount > 0 and ccc.contract_id = ct.contract_id
and ccc.times > 1 and (ccc.due_amount > 0 or exists
and rownum = 1), (select 1
'否') cf_9_notfirsttime_exists_flag from CON_CONTRACT_CASE_RECORD cr,
CON_CONTRACT_PENALTY_REDUCE pr,
CON_CONTRACT_PENALTY_INFO pi,
con_contract_cashflow cf
where cr.record_id = pr.record_id
and pr.penalty_reduce_id = pi.penalty_reduce_id
and pr.contract_id = ccc.contract_id
and pi.penalty_reduce_amount > 0
and cr.status = 'APPROVED'
and pi.cashflow_id = cf.cashflow_id
and cf.times > 1))
and ccc.times > 1
and rownum = 1),
'否') cf_9_notfirsttime_exists_flag
FROM con_contract ct FROM con_contract ct
WHERE ct.contract_status NOT IN ('CANCEL') WHERE ct.contract_status NOT IN ('CANCEL')
AND ct.data_class = 'NORMAL' AND ct.data_class = 'NORMAL'
......
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