Commit 685a4805 authored by gzj34291's avatar gzj34291

对账单和催收函转PDF盖章

parent baca385d
package com.hand.kinggrid;
import com.alibaba.fastjson.JSONObject;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.UUID;
import static com.hand.kinggrid.MainRequest.createHttpRequest;
public class ContractSignaturesNew
{
public static String hl_contract_signatures(String file_path, String sign_path, Object[] param,String server_url,String app_id,String app_security,String datePath)
throws IOException, NoSuchAlgorithmException
{
String contractid = UUID.randomUUID().toString().replaceAll("-", "");
HttpRequest request = createHttpRequest("/api/cnt/sign",server_url,app_id,app_security);
InputStream is = null;
String status;
String signer_info;
try
{
File file = new File(file_path);
request.addFile("pdf_file", file);
request.addParam("contract_name", "合同名称");
request.addParam("contract_id", contractid);
request.addParam("biz_id",
UUID.randomUUID().toString().replaceAll("-", ""));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
request.addParam("biz_time", sdf.format(new Date()));
for(int i=0;i<param.length;i++){
signer_info = param[i].toString();
request.addParam("signer_info", signer_info);
}
/*
* if (qf_flag.equalsIgnoreCase("Y")) { request.addParam( "signer_info",
* "[{code:\"hlrzzl\",seal_code:\"9295f56b09124d508079b85f4a1e7e19\",seal_width:151,fontname:\"����\",fontsize:\"50\",fontcolor:\"#FF00FF\",pageno:\"0\",text:\"��ͬӡ��λ��\",qfzstart:\"1\",qfzdistance:\"200\"}]"
* ); } else { request.addParam( "signer_info",
* "[{code:\"hlrzzl\",seal_code:\"9295f56b09124d508079b85f4a1e7e19\",seal_width:151,fontname:\"����\",fontsize:\"50\",fontcolor:\"#FF00FF\",pageno:\"0\",text:\"��ͬӡ��λ��\"}]"
* ); }
*
* if (org_flag.equalsIgnoreCase("Y")) { request.addParam( "signer_info",
* "[{code:\"hlrzzl\",seal_code:\"fdd2f48507cb460fb372be3af2551a71\",seal_width:151,fontname:\"����\",fontsize:\"50\",fontcolor:\"#FF00FF\",pageno:\"0\",text:\"����ӡ��λ��\"}]"
* ); }
*/
request.send();
JSONObject json = JSONObject.parseObject(request.resultToString());
if (json.getInteger("code").intValue() == 1)
{
ContractWithTemplate.downFiles(
json.getJSONArray("record_saved_urls"),
datePath,
server_url,
app_id,
app_security);
status = "SUCCESS";
} else {
status = "FAILURE";
}
}
finally
{
if (is != null) {
is.close();
}
}
return status;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gzj
$Date: 2022年12月8日 17:13:08
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select t.file_name,
to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date,
t.print_id,
(SELECT su.description FROM sys_user su WHERE su.user_id = t.created_by) user_name
from cux_contract_print t
where (((SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019')
and t.created_by = ${/session/@user_id})
or (SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) not in
('0018', '0019'))
and t.contract_id = ${@contract_id}
and t.lease_type = '01'
order by t.print_date desc
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gzj
$Date: 2022年03月20日 17:13:08
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:fields>
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT fa.file_name,fa.file_path
FROM fnd_atm_attachment fa, fnd_atm_attachment_multi fm
WHERE fa.attachment_id = fm.attachment_id
and fm.table_name = 'CUX_CONTRACT_PRINT'
and fm.table_pk_value = ${@record_id}
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:ns2="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
hl_contract_pkg.insert_into_attachment_bmp(
p_file_path =>${@p_file_path},
p_file_name =>${@p_file_name},
p_file_size =>${@p_file_size},
p_user_id =>${@p_user_id},
p_contract_id =>${@p_contract_id},
p_file_type =>${@p_file_type},
p_lease_type =>${@p_lease_type}
);
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2014-11-26 下午04:24:11
$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
faa.file_name,
faa.file_path,
faa.attachment_id
FROM
fnd_atm_attachment_multi fam,
fnd_atm_attachment faa
WHERE fam.table_name = 'CON_CONTRACT_CONTENT' AND
fam.attachment_id = faa.attachment_id AND
fam.table_pk_value = ${@content_id}
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
<bm:field name="attachment_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="ATTACHMENT_ID"/>
<!-- <bm:field name="templet_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TEMPLET_CODE"/>-->
</bm:fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: Yenick
$Date: 2018-06-06 下午04:24:11
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
HL_CONTRACT_PKG.save_pdf_atm(p_content_id =>${@content_id});
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gzj
$Date: 2022年12月8日 17:13:08
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select t.file_name,
to_char(t.print_date,'yyyy-mm-dd hh24:mi:ss') print_date,
t.print_id,
(SELECT su.description FROM sys_user su WHERE su.user_id = t.created_by) user_name
from cux_contract_print t
where (((SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) in ('0018', '0019')
and t.created_by = ${/session/@user_id})
or (SELECT e.role_code
FROM sys_role_vl e
WHERE e.role_id = ${/session/@role_id}) not in
('0018', '0019'))
and t.contract_id = ${@contract_id}
and t.lease_type = '02'
order by t.print_date desc
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: wxm
$Date: 2020-6-08 下午04:24:11
$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 s.signature_code,
s.code,
s.seal_code,
s.seal_width,
s.fontname,
s.fontsize,
s.fontcolor,
s.pageno,
s.word_code,
s.qfzstart,
s.qfzdistance
from CON_CONTRACT_SIGNATURE_CM s
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="signature_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SIGNATURE_CODE"/>
<bm:field name="code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="CODE"/>
<bm:field name="seal_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="SEAL_CODE"/>
<bm:field name="seal_width" databaseType="NUMBER" datatype="java.lang.Long" physicalName="SEAL_WIDTH"/>
<bm:field name="fontname" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FONTNAME"/>
<bm:field name="fontsize" databaseType="NUMBER" datatype="java.lang.Long" physicalName="FONTSIZE"/>
<bm:field name="fontcolor" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FONTCOLOR"/>
<bm:field name="pageno" databaseType="NUMBER" datatype="java.lang.Long" physicalName="PAGENO"/>
<bm:field name="word_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="WORD_CODE"/>
<bm:field name="qfzstart" databaseType="NUMBER" datatype="java.lang.Long" physicalName="QFZSTART"/>
<bm:field name="qfzdistance" databaseType="NUMBER" datatype="java.lang.Long" physicalName="QFZDISTANCE"/>
</bm:fields>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" needAccessControl="false">
<bm:fields>
<bm:field name="server_url" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="app_id" databaseType="VARCHAR2" datatype="java.lang.String"/>
<bm:field name="app_security" databaseType="VARCHAR2" datatype="java.lang.String"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select sys_parameter_pkg.value(p_parameter_code => 'JG_SERVER_URL') server_url,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_ID') app_id,
sys_parameter_pkg.value(p_parameter_code => 'JG_APP_SECURITY') app_security
from dual
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
function set_parameter_file_path(name) {
$ctx.parameter.file_path = '/u01/hls_file/excel/';
}
};
function set_pdf_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
};
......@@ -23,3 +23,6 @@ function set_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
$ctx.parameter.pdf_path = 'D:/u01/hls_file/content_pdf/';
};
function set_pdf_parameter_file_path(name) {
$ctx.parameter.file_path = 'D:/u01/hls_file/excel/';
};
<?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:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script ><![CDATA[
importPackage(Packages.java.util);
importPackage(Packages.java.lang);
importPackage(Packages.com.hand.hl);
importPackage(Packages.java.io);
importPackage(java.io);
try{
var sys_url_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='HLS_SYSTEM_URL';
var SysurlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var sys_url = SysurlQuery.getChildren()[0].parameter_value;
var down_url =sys_url+'con/contract/conExportExcel?contractId=' +$ctx.parameter.contract_id;
println(down_url);
var now = new Date();
y = now.getFullYear();
m = now.getMonth() + 1;
m = m < 10 ? "0" + m : m;
d = now.getDate();
d = d < 10 ? "0" + d : d;
h = now.getHours();
h = h < 10 ? "0" + h : h;
mi = now.getMinutes();
mi = mi < 10 ? "0" + mi : mi;
var f_fileDir = $ctx.parameter.file_path;
var filePath = (f_fileDir + y + "//" + m + "//").toString();
var tranfer_dir= new File(String(filePath));
if(!tranfer_dir.exists()){//如果文件夹不存在,创建文件夹
tranfer_dir.mkdirs();//创建文件夹
}
var contract_number = $ctx.parameter.contract_number;
var file_name = $ctx.parameter.file_name + y + m + d + h + mi + ".xlsx";
var f_fileName = file_name.toString();
var result_flag=DoloadFileByUrl.downloadFile(down_url, filePath, f_fileName);
file_size=get_file_length(filePath+f_fileName);
if(result_flag=true){
var business_daily_email=$bm('cont.CON301N.insert_into_attachment_bmp').update({
p_file_path :(filePath+f_fileName).toString(),
p_file_name :f_fileName,
p_file_size :file_size,
p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id,
p_file_type :'EXCEL',
p_lease_type :'01'
});
}
}catch(e){
raise_app_error(e.message);
}
function get_file_length(path){
var file=new File(String(path));
if(file.exists() && file.isFile()){
length=file.length();
return length;
}else{
return 0 ;
}
}
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter"/>
</a:service>
\ No newline at end of file
<?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:service xmlns:ns1="leaf.application.action" xmlns:p="uncertain.proc" xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script ><![CDATA[
importPackage(Packages.java.util);
importPackage(Packages.java.lang);
importPackage(Packages.com.hand.kinggrid);
importPackage(Packages.com.hand.hl);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.java.io);
importPackage(java.io);
//获取日期目录
var datePath = getDate();
var tranfer_dir= new File(String(datePath));
if(!tranfer_dir.exists()){//如果文件夹不存在,创建文件夹
tranfer_dir.mkdirs();//创建文件夹
}
try{
var sys_url_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='HLS_SYSTEM_URL';
var SysurlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var sys_url = SysurlQuery.getChildren()[0].parameter_value;
var down_url =sys_url+'con/contract/conExportExcel?contractId=' +$ctx.parameter.contract_id;
var now = new Date();
y = now.getFullYear();
m = now.getMonth() + 1;
m = m < 10 ? "0" + m : m;
d = now.getDate();
d = d < 10 ? "0" + d : d;
h = now.getHours();
h = h < 10 ? "0" + h : h;
mi = now.getMinutes();
mi = mi < 10 ? "0" + mi : mi;
var sys_file_path_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='TEMPORARY_FILES';
var SysurlQuery = sys_url_bm.queryAsMap({
parameter_code: parameter_code
});
var sys_file_path = SysurlQuery.getChildren()[0].parameter_value;
var f_fileDir = sys_file_path;
var filePath = (f_fileDir + y + "\/" + m + "\/").toString();
//var filePath = (f_fileDir + y + "//" + m + "//").toString();
var tranfer_dir= new File(String(filePath));
if(!tranfer_dir.exists()){//如果文件夹不存在,创建文件夹
tranfer_dir.mkdirs();//创建文件夹
}
var contract_number = $ctx.parameter.contract_number;
var file_name = $ctx.parameter.file_name + y + m + d + h + mi + ".xlsx";
var f_fileName = file_name.toString();
var result_flag=DoloadFileByUrl.downloadFile(down_url, filePath, f_fileName);
//excel 转pdf
var to_file_path = filePath + file_name;
var pdf_file_path= filePath + $ctx.parameter.file_name + y + m + d + h + mi + ".pdf";
println('to_file_path = ' + to_file_path);
println('pdf_file_path = ' + pdf_file_path);
var outputfilepath = wordToPdf(to_file_path,pdf_file_path);
file_size=get_file_length(outputfilepath);
pdf_path =(pdf_file_path).toString()
println('p_file_name = '+ $ctx.parameter.file_name + y + m + d + h + mi + ".pdf");
println('contract_id = ' + $ctx.parameter.contract_id);
word_to_pdf_sign($ctx.parameter.contract_id,pdf_file_path,$ctx.parameter.file_name);
if(result_flag=true){
var business_daily_email=$bm('cont.CON301N.insert_into_attachment_bmp').update({
p_file_path :(datePath + $ctx.parameter.file_name + y + m + d + h + mi + ".pdf").toString(),
p_file_name :($ctx.parameter.file_name + y + m + d + h + mi + ".pdf").toString(),
p_file_size :file_size,
p_user_id :$ctx.session.user_id,
p_contract_id :$ctx.parameter.contract_id,
p_file_type :'PDF',
p_lease_type :'01'
});
}
}catch(e){
raise_app_error(e.message);
}
function get_file_length(path){
var file=new File(String(path));
if(file.exists() && file.isFile()){
length=file.length();
return length;
}else{
return 0 ;
}
}
function wordToPdf(word_file_path,pdf_file_path) {
// excel转pdf
//var pdf_file_path_new = pdf_file_path + '.pdf';
var pdf_file_path_new = pdf_file_path;
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
wordToPdf.exceltopdf(word_file_path, pdf_file_path_new);
//删除word文件
//deleteFile(word_file_path);
return pdf_file_path_new;
}
function getDate() {
var file_path = $ctx.parameter.file_path;
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var path = file_path + y + "/" + m + "/";
return path;
}
function word_to_pdf_sign(content_id,pdf_file_path,file_name) {
importPackage(Packages.com.hl.signatures);
importPackage(Packages.java.io);
importPackage(Packages.java.util);
var org_flag = '';
var qf_flag = '';
var param = new ArrayList();
var paramdetail;
var attachment_update = $bm('cont.CON620.con_contract_save_pdf_atm');
var file_name = file_name;
var file_path = pdf_file_path;
if (file_name.substring(file_name.length - 4) == '.doc') {
file_name = file_name.substring(0, file_name.length - 4);
} else if (file_name.substring(file_name.length - 5) == '.docx') {
file_name = file_name.substring(0, file_name.length - 5);
}
var outputfilepath = pdf_file_path;// 由于wordToPdf转换后pdf文件已经带有.pdf
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.19-x64.dll");
//wordToPdf.word2pdf(file_path, outputfilepath);
var con_signature_info = $bm('cont.CON620.get_con_signature_info').queryAsMap();
var con_signature_data = con_signature_info.getChildren();
var con_signature_record;
for (var i = 0;i < con_signature_data.length;i++) {
con_signature_record = con_signature_data[i];
println(con_signature_record.signature_code);
if (con_signature_record.signature_code == 'gz_flag'){
paramdetail = '[{ "code":"' + con_signature_record.code +
'", "seal_code":"' + con_signature_record.seal_code +
'", "seal_width":' + con_signature_record.seal_width +
', "fontname":"' + con_signature_record.fontname +
'", "fontsize":"' + con_signature_record.fontsize +
'", "fontcolor":"' + con_signature_record.fontcolor +
'", "pageno":"' + con_signature_record.pageno +
'", "text":"' + con_signature_record.word_code + '"}]';
}
param.add(paramdetail);
}
var con_signature_info = $bm('cont.CON620.get_kinggrid_info').queryAsMap();
var con_kinggrid_data = con_signature_info.getChildren()[0];
var server_url = con_kinggrid_data.server_url;
var app_id = con_kinggrid_data.app_id;
var app_security = con_kinggrid_data.app_security;
var status = new com.hand.kinggrid.ContractSignaturesNew.hl_contract_signatures(outputfilepath, 1,param.toArray(),server_url,app_id,app_security,datePath);
<!-- attachment_update.update({-->
<!-- content_id: content_id,-->
<!-- table_name: 'HLS_DOC_FILE_CONTENT'-->
<!-- });-->
}
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter"/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: ZLF
$Date: 2014-11-20 下午8:50:38
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
trace="true">
<a:init-procedure>
<s:server-script import="con_print_path.js"><![CDATA[
set_pdf_parameter_file_path();
]]></s:server-script>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure>
<a:view>
<a:link id="con_contract_content_asset_detail_link_id"
url="${/request/@context_path}/modules/cont/CON505/con_contract_content_asset_detail.lview"/>
<a:link id="con_doc_batch_create_link_id"
url="${/request/@context_path}/modules/cont/CON500/con_doc_batch_create.lsc"/>
<!-- <a:link id="con301n_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>-->
<a:link id="con301n_downloadFile_id" url="${/request/@context_path}/modules/cont/CON301N/con_downfile.lsc"/>
<a:link id="con301n_print_excel_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/>
<a:link id="con301n_print_pdf_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/>
<script type="text/javascript"><![CDATA[
function lock_current_window() {
Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
}
function unlock_current_window() {
Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
}
function con_print_excel_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var contract_number = '${/parameter/@contract_number}';
var tenant_name = '${/parameter/@tenant_name}';
var file_path = '${/parameter/@file_path}';
//var file_name = '对账单('+ tenant_name + '_'+contract_number+').xlsx';
var file_name = '对账单('+ tenant_name + '_'+contract_number+')';
Leaf.request({
url: $('con301n_print_excel_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
file_path : file_path,
file_name : file_name
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function con_print_signatures_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var contract_number = '${/parameter/@contract_number}';
var tenant_name = '${/parameter/@tenant_name}';
var file_path = '${/parameter/@file_path}';
//var file_name = '对账单('+ tenant_name + '_'+contract_number+').xlsx';
var file_name = '对账单('+ tenant_name + '_'+contract_number+')';
Leaf.request({
url: $('con301n_print_pdf_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
file_path : file_path,
file_name : file_name
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function update_attachment_renderer(value, record, name) {
var content_id = record.get('content_id');
return '<a href="javascript:open_uploadfile_win(' + content_id + ')">附件</a>';
}
function attachment_download(val,rec,name) {
return '<a href=javascript:detail_download_window('+rec.get('print_id')+')>下载</a>';}
function detail_download_window(record_id) {
var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id;
// var win = new Leaf.Window({
// url: url,
// title: '${l:HLS.SUPPORTING_DOCUMENT}',
// id: 'con301n_records_uploadFile_id',
// width: 850,
// height: 400
// });
// win.on('close', function() {
// });
var url = $('con301n_downloadFile_id').getUrl() + '?record_id=' + record_id + '&table_name=CUX_CONTRACT_PRINT';
window.open(url, '_self');
}
]]></script>
<a:dataSets>
<a:dataSet id="con_contract_update_print_detail_header_ds" autoCreate="true">
<a:fields>
<a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
<a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
</a:fields>
</a:dataSet>
<a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
queryUrl="${/request/@context_path}/autocrud/cont.CON301N.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}">
<a:fields>
<a:field name="contract_id"/>
<a:field name="content_number" readOnly="true"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<div id="screenTopToolbardiv">
<a:screenTopToolbar style="width:700px">
<a:gridButton id="con_print_id" click="con_print_excel_create" text="生成对账单excel"/>
<a:gridButton id="con_print_signatures_id" click="con_print_signatures_create" text="生成对账单PDF"/>
</a:screenTopToolbar>
<a:form column="2" width="700">
<a:textField name="contract_number" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NUMBER"/>
<a:textField name="contract_name" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NAME" width="330"/>
</a:form>
</div>
<a:grid id="con_contract_update_print_detail_grid_id" bindTarget="con_contract_print_detail_line_ds"
height="350" navBar="true" width="700">
<a:toolBar>
<a:button prompt="PROMPT.EXPORT_EXCEL" type="excel"/>
</a:toolBar>
<a:columns>
<a:column name="file_name" prompt="文本名称" width="260"/>
<a:column name="user_name" prompt="打印人" width="160"/>
<a:column name="print_date" prompt="生成日期" width="180"/>
<a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/>
</a:columns>
</a:grid>
</a:screenBody>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function() {
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("con_print_signatures_id").style.display = "";
} else {
document.getElementById("con_print_signatures_id").style.display = "none";
}
});
]]></script>
</a:view>
</a:screen>
......@@ -35,9 +35,9 @@
url="${/request/@context_path}/modules/cont/CON3200/con_re_incept_modify.lview"/>
<a:link id="${/parameter/@layout_code}_contract_seal_link_id" url="${/request/@context_path}/modules/cont/CON301N/con_contract_finish_seal_info.lview"/>
<a:link id="con_contract_finish_print_link_id" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req_history_pdf_print.lsc"/>
<script src="${/request/@context_path}/javascripts/hap/dynamicStopAutoQuery.js" type="text/javascript"/>
<a:link id="rl_notice_print_link"
url="${/request/@context_path}/modules/cont/CON301N/rl_notice_print.lsc"/>
<!-- <script src="${/request/@context_path}/javascripts/hap/dynamicStopAutoQuery.js" type="text/javascript"/>-->
<a:link id="${/parameter/@layout_code}_contract_print_signatures_link_id"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_signatures.lview"/>
<script type="text/javascript"><![CDATA[
// stopDymanicAutoQuery('${/parameter/@layout_code}', 'G_CONTRACT_RESULT', 'con_contract');
......@@ -97,7 +97,6 @@
document.getElementById("CONTRACT_QUERY_ENTRANCE_user_button9").style.display = "";
}
});
function open_contract_win(ds_id, record_id) {
var record = $(ds_id).findById(record_id);
var param = record.data;
......@@ -277,6 +276,7 @@
url ='${/request/@context_path}/con/contract/conExportExcel?contractId=' + record.get('contract_id');
window.open(href = url);
//window.location.href='${/request/@context_path}/con/contract/conExportExcel?contractId='+record.get('contract_id');
};
//返还金通知打印
......@@ -308,6 +308,35 @@
}
//对账单打印加盖公章
window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () {
var ds = $('CONTRACT_QUERY_ENTRANCE_G_CONTRACT_RESULT_con_contract_ds');
var records = ds.getSelected();
if (records.length != 1) {
Leaf.showMessage('提示', '请选择一条数据!');
return;
}
var contract_id = records[0].get('contract_id');
var contract_number = records[0].get('contract_number');
var contract_name = records[0].get('contract_name');
var tenant_name = records[0].get('bp_id_tenant_n');
var win = new Leaf.Window({
id: 'contract_print_signatures',
url: $('${/parameter/@layout_code}_contract_print_signatures_link_id').getUrl(),
params: {
contract_id: contract_id,
contract_number: contract_number,
contract_name: contract_name,
tenant_name: tenant_name,
winid : 'contract_print_signatures_winid'
},
title: '对账单打印',
height: 500,
width: 800
});
};
]]></script>
<a:screen-include
screen="modules/cont/CON500/con_contract_authority_list_validate.lview?document_category=CONTRACT&amp;function_code=CON501"/>
......
<?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 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();
}
$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");
try {
var sys_url_bm=$bm('cont.CON301N.get_file_address');
var FileQuery = sys_url_bm.queryAsMap({
record_id: $ctx.parameter.record_id
});
var arr = FileQuery.getChildren();
var file_name = arr[0].file_name;
var file_path = arr[0].file_path;
println('file_name = '+ file_name);
println('file_path = '+ file_path);
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();
} catch (e) {
println(e);
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: ZLF
$Date: 2014-11-20 下午8:50:38
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" customizationEnabled="true"
trace="true">
<a:init-procedure>
<s:server-script import="con_print_path.js"><![CDATA[
set_parameter_file_path();
]]></s:server-script>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
</a:init-procedure>
<a:view>
<!-- <a:link id="con301n_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>-->
<a:link id="con301n_downloadFile_id" url="${/request/@context_path}/modules/cont/CON301N/con_downfile.lsc"/>
<a:link id="con301n_print_excel_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_atm.lsc"/>
<a:link id="con301n_print_pdf_link"
url="${/request/@context_path}/modules/cont/CON301N/con_contract_print_pdf.lsc"/>
<a:link id="con_cashflow_print_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection.lsc"/>
<a:link id="con_cashflow_print_signatures_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/>
<script type="text/javascript"><![CDATA[
function lock_current_window() {
Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
}
function unlock_current_window() {
Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
}
function con_print_word_create() {
debugger;
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var templet_code = '${/parameter/@templet_code}';
var bp_name = '${/parameter/@bp_name}';
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_name = '催收函-'+ bp_name;
Leaf.request({
url: $('con_cashflow_print_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
contract_name : contract_name,
templet_code : templet_code,
file_name : file_name
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function con_print_signatures_create() {
Leaf.Masker.mask(Ext.getBody(), '请稍等......');
var contract_id = '${/parameter/@contract_id}';
var templet_code = '${/parameter/@templet_code}';
var bp_name = '${/parameter/@bp_name}';
var contract_number = '${/parameter/@contract_number}';
var contract_name = '${/parameter/@contract_name}';
var file_name = '催收函'+ bp_name ;
Leaf.request({
url: $('con_cashflow_print_signatures_link').getUrl(),
para: {
contract_id : contract_id,
contract_number : contract_number,
contract_name : contract_name,
templet_code : templet_code,
file_name : file_name
},
success: function(res) {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
failure: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
},
error: function() {
Leaf.Masker.unmask(Ext.getBody());
$('con_contract_print_detail_line_ds').query();
}
});
}
function update_attachment_renderer(value, record, name) {
var content_id = record.get('content_id');
return '<a href="javascript:open_uploadfile_win(' + content_id + ')">附件</a>';
}
function attachment_download(val,rec,name) {
return '<a href=javascript:detail_download_window('+rec.get('print_id')+')>下载</a>';}
function detail_download_window(record_id) {
// var url = $('con301n_downloadFile_id').getUrl() + '?table_name=CUX_CONTRACT_PRINT&header_id=' + record_id;
// var win = new Leaf.Window({
// url: url,
// title: '${l:HLS.SUPPORTING_DOCUMENT}',
// id: 'con301n_records_uploadFile_id',
// width: 850,
// height: 400
// });
// win.on('close', function() {
// });
var url = $('con301n_downloadFile_id').getUrl() + '?record_id=' + record_id + '&table_name=CUX_CONTRACT_PRINT';
window.open(url, '_self');
}
]]></script>
<a:dataSets>
<a:dataSet id="con_contract_update_print_detail_header_ds" autoCreate="true">
<a:fields>
<a:field name="contract_number" defaultValue="${/parameter/@contract_number}" readOnly="true"/>
<a:field name="contract_name" defaultValue="${/parameter/@contract_name}" readOnly="true"/>
</a:fields>
</a:dataSet>
<a:dataSet id="con_contract_print_detail_line_ds" autoQuery="true" fetchAll="true" pageSize="100"
queryUrl="${/request/@context_path}/autocrud/cont.CON620.con_statement_of_account_print/query?contract_id=${/parameter/@contract_id}">
<a:fields>
<a:field name="contract_id"/>
<a:field name="content_number" readOnly="true"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<div id="screenTopToolbardiv">
<a:screenTopToolbar style="width:700px">
<a:gridButton id="con_print_id" click="con_print_word_create" text="生成催收函Word"/>
<a:gridButton id="con_print_signatures_id" click="con_print_signatures_create" text="生成催收函PDF"/>
</a:screenTopToolbar>
<a:form column="2" width="700">
<a:textField name="contract_number" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NUMBER"/>
<a:textField name="contract_name" bindTarget="con_contract_update_print_detail_header_ds"
prompt="HLS.CONTRACT_NAME" width="330"/>
</a:form>
</div>
<a:grid id="con_contract_update_print_detail_grid_id" bindTarget="con_contract_print_detail_line_ds"
height="350" navBar="true" width="700">
<a:toolBar>
<a:button prompt="PROMPT.EXPORT_EXCEL" type="excel"/>
</a:toolBar>
<a:columns>
<a:column name="file_name" prompt="文本名称" width="260"/>
<a:column name="user_name" prompt="打印人" width="160"/>
<a:column name="print_date" prompt="生成日期" width="180"/>
<a:column name="download" align="center" prompt="下载" renderer="attachment_download" width="50"/>
</a:columns>
</a:grid>
</a:screenBody>
<script type="text/javascript"><![CDATA[
Leaf.onReady(function() {
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("con_print_signatures_id").style.display = "";
} else {
document.getElementById("con_print_signatures_id").style.display = "none";
}
});
]]></script>
</a:view>
</a:screen>
......@@ -38,7 +38,10 @@
url="${/request/@context_path}/modules/cont/CON620/create_content_lease_return.lsc"/>
<a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="con_collection_message_create_link_id" model="cont.CON620.con_collection_message_create" modelaction="update"/>
<a:link id="con_lease_org_print_signatures_link"
url="${/request/@context_path}/modules/cont/CON620/create_content_for_collection_signatures.lsc"/>
<a:link id="cashflow_print_signatures_link_id"
url="${/request/@context_path}/modules/cont/CON620/con_cashflow_print_signatures.lview"/>
<script type="text/javascript"><![CDATA[
Ext.ux.Lightbox.register('a[ref=img]', true);
......@@ -68,13 +71,13 @@
});
}
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_ORG';
var url=$('con_lease_org_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
window.open(url, '_self');
create_message(contract_id,templet_code);
};
// window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
// var contract_id = '${/parameter/@document_id}';
// var templet_code = 'CON_LEASE_ORG';
// var url=$('con_lease_org_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
// window.open(url, '_self');
// create_message(contract_id,templet_code);
// };
window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function () {
var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_CONFIRM';
......@@ -186,7 +189,6 @@
//add by lihh 20210318 发送函件类型为只读
//加载时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record, config_records, bp_seq) {
debugger;
var col_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_collection');
var records = $(col_ds).getAll();
if(ds.id == col_ds && col_ds){
......@@ -209,13 +211,44 @@
if("${/model/role_info/record/@role_code}"!="0018"&&"${/model/role_info/record/@role_code}"!="0019") {
document.getElementById("CON_DUE_DETAIL_user_button4").style.display = "";
document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "";
document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "";
} else {
document.getElementById("CON_DUE_DETAIL_user_button4").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button3").style.display = "none";
document.getElementById("CON_DUE_DETAIL_user_button5").style.display = "none";
}
}
});
//新增催款函pdf打印(盖章)
window['${/parameter/@layout_code}_user_button5_layout_dynamic_click'] = function () {
debugger;
var ds = $('CON_DUE_DETAIL_F_BASIC_con_contract_ds');
var records = ds.getCurrentRecord();
var bp_name = records.get('bp_name');
var contract_number = records.get('contract_number');
var contract_name = records.get('contract_name');
var contract_id = '${/parameter/@document_id}';
var templet_code = 'CON_LEASE_ORG';
var win = new Leaf.Window({
id: 'cashflow_print_signatures',
url: $('cashflow_print_signatures_link_id').getUrl(),
params: {
contract_id: contract_id,
templet_code: templet_code,
bp_name : bp_name,
contract_number : contract_number,
contract_name : contract_name,
winid : 'contract_print_signatures_winid'
},
title: '催款函打印',
height: 500,
width: 800
});
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
......
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