Commit 404f515e authored by chenzhuo's avatar chenzhuo

现金流查询调整

parent 7003eba6
......@@ -15,7 +15,7 @@
<bm:query-sql><![CDATA[
select cc.times, --期数
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
where h.cf_item = cc.cf_item
and h.enabled_flag = 'Y'
......@@ -42,7 +42,10 @@
end) as cf_status_n --支付状态
from con_contract_cashflow cc
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
]]></bm:query-sql>
</bm:operation>
......
......@@ -45,9 +45,17 @@
and ci.equipment_type = 'MAIN') modelcd, --机型
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
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.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')
from con_contract_cashflow cc
where cc.contract_id = t1.contract_id
......@@ -65,6 +73,8 @@
(select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00')
from con_contract_cashflow cc
where cc.contract_id = t1.contract_id
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') due_amount_all --应还总额
from con_contract t1, con_contract_change_req cr
......@@ -106,7 +116,7 @@
and cb.contract_id = t1.contract_id
and hb.social_code = ${@id_no})))
union all
union
select t1.contract_id,
t1.ele_flow_id,
......@@ -149,14 +159,23 @@ select t1.contract_id,
and ci.equipment_type = 'MAIN') modelcd, --机型
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
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.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')
from con_contract_cashflow cc
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, --还款日
(NVL(t1.down_payment, 0) + NVL(t1.residual_value, 0) +
NVL(t1.total_rental, 0)) total_sign, --总金额
......@@ -169,6 +188,8 @@ select t1.contract_id,
(select to_char(sum(cc.due_amount), 'FM9,999,999,999,990.00')
from con_contract_cashflow cc
where cc.contract_id = t1.contract_id
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') due_amount_all --应还总额
from con_contract t1
......
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