Commit 7bd894a1 authored by gzj34291's avatar gzj34291

建机营业日报

parent 2052060c
<?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
business_daily_pkg.business_daily_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}
);
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" dataSourceName="u8" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select v.parameter_value
from sys_parameter_values v,sys_parameters p
where v.module_id = p.module_id
and p.parameter_code ='${:@parameter_code}'
and v.parameter_id = p.parameter_id
and v.level_id = 101
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:o="leaf.database.local.oracle" xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select v.parameter_value
from sys_parameter_values v,sys_parameters p
where v.module_id = p.module_id
and p.parameter_code ='${:@parameter_code}'
and v.parameter_id = p.parameter_id
and v.level_id = 101
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="parameter_value"/>
</bm:fields>
</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 (select nvl(sum(nvl(ci.set_number, 1)), 0)
from con_contract cc, con_contract_lease_item ci
where cc.lease_start_date = TRUNC(sysdate )
and ci.contract_id = cc.contract_id
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL') day_num, --日台数
nvl((select to_char(round(sum(nvl(cc.total_rental, 0)) +
sum(nvl(cc.residual_value, 0)),2),'fm99999999999990.00')
from con_contract cc
where cc.lease_start_date = TRUNC(sysdate )
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL'),
0) day_money, --日金额
(select nvl(sum(nvl(ci.set_number, 1)),0)
from con_contract cc, con_contract_lease_item ci
where cc.lease_start_date between trunc(sysdate, 'mm') and
trunc(sysdate)
and ci.contract_id = cc.contract_id
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL') month_num, --月数量
nvl((select to_char(round(sum(nvl(cc.total_rental, 0)) +
sum(nvl(cc.residual_value, 0)),2),'fm99999999999990.00')
from con_contract cc
where cc.lease_start_date between trunc(sysdate, 'mm') and
trunc(sysdate)
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL'),
0) month_money, --月金额
case
when trunc(sysdate) >
to_date(to_char(sysdate, 'yyyy') || '0331', 'yyyymmdd') then
(select sum(nvl(ci.set_number, 1))
from con_contract cc, con_contract_lease_item ci
where cc.lease_start_date between
to_date(to_char(sysdate, 'yyyy') || '0401', 'yyyymmdd') and
to_date(to_char(add_months(sysdate, 12), 'yyyy') || '0331',
'yyyymmdd')
and ci.contract_id = cc.contract_id
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL')
else
(select sum(nvl(ci.set_number, 1))
from con_contract cc, con_contract_lease_item ci
where cc.lease_start_date between
to_date(to_char(add_months(sysdate, -12), 'yyyy') ||
'0401',
'yyyymmdd') and
to_date(to_char(sysdate, 'yyyy') || '0331', 'yyyymmdd')
and cc.contract_status = 'INCEPT'
and ci.contract_id = cc.contract_id
and cc.data_class = 'NORMAL')
end as year_num, --年台数
(case
when trunc(sysdate) >
to_date(to_char(sysdate, 'yyyy') || '0331', 'yyyymmdd') then
(select to_char(round(sum(nvl(cc.total_rental, 0)) +
sum(nvl(cc.residual_value, 0)),2),'fm99999999999990.00')
from con_contract cc
where cc.lease_start_date between
to_date(to_char(sysdate, 'yyyy') || '0401', 'yyyymmdd') and
to_date(to_char(add_months(sysdate, 12), 'yyyy') || '0331',
'yyyymmdd')
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL')
else
(select to_char(round(sum(nvl(cc.total_rental, 0)) +
sum(nvl(cc.residual_value, 0)),2),'fm99999999999990.00')
from con_contract cc
where cc.lease_start_date between
to_date(to_char(add_months(sysdate, -12), 'yyyy') ||
'0401',
'yyyymmdd') and
to_date(to_char(sysdate, 'yyyy') || '0331', 'yyyymmdd')
and cc.contract_status = 'INCEPT'
and cc.data_class = 'NORMAL')
end) year_money, --年金额
(select nvl(sum(nvl(ci.set_number, 1)), 0)
from con_contract cc, con_contract_lease_item ci
where (cc.contract_status in ('INCEPT', 'REPURING', 'ETING') or
(cc.contract_status = 'PENDING' and cc.project_id is not null and
exists
(select 1
from zj_wfl_workflow_instance_v zw,
ZJ_WFL_WORKFLOW_INSTANCE_PARA zi,
zj_wfl_workflow_type_parameter zp
where zw.workflow_code = 'CONTRACT_INCEPT_WFL'
and zw.instance_status = '10'
and zi.workflow_type_para_id = zp.workflow_type_para_id
and zp.parameter_code = 'CONTRACT_ID'
and zw.instance_id = zi.instance_id
and to_char(cc.contract_id) = zi.parameter_value))or
(cc.contract_status = 'PENDING' and
cc.project_id is null))
and ci.contract_id = cc.contract_id
and cc.lease_start_date <= TRUNC(sysdate )
and cc.data_class = 'NORMAL') all_num, --昨日资产台数
nvl((select to_char(round(sum(ccc.due_amount) - sum(nvl(ccc.received_amount, 0)),2),'fm99999999999990.00')
from con_contract_cashflow ccc
where ccc.contract_id in
(select cc.contract_id
from con_contract cc
where (cc.contract_status in
('INCEPT', 'REPURING', 'ETING') or
(cc.contract_status = 'PENDING' and
cc.project_id is not null and exists
(select 1
from zj_wfl_workflow_instance_v zw,
ZJ_WFL_WORKFLOW_INSTANCE_PARA zi,
zj_wfl_workflow_type_parameter zp
where zw.workflow_code = 'CONTRACT_INCEPT_WFL'
and zw.instance_status = '10'
and zi.workflow_type_para_id =
zp.workflow_type_para_id
and zp.parameter_code = 'CONTRACT_ID'
and zw.instance_id = zi.instance_id
and to_char(cc.contract_id) =
zi.parameter_value))or
(cc.contract_status = 'PENDING' and
cc.project_id is null))
and cc.lease_start_date <= TRUNC(sysdate)
and cc.data_class = 'NORMAL')
and ccc.cf_status = 'RELEASE'
and ccc.cf_item in (1, 8, 9,250,200,11)),
0) all_money --昨日资产金额
from dual
]]></bm:query-sql>
</bm:operation>
</bm:operations>
</bm:model>
\ 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.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/CON4000/hlcm_business_daily.lsc';
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
d = now.getDate();
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 f_fileName = ('建机营业日报'+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.CON4000.business_daily_email').update({
p_file_path :(filePath+f_fileName).toString(),
p_file_name :f_fileName,
p_file_size :file_size,
p_user_id :1
});
}
}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
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script"
xmlns:dr="leaf.plugin.excelreport" trace="true">
<a:init-procedure>
<a:model-query fetchAll="true" model="cont.CON4000.hlcm_business_daily" rootPath="/model/hlcm_business_daily"/>
<dr:excel-report enableTask="false" filename="营业日报.xlsx">
<dr:styles>
<dr:cell-style name="header" align="ALIGN_CENTER" borderbottom="BORDER_THIN" borderleft="BORDER_THIN"
borderright="BORDER_THIN" bordertop="BORDER_THIN">
<dr:font bold="true" fontname="宋体" height="10" italic="false"/>
</dr:cell-style>
<dr:cell-style name="cell1" align="ALIGN_LEFT" borderbottom="BORDER_THIN" borderleft="BORDER_THIN"
borderright="BORDER_THIN" bordertop="BORDER_THIN">
<dr:font bold="false" fontname="宋体" height="10" italic="false"/>
</dr:cell-style>
<dr:cell-style name="cell2" align="ALIGN_RIGHT" borderbottom="BORDER_THIN" borderleft="BORDER_THIN"
borderright="BORDER_THIN" bordertop="BORDER_THIN">
<dr:font bold="false" fontname="Arial" height="10" italic="false"/>
</dr:cell-style>
</dr:styles>
<dr:sheets>
<dr:sheet name="建机营业日表" autoSizeColumns="0,1,2,3,4,5," displayGridlines="false" dataModel="/model/hlcm_business_daily">
<dr:static-content>
<dr:cell-data cell="C" row="1" stylename="header" type="content" value="新规案件" />
<dr:cell-data cell="D" row="1" stylename="header" type="content" value="新规案件" tablecolmerge="3"/>
<dr:cell-data cell="E" row="1" stylename="header" type="content" value="新规案件" tablecolmerge="3"/>
<dr:cell-data cell="F" row="1" stylename="header" type="content" value="资产余额"/>
<dr:cell-data cell="A" row="2" stylename="header" type="content" value="业务"/>
<dr:cell-data cell="B" row="2" stylename="header" type="content" value="类别"/>
<dr:cell-data cell="C" row="2" stylename="header" type="content" value="今日"/>
<dr:cell-data cell="D" row="2" stylename="header" type="content" value="累计(本月)"/>
<dr:cell-data cell="E" row="2" stylename="header" type="content" value="累计(本财年)"/>
<dr:cell-data cell="F" row="2" stylename="header" type="content" value="今日"/>
<dr:cell-data cell="A" row="3" stylename="header" type="content" value="建机"/>
<dr:cell-data cell="A" row="4" stylename="header" type="content" value="建机"/>
<dr:cell-data cell="B" row="3" stylename="header" type="content" value="台数"/>
<dr:cell-data cell="B" row="4" stylename="header" type="content" value="金额"/>
<dr:cell-data cell="C" row="3" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@day_num}"/>
<dr:cell-data cell="D" row="3" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@month_num}"/>
<dr:cell-data cell="E" row="3" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@year_num}"/>
<dr:cell-data cell="F" row="3" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@all_num}"/>
<dr:cell-data cell="C" row="4" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@day_money}"/>
<dr:cell-data cell="D" row="4" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@month_money}"/>
<dr:cell-data cell="E" row="4" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@year_money}"/>
<dr:cell-data cell="F" row="4" stylename="header" type="content" value="${/model/hlcm_business_daily/record/@all_money}"/>
</dr:static-content>
</dr:sheet>
</dr:sheets>
</dr:excel-report>
</a:init-procedure>
</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