Commit a749a6ba authored by 陆正友's avatar 陆正友 Committed by lizhe

佣金资管报表合并

parent dfc40be9
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT T1.PERIOD_NAME period_name
FROM GLD_PERIOD_STATUS_V t1
WHERE company_id =1
AND adjustment_flag = 'N'
--AND T1.END_DATE<=SYSDATE
ORDER BY start_date DESC
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT *
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,
--承租人名称
(select hbm.bp_name
from hls_bp_master hbm
where hbm.bp_id = cc.bp_id_tenant) bp_name,
--承租人编号
(select hbm.bp_code
from hls_bp_master hbm
where hbm.bp_id = cc.bp_id_tenant) bp_code,
--经销商名称
(select hbm.extra_nam
from hls_bp_master hbm
where hbm.bp_id = cc.bp_id_agent_level1) agent_name,
--经销商编号
(select hbm.bp_code
from hls_bp_master hbm
where hbm.bp_id = cc.bp_id_agent_level1) agent_code,
cc.division,
--租赁物
(select v.code_value_name
from sys_code_values_v v
where v.code_enabled_flag = 'Y'
and v.code_value_enabled_flag = 'Y'
and v.code = 'DIVISION'
and v.code_value = cc.division) division_desc,
--利息总额
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((SELECT sum(ccw.interest)
FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id
and ccw.cf_item = 1
and ccw.cf_direction = 'INFLOW'
and ccw.cf_status = 'RELEASE'),
0)
else
null
end interest,
--已核销利息总额
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((SELECT sum(NVL(ccw.Received_Interest, 0))
FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id
and ccw.cf_item = 1
and ccw.cf_direction = 'INFLOW'
and ccw.cf_status = 'RELEASE'),
0)
else
null
end Received_Interest,
--期间
gp.internal_period_num,
--当期不可列支佣金(不含税)
(SELECT ce.income_tax_amount
FROM con_unearned_comsn_income ce
WHERE ce.contract_id = cc.contract_id
and ce.internal_period_num = gp.internal_period_num) income_tax_amount,
--当期可列支佣金(不含税)
(SELECT ce.income_tax_diff_amount
FROM con_unearned_comsn_income ce
WHERE ce.contract_id = cc.contract_id
and ce.internal_period_num = gp.internal_period_num) income_tax_diff_amount,
--当期资产管理费(不含税)
(select SUM(round(ccc.due_amount / 1.06, 2))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.due_date >= gp.start_date
and ccc.due_date < gp.end_date + 1
and ccc.cf_item = 40) asset_not_due_amount,
--当期费用合计
round((COALESCE((SELECT ce.income_tax_amount
FROM con_unearned_comsn_income ce
WHERE ce.contract_id = cc.contract_id
AND ce.internal_period_num =
gp.internal_period_num),
0) +
COALESCE((SELECT ce.income_tax_diff_amount
FROM con_unearned_comsn_income ce
WHERE ce.contract_id = cc.contract_id
AND ce.internal_period_num =
gp.internal_period_num),
0) +
COALESCE((SELECT SUM(ROUND(ccc.due_amount / 1.06, 2))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.due_date >= gp.start_date
AND ccc.due_date < gp.end_date + 1
AND ccc.cf_item = 40),
0)),
2) sum_asset_commission,
--当期收入合计
(SELECT sum(ce.UNEARNED_FINANCE_INCOME)
FROM CON_UNEARNED_FINANCE_INCOME ce,
con_contract_cashflow ccc
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,
--不含税佣金
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((SELECT sum(NVL(round(ccw.due_amount / 1.06, 2), 0))
FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id
and ccw.cf_item = 911
and ccw.cf_direction = 'OUTFLOW'
and ccw.cf_status = 'RELEASE'),
0)
else
null
end commission_not_due_amount,
--含税佣金
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
nvl((SELECT sum(NVL(round(ccw.due_amount, 2), 0))
FROM con_contract_cashflow ccw
WHERE ccw.contract_id = cc.contract_id
and ccw.cf_item = 911
and ccw.cf_direction = 'OUTFLOW'
and ccw.cf_status = 'RELEASE'),
0)
else
null
end commission_due_amount,
--支付日期
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
(select to_char(ccc.due_date, 'yyyy-mm-dd')
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item = 911)
else
null
end commission_due_date,
--发票号码
case
when gp.internal_period_num =
to_number(to_char(cc.inception_of_lease, 'yyyymm')) then
(SELECT INVOICE_NUMBER
FROM hlcm_monthly_report_temp htp,
con_contract_cashflow ccc
WHERE htp.contract_id = cc.contract_id
and ccc.contract_id = cc.contract_id
and ccc.cf_item = 911)
else
null
end commission_invoice_number,
--含税资产管理费
(select SUM(round(ccc.due_amount, 2))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item = 40) sum_asset_due_amount,
--不含税资产管理费
nvl((select SUM(round(ccc.due_amount / 1.06, 2))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item = 40),
0) sum_asset_not_due_amount
from con_contract cc, gld_periods gp
where cc.data_class = 'NORMAL'
and gp.adjustment_flag != 'Y'
and cc.contract_status not IN ('NEW', 'INCEPT_RETURN', 'CANCEL')
and gp.internal_period_num >=
to_number(to_char(cc.inception_of_lease, 'yyyymm'))
and gp.internal_period_num <=
(select to_number(to_char(MAX(CCC.DUE_DATE), 'yyyymm'))
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item in (1, 200, 250)
and ccc.cf_direction = 'INFLOW'
and ccc.cf_status = 'RELEASE')
and exists (select 1
from con_contract_cashflow ccc
where ccc.contract_id = cc.contract_id
and ccc.cf_item in (40, 911))) t1
#WHERE_CLAUSE#
]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="contract_number"
queryExpression="t1.contract_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
<bm:query-field name="bp_name"
queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
<bm:query-field name="agent_name"
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_to" queryExpression="internal_period_num &lt;= TO_NUMBER(TO_CHAR(TO_DATE(${@period_name_to}, 'YYYY-MM'), 'YYYYMM'))"/>
</bm:query-fields>
</bm:model>
var add_datafilters=[
{
name:'contract_id',
expression:"(t1.contract_id=${/parameter/@contract_id})"
}
];
add_datafilter();
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
: 42492
: 2023-4-17 10:02:07
: 1.0 $
: $
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true" customizationEnabled="true">
<!--初始化-->
<a:init-procedure>
<a:model-query model="rpt.RPT7100.get_period_name" rootPath="gld_periods_combo"/>
</a:init-procedure>
<a:view>
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="asset_fee_detail_link"
url="${/request/@context_path}/modules/rpt/RPT7100/rpt_asset_commission_split_details.lview"/>
<script type="text/javascript"><![CDATA[
function rpt7100_asset_commission_split_query() {
$('asset_commission_split_ds').query();
}
function rpt7100_asset_commission_split_reset() {
$('rpt_rpt7100_query_ds').reset();
}
function rpt7100_asset_commission_split_export() {
$('asset_commission_split_id')._export();
}
function asset_link(value, record, name) {
if (name == 'sum_asset_not_due_amount') {
return '<a href="javascript:asset_contract_number_link(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
}
}
function asset_contract_number_link(ds_id, id) {
console.log(ds_id);
console.log(id);
var loan_contract_ds_id = 'asset_commission_split_ds';
var record = $(loan_contract_ds_id).findById(id);
var param = {};
param['function_code'] = 'RPT7100_QUERY';
param['function_usage'] = 'QUERY';
param['contract_id'] = record.get('contract_id');
param['maintain_type'] = 'UPDATE';
param['url_title'] = '合同资管发票明细';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'asset_fee_detail_link', ds_id);
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="rpt7100_period_name_ds">
<a:datas dataSource="/model/gld_periods_combo"/>
</a:dataSet>
<a:dataSet id="rpt_rpt7100_query_ds" autoCreate="true">
<a:fields>
<a:field name="contract_number"/>
<a:field name="bp_name"/>
<a:field name="agent_name"/>
<a:field name="period_name_from" displayField="period_name" options="rpt7100_period_name_ds"
returnField="period_name_from" valueField="period_name"/>
<a:field name="period_name_to" displayField="period_name" options="rpt7100_period_name_ds"
returnField="period_name_to" valueField="period_name"/>
</a:fields>
</a:dataSet>
<a:dataSet id="asset_commission_split_ds" autoQuery="true" pageSize="10"
queryUrl="${/request/@context_path}/autocrud/rpt.RPT7100.rpt_asset_commission_split/query"
queryDataSet="rpt_rpt7100_query_ds">
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton click="rpt7100_asset_commission_split_query" text="HLS.QUERY"/>
<a:gridButton click="rpt7100_asset_commission_split_reset" text="重置"/>
<a:gridButton click="rpt7100_asset_commission_split_export" text="导出"/>
</a:screenTopToolbar>
<a:form column="4" labelWidth="150" marginWidth="30" title="查询条件">
<a:textField name="contract_number" 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:comboBox name="period_name_to" bindTarget="rpt_rpt7100_query_ds" prompt="期间到"/>
<a:textField name="agent_name" bindTarget="rpt_rpt7100_query_ds" prompt="代理店简称"/>
</a:form>
<a:grid id="asset_commission_split_id" bindTarget="asset_commission_split_ds" marginHeight="170"
marginWidth="30" navBar="true">
<a:columns>
<a:column name="times" 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_name" align="center" prompt="承租人" width="130"/>
<a:column name="agent_code" align="center" prompt="代理店编号" width="130"/>
<a:column name="agent_name" 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="received_interest" align="center" prompt="已核销利息总额" width="130"/>
<a:column name="internal_period_num" align="center" prompt="期间" width="130"/>
<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="asset_not_due_amount" align="center" prompt="当期资产管理费(不含税)" width="200"/>
<a:column name="sum_asset_commission" align="center" prompt="当期费用合计" width="130"/>
<a:column name="unearned_finance_income" align="center" prompt="当期收入合计" width="130"/>
<a:column name="commission_not_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_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"
renderer="asset_link"/>
</a:columns>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: 38823
$Date: 2023-01-24
$Revision: 1.0
$purpose: 资产管理费报表明细
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:init-procedure>
</a:init-procedure>
<a:view>
<a:link id="csh_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function() {
debugger;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_write_off');
$(ds_id).setQueryParameter('contract_id','${/parameter/@contract_id}');
$(ds_id).query();
if('${/parameter/@winid}' == 'open_asset_check_id'){
var gridId= 'CON_ASSET_FEE_DETAIL_S_ASSET_GRID_csh_write_off_layout_grid_id';
$(gridId).hideColumn('write_off_type_desc');
$(gridId).hideColumn('write_off_date');
$(gridId).hideColumn('write_off_amount');
$(gridId).hideColumn('payment_date');
$(gridId).hideColumn('payment_amount');
$(gridId).hideColumn('creade_by');
}
});
//附件
function upload_csh_file(id,record_id) {
debugger;
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record_id == "undefined"){
var url = $('csh_downloadFile_id').getUrl();
}else {
url = $('csh_downloadFile_id').getUrl() + '?table_name=CSH_PAYMENT_REQ_ASSET_HD&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'csh_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
//record.ds.query();
});
}
//发票附件
function upload_invoice_file(id,record_id) {
debugger;
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record_id == "undefined"){
var url = $('csh_downloadFile_id').getUrl();
}else {
url = $('csh_downloadFile_id').getUrl() + '?table_name=HL_REQ_PAYMENT_ACP&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'invoice_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
//record.ds.query();
});
}
//超链接渲染
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if(name == 'attachment'){
link_function = 'upload_csh_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.get('payment_req_id') + '\')">' + '附件'+ '</a>';
}
if(name == 'invoice_link'){
link_function = 'upload_invoice_file';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + record.get('payment_req_id') + '\')">' + '发票附件' + '</a>';
}
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
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