Commit 701e80e1 authored by stone's avatar stone

【fix] 应收明细表修改

parent f76fecf0
......@@ -24,7 +24,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0),'FM999,999,999,990.00') up_interest, --上端
to_char(nvl((SELECT cu.interest
to_char(nvl((SELECT SUM(cu.interest)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -41,7 +41,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0),'FM999,999,999,990.00') up_vat_interest, --上端
to_char(nvl((SELECT cu.vat_interest
to_char(nvl((SELECT SUM(cu.vat_interest)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -60,7 +60,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0),'FM999,999,999,990.00') up_net_interest,
to_char(nvl((SELECT cu.unearned_finance_income
to_char(nvl((SELECT SUM(cu.unearned_finance_income)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
......@@ -72,7 +72,7 @@
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) + nvl((SELECT cu.unearned_finance_income
0) + nvl((SELECT SUM(cu.unearned_finance_income)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -81,19 +81,19 @@
),'FM999,999,999,990.00') total_net_interest,
--本期天数
nvl((SELECT cu.weight_factor
nvl((SELECT SUM(cu.weight_factor)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) up_weight_factor,
nvl((SELECT cu.weight_factor
nvl((SELECT SUM(cu.weight_factor)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0) down_weight_factor,
nvl((SELECT cu.total_weight
nvl((SELECT SUM(cu.total_weight)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -104,6 +104,7 @@
WHERE ct.contract_id = cw.contract_id
AND cf_item <> 0
AND ct.contract_id = ${/parameter/@contract_id}
UNION ALL
SELECT '' times,
......@@ -124,7 +125,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)),'FM999,999,999,990.00') up_interest, --上端
to_char(SUM(nvl((SELECT cu.interest
to_char(SUM(nvl((SELECT SUM(cu.interest)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -141,7 +142,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)),'FM999,999,999,990.00') up_vat_interest, --上端
to_char(SUM(nvl((SELECT cu.vat_interest
to_char(SUM(nvl((SELECT SUM(cu.vat_interest)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -159,7 +160,7 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)),'FM999,999,999,990.00') up_net_interest,
to_char(SUM(nvl((SELECT cu.unearned_finance_income
to_char(SUM(nvl((SELECT SUM(cu.unearned_finance_income)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -170,7 +171,7 @@
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0) + nvl((SELECT cu.unearned_finance_income
0) + nvl((SELECT SUM(cu.unearned_finance_income)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......@@ -185,13 +186,13 @@
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 2),
0)) up_weight_factor,
SUM(nvl((SELECT cu.weight_factor
SUM(nvl((SELECT SUM(cu.weight_factor)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
AND cu.seq_in_period = 1),
0)) down_weight_factor,
SUM(nvl((SELECT cu.total_weight
SUM(nvl((SELECT SUM(cu.total_weight)
FROM con_unearned_finance_income cu
WHERE cu.cashflow_id = cw.cashflow_id
AND cu.contract_id = cw.contract_id
......
......@@ -11,13 +11,12 @@
<bm:query-sql><![CDATA[
SELECT *
FROM (SELECT cc.contract_id,
cc.contract_status,
cc.contract_name,
(SELECT pp.project_number
FROM prj_project pp
WHERE pp.project_id = cc.project_id) project_number,
cc.bp_id_tenant,
TO_CHAR(cc.inception_of_lease, 'yyyy-mm-dd') inception_of_lease,
to_char(cc.inception_of_lease, 'yyyy-mm-dd') inception_of_lease,
(SELECT hb.bp_name
FROM hls_bp_master hb, con_contract_bp ccb
WHERE hb.bp_category = 'AGENT'
......@@ -30,7 +29,7 @@
AND enabled_flag = 'Y') bp_id_tenant_desc,
cc.contract_number,
cc.bp_id_agent_level1,
(SELECT bp_name
(SELECT extra_nam
FROM hls_bp_master
WHERE bp_id = cc.bp_id_agent_level1
AND enabled_flag = 'Y') bp_id_agent_desc,
......@@ -39,61 +38,127 @@
FROM sys_user
WHERE user_id = cc.owner_user_id) owner_user_id_desc,
cc.lease_organization,
cc.lease_times,
(SELECT description
FROM hls_lease_organization
WHERE lease_organization = cc.lease_organization
AND enabled_flag = 'Y') lease_organization_desc,
(SELECT a.description value_name
FROM HLS_BUSINESS_TYPE_V a
WHERE A.enabled_flag = 'Y'
AND A.business_type = cc.business_type) business_type_n,
FROM hls_business_type_v a
WHERE a.enabled_flag = 'Y'
AND a.business_type = cc.business_type) business_type_n,
cc.data_class,
(select hd.description
from hls_division hd
where hd.enabled_flag = 'Y'
and hd.division = cc.division) division_n,
(SELECT hd.description
FROM hls_division hd
WHERE hd.enabled_flag = 'Y'
AND hd.division = cc.division) division_n,
cc.division,
con_contract_pkg.get_cus_column(p_contract_id => cc.contract_id,
p_type => 'times') account_due_times, --会计逾期总期数
con_contract_pkg.get_cus_column(p_contract_id => cc.contract_id,
p_type => 'days') account_due_days, --会计逾期总天数
con_contract_pkg.get_cus_column(p_contract_id => cc.contract_id,
p_type => 'amounts') account_due_amount, --会计逾期总金额
(select count(1)
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.overdue_status = 'Y'
and ccc.cf_item = 1
and ccc.write_off_flag <> 'FULL') business_due_times, --营业逾期总期数
contract_item_query_pkg.calc_ac_overdue_times(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) account_due_times,
contract_item_query_pkg.calc_ac_overdue_days(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) account_due_days,
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8, 250)
AND trunc(ccc.due_date) <= trunc(SYSDATE)) -
nvl((SELECT SUM(nvl(gwo.write_off_amount, 0))
FROM gld_write_off gwo
WHERE gwo.reversed_flag = 'N'
AND gwo.contract_id = cc.contract_id
AND gwo.cf_item IN (1, 8, 250)),
0) account_due_amount,
contract_item_query_pkg.calc_business_overdue_times(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) business_due_times,
contract_item_query_pkg.calc_bussiness_overdue_days(p_contract_id => cc.contract_id,
p_calc_date => SYSDATE,
p_user_id => -1) business_due_days,
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.overdue_status = 'Y'
AND ccc.cf_item IN (1, 8)
AND ccc.write_off_flag <> 'FULL') business_due_amount, --营业逾期总金额
(select sum(ccc.overdue_max_days)
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.overdue_status = 'Y'
and ccc.cf_item = 1
and ccc.write_off_flag <> 'FULL') business_due_days, --营业逾期总天数
(select sum(ccc.due_amount - nvl(ccc.received_amount, 0))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.overdue_status = 'Y'
and ccc.cf_item = 1
and ccc.write_off_flag <> 'FULL') business_due_amount, --营业逾期总金额
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_item = 9
AND ccc.write_off_flag <> 'FULL') over_due_amount,
--营业最早逾期的预定支付日
(SELECT to_char(MIN(ccc.due_date),'yyyy-mm-dd')
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.overdue_status = 'Y'
AND ccc.cf_item = 1
AND ccc.write_off_flag <> 'FULL') min_overdue_date,
--营业已收租金
(SELECT SUM(nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_item IN (1, 8, 250)) business_received_amount,
--营业未收租金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_item IN (1, 8, 250)
AND trunc(ccc.due_date) <= trunc(SYSDATE)) business_unreceived_amount,
--会计已收租金
nvl((SELECT SUM(nvl(gwo.write_off_amount, 0))
FROM gld_write_off gwo
WHERE gwo.reversed_flag = 'N'
AND gwo.contract_id = cc.contract_id
AND gwo.cf_item IN (1, 8, 250)),
0) ac_received_amount,
--会计未收租金
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8, 250)
AND trunc(ccc.due_date) <= trunc(SYSDATE)) -
nvl((SELECT SUM(nvl(gwo.write_off_amount, 0))
FROM gld_write_off gwo
WHERE gwo.reversed_flag = 'N'
AND gwo.contract_id = cc.contract_id
AND gwo.cf_item IN (1, 8, 250)),
0) ac_unreceived_amount,
--机型
(SELECT ccli.modelcd
FROM con_contract_lease_item ccli
WHERE ccli.contract_id = cc.contract_id) modelcd,
--机号
(SELECT ccli.machine_number
FROM con_contract_lease_item ccli
WHERE ccli.contract_id = cc.contract_id) machine_number,
to_char(cc.lease_start_date,'yyyy-mm-dd')lease_start_date,
cc.lease_times,
--租金合计
(SELECT SUM(ccc.due_amount)
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8, 250)
AND trunc(ccc.due_date) <= trunc(SYSDATE)) total_due_amount,
cc.contract_status
(select sum(ccc.due_amount-nvl(ccc.received_amount,0))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item =9
and ccc.write_off_flag <> 'FULL') over_due_amount
FROM con_contract cc
where exists (select 1
from con_contract_cashflow ccw
where ccw.contract_id = cc.contract_id
and ccw.overdue_status = 'Y'
and ccw.write_off_flag <> 'FULL')
WHERE EXISTS
(SELECT 1
FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id
AND ccw.overdue_status = 'Y'
AND ccw.write_off_flag <> 'FULL')
AND ('Y' = 'Y' AND EXISTS
(SELECT
1
(SELECT 1
FROM aut_trx_user_authorize a1, aut_owner_user_authorize a2
WHERE a1.trx_category = 'CONTRACT'
AND a1.trx_id = cc.contract_id
......@@ -101,9 +166,13 @@
nvl(a1.end_date, trunc(SYSDATE))
AND a1.user_id = a2.owner_user_id
AND a1.trx_category = a2.trx_category
AND a2.authorized_user_id =${/session/@user_id}
AND a2.authorized_user_id = ${/session/@user_id}
AND trunc(SYSDATE) BETWEEN a2.start_date AND
nvl(a2.end_date, trunc(SYSDATE))))) t1 #WHERE_CLAUSE#
nvl(a2.end_date, trunc(SYSDATE))))) t1
#WHERE_CLAUSE#
]]>
</bm:query-sql>
......
......@@ -276,28 +276,47 @@
marginWidth="30" navBar="true" height="1000">
<a:columns>
<a:column name="contract_number" lock="true" prompt="HLS.CONTRACT_NUMBER"
renderer="CON620_render_contract_dun_grid" width="150"/>
renderer="CON620_render_contract_dun_grid" width="100"/>
<a:column name="contract_name" align="center"
prompt="合同名称" width="120"/><!--<a:column name="bp_id_tenant_desc" lock="true" prompt="承租人名称" renderer="CON620_render_contract_dun_grid" showTitle="true" width="210"/>-->
<a:column name="bp_id_tenant_desc" lock="true" prompt="承租人名称" showTitle="true" width="170"
<a:column name="bp_id_tenant_desc" lock="true" prompt="承租人名称" showTitle="true" width="100"
align="center"/>
<a:column name="bp_id_agent_desc" align="center" prompt="代理店" width="200"/>
<a:column name="business_type_n" align="center" prompt="业务类型" width="60"/>
<a:column name="division_n" align="center" prompt="租赁物" width="60" footerRenderer="summaryRenderer"/>
<a:column name="business_due_times" align="center" prompt="营业逾期总期数"
<a:column name="bp_id_agent_desc" align="center" prompt="代理店" width="100"/>
<a:column name="min_overdue_date" align="center" prompt="预定支付日" width="100" renderer="Leaf.formatDate"/>
<a:column name="business_due_times" align="center" prompt="逾期期数(营业)"
width="100"/>
<a:column name="business_due_days" align="center" prompt="营业逾期总天数"
<a:column name="business_due_days" align="center" prompt="逾期天数(营业)"
width="100"/>
<a:column name="business_due_amount" align="right" prompt="营业逾期总金额" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
<a:column name="business_due_amount" align="right" prompt="逾期金额(营业)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="over_due_amount" align="right" prompt="违约金" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="account_due_times" align="center" prompt="会计逾期总期数"
<a:column name="business_received_amount" align="right" prompt="已收租金(营业)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="business_unreceived_amount" align="right" prompt="未收租金(营业)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="account_due_times" align="center" prompt="逾期期数(会计)"
width="100"/>
<a:column name="account_due_days" align="center" prompt="逾期天数(会计)"
width="100"/>
<a:column name="account_due_days" align="center" prompt="会计逾期总天数"
<a:column name="account_due_amount" align="right" prompt="逾期金额(会计)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="account_due_amount" align="right" prompt="会计逾期总金额" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
<a:column name="ac_received_amount" align="right" prompt="已收租金(会计)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="ac_unreceived_amount" align="right" prompt="未收租金(会计)" renderer="Leaf.formatMoney" footerRenderer="summaryRenderer"
width="100"/>
<a:column name="business_type_n" align="center" prompt="业务类型" width="60"/>
<a:column name="division_n" align="center" prompt="租赁物" width="60" footerRenderer="summaryRenderer"/>
<a:column name="modelcd" align="center" prompt="机型" width="100"/>
<a:column name="machine_number" align="center" prompt="机器号码" width="100"/>
<a:column name="lease_start_date" align="center" prompt="租赁开始日" width="100"/>
<a:column name="lease_times" align="center" prompt="期数" width="100"/>
<a:column name="total_due_amount" align="right" prompt="租金合计" width="100" renderer="Leaf.formatMoney"/>
<!-- <a:column name="contract_status" align="center" prompt="合同状态" width="100"/>-->
</a:columns>
</a:grid>
</a:screenBody>
......
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