Commit 404f515e authored by chenzhuo's avatar chenzhuo

现金流查询调整

parent 7003eba6
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
select cc.times, --期数 select cc.times, --期数
to_char(cc.due_date, 'YYYY') due_year, --支付年 to_char(cc.due_date, 'YYYY') due_year, --支付年
to_char(cc.due_date, 'MM-dd') due_year, --支付日期 to_char(cc.due_date, 'MM-dd') due_date, --支付日期
(select h.description from hls_cashflow_item h (select h.description from hls_cashflow_item h
where h.cf_item = cc.cf_item where h.cf_item = cc.cf_item
and h.enabled_flag = 'Y' and h.enabled_flag = 'Y'
...@@ -42,7 +42,10 @@ ...@@ -42,7 +42,10 @@
end) as cf_status_n --支付状态 end) as cf_status_n --支付状态
from con_contract_cashflow cc from con_contract_cashflow cc
where cc.contract_id = ${@contract_id} where cc.contract_id = ${@contract_id}
and cc.cf_item = 1 and ((cc.cf_item = 1 and cc.cf_type in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE'
order by cc.times order by cc.times
]]></bm:query-sql> ]]></bm:query-sql>
</bm:operation> </bm:operation>
......
...@@ -45,9 +45,17 @@ ...@@ -45,9 +45,17 @@
and ci.equipment_type = 'MAIN') modelcd, --机型 and ci.equipment_type = 'MAIN') modelcd, --机型
to_char(t1.lease_start_date, 'yyyy-mm-dd') lease_start_date, --合同开始日期 to_char(t1.lease_start_date, 'yyyy-mm-dd') lease_start_date, --合同开始日期
(select to_char(ccc.due_date,'yyyy-MM-dd') from con_contract_cashflow ccc (select to_char(ccc.due_date,'yyyy-MM-dd') from con_contract_cashflow ccc
where ccc.contract_id = t1.contract_id and ccc.cf_item = 1 where ccc.contract_id = t1.contract_id
and ((ccc.cf_item = 1 and ccc.cf_type in (1,200,250)) or (ccc.cf_item = 11 and ccc.cf_type =11)
or (ccc.cf_item = 8 and ccc.cf_type = 8) or (ccc.cf_item = 9 and ccc.cf_type = 9))
and ccc.cf_direction = 'INFLOW'
and ccc.cf_status = 'RELEASE'
and ccc.times = (select max(cc.times) from con_contract_cashflow cc where cc.contract_id = ccc.contract_id and ccc.times = (select max(cc.times) from con_contract_cashflow cc where cc.contract_id = ccc.contract_id
and ccc.cf_item = 1)) lease_end_date, --合同结束日期 and ((cc.cf_item = 1 and cc.cf_type in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE')
and rownum =1) lease_end_date, --合同结束日期
(select to_char(cc.due_date, 'dd') (select to_char(cc.due_date, 'dd')
from con_contract_cashflow cc from con_contract_cashflow cc
where cc.contract_id = t1.contract_id where cc.contract_id = t1.contract_id
...@@ -65,8 +73,10 @@ ...@@ -65,8 +73,10 @@
(select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00') (select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00')
from con_contract_cashflow cc from con_contract_cashflow cc
where cc.contract_id = t1.contract_id where cc.contract_id = t1.contract_id
and cc.cf_direction = 'INFLOW' and ((cc.cf_item = 1 and cc.cf_type in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
and cc.cf_status = 'RELEASE') due_amount_all --应还总额 or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE') due_amount_all --应还总额
from con_contract t1, con_contract_change_req cr from con_contract t1, con_contract_change_req cr
where t1.data_class = 'NORMAL' where t1.data_class = 'NORMAL'
and t1.sign_contract_status = decode(t1.contract_status,'NEW','SIGN',t1.sign_contract_status) and t1.sign_contract_status = decode(t1.contract_status,'NEW','SIGN',t1.sign_contract_status)
...@@ -106,7 +116,7 @@ ...@@ -106,7 +116,7 @@
and cb.contract_id = t1.contract_id and cb.contract_id = t1.contract_id
and hb.social_code = ${@id_no}))) and hb.social_code = ${@id_no})))
union all union
select t1.contract_id, select t1.contract_id,
t1.ele_flow_id, t1.ele_flow_id,
...@@ -148,15 +158,24 @@ select t1.contract_id, ...@@ -148,15 +158,24 @@ select t1.contract_id,
where ci.contract_id = t1.contract_id where ci.contract_id = t1.contract_id
and ci.equipment_type = 'MAIN') modelcd, --机型 and ci.equipment_type = 'MAIN') modelcd, --机型
to_char(t1.lease_start_date, 'yyyy-mm-dd') lease_start_date, --合同开始日期 to_char(t1.lease_start_date, 'yyyy-mm-dd') lease_start_date, --合同开始日期
(select to_char(ccc.due_date,'yyyy-MM-dd') from con_contract_cashflow ccc (select to_char(ccc.due_date,'yyyy-MM-dd') from con_contract_cashflow ccc
where ccc.contract_id = t1.contract_id and ccc.cf_item = 1 where ccc.contract_id = t1.contract_id
and ((ccc.cf_item = 1 and ccc.cf_type in (1,200,250)) or (ccc.cf_item = 11 and ccc.cf_type =11)
or (ccc.cf_item = 8 and ccc.cf_type = 8) or (ccc.cf_item = 9 and ccc.cf_type = 9))
and ccc.cf_direction = 'INFLOW'
and ccc.cf_status = 'RELEASE'
and ccc.times = (select max(cc.times) from con_contract_cashflow cc where cc.contract_id = ccc.contract_id and ccc.times = (select max(cc.times) from con_contract_cashflow cc where cc.contract_id = ccc.contract_id
and ccc.cf_item = 1)) lease_end_date, --合同结束日期 and ((cc.cf_item = 1 and cc.cf_type in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE')
and rownum =1) lease_end_date, --合同结束日期
(select to_char(cc.due_date, 'dd') (select to_char(cc.due_date, 'dd')
from con_contract_cashflow cc from con_contract_cashflow cc
where cc.contract_id = t1.contract_id where cc.contract_id = t1.contract_id
and cc.times = 1 and cc.cf_item = 1
and cc.cf_item = '1' and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE'
and rownum = 1) due_day, --还款日 and rownum = 1) due_day, --还款日
(NVL(t1.down_payment, 0) + NVL(t1.residual_value, 0) + (NVL(t1.down_payment, 0) + NVL(t1.residual_value, 0) +
NVL(t1.total_rental, 0)) total_sign, --总金额 NVL(t1.total_rental, 0)) total_sign, --总金额
...@@ -169,8 +188,10 @@ select t1.contract_id, ...@@ -169,8 +188,10 @@ select t1.contract_id,
(select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00') (select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00')
from con_contract_cashflow cc from con_contract_cashflow cc
where cc.contract_id = t1.contract_id where cc.contract_id = t1.contract_id
and cc.cf_direction = 'INFLOW' and ((cc.cf_item = 1 and cc.cf_type in (1,200,250)) or (cc.cf_item = 11 and cc.cf_type =11)
and cc.cf_status = 'RELEASE') due_amount_all --应还总额 or (cc.cf_item = 8 and cc.cf_type = 8) or (cc.cf_item = 9 and cc.cf_type = 9))
and cc.cf_direction = 'INFLOW'
and cc.cf_status = 'RELEASE') due_amount_all --应还总额
from con_contract t1 from con_contract t1
where t1.data_class = 'NORMAL' where t1.data_class = 'NORMAL'
and t1.sign_contract_status = decode(t1.contract_status,'NEW','SIGN',t1.sign_contract_status) and t1.sign_contract_status = decode(t1.contract_status,'NEW','SIGN',t1.sign_contract_status)
......
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