1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:dr="leaf.plugin.excelreport" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-query fetchAll="true" model="rpt.RPT5090.atm_update" rootPath="/model/day"/>
<a:model-query fetchAll="true" model="rpt.RPT5090.atm_update_month" rootPath="/model/month"/>
<s:server-script><![CDATA[
<!-- var para = $ctx.current_parameter || $ctx.parameter;-->
<!-- println(para.toXML());-->
$ctx.parameter.file_name='财务收支一览表.xlsx';
$ctx.parameter.file_path = 'D:/u01/hls_file/task_excel';
]]></s:server-script>
<dr:excel-report enableTask="true" fileName="${/parameter/@file_name}">
<dr:styles>
<dr:cell-style name="cell1" align="ALIGN_LEFT" vertical="VERTICAL_CENTER">
<dr:font bold="true" fontName="宋体" height="10"/>
</dr:cell-style>
<dr:cell-style name="cell2" align="ALIGN_RIGHT" vertical="VERTICAL_CENTER">
<dr:font bold="false" fontName="Calibri" height="11"/>
</dr:cell-style>
<dr:cell-style name="cell3" align="ALIGN_CENTER" vertical="VERTICAL_CENTER">
<dr:font bold="false" fontName="Arial" height="9"/>
</dr:cell-style>
<dr:cell-style name="header" cell_style_id="2" foregroundcolor="BLACK">
<dr:font cell_style_id="2" fontname="微软雅黑" height="10" bold="true"/>
</dr:cell-style>
</dr:styles>
<dr:sheets>
<dr:sheet name="日次" autoSizeColumns="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119" displayGridlines="true">
<dr:dynamic-content cell="A" dataModel="/model/day" row="1">
<dr:columns>
<dr:table-column cellStyle="cell2" field="calendar_date" title="daily" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="named_day" title="曜日" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="purchase_amount" title="留购金" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="down_payment" title="首付款" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="lease_amount" title="租金" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_amount" title="合计" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="outflow_amount" title="cash-out" titlestyle="header" type="content"/>
</dr:columns>
</dr:dynamic-content>
</dr:sheet>
<dr:sheet name="月次" autoSizeColumns="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119" displayGridlines="true">
<dr:dynamic-content cell="A" dataModel="/model/month" row="1">
<dr:columns>
<dr:table-column cellStyle="cell2" field="monthly" title="monthly" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_purchase_amount" title="留购金" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_down_payment" title="首付款" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_lease_amount" title="租金" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_amount" title="合计" titlestyle="header" type="content"/>
<dr:table-column cellStyle="cell2" field="total_outflow_amount" title="cash-out" titlestyle="header" type="content"/>
</dr:columns>
</dr:dynamic-content>
</dr:sheet>
</dr:sheets>
</dr:excel-report>
<s:server-script><![CDATA[
importPackage(java.util.zip);
importPackage(java.io);
try {
var file = new File($ctx.parameter.file_path);
var file_size = 0;
if(file.exists()){
file_size = file.length();
}
// 往邮箱插入待发送的数据,插附件表
var atm_bm = $bm('rpt.RPT5090.atm_update');
atm_bm.update({
file_name: $ctx.parameter.file_name,//附件需要关联到记录ID
file_path: $ctx.parameter.file_path,//文件名
file_size: file_size
});
$ctx.success = "true";
$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);
//$bm('rollback').update({});
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
println(result);
]]></s:server-script>
</a:init-procedure>
<a:service-output output="/parameter"/>
</a:service>