Commit af6c7120 authored by lizhe's avatar lizhe

应收明细表附件

parent 7d49b1e5
<?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 nvl((select ep.employee_type_code
from exp_employees e, exp_employee_types_vl ep
where e.employee_id = su.employee_id
and e.employee_type_id = ep.employee_type_id),'NULL') employee_type_code
from sys_user su
where su.user_id = ${/session/@user_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
con_contract_workflow_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_check_id =>${@p_check_id}
);
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -9,6 +9,7 @@
dynamiccreateenabled="true" trace="true">
<a:init-procedure>
<a:model-query model="cont.CON620.get_sys_role" rootPath="role_info"/>
<a:model-query model="cont.CON3200.get_user_employee_type" rootPath="employee_info"/>
<a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name" rootPath="file_name_path"/>
<s:server-script import="contract_print_path.js"><![CDATA[
$ctx.parameter.file_path = con_print_path['con_print_path'];
......@@ -761,5 +762,15 @@
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<script type="text/javascript"><![CDATA[
Leaf.onReady(init);
function init() {
//用户对应员工不是员工 就不显示该附件组件
if("${/model/employee_info/record/@employee_type_code}" != 'STAFF'){
document.getElementById('${/parameter/@layout_code}_C_ATTCH_2_con_contract_grid_id_wrap').style.display = 'none';
}
}
]]></script>
</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: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+'modules/cont/CON3200/contract_receipt_detail_print.lsc?template_name='+'aa.xls'
+ '&contract_id=' +$ctx.parameter.p_contract_id
+ '&file_name=' + encodeURI('应收明细表','utf-8');
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;
var fileDir_bm=$bm('cont.CON4000.get_sys_url');
var parameter_code='HLCM_EMAIL_URL'; //存放文件路径 待修改
var fileDirQuery = fileDir_bm.queryAsMap({
parameter_code: parameter_code
});
var f_fileDir = fileDirQuery.getChildren()[0].parameter_value;
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.p_contract_number;
var f_fileName = (contract_number+'应收明细表'+y+m+d+'.xlsx').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.CON3200.receipt_detail_insert_atm').update({
p_file_path :(filePath+f_fileName).toString(),
p_file_name :f_fileName,
p_file_size :file_size,
p_user_id :1,
p_check_id :$ctx.parameter.p_check_id
});
}
}catch(e){
raise_app_error(e.message);
}
function get_file_length(path){
var file=new File(String(path));
if(file.exists() && file.isFile()){
//println(f.length());
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
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