Commit 78d1f4fd authored by 18083's avatar 18083

经租付款改造

parent 87880cd4
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
modelaction="update"/> modelaction="update"/>
<a:link id="csh501_csh_payment_req_link1_id" <a:link id="csh501_csh_payment_req_link1_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/> url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/>
<a:link id="csh501_csh_payment_req_op_link1_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_op_req.lview"/>
<a:link id="delete_payment_req_link_id" model="csh.CSH501.delete_payment_req" modelaction="batch_update"/> <a:link id="delete_payment_req_link_id" model="csh.CSH501.delete_payment_req" modelaction="batch_update"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
Leaf.onReady(function () { Leaf.onReady(function () {
...@@ -227,6 +229,8 @@ ...@@ -227,6 +229,8 @@
function detail_link(id, name, query_only) { function detail_link(id, name, query_only) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name]; 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 ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
//跳转根据产品线区分经营性租赁 18083 2023/10/10
var division_diff = record.get('division_diff');
var param = {}; var param = {};
param['payment_req_id'] = record.get('payment_req_id'); param['payment_req_id'] = record.get('payment_req_id');
param['document_category'] = record.get('document_category'); param['document_category'] = record.get('document_category');
...@@ -246,7 +250,16 @@ ...@@ -246,7 +250,16 @@
} else if (record.get('business_type') == 'PREPAYMENT') { } else if (record.get('business_type') == 'PREPAYMENT') {
param['function_code'] = 'CSH501_PRE_D'; param['function_code'] = 'CSH501_PRE_D';
} }
if(division_diff=='95'){
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501H_OP';
} else {
param['function_usage'] = 'QUERY';
param['function_code'] = 'CSH501Q_OP';
param['download'] = 'Y';
}
}else{
if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') { if (record.get('approval_status') == 'NEW' || record.get('approval_status') == 'RETURN' || record.get('approval_status') == 'REJECT') {
param['function_usage'] = 'UPDATE'; param['function_usage'] = 'UPDATE';
param['function_code'] = 'CSH501D'; param['function_code'] = 'CSH501D';
...@@ -255,6 +268,7 @@ ...@@ -255,6 +268,7 @@
param['function_code'] = 'CSH501Q'; param['function_code'] = 'CSH501Q';
param['download'] = 'Y'; param['download'] = 'Y';
} }
}
param['winid'] = 'csh_payment_update_window'; param['winid'] = 'csh_payment_update_window';
param['url_title'] = '付款申请'; param['url_title'] = '付款申请';
if (record.get('ln_cf_item') == 0) { if (record.get('ln_cf_item') == 0) {
...@@ -262,9 +276,12 @@ ...@@ -262,9 +276,12 @@
} else { } else {
param['cond_para1'] = 'OTHER'; param['cond_para1'] = 'OTHER';
} }
if(division_diff=='95'){
hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_payment_req_op_link1_id', ds_id, '${/parameter/@layout_code}');
}else{
hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_payment_req_link1_id', ds_id, '${/parameter/@layout_code}'); hls_doc_get_layout_code('get_layout_code_link_id', param, 'csh501_csh_payment_req_link1_id', ds_id, '${/parameter/@layout_code}');
} }
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) { 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; window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-28 下午03:50:31
$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 rownum, v.*
from (select
(select cc.contract_number
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(c.project_id)) contract_number,
(select cc.search_term_1
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(c.project_id)) vender_contract_number,
(select pp.project_number from prj_project pp where pp.project_id=c.project_id) project_number,
c.contract_id,
c.bp_id_tenant,
c.project_id,
(select b.bp_name
from con_contract_bp b
where b.contract_id = c.contract_id
and b.bp_category = 'TENANT') bp_id_tenant_n,
hbm.bp_name,
(select cph.payment_req_number
from csh_payment_req_hd cph
where cpr.payment_req_id = cph.payment_req_id) payment_req_number,
cpr.ref_doc_line_id cashflow_id,
(select times
from con_contract_cashflow ccc
where ccc.cashflow_id = cpr.ref_doc_line_id) times,
(select ccc.due_amount
from con_contract_cashflow ccc
where ccc.cashflow_id = cpr.ref_doc_line_id) due_amount,
(select description
from hls_cashflow_item hci, con_contract_cashflow ccc
where hci.cf_item = ccc.cf_item
and hci.cf_type = ccc.cf_type
and ccc.cashflow_id = cpr.ref_doc_line_id) CF_DESCRIPTION,
cpr.vender_name vender_name,
cpr.vender_bank_account_id,
cpr.vender_bank_account_number vender_bank_account_number,
cpr.vender_bank_account_number vender_bank_account_number_n,
cpr.vender_bank_account_name vender_bank_account_name,
cpr.vender_bank_full_name vender_bank_full_name,
cpr.amount,
c.lease_item_amount,
--发票状态
acp_invoice_pkg.return_invoice_status(p_contract_id => c.contract_id) invoice_status_n,
(SELECT gc.currency_name
FROM gld_currency_v gc
WHERE gc.currency_code = cpr.currency_code) currency_name,
cpr.payment_req_ln_id,
cpr.payment_req_id,
cpr.payment_req_ln_type,
cpr.ref_doc_id,
cpr.ref_doc_line_id,
cpr.ref_doc_category,
c.division,
(select pp.ref_d10 from prj_project pp where pp.project_id=c.project_id) due_date,
(select count(*)
from prj_project_lease_item pp
where pp.project_id=c.project_id
) lease_item_count,
(select nvl(sum(nvl(pp.ACTUAL_PRICE, 0) * nvl(pp.BALLOON_RATIO,0)),0)
from prj_project_lease_item pp
where pp.project_id=c.project_id
) insurance_fee,
cpr.insurance_fee_ddct
from csh_payment_req_ln cpr,
con_contract c,
hls_bp_master hbm,
con_contract_cashflow ccc
where cpr.ref_doc_category = 'CONTRACT'
and c.contract_id = cpr.ref_doc_id
and hbm.bp_id = c.bp_id_tenant
AND ccc.contract_id = c.contract_id
AND ccc.cf_item = 0) v
#WHERE_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:data-filters>
<bm:data-filter enforceOperations="query" expression="v.payment_req_id =${@payment_req_id}"/>
</bm:data-filters>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-9-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 t.contract_id,
--con_contract_pkg.get_first_contract_id(t.project_id) contract_id,
(select cc.contract_number
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_number,
(select cc.search_term_1
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) vender_con_number,
(select cc.contract_status
from con_contract cc
where cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_status,
(select sc.code_value_name
from con_contract cc, sys_code_values_v sc
where sc.code_value = cc.contract_status
and sc.code = 'CON500_CONTRACT_STATUS'
and cc.contract_id =
con_contract_pkg.get_first_contract_id(t.project_id)) contract_status_desc,
f.cashflow_id,
f.times,
t.bp_id_tenant,
hbm.bp_id tenant_bp_id,
h.description cf_item_desc,
h.cf_item,
f.due_amount,
--发票状态
acp_invoice_pkg.return_invoice_status(p_contract_id => t.contract_id) invoice_status_n,
to_char(f.due_date, 'yyyy-mm-dd') due_date,
nvl(f.received_amount, 0) received_amount,
nvl(f.due_amount, 0) - nvl(f.received_amount, 0) residual_amount,
(nvl((SELECT SUM(l.amount_paid)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND nvl(h.closed_flag, 'N') = 'Y'),
0) +
nvl((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVED'
AND nvl(h.closed_flag, 'N') <> 'Y'),
0) +
nvl((SELECT SUM(l.amount)
FROM csh_payment_req_ln l, csh_payment_req_hd h
WHERE l.ref_doc_line_id = f.cashflow_id
AND l.payment_req_id = h.payment_req_id
AND h.submitted_flag = 'Y'
AND h.approval_status = 'APPROVING'),
0)) applied_pay_amount,
(select pp.project_number
from prj_project pp
where pp.project_id = t.project_id) project_number,
(select bp.bp_name
from hls_bp_master bp, prj_project p
where bp.bp_id = p.bp_id_tenant
and p.project_id = t.project_id) vender_name_n,
(select nvl(sum(li.ACTUAL_PRICE), 0)
from prj_project_lease_item li
where li.project_id = t.project_id) lease_item_amount,
(select count(1)
from prj_project_lease_item li
where li.project_id = t.project_id) lease_item_count,
(select to_char(p.ref_d10, 'yyyy-mm-dd')
from prj_project p
where p.project_id = t.project_id) plan_order_date,
(SELECT nvl(sum(nvl(li.ACTUAL_PRICE, 0) *
nvl(li.BALLOON_RATIO, 0)),
0)
from prj_project_lease_item li
where li.project_id = t.project_id) insurance_fee
FROM con_contract_cashflow f,
hls_cashflow_item h,
hls_bp_master hbm,
con_contract t
WHERE t.contract_id = f.contract_id
and t.bp_id_tenant = hbm.bp_id(+)
AND f.cf_item = h.cf_item(+)
AND h.cf_direction(+) = 'OUTFLOW'
AND f.write_off_flag <> 'FULL'
AND f.cf_status IN ('RELEASE', 'BLOCK')
AND f.cf_direction = 'OUTFLOW'
and t.business_type = 'OTHERS'
and t.document_type = 'PUR_ORDER'
and t.division='95'
AND nvl(t.contract_status,'NEW') = 'INCEPT'
AND NOT EXISTS(SELECT 1
FROM csh_payment_req_ln l, csh_payment_req_hd hd
WHERE l.ref_doc_line_id = f.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 t.data_class = 'NORMAL'
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 = con_contract_pkg.get_first_contract_id(t.project_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 f.cf_item in (0)) t1
#WHERE_CLAUSE#
#ORDER_BY_CLAUSE#
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="project_number"
queryExpression="t1.project_number like &apos;%&apos;||${@project_number}||&apos;%&apos;"/>
<bm:query-field name="plan_order_date_from"
queryExpression="t1.plan_order_date &gt;= ${@plan_order_date_from}"/>
<bm:query-field name="plan_order_date_to"
queryExpression="t1.plan_order_date &lt;= ${@plan_order_date_to}"/>
<bm:query-field name="lease_item_amount"
queryExpression="t1.due_amount&gt;=${@lease_item_amount}"/>
<bm:query-field name="vender_con_number" queryExpression="t1.vender_con_number=${@vender_con_number}"/>
<bm:query-field name="invoice_status_n"
queryExpression="t1.invoice_status_n like &apos;%&apos;||${@invoice_status_n}||&apos;%&apos;"/>
<bm:query-field name="contract_number" queryExpression="t1.contract_number=${@contract_number}"/>
</bm:query-fields>
</bm:model>
<?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 {
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>
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