Commit 66b9a48f authored by 18083's avatar 18083

佣金付款、月结、合同结束改造

parent bf73a135
......@@ -37,7 +37,7 @@
<!--<bm:field name="bp_vender" expression="(select bp_name from hls_bp_master where bp_id=t1.bp_id_vender and enabled_flag=&apos;Y&apos;)" forInsert="false" forUpdate="false"/>-->
<bm:field name="lease_organization_desc" expression="(select description from hls_lease_organization where lease_organization = t1.lease_organization)" forInsert="false" forUpdate="false"/>
<!--<bm:field name="owner_user_id_n" expression="(select description from sys_user where user_id = t1.created_by)" forInsert="false" forUpdate="false"/>-->
<bm:field name="is_terminate" expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and ccc.cf_item&lt;&gt;0) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and ccc.cf_item&lt;&gt;0)) = 0 THEN &apos;是&apos; ELSE &apos;否&apos; END)" forInsert="false" forUpdate="false"/>
<bm:field name="is_terminate" expression="(CASE WHEN ((select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and ccc.cf_item not in('0','40','911')) - (select sum(ccc.received_amount) from con_contract_cashflow ccc where ccc.contract_id = t1.contract_id AND ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and ccc.cf_item not in('0','40','911') )) = 0 THEN &apos;是&apos; ELSE &apos;否&apos; END)" forInsert="false" forUpdate="false"/>
<bm:field name="amount_total" expression="(select sum(ccc.due_amount) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and ccc.cf_item=1)" forInsert="false" forUpdate="false"/>
<bm:field name="amount_principal" expression="(select sum(nvl(ccc.principal,0)) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status&lt;&gt;&apos;BLOCK&apos;)" forInsert="false" forUpdate="false"/>
<bm:field name="amount_interest" expression="(select sum(nvl(ccc.interest,0)) from con_contract_cashflow ccc where ccc.contract_id=t1.contract_id and ccc.cf_status&lt;&gt;&apos;BLOCK&apos; and cf_item=1)" forInsert="false" forUpdate="false"/>
......@@ -83,6 +83,8 @@
<bm:data-filter enforceOperations="query" expression="t1.contract_status in (&apos;INCEPT&apos;,&apos;ETING&apos;,&apos;REPURING&apos;,&apos;TERMINATING&apos;) "/>
<!-- <bm:data-filter enforceOperations="query" expression="t1.lease_end_date &lt;= sysdate"/> -->
<bm:data-filter enforceOperations="query" expression="t1.data_class = &apos;NORMAL&apos;"/>
<bm:data-filter enforceOperations="query" expression="t1.division != &apos;95&apos;"/>
<!-- <bm:data-filter enforceOperations="query" expression=" not exists (select 1 from con_contract_cashflow ccw where ccw.contract_id = t1.contract_id and ccw.cf_item=1 and ccw.cf_status=&apos;RELEASE&apos; and nvl(ccw.output_tax_create_je_flag,'N')='N')"/>-->
<bm:data-filter enforceOperations="query" expression=" not exists (select 1 from con_contract_cashflow ccw , con_unearned_finance_income cf where ccw.contract_id = t1.contract_id and ccw.cf_item=1 and cf.cashflow_id(+)=ccw.cashflow_id and ccw.cf_status=&apos;RELEASE&apos; and nvl(cf.create_je_flag,'N')='N' and nvl(ccw.output_tax_create_je_flag,'N')='N')"/>
<!-- <bm:data-filter enforceOperations="query" expression="t1.contract_id = ${@contract_id}"/>-->
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-3-27 下午03:50:31
$Revision: 1.0
$Purpose:佣金付款
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1"
baseTable="CSH_PAYMENT_REQ_LN" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select t.contract_id ref_doc_id,
f.cashflow_id ref_doc_line_id,
t.document_category ref_doc_category,
hc.bp_id,
t.bp_id_agent_level1,
t.contract_id,
f.cashflow_id,
t.contract_number,
t.contract_name,
hc.bp_id bp_id_agent_level1,
(select hbm.bp_name from hls_bp_master hbm where hbm.bp_id = hc.bp_id) bp_id_agent_level1_n,
hc.finance_amount,
t.lease_start_date,
hc.overdue_max_days,
hc.comsn_amount amount_agent,
hc.comsn_amount amount,
t.currency currency_code,
(SELECT gc.currency_name
FROM gld_currency_v gc
WHERE gc.currency_code = t.currency) currency_name,
(select to_char(sysdate, 'yyyy-mm') || '-20' from dual) apply_pay_date
FROM con_contract_cashflow f
join con_contract t
on t.contract_id = f.contract_id
join hlcm_comsn_reconcilia hc
on f.cashflow_id = hc.cashflow_id
where EXISTS (SELECT 1
FROM CSH_PAYMENT_CASHFLOW_ID_TEMP tmp
WHERE tmp.session_id = ${/session/@session_id}
AND tmp.cashflow_id = f.cashflow_id)
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-3-26 下午03:42:50
$Revision: 1.0
$Purpose: 对账单查询
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:f="leaf.database.features"
xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select * from(
select hb.batch_number,
hc.batch_id,
hc.policy_hd_id,
hc.bp_id,
(select cc.contract_number
from con_contract cc
where cc.contract_id = hc.contract_id) contract_number,
(select cc.contract_name
from con_contract cc
where cc.contract_id = hc.contract_id) contract_name,
hc.bp_id bp_id_agent_level1,
(select hbm.bp_name from hls_bp_master hbm where hbm.bp_id = hc.bp_id) bp_id_agent_level1_n,
(select h.description
from con_contract cc,hls_division h
where cc.division= h.division and cc.contract_id = hc.contract_id) division_n,
hc.finance_amount,
(select to_char(cc.lease_start_date,'yyyy/mm/dd')
from con_contract cc
where cc.contract_id = hc.contract_id) lease_start_date,
(select cc.business_type
from con_contract cc
where cc.contract_id = hc.contract_id) con_business_type,
(select cc.business_type
from con_contract cc,hls_division hd
where cc.division= hd.division and cc.contract_id = hc.contract_id) con_business_type_n,
hc.rental_re_times,
hc.overdue_max_days,
hc.comsn_rate*100||'%' comsn_rate,
hc.comsn_amount,
(select sum(i.unearned_finance_income)
from con_unearned_finance_income i
where i.contract_id = hc.contract_id) net_interest_amount,
(select ccc.net_due_amount from con_contract_cashflow ccc where ccc.cashflow_id= hc.cashflow_id) net_comm_amount,
hc.cashflow_id,
hc.contract_id,
(select hd.policy_name from hlcm_comsn_policy_hd hd where hd.policy_hd_id=hc.policy_hd_id) policy_name
from hlcm_comsn_reconcilia_batch hb, hlcm_comsn_reconcilia hc
where hb.batch_id = hc.batch_id
and hb.wfl_status='APPROVED'
AND NOT EXISTS (
SELECT 1
FROM csh_payment_req_ln l,csh_payment_req_hd hd
WHERE l.ref_doc_line_id=hc.cashflow_id
AND l.ref_doc_category='CONTRACT'
and l.payment_req_id=hd.payment_req_id
and hd.approval_status in ('NEW','REJECT','APPROVED','APPROVING','RETURN')
)
AND ('Y' = 'Y' AND EXISTS
(SELECT 1
FROM aut_trx_user_authorize a1, aut_owner_user_authorize a2
WHERE a1.trx_category = 'CONTRACT'
AND a1.trx_id = hc.contract_id
AND trunc(SYSDATE) BETWEEN a1.start_date AND
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 trunc(SYSDATE) BETWEEN a2.start_date AND
nvl(a2.end_date, trunc(SYSDATE))))
AND NOT EXISTS (
SELECT 1
FROM csh_payment_req_ln l,csh_payment_req_hd hd
WHERE l.ref_doc_line_id=hc.cashflow_id
AND l.ref_doc_category='CONTRACT'
and l.payment_req_id=hd.payment_req_id
and hd.approval_status in ('NEW','REJECT','APPROVED','APPROVING','RETURN')
)
AND ('Y' = 'Y' AND EXISTS
(SELECT 1
FROM aut_trx_user_authorize a1, aut_owner_user_authorize a2
WHERE a1.trx_category = 'CONTRACT'
AND a1.trx_id = hc.contract_id
AND trunc(SYSDATE) BETWEEN a1.start_date AND
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 trunc(SYSDATE) BETWEEN a2.start_date AND
nvl(a2.end_date, trunc(SYSDATE))))
order by hc.overdue_max_days desc
) t1
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="batch_number"
queryExpression="t1.batch_number like &apos;%&apos;||${@batch_number}||&apos;%&apos;"/>
<bm:query-field name="contract_number"
queryExpression="t1.batch_number like &apos;%&apos;||${@contract_number}||&apos;%&apos;"/>
<bm:query-field name="bp_id_agent_level1_n" queryExpression="t1.bp_id_agent_level1_n like &apos;%&apos;||${@bp_id_agent_level1_n}||&apos;%&apos;"/>
<bm:query-field name="division_n" queryExpression="t1.division_n like &apos;%&apos;||${@division_n}||&apos;%&apos;"/>
<bm:query-field name="policy_name" queryExpression="t1.policy_name=${@policy_name}"/>
<bm:query-field name="overdue_max_days_f" queryExpression="t1.overdue_max_days &gt;= ${@overdue_max_days_f}"/>
<bm:query-field name="overdue_max_days_t" queryExpression="t1.overdue_max_days &lt;= ${@overdue_max_days_t}"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: 18083
$Date:
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select
t.bank_account_id bp_bank_account_id,
t.bank_account_code bp_bank_account_code,
t.bank_account_num bp_bank_account_num,
t.bank_account_name bp_bank_account_name,
t.bank_full_name bp_bank_full_name
from hls_bp_master_bank_account_v t
where t.bp_id = ${/parameter/@bp_id_agent_level1}
and t.enabled_flag = 'Y'
and rownum = 1
]]></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 h.policy_hd_id,
h.policy_name,
h.policy_ext_name,
h.division,
(select d.description
from hls_division d
where d.division = h.division) division_n
from hlcm_comsn_policy_hd h
where h.wfl_status = 'APPROVED'
and h.bp_id = ${@bp_id}) t
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="policy_hd_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="POLICY_HD_ID" prompt="佣金政策id"/>
<bm:field name="policy_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="220" forDisplay="true" forQuery="true" physicalName="POLICY_NAME" prompt="佣金政策"/>
<bm:field name="policy_ext_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="120" forDisplay="true" forQuery="true" physicalName="POLICY_NAME" prompt="佣金政策简称"/>
<bm:field name="division" databaseType="NUMBER" datatype="java.lang.Long" physicalName="DIVISION" prompt="产品线"/>
<bm:field name="division_n" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="160" forDisplay="true" forQuery="true" physicalName="DIVISION_N" prompt="产品线"/>
</bm:fields>
<bm:query-fields>
<bm:query-field field="policy_name" queryExpression="t.policy_name like &apos;%&apos;||${@policy_name}||&apos;%&apos;"/>
<bm:query-field field="policy_ext_name" queryExpression="t.policy_ext_name like &apos;%&apos;||${@policy_ext_name}||&apos;%&apos;"/>
<bm:query-field field="division_n" queryExpression="t.division_n like &apos;%&apos;||${@division_n}||&apos;%&apos;"/>
</bm:query-fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-1-19 上午11:15:04
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
csh_payment_comm_req_pkg.payment_comm_submit
(
p_payment_req_id=>${@payment_req_id},
p_user_id=>${/session/@user_id}
);
end;]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -66,7 +66,7 @@
and l.ref_doc_category = 'CONTRACT'
and l.ref_doc_id = cc.contract_id
and l.ref_doc_line_id = cf.cashflow_id
and cf.cf_item in ('40'))) v #WHERE_CLAUSE#
and cf.cf_item in ('40','911'))) v #WHERE_CLAUSE#
ORDER BY transaction_date DESC, transaction_num
]]></bm:query-sql>
......
......@@ -13,9 +13,13 @@
gld_period_pkg.close_period(${/session/@company_id},
${@period_set_code},
${@period_name},
${/session/@user_id});
${/session/@user_id},
${@p_err_msg});
end;
]]></update-sql>
<parameters>
<parameter name="p_err_msg" dataType="java.lang.String" input="false" output="true" outputPath="@p_err_msg"/>
</parameters>
</operation>
</operations>
</model>
remove_query_field('approval_status_n');
var override_queryfields = [
{
name : 'amount_from',
queryexpression : "T1.amount>=${@amount_from}"
},
{
name : 'amount_to',
queryexpression : "T1.amount<=${@amount_to}"
},
{
name : 'req_date_from',
queryexpression : "T1.req_date>=trunc(to_date(${@req_date_from},'yyyy-mm-dd'))"
},
{
name : 'req_date_to',
queryexpression : "trunc(T1.req_date)<=to_date(${@req_date_to},'yyyy-mm-dd')"
},
{
name:'payment_req_number',
queryexpression:"t1.payment_req_number like '%'||${@payment_req_number}||'%'"
}
{
name : 'amount_from',
queryexpression : "T1.amount>=${@amount_from}"
},
{
name : 'amount_to',
queryexpression : "T1.amount<=${@amount_to}"
},
{
name : 'req_date_from',
queryexpression : "T1.req_date>=trunc(to_date(${@req_date_from},'yyyy-mm-dd'))"
},
{
name : 'req_date_to',
queryexpression : "trunc(T1.req_date)<=to_date(${@req_date_to},'yyyy-mm-dd')"
},
{
name:'payment_req_number',
queryexpression:"t1.payment_req_number like '%'||${@payment_req_number}||'%'"
},
{
name:'approval_status',
queryexpression:"t1.approval_status = ${@approval_status}"
}
];
var add_datafilters = [
{
......
remove_query_field('approval_status_n');
var override_queryfields = [
{
name : 'req_date_from',
queryexpression : "T1.req_date>=trunc(to_date(${@req_date_from},'yyyy-mm-dd'))"
},
{
name : 'req_date_to',
queryexpression : "trunc(T1.req_date)<=to_date(${@req_date_to},'yyyy-mm-dd')"
},
{
name:'payment_req_number',
queryexpression:"t1.payment_req_number like '%'||${@payment_req_number}||'%'"
},
{
name:'approval_status',
queryexpression:"t1.approval_status = ${@approval_status}"
}
];
var add_datafilters = [
{
name : '',
expression : "exists(select 1\n" +
" from csh_payment_req_ln l,con_contract cc,con_contract_cashflow cf\n" +
" where l.payment_req_id = t1.payment_req_id\n" +
" and l.ref_doc_category = 'CONTRACT'\n" +
" and l.ref_doc_id = cc.contract_id\n" +
" and l.ref_doc_line_id = cf.cashflow_id\n" +
" and cf.cf_item in ('911'))"
} ];
add_datafilter();
override();
......@@ -349,5 +349,7 @@ var enableLayoutConfig = {
'modules/hls/HLS303/bp_asset_create.lview':true,
'modules/csh/CSH1500/csh_asset_reconciliation.lview':true,
'modules/csh/CSH501C/csh_payment_asset_create_entrance.lview': true,
'modules/csh/CSH501C/csh_payment_asset_req.lview': true
'modules/csh/CSH501C/csh_payment_asset_req.lview': true,
'modules/csh/CSH501R/csh_payment_comm_create_entrance.lview':true,
'modules/csh/CSH501R/csh_payment_comm_req.lview':true
};
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
trace="true">
<a:init-procedure>
</a:init-procedure>
<a:view>
<a:link id="get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="csh_payment_comm_create_link" url="${/request/@context_path}/modules/csh/CSH501R/csh_payment_comm_selected.lview"/>
<a:link id="csh501_csh_comm_req_link_id"
url="${/request/@context_path}/modules/csh/CSH501R/csh_payment_comm_req.lview"/>
<script type="text/javascript"><![CDATA[
//新增
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var url = $('csh_payment_comm_create_link').getUrl();
var win = new Leaf.Window({
url: url,
params: {
winid: 'csh_payment_req_comm_win_id',
ds_id: ds_id
},
title: '佣金付款申请页面',
id: 'csh_payment_req_comm_win_id',
fullScreen: true
});
win.on('close', function () {
$(ds_id).query();
});
};
function detail_link(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var param = {};
param['payment_req_id'] = record.get('payment_req_id');
param['bp_id'] = record.get('bp_id_agent_level1');
param['business_type'] = record.get('business_type');
param['approval_status'] = record.get('approval_status');
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501D_COMM';
} else{
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY';
param['function_code'] = 'SAVE_COMM';
param['download'] = 'Y';
}
param['winid'] = 'csh_payment_comm_update_window';
param['url_title'] = '佣金付款申请';
hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_comm_req_link_id', ds_id, '${/parameter/@layout_code}');
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'payment_req_number' && value) {
link_function = 'detail_link';
return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + value + '</a>';
}
return value;
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.io);
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
//生成pdf
function wordToPdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
wordToPdf.word2pdf(word_file_path, pdf_file_path_new);
//删除word文件
//deleteFile(word_file_path);
return pdf_file_path_new;
}
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
function transfer(file_path, os) {
println(file_path);
var fis = new FileInputStream(file_path);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function write_os_to_file(file, os) {
var fis = new FileInputStream(file);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
function download_file(file_name, file_path) {
$ctx["__request_type__"] = 'file'; //to indicate this request is not a JSON_REQUEST
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'UTF-8'));
var os = resp.getOutputStream();
//transfer(file_path, os);
write_os_to_file(file_path, os);
os.flush();
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.pdf_path; //file_path = c:/hls_test_files/content_files/
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var datePath = file_path + y + "/" + m + "/";
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/
}
function collection_create_content() {
try {
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var attachment_batch_dl = $bm('hls.HLS811.hls_doc_file_templet_get_atm');
var result = attachment_batch_dl.queryAsMap({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table,
batch_flag: $ctx.parameter.batch_flag,
content_id: $ctx.parameter.content_id
});
var from_file_data = result.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
if (!$ctx.parameter.file_path) {
set_parameter_file_path();
}
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
//if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = datePath + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
try {
$bm('csh.CSH501.csh_transaction_return_print').update({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table
});
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id.toString(), 'COMMON');
} catch (e) {
raise_app_error(e);
}
// word转pdf
var pdf_file_path=to_file_path;
var outputfilepath = wordToPdf(to_file_path,pdf_file_path);
//var outputfilename= record_data.to_file_name +'.pdf';
var filename_str = record_data.to_file_name;
var outputfilename= filename_str.substr(0, filename_str.length - 5) +'.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
}
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'HLS_DOC_FILE_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
source_type: $ctx.parameter.source_type
});
//var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
//HlsFileUtil.downloadFile(encodeURI(to_file_path,'utf-8'),encodeURI(to_file_name,'utf-8'),resp);
//print(outputfilepath.toString());
//print(outputfilename.toString());
download_file(outputfilename.toString(),outputfilepath.toString());
}
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
raise_app_error(e);
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
$ctx.parameter.json = JSON.stringify(result);
}
if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
collection_create_content();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-1-18 上午09:27:36
$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>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
$ctx.parameter.tomcat_source = con_print_path['tomcat_source'];
]]>
</s:server-script>
<a:model-query defaultWhereClause="t1.user_id=${/session/@user_id}" model="basic.sys_session_info"
rootPath="user_name_path"/>
<a:model-query fetchAll="true" model="csh.CSH501R.get_bp_bank_info" rootPath="bank_account_path"/>
<a:model-query autoCount="false"
defaultWhereClause=" document_category=&apos;PAYMENT_REQ&apos; and document_type=&apos;STD_PAYMENT_REQ&apos;"
fetchAll="true" model="hls.HLS003.hls_document_type" rootPath="default_payment_document_type"/>
</a:init-procedure>
<a:view>
<a:link id="csh_payment_comm_req_print_link_id"
url="${/request/@context_path}/modules/csh/CSH501R/csh_payment_comm_pdf.lsc"/>
<a:link id="csh501d_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="con_rd_wfl_link" url="${/request/@context_path}/modules/cont/CON505/con_contract_modify.lview"/>
<!--<a:link id="update_csh_payment_comm_info_link" model="csh.CSH501.csh_payment_req_get_num" modelaction="execute"/>-->
<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
<script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
<script src="${/request/@context_path}/javascripts/jquery-1.6.4.min.js" type="text/javascript"/>
<a:link id="csh_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="csh_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<a:link id="csh_invoice_inf_import_link" model="csh.CSH501C.req_acp_inf_import" modelaction="update"/>
<a:link id="csh_invoice_inf_import_total_link" model="csh.CSH501C.req_acp_inf_import_total" modelaction="update"/>
<script type="text/javascript"><![CDATA[
jQuery.noConflict();
function get_current_amount(amt) {
if (!Ext.isEmpty(amt)) {
return parseFloat(amt).toFixed(2);
} else {
return 0;
}
}
Leaf.onReady(function () {
if ('${/parameter/@source_type}' == 'WFL'||'${/parameter/@source_type}' == 'WFL_N'||'${/parameter/@source_type}' == 'WFL_ACCT') {
if(document.getElementById('${/parameter/@layout_code}_save')){
document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
}
}
if('${/parameter/@maintain_type}' == 'READONLY'){
if(document.getElementById('${/parameter/@layout_code}_save')){
document.getElementById('${/parameter/@layout_code}_save').style.display = "none";
}
}
if('${/parameter/@function_usage}' == 'QUERY'){
if($jq('#${/parameter/@layout_code}_AP_INVOICE_DETAIL_G_ADD_layout_dynamic_button_id')){
$jq('#${/parameter/@layout_code}_AP_INVOICE_DETAIL_G_ADD_layout_dynamic_button_id').hide();
}
if($jq('#${/parameter/@layout_code}_AP_INVOICE_DETAIL_G_DELETE_layout_dynamic_button_id')){
$jq('#${/parameter/@layout_code}_AP_INVOICE_DETAIL_G_DELETE_layout_dynamic_button_id').hide();
}
}
//进项发票信息
var first = document.getElementsByClassName("item-input-wrap");
var second = first[5].getElementsByClassName('item-textField');
var third = second[0];
third.setAttribute('placeholder', '注:扫描时请将鼠标光标放在此处。。。');
third.style.backgroundColor = '#FF7744';
});
function on_csh_payment_req_temp_ln_ds_load(ds) {
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = ds.getAll();
if (!'${/parameter/@payment_req_id}' && lnds_id && '${/parameter/@business_type}' == 'PAYMENT') {
for (var i = 0; i < records.length; i++) {
var record = records[i];
if (!record.get('apply_pay_date')) {
//添加时间为预定的每月20号
var pre_date = [new Date().getFullYear(), new Date().getMonth() + 1, 20].join('-');
record.set('apply_pay_date', pre_date);
}
if (!record.get('bp_bank_account_num')||!record.get('bp_bank_account_name')) {
records[i].set('bp_bank_account_num', '${/model/bank_account_path/record/@bp_bank_account_num}');
records[i].set('bp_bank_account_num_n', '${/model/bank_account_path/record/@bp_bank_account_num}');
records[i].set('bp_bank_full_name', '${/model/bank_account_path/record/@bp_bank_full_name}');
records[i].set('bp_bank_account_name','${/model/bank_account_path/record/@bp_bank_account_name}');
records[i].set('bp_bank_account_id', '${/model/bank_account_path/record/@bp_bank_account_id}');
}
$(lnds_id).create(Ext.apply({}, record.data));
}
}
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
}
function on_csh_payment_req_temp_ln_ds_query(ds, qpara) {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
qpara['payment_bp_id'] = '${/parameter/@payment_bp_id}';
}
//grid加载
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var lnds_id_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
if(lnds_id_ds_id == ds.id &&lnds_id_ds_id){
if ('${/parameter/@source_type}' != 'WFL_ACCT') {
var gridId= ds.bindname+'_layout_grid_id';
$(gridId).hideColumn('sbo_num');
$(gridId).hideColumn('journal_date');
}
}
}
var dirty_flag = 'N';
window['${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
dirty_flag = 'Y';
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
hd_ds = $(hdds_id);
var hdrecord = hd_ds.getCurrentRecord();
var bp_bank_account_name = hdrecord.get('bp_bank_account_name');
var bp_bank_account_id = hdrecord.get('bp_bank_account_id');
var bp_bank_account_num = hdrecord.get('bp_bank_account_num');
var bp_bank_full_name = hdrecord.get('bp_bank_full_name')
var hd_ds, ln_ds, lineRecords, currency_code, currency_name;
if (hdds_id) {
if((name == 'bp_bank_account_num'||name == 'bp_bank_account_name') && !Ext.isEmpty(hdrecord.get('bp_bank_account_num')) && !Ext.isEmpty(hdrecord.get('bp_bank_account_name'))){
if (lnds_id && $L.CmpManager.get(lnds_id)) {
var records = $(lnds_id).getAll();
for (var i = 0; i < records.length; i++) {
records[i].set('bp_bank_account_num', bp_bank_account_num);
records[i].set('bp_bank_full_name', bp_bank_full_name);
records[i].set('bp_bank_account_name', bp_bank_account_name);
records[i].set('bp_bank_account_id', bp_bank_account_id);
}
}
}
//进项票
var acp_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hl_req_payment_acp');
if (name == 'invoice' && value) {
var payment_req_id = hdrecord.get('payment_req_id');
var strs = value.split(',');
var invoice_type = strs[1];
var invoice_code = strs[2];
var invoice_number = strs[3];
var net_amount = strs[4];
var invoice_date = strs[5];
var total_amount =strs[4];
if (strs.length == 9) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('csh_invoice_inf_import_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
net_amount: net_amount,
invoice_date: invoice_date,
payment_req_id:payment_req_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
} else if (strs.length == 8) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('csh_invoice_inf_import_total_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
total_amount: total_amount,
invoice_date: invoice_date,
payment_req_id:payment_req_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
} else if (strs.length == 7) {
//校验重复发票号码 add by 26887cz 2021-09-07
var acr_records = $(acp_ds_id).getAll();
for (var i = 0; i < acr_records.length; i++) {
if (acr_records[i].get("invoice_number") == invoice_number) {
Leaf.showMessage('提示', '发票号码重复,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
return;
}
}
Leaf.request({
url: $('csh_invoice_inf_import_link').getUrl(),
para: {
invoice_type: invoice_type,
invoice_code: invoice_code,
invoice_number: invoice_number,
net_amount: net_amount,
invoice_date: invoice_date,
payment_req_id:payment_req_id
},
success: function () {
Leaf.SideBar.show({
msg: '导入成功',
duration: 2000
}
);
setTimeout(function () {
record.set('invoice', '');
}, 50);
$(acp_ds_id).query();
}, failure: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
error: function () {
setTimeout(function () {
record.set('invoice', '');
}, 50);
},
scope: this
});
}else {
Leaf.showMessage('提示', '发票信息有错误,请重新扫描!');
setTimeout(function () {
record.set('invoice', '');
}, 50);
}
}
}
};
//新增时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_add'] = function (ds, record, config_records, bp_seq) {
record.set("created_by_n", '${/model/user_name_path/record/@user_desc}');
record.set("created_by", '${/session/@user_id}');
record.set("update_date", new Date());
};
function csh_payment_req_submit_finally() {
Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS.ARE_YOU_SURE_TO_SUBMIT}', function okFun() {
window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(ds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
var line_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var line_record = $(line_ds_id).getAt(0);
Leaf.request({
url: '${/request/@context_path}/autocrud/csh.CSH501R.upd_csh_payment_comm_flag/execute',
para: {
payment_req_id: payment_req_id,
_status: 'execute'
},
success: function (res) {
Leaf.SideBar.enable = true;
Leaf.SideBar.show({
msg: '${l:HLS.SUBMIT_SUCCESS}',
duration: 2000
});
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
$('${/parameter/@winid}').close();
},
failure: function () {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
error: function () {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
},
scope: this
});
}, function cancelFun() {
Leaf.SideBar.enable = true;
window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
});
}
//打印
function csh501_print() {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
var url_l = $('csh_payment_comm_req_print_link_id').getUrl() + '?document_id=' + hd_record.get('payment_req_id') + '&document_table=CSH_PAYMENT_REQ_COMM_HD&file_path=${/parameter/@file_path}&batch_flag=Y&source_type=COMMON';
window.open(href = url_l, target = "_self");
}
window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function () {
Leaf.SideBar.enable = false;
window['${/parameter/@layout_code}_SAVE_LAYOUT_DYNAMIC_CLICK'](csh_payment_req_submit_finally);
};
window['${/parameter/@layout_code}_print_layout_dynamic_click'] = function () {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var hd_ds = $(hdds_id),
ln_ds = $(lnds_id);
var hd_record = hd_ds.getCurrentRecord(),
ln_records = ln_ds.getAll();
if (ln_records.length > 0 && !ln_records[0].get('payment_req_ln_id')) {
Leaf.showMessage('${HLS.PROMPT}', '请先保存!');
} else {
csh501_print();
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
if (hdds_id == ds.id && record.isNew) {
if ('${/parameter/@business_type}' == 'PAYMENT') {
record.set('business_type', '${/model/default_payment_document_type/record/@business_type}');
record.set('document_type', '${/model/default_payment_document_type/record/@document_type}');
record.set('document_type_n', '${/model/default_payment_document_type/record/@description}');
record.set('con_business_type', '${/parameter/@con_business_type}');
record.set('con_business_type_n', '${/parameter/@con_business_type_n}');
record.set('taxpayer_type', '${/parameter/@taxpayer_type}');
record.set('taxpayer_type_n', '${/parameter/@taxpayer_type_n}');
record.set('contract_id', '${/parameter/@contract_id}');
}
record.set('bp_id_agent_level1','${/parameter/@bp_id_agent_level1}');
record.set('bp_bank_account_id','${/model/bank_account_path/record/@bp_bank_account_id}');
record.set('bp_bank_account_code','${/model/bank_account_path/record/@bp_bank_account_code}');
record.set('bp_bank_account_num','${/model/bank_account_path/record/@bp_bank_account_num}');
record.set('bp_bank_account_num_n','${/model/bank_account_path/record/@bp_bank_account_num}');
record.set('bp_bank_account_name','${/model/bank_account_path/record/@bp_bank_account_name}');
record.set('bp_bank_full_name','${/model/bank_account_path/record/@bp_bank_full_name}');
}
var head_record = $(hdds_id).getAt(0);
if (hdds_id == ds.id) {
if ('${/parameter/@function_usage}' == 'READONLY') {
} else {
var compensatory_flag = record.get('compensatory_flag');
if (compensatory_flag == 'Y') {
record.getField('las_compensatory_amount').setReadOnly(false);
} else {
record.getField('las_compensatory_amount').setReadOnly(true);
}
}
}
};
//保存前调用
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_before_submit'] = function (ds, record) {
window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
var check_flag = false;
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var ds_line_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
if ($(ds_line_id).data.length <= 0) {
$L.showErrorMessage("错误", '无付款记录,不可提交审批!');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
return;
}
var total_amount_agent = 0;
var total_apply_amount = 0;
var line_datas = $(ds_line_id).data;
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
var amount_agent = get_current_amount(line_data.get('amount_agent'));
var amount = get_current_amount(line_data.get('amount'));
//本次申请金额等于委托加我司加应付承租人金额
total_amount_agent = plus(total_amount_agent, amount_agent);
total_apply_amount = plus(total_apply_amount, amount);
}
//给头表赋值
$(ds_id).getAt(0).set('amount_agent_total', total_amount_agent);
$(ds_id).getAt(0).set('amount', total_apply_amount);
$(ds_id).getAt(0).set('company_id', '${/session/@company_id}');
$(ds_id).getAt(0).set('transaction_category', 'BUSINESS');
$(ds_id).getAt(0).set('submitted_flag', 'N');
$(ds_id).getAt(0).set('printed_flag', 'N');
$(ds_id).getAt(0).set('document_category', 'PAYMENT_REQ');
//确认保存
var hd_record = $(ds_id).getCurrentRecord();
var payment_req_id = hd_record.get('payment_req_id');
if (payment_req_id) {
Leaf.request({
url: $('${/parameter/@layout_code}csh511_csh_payment_req_hd_query').getUrl(),
para: {
payment_req_id: payment_req_id,
},
success: function (res) {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
if (res.result.record.submitted_flag == 'Y' && '${/parameter/@source_type}' != 'WFL_Y') {
Leaf.showMessage('${l:PROMPT}', '该单据已经提交');
check_flag = false;
} else {
check_flag = true;
}
},
error: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
},
failure: function () {
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
check_flag = false;
},
sync: true,
scope: this
});
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
} else {
check_flag = true;
}
return check_flag || false;
};
//合同编号超链接
function open_con_contract_readonly_win(record_id, ds_id) {
var record = $(ds_id).findById(record_id);
var division = record.get('division');
if (!division) {
division = '${/parameter/@division}';
}
var param = record.data;
param.function_code = 'CON3200Q';
param.division = division;
param.function_usage = 'QUERY';
param.maintain_type = 'QUERY';
param.url_title = '${l:CON301.CONTRACT_DETAIL}';
param.winid = 'con_rd_wfl_link_winid';
hls_doc_get_layout_code('csh501d_get_layout_code_link_id', param, 'con_rd_wfl_link', '', '${/parameter/@layout_code}');
}
//上传附件
function upload_csh_file(id,name,record_id,query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record.data['payment_req_id']){
if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY'){
var url = $('csh_downloadFile_id').getUrl() + '?table_name=CSH_PAYMENT_REQ_COMM_HD&header_id=' + record.data['payment_req_id'];
}else{
var url = $('csh_uploadFile_id').getUrl() + '?table_name=CSH_PAYMENT_REQ_COMM_HD&header_id=' + record.data['payment_req_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 () {
});
}else{
Leaf.showMessage('提示','请先保存后再上传附件!');
}
}
//上传发票附件:用于电子档案
function upload_invoice_file(id,name,record_id,query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if(record.data['payment_req_id']){
if (query_only == 'Y' || '${/parameter/@function_usage}' == 'QUERY'){
var url = $('csh_downloadFile_id').getUrl() + '?table_name=HL_COMM_PAYMENT_ACP&header_id=' + record.data['payment_req_id'];
}else{
var url = $('csh_uploadFile_id').getUrl() + '?table_name=HL_COMM_PAYMENT_ACP&header_id=' + record.data['payment_req_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 () {
});
}else{
Leaf.showMessage('提示','请先保存后再上传附件!');
}
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'contract_number'&& value) {
return '<a href="javascript:open_con_contract_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}else if (name == 'attach_link'){
return '<a href=javascript:upload_csh_file(\''+record.id+'\',\''+ name + '\',\'' +record.get('payment_req_id')+'\',\'' + config_record.get('query_only')+'\')>附件上传</a>';
}else if (name == 'invoice_link'){
return '<a href=javascript:upload_invoice_file(\''+record.id+'\',\''+ name + '\',\'' +record.get('payment_req_id')+'\',\'' + config_record.get('query_only')+'\')>发票附件上传</a>';
}
};
]]></script>
<a:link id="${/parameter/@layout_code}csh511_csh_payment_req_hd_query" model="csh.CSH511.csh_payment_req_hd"
modelaction="query"/>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="csh_payment_req_temp_ln_ds" autoQuery="true" fetchAll="true"
model="csh.CSH501R.csh_payment_req_comm_ln_query">
<a:events>
<a:event name="load" handler="on_csh_payment_req_temp_ln_ds_load"/>
<a:event name="query" handler="on_csh_payment_req_temp_ln_ds_query"/>
</a:events>
</a:dataSet>
</a:dataSets>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2024-3-27 上午11:10:19
$Revision: 1.0
$Purpose:佣金支付选择对账单
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
<a:init-procedure>
</a:init-procedure>
<a:view>
<a:link id="csh_payment_comm_cashflow_id_link"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_cashflow_id.lsc"/>
<a:link id="csh501_csh_payment_comm_req_link_id"
url="${/request/@context_path}/modules/csh/CSH501R/csh_payment_comm_req.lview"/>
<a:link id="csh501_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="${/parameter/@layout_code}comm_detail_link"
url="${/request/@context_path}/modules/hls/HLS303/bp_agent_bounty_detail.lview"/>
<a:link id="${/parameter/@layout_code}comsn_recon_detail_link"
url="${/request/@context_path}/modules/csh/CSH551/con_comsn_reconcilia_wfl.lview"/>
<script type="text/javascript"><![CDATA[
function comm_payment_return() {
$('${/parameter/@winid}').close();
$('${/parameter/@ds_id}').query();
}
function comm_req_query() {
$('csh_payment_comm_selectedDs').query();
}
function comm_payment_reset() {
$('csh_payment_req_comm_ds').reset();
}
function comm_confirmFun(){
var a = $('csh_payment_comm_selectedDs').getSelected();
var record = a[0];
var cashflow_id_list = [];
var param = {};
var contract_id_list = [];
if (record == undefined) {
Leaf.showMessage('${l:PROMPT_MESSAGE}', '至少选择一条佣金计提单!', null, 250, 100);
return;
}
if(a.length>490){
Leaf.showMessage('${l:PROMPT_MESSAGE}', '一笔付款选择计提单条数最多不能超过490条!', null, 250, 100);
return;
}
//对是否为同一个代理店进行检查
var bp_id_agent = record.get('bp_id_agent_level1_n');
for (i = 0; i < a.length; i++) {
if (a[i].get('bp_id_agent_level1_n') != bp_id_agent) {
vender_flag = false;
$L.showErrorMessage("提示", '请选择代理店相同的佣金计提单据!');
return;
}
cashflow_id = a[i].get('cashflow_id');
var arr = {};
contract_id_list[i] = a[i].get('contract_id');
arr['_status'] = 'insert';
arr['cashflow_id'] = cashflow_id;
arr['contract_id'] = a[i].get('contract_id');
arr['session_id'] = '${/session/@session_id}';
cashflow_id_list.push(arr);
}
param['details'] = cashflow_id_list;
//存在逾期合同添加弱校验
var flag= false;
for (var j = 0; j < a.length; j++) {
if(a[j].get('overdue_max_days')>0){
var flag= true;
}
}
if (flag){
Leaf.showConfirm('${l:PROMPT}', '当前勾选数据含逾期合同,您是否确定进行支付申请创建?', function () {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: $('csh_payment_comm_cashflow_id_link').getUrl(),
para: param,
success: function () {
if (cashflow_id != '') {
Leaf.Masker.unmask(Ext.getBody());
var param = {};
var query_record = $('csh_payment_req_comm_ds').getCurrentRecord();
param['function_code'] = 'CSH501D_COMM';
param['function_usage'] = 'CREATE';
param['document_category'] = 'PAYMENT_REQ';
param['business_type'] = 'PAYMENT';
param['business_type_n'] = '付款申请';
param['payment_bp_id'] = query_record.get('bp_id_agent_level1');
param['bp_id_agent_level1'] = record.get('bp_id_agent_level1');
param['contract_id'] = record.get('contract_id');
if (a.length == 1) {
param['contract_number'] = record.get('contract_number');
}
param['winid'] = 'csh501_csh_payment_comm_req_link_winid';
param['url_title'] = '付款申请';
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, 'csh501_csh_payment_comm_req_link_id', 'csh_payment_comm_selectedDs');
}
},
failure: function () {
Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}, function () {
Leaf.Masker.unmask(Ext.getBody());
}, null, null);
}else{
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
Leaf.request({
url: $('csh_payment_comm_cashflow_id_link').getUrl(),
para: param,
success: function () {
if (cashflow_id != '') {
Leaf.Masker.unmask(Ext.getBody());
var param = {};
var query_record = $('csh_payment_req_comm_ds').getCurrentRecord();
param['function_code'] = 'CSH501D_COMM';
param['function_usage'] = 'CREATE';
param['document_category'] = 'PAYMENT_REQ';
param['business_type'] = 'PAYMENT';
param['business_type_n'] = '付款申请';
param['payment_bp_id'] = query_record.get('bp_id_agent_level1');
param['bp_id_agent_level1'] = record.get('bp_id_agent_level1');
param['contract_id'] = record.get('contract_id');
if (a.length == 1) {
param['contract_number'] = record.get('contract_number');
}
param['winid'] = 'csh501_csh_payment_comm_req_link_winid';
param['url_title'] = '付款申请';
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, 'csh501_csh_payment_comm_req_link_id', 'csh_payment_comm_selectedDs');
}
},
failure: function () {
Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
}
}
function change_background_color(record) {
if(record.get('overdue_max_days') != 'undefined' && record.get('overdue_max_days') != null && record.get('overdue_max_days') != ''){
if (record.get('overdue_max_days')>0) {
return 'background-color:#fc9492;';
}
}
}
function open_batch_number_readonly_win(record_id, ds_id) {
var record = $(ds_id).findById(record_id);
var batch_id=record.get('batch_id');
var param = record.data;
param.function_code = 'CSH551WFL';
param.function_usage = 'QUERY';
param.maintain_type = 'QUERY';
param.url_title = '佣金计提详情';
param.winid = 'con_comsn_wfl_link_winid';
param['batch_id'] = batch_id;
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, '${/parameter/@layout_code}comsn_recon_detail_link', ds_id, '${/parameter/@layout_code}');
}
function open_policy_detail_readonly_win(record_id, ds_id){
var record = $(ds_id).findById(record_id);
var policy_hd_id=record.get('policy_hd_id');
var bpId=record.get('bp_id_agent_level1');
var param = {};
param['function_code'] = 'HLS303_BD';
param['function_usage'] = 'QUERY';
param['maintain_type'] = 'READONLY'
param['url_title'] = '佣金政策维护';
param['policy_hd_id'] = policy_hd_id;
param['bp_id'] = bpId;
hls_doc_get_layout_code('csh501_get_layout_code_link_id', param, '${/parameter/@layout_code}comm_detail_link', ds_id, '${/parameter/@layout_code}');
}
function comm_req_detail_renderer(value, record, name) {
if (name == 'batch_number' && value) {
return '<a href="javascript:open_batch_number_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}else if (name == 'policy_name' && value){
return '<a href="javascript:open_policy_detail_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}
}
function headUpdateFunction(dataSet,record,name,value,oldValue){
if(name == 'bp_id'){
$('csh_payment_req_comm_ds').getAt(0).getMeta().getField('policy_name').setLovPara('bp_id',value);
}
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="comm_division_name_ds" loadData="true" model="basic.sys_code_value_v_lease"/>
<a:dataSet id="csh_payment_req_comm_ds" autoCreate="true">
<a:fields>
<a:field name="batch_number"/>
<a:field name="contract_number"/>
<a:field name="bp_id_agent_level1_n" lovGridHeight="300" lovHeight="450" lovLabelWidth="120"
lovService="basic.hls_bp_master_v_for_lov?bp_category=AGENT" lovWidth="600" title="代理店">
<a:mapping>
<a:map from="bp_id" to="bp_id"/>
<a:map from="bp_name" to="bp_id_agent_level1_n"/>
</a:mapping>
</a:field>
<a:field name="bp_id"/>
<a:field name="policy_name" lovGridHeight="300" lovHeight="450" lovLabelWidth="120"
lovService="csh.CSH501R.sys_code_value_v_policy" lovWidth="600" title="佣金政策">
<a:mapping>
<a:map from="policy_id" to="policy_id"/>
<a:map from="policy_name" to="policy_name"/>
<a:map from="policy_ext_name" to="policy_ext_name"/>
<a:map from="division" to="division"/>
<a:map from="division_n" to="division_n"/>
<a:map from="bp_id" to="bp_id"/>
</a:mapping>
</a:field>
<a:field name="division_n" displayField="value_name" options="comm_division_name_ds"
returnField="division" valueField="value_code"/>
<a:field name="overdue_max_days"/>
</a:fields>
<a:events>
<a:event name="update" handler="headUpdateFunction"/>
</a:events>
</a:dataSet>
<a:dataSet id="csh_payment_comm_selectedDs" pageSize="100" autoQuery="true"
model="csh.CSH501R.csh_payment_req_comm_selected" queryDataSet="csh_payment_req_comm_ds"
selectable="true">
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:screenTopToolbar>
<a:screenTitle/>
<a:gridButton click="comm_payment_return" text="退出"/>
<a:gridButton id="comm_receipt_back_id" click="comm_req_query" text="查询"/>
<a:gridButton click="comm_payment_reset" text="重置"/>
<a:gridButton id="comm_receipt_posted_id" click="comm_confirmFun" text="确定"/>
</a:screenTopToolbar>
<a:form column="4" labelWidth="100" marginWidth="40" title="查询条件">
<a:textField name="batch_number" bindTarget="csh_payment_req_comm_ds" prompt="计提单号"/>
<a:textField name="contract_number" bindTarget="csh_payment_req_comm_ds" prompt="合同编号"/>
<a:lov name="bp_id_agent_level1_n" bindTarget="csh_payment_req_comm_ds" prompt="代理店"></a:lov>
<a:lov name="policy_name" bindTarget="csh_payment_req_comm_ds" prompt="佣金政策"/>
<a:comboBox name="division_n" bindTarget="csh_payment_req_comm_ds" prompt="产品线"/>
<a:numberField name="overdue_max_days_f" allowFormat="true" bindTarget="csh_payment_req_comm_ds"
prompt="最新逾期天数从" allowDecimals="false"/>
<a:numberField name="overdue_max_days_t" allowFormat="true" bindTarget="csh_payment_req_comm_ds"
prompt="最新逾期天数到" allowDecimals="false"/>
</a:form>
<a:grid id="csh_payment_commi_maintain_grid_ds" bindTarget="csh_payment_comm_selectedDs" marginHeight="200"
marginWidth="40" navBar="true" rowRenderer="change_background_color">
<a:columns>
<a:column name="batch_number" prompt="计提单号" renderer="comm_req_detail_renderer" width="120"/>
<a:column name="contract_number" prompt="合同编号" width="120"/>
<a:column name="contract_name" prompt="合同名称" width="150"/>
<a:column name="bp_id_agent_level1_n" prompt="代理店"/>
<a:column name="division_n" prompt="产品线"/>
<a:column name="finance_amount" align="right" prompt="融资额" renderer="Leaf.formatMoney" width="100"/>
<a:column name="lease_start_date" renderer="Leaf.formatDate" prompt="租赁开始日" />
<a:column name="rental_re_times" align="center" prompt="租金归还期数" width="100"/>
<a:column name="overdue_max_days" align="center" prompt="最新逾期天数" width="100"/>
<a:column name="policy_name" prompt="佣金政策" renderer="comm_req_detail_renderer" width="150"/>
<a:column name="comsn_rate" align="right" prompt="佣金比例" width="120"/>
<a:column name="comsn_amount" align="right" prompt="佣金金额" renderer="Leaf.formatMoney" width="120"/>
<a:column name="net_comm_amount" align="right" prompt="不含税佣金金额" renderer="Leaf.formatMoney" width="120"/>
<a:column name="net_interest_amount" align="right" prompt="不含税利息总额" renderer="Leaf.formatMoney" width="120"/>
</a:columns>
</a:grid>
</a:screenBody>
</a:view>
</a:screen>
......@@ -86,16 +86,21 @@
Leaf.request({
url: url,
para: record.data,
success: function() {
success: function(args) {
if (args.result.p_err_msg) {
$L.showConfirm('提示', args.result.p_err_msg, function () {
record.set('period_status_code', 'C');
});
} else {
record.set('period_status_code','C');
Leaf.SideBar.enable = true;
Leaf.SideBar.show({
msg: '关闭成功',
duration: 3000
});
}
},
scope: this
});
......
......@@ -351,8 +351,13 @@
Leaf.request({
url: url,
para: record.data,
success: function () {
success: function (args) {
if (args.result.p_err_msg) {
$L.showConfirm('提示', args.result.p_err_msg, function () {
record.set('period_status_code', 'C');
});
} else {
record.set('period_status_code', 'C');
Leaf.SideBar.enable = true;
......@@ -360,7 +365,7 @@
msg: '关闭成功',
duration: 3000
});
}
},
scope: this
});
......
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