Commit e6b65a17 authored by lizhe's avatar lizhe

佣金资管报表合并调整

parent 6e5136f9
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false"> <bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:fields>
<bm:field name="period_name" forQuery="true" forDisplay="true" physicalName="period_name" prompt="期间"/>
</bm:fields>
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
SELECT T1.PERIOD_NAME period_name select* from( select p.period_name
FROM GLD_PERIOD_STATUS_V t1 from gld_periods p
WHERE company_id =1 where p.period_set_code = 'STD_PERIOD' and p.adjustment_flag= 'N' and p.period_name>'2015-13'
AND adjustment_flag = 'N' order by p.internal_period_num)t #WHERE_CLAUSE#
--AND T1.END_DATE<=SYSDATE
ORDER BY start_date DESC
]]> ]]>
</bm:query-sql> </bm:query-sql>
</bm:operation> </bm:operation>
</bm:operations> </bm:operations>
<bm:query-fields>
<bm:query-field name="period_name" queryExpression="t.period_name like &apos;%&apos;||${@period_name}||&apos;%&apos;"/>
</bm:query-fields>
</bm:model> </bm:model>
...@@ -3,16 +3,8 @@ ...@@ -3,16 +3,8 @@
<bm:operations> <bm:operations>
<bm:operation name="query"> <bm:operation name="query">
<bm:query-sql><![CDATA[ <bm:query-sql><![CDATA[
SELECT * SELECT *
FROM (select cc.contract_id, FROM (select cc.contract_id,
(select times
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item = 1
and ccc.cf_direction = 'INFLOW'
and ccc.cf_status = 'RELEASE'
and ccc.due_date >= gp.start_date
and ccc.due_date < gp.end_date + 1) times,
--合同编号 --合同编号
cc.contract_number, cc.contract_number,
--承租人名称 --承租人名称
...@@ -35,9 +27,7 @@ ...@@ -35,9 +27,7 @@
--租赁物 --租赁物
(select v.code_value_name (select v.code_value_name
from sys_code_values_v v from sys_code_values_v v
where v.code_enabled_flag = 'Y' where v.code = 'DIVISION'
and v.code_value_enabled_flag = 'Y'
and v.code = 'DIVISION'
and v.code_value = cc.division) division_desc, and v.code_value = cc.division) division_desc,
--利息总额 --利息总额
case case
...@@ -69,6 +59,7 @@ ...@@ -69,6 +59,7 @@
end Received_Interest, end Received_Interest,
--期间 --期间
gp.internal_period_num, gp.internal_period_num,
gp.period_name,
--当期不可列支佣金(不含税) --当期不可列支佣金(不含税)
(SELECT ce.income_tax_amount (SELECT ce.income_tax_amount
FROM con_unearned_comsn_income ce FROM con_unearned_comsn_income ce
...@@ -80,7 +71,13 @@ ...@@ -80,7 +71,13 @@
WHERE ce.contract_id = cc.contract_id WHERE ce.contract_id = cc.contract_id
and ce.internal_period_num = gp.internal_period_num) income_tax_diff_amount, and ce.internal_period_num = gp.internal_period_num) income_tax_diff_amount,
--当期资产管理费(不含税) --当期资产管理费(不含税)
(select SUM(round(ccc.due_amount / 1.06, 2)) (select SUM(round(ccc.due_amount /
(nvl((select hf.vat_rate
from hl_asset_manage_fee hf
where hf.cashflow_id = ccc.cashflow_id),
nvl(hlcm_monthend_je_pkg.get_acp_rate(cc.bp_id_agent_level1),
0.06)) + 1),
2))
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.due_date >= gp.start_date and ccc.due_date >= gp.start_date
...@@ -99,7 +96,13 @@ ...@@ -99,7 +96,13 @@
AND ce.internal_period_num = AND ce.internal_period_num =
gp.internal_period_num), gp.internal_period_num),
0) + 0) +
COALESCE((SELECT SUM(ROUND(ccc.due_amount / 1.06, 2)) COALESCE((SELECT SUM(ROUND(ccc.due_amount /
(nvl((select hf.vat_rate
from hl_asset_manage_fee hf
where hf.cashflow_id = ccc.cashflow_id),
nvl(hlcm_monthend_je_pkg.get_acp_rate(cc.bp_id_agent_level1),
0.06)) + 1),
2))
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.due_date >= gp.start_date AND ccc.due_date >= gp.start_date
...@@ -109,16 +112,21 @@ ...@@ -109,16 +112,21 @@
2) sum_asset_commission, 2) sum_asset_commission,
--当期收入合计 --当期收入合计
(SELECT sum(ce.UNEARNED_FINANCE_INCOME) (SELECT sum(ce.UNEARNED_FINANCE_INCOME)
FROM CON_UNEARNED_FINANCE_INCOME ce, FROM CON_UNEARNED_FINANCE_INCOME ce
con_contract_cashflow ccc
WHERE ce.contract_id = cc.contract_id WHERE ce.contract_id = cc.contract_id
and ccc.contract_id = cc.contract_id
and ce.internal_period_num = gp.internal_period_num) UNEARNED_FINANCE_INCOME, and ce.internal_period_num = gp.internal_period_num) UNEARNED_FINANCE_INCOME,
--不含税佣金 --不含税佣金
case case
when gp.internal_period_num = when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((SELECT sum(NVL(round(ccw.due_amount / 1.06, 2), 0)) nvl((SELECT sum(NVL(round(ccw.due_amount /
(nvl((select hf.vat_rate
from hl_asset_manage_fee hf
where hf.cashflow_id = ccw.cashflow_id),
nvl(hlcm_monthend_je_pkg.get_acp_rate(cc.bp_id_agent_level1),
0.06)) + 1),
2),
0))
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.cf_item = 911 and ccw.cf_item = 911
...@@ -146,7 +154,7 @@ ...@@ -146,7 +154,7 @@
case case
when gp.internal_period_num = when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
(select to_char(ccc.due_date, 'yyyy-mm-dd') (select to_char(ccc.last_received_date, 'yyyy-mm-dd')
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.cf_item = 911) and ccc.cf_item = 911)
...@@ -158,25 +166,40 @@ ...@@ -158,25 +166,40 @@
when gp.internal_period_num = when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
(SELECT INVOICE_NUMBER (SELECT INVOICE_NUMBER
FROM hlcm_monthly_report_temp htp, FROM hlcm_monthly_report_temp htp
con_contract_cashflow ccc WHERE htp.contract_id = cc.contract_id)
WHERE htp.contract_id = cc.contract_id
and ccc.contract_id = cc.contract_id
and ccc.cf_item = 911)
else else
null null
end commission_invoice_number, end commission_invoice_number,
--含税资产管理费 --含税资产管理费
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
(select SUM(round(ccc.due_amount, 2)) (select SUM(round(ccc.due_amount, 2))
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.cf_item = 40) sum_asset_due_amount, and ccc.cf_item = 40)
else
null
end sum_asset_due_amount,
--不含税资产管理费 --不含税资产管理费
nvl((select SUM(round(ccc.due_amount / 1.06, 2)) case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((select SUM(round(ccc.due_amount /
(nvl((select hf.vat_rate
from hl_asset_manage_fee hf
where hf.cashflow_id = ccc.cashflow_id),
nvl(hlcm_monthend_je_pkg.get_acp_rate(cc.bp_id_agent_level1),
0.06)) + 1),
2))
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.cf_item = 40), and ccc.cf_item = 40),
0) sum_asset_not_due_amount 0)
else
null
end sum_asset_not_due_amount
from con_contract cc, gld_periods gp from con_contract cc, gld_periods gp
where cc.data_class = 'NORMAL' where cc.data_class = 'NORMAL'
and gp.adjustment_flag != 'Y' and gp.adjustment_flag != 'Y'
...@@ -193,8 +216,10 @@ ...@@ -193,8 +216,10 @@
and exists (select 1 and exists (select 1
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.cf_item in (40, 911))) t1 and ccc.cf_item in (40, 911))) t1 #WHERE_CLAUSE#
#WHERE_CLAUSE# order By t1.contract_number,t1.internal_period_num
]]> ]]>
</bm:query-sql> </bm:query-sql>
</bm:operation> </bm:operation>
...@@ -206,7 +231,9 @@ ...@@ -206,7 +231,9 @@
queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/> queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
<bm:query-field name="agent_name" <bm:query-field name="agent_name"
queryExpression="t1.agent_name like &apos;%&apos;||${@agent_name}||&apos;%&apos;"/> queryExpression="t1.agent_name like &apos;%&apos;||${@agent_name}||&apos;%&apos;"/>
<bm:query-field name="period_name_from" queryExpression="internal_period_num &gt;= TO_NUMBER(TO_CHAR(TO_DATE(${@period_name_from}, 'YYYY-MM'), 'YYYYMM'))"/> <bm:query-field name="period_name_from"
<bm:query-field name="period_name_to" queryExpression="internal_period_num &lt;= TO_NUMBER(TO_CHAR(TO_DATE(${@period_name_to}, 'YYYY-MM'), 'YYYYMM'))"/> queryExpression="t1.period_name &gt;= nvl(${@period_name_from},t1.period_name)"/>
<bm:query-field name="period_name_to"
queryExpression="t1.period_name &lt;= nvl(${@period_name_to},t1.period_name)"/>
</bm:query-fields> </bm:query-fields>
</bm:model> </bm:model>
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
function rpt7100_asset_commission_split_query() { function rpt7100_asset_commission_split_query() {
if(Ext.isEmpty($('rpt_rpt7100_query_ds').getCurrentRecord().get('period_name_from'))){
Leaf.showMessage('提示', '请选择“期间从”进行查询');
return;
}
$('asset_commission_split_ds').query(); $('asset_commission_split_ds').query();
} }
...@@ -34,14 +38,14 @@ ...@@ -34,14 +38,14 @@
function asset_link(value, record, name) { function asset_link(value, record, name) {
if (name == 'sum_asset_not_due_amount') { if (name == 'sum_asset_due_amount' && !Ext.isEmpty(value)) {
return '<a href="javascript:asset_contract_number_link(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>'; return '<a href="javascript:asset_contract_number_link(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
} }
} }
function asset_contract_number_link(ds_id, id) { function asset_contract_number_link(ds_id, id) {
console.log(ds_id); // console.log(ds_id);
console.log(id); // console.log(id);
var loan_contract_ds_id = 'asset_commission_split_ds'; var loan_contract_ds_id = 'asset_commission_split_ds';
var record = $(loan_contract_ds_id).findById(id); var record = $(loan_contract_ds_id).findById(id);
var param = {}; var param = {};
...@@ -64,13 +68,23 @@ ...@@ -64,13 +68,23 @@
<a:field name="contract_number"/> <a:field name="contract_number"/>
<a:field name="bp_name"/> <a:field name="bp_name"/>
<a:field name="agent_name"/> <a:field name="agent_name"/>
<a:field name="period_name_from" displayField="period_name" options="rpt7100_period_name_ds" <!-- <a:field name="period_name_from" displayField="period_name" options="rpt7100_period_name_ds"-->
returnField="period_name_from" valueField="period_name"/> <!-- returnField="period_name_from" valueField="period_name" required="true"/>-->
<a:field name="period_name_to" displayField="period_name" options="rpt7100_period_name_ds" <!-- <a:field name="period_name_to" displayField="period_name" options="rpt7100_period_name_ds"-->
returnField="period_name_to" valueField="period_name"/> <!-- returnField="period_name_to" valueField="period_name"/>-->
<a:field name="period_name_from" required="true" lovGridHeight="300" lovHeight="500" lovService="rpt.RPT7100.get_period_name" lovWidth="500" title="GLD_PERIODS.PERIOD_NAME">
<a:mapping>
<a:map from="period_name" to="period_name_from"/>
</a:mapping>
</a:field>
<a:field name="period_name_to" lovGridHeight="300" lovHeight="500" lovService="rpt.RPT7100.get_period_name" lovWidth="500" title="GLD_PERIODS.PERIOD_NAME">
<a:mapping>
<a:map from="period_name" to="period_name_to"/>
</a:mapping>
</a:field>
</a:fields> </a:fields>
</a:dataSet> </a:dataSet>
<a:dataSet id="asset_commission_split_ds" autoQuery="true" pageSize="10" <a:dataSet id="asset_commission_split_ds" autoQuery="false" autoPageSize="true"
queryUrl="${/request/@context_path}/autocrud/rpt.RPT7100.rpt_asset_commission_split/query" queryUrl="${/request/@context_path}/autocrud/rpt.RPT7100.rpt_asset_commission_split/query"
queryDataSet="rpt_rpt7100_query_ds"> queryDataSet="rpt_rpt7100_query_ds">
...@@ -88,14 +102,14 @@ ...@@ -88,14 +102,14 @@
<a:textField name="contract_number" bindTarget="rpt_rpt7100_query_ds" <a:textField name="contract_number" bindTarget="rpt_rpt7100_query_ds"
prompt="合同编号"/> prompt="合同编号"/>
<a:textField name="bp_name" bindTarget="rpt_rpt7100_query_ds" prompt="承租人"/> <a:textField name="bp_name" bindTarget="rpt_rpt7100_query_ds" prompt="承租人"/>
<a:comboBox name="period_name_from" bindTarget="rpt_rpt7100_query_ds" prompt="期间从"/> <a:lov name="period_name_from" bindTarget="rpt_rpt7100_query_ds" prompt="期间从"/>
<a:comboBox name="period_name_to" bindTarget="rpt_rpt7100_query_ds" prompt="期间到"/> <a:lov name="period_name_to" bindTarget="rpt_rpt7100_query_ds" prompt="期间到"/>
<a:textField name="agent_name" bindTarget="rpt_rpt7100_query_ds" prompt="代理店简称"/> <a:textField name="agent_name" bindTarget="rpt_rpt7100_query_ds" prompt="代理店简称"/>
</a:form> </a:form>
<a:grid id="asset_commission_split_id" bindTarget="asset_commission_split_ds" marginHeight="170" <a:grid id="asset_commission_split_id" bindTarget="asset_commission_split_ds" marginHeight="170"
marginWidth="30" navBar="true"> marginWidth="30" navBar="true">
<a:columns> <a:columns>
<a:column name="times" align="center" prompt="期数" width="130"/> <!-- <a:column name="times" align="center" prompt="期数" width="130"/>-->
<a:column name="contract_number" align="center" prompt="合同编号" width="130"/> <a:column name="contract_number" align="center" prompt="合同编号" width="130"/>
<a:column name="bp_code" align="center" prompt="承租人编号" width="130"/> <a:column name="bp_code" align="center" prompt="承租人编号" width="130"/>
<a:column name="bp_name" align="center" prompt="承租人" width="130"/> <a:column name="bp_name" align="center" prompt="承租人" width="130"/>
...@@ -104,7 +118,7 @@ ...@@ -104,7 +118,7 @@
<a:column name="division_desc" align="center" prompt="租赁物" width="130"/> <a:column name="division_desc" align="center" prompt="租赁物" width="130"/>
<a:column name="interest" align="center" prompt="合同利息总额" width="130"/> <a:column name="interest" align="center" prompt="合同利息总额" width="130"/>
<a:column name="received_interest" align="center" prompt="已核销利息总额" width="130"/> <a:column name="received_interest" align="center" prompt="已核销利息总额" width="130"/>
<a:column name="internal_period_num" align="center" prompt="期间" width="130"/> <a:column name="period_name" align="center" prompt="期间" width="130"/>
<a:column name="income_tax_amount" align="center" prompt="当期可列支佣金(不含税)" width="200"/> <a:column name="income_tax_amount" align="center" prompt="当期可列支佣金(不含税)" width="200"/>
<a:column name="income_tax_diff_amount" align="center" prompt="当期不可列支佣金(不含税)" width="200"/> <a:column name="income_tax_diff_amount" align="center" prompt="当期不可列支佣金(不含税)" width="200"/>
<a:column name="asset_not_due_amount" align="center" prompt="当期资产管理费(不含税)" width="200"/> <a:column name="asset_not_due_amount" align="center" prompt="当期资产管理费(不含税)" width="200"/>
...@@ -114,8 +128,8 @@ ...@@ -114,8 +128,8 @@
<a:column name="commission_due_amount" align="center" prompt="含税佣金" width="130"/> <a:column name="commission_due_amount" align="center" prompt="含税佣金" width="130"/>
<a:column name="commission_due_date" align="center" prompt="佣金支付日期" width="130"/> <a:column name="commission_due_date" align="center" prompt="佣金支付日期" width="130"/>
<a:column name="commission_invoice_number" align="center" prompt="佣金发票号码" width="130"/> <a:column name="commission_invoice_number" align="center" prompt="佣金发票号码" width="130"/>
<a:column name="sum_asset_due_amount" align="center" prompt="不含税资产管理费" width="130"/> <a:column name="sum_asset_not_due_amount" align="center" prompt="不含税资产管理费" width="130"/>
<a:column name="sum_asset_not_due_amount" align="center" prompt="含税资产管理费" width="130" <a:column name="sum_asset_due_amount" align="center" prompt="含税资产管理费" width="130"
renderer="asset_link"/> renderer="asset_link"/>
</a:columns> </a:columns>
</a:grid> </a:grid>
......
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