Skip to content

Commit be4e65c

Browse files
committed
Added PDF generation test
1 parent e447581 commit be4e65c

File tree

3 files changed

+648
-0
lines changed

3 files changed

+648
-0
lines changed

tests/files/pdf_template1.ftl

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<#assign workspace=objects[0]>
2+
<#assign submission=objects[1]>
3+
4+
<html>
5+
<body>
6+
<p>
7+
This
8+
Report
9+
was submitted on ${submission.submittedOn?number_to_datetime} from [IP_ADDRESS]
10+
by
11+
${workspace.properties.principalInvestigator.firstName}
12+
${workspace.properties.principalInvestigator.lastName}
13+
(
14+
<a href="${workspace.properties.principalInvestigator.email}">
15+
${workspace.properties.principalInvestigator.email}
16+
</a>
17+
)
18+
</p>
19+
<p>
20+
If there is an issue with this submission, we will contact you by email.
21+
</p>
22+
23+
<!-- Grant Details -->
24+
<h2>Grant Details</h2>
25+
<table>
26+
<thead>
27+
<tr>
28+
<th>Key</th>
29+
<th>Value</th>
30+
</tr>
31+
</thead>
32+
<tbody>
33+
<#list workspace.properties.details as detail>
34+
<tr>
35+
<td>${detail.key}</td>
36+
<td>${detail.value}</td>
37+
</tr>
38+
</#list>
39+
</tbody>
40+
</table>
41+
42+
<h2>Financials</h2>
43+
44+
<h3>Summary</h3>
45+
<table>
46+
<tbody>
47+
<tr>
48+
<td>Report Date</td>
49+
<td></td>
50+
</tr>
51+
<tr>
52+
<td>Total Grant Amount</td>
53+
<td>${submission.data.rewardAmount}</td>
54+
</tr>
55+
<tr>
56+
<td>Total Received to Date</td>
57+
<td>${submission.data.fundsReceived}</td>
58+
</tr>
59+
<tr>
60+
<td>Total Expenditures this Report</td>
61+
<td>${submission.data.expensesTotal}</td>
62+
</tr>
63+
<tr>
64+
<td>Total Encumbrances</td>
65+
<td>${submission.data.encumbrancesTotal}</td>
66+
</tr>
67+
<tr>
68+
<td>Carry-Over Balance</td>
69+
<td>${submission.data.carryOverBalanceFromLastYear}</td>
70+
</tr>
71+
</tbody>
72+
</table>
73+
74+
<h3>Personnel Expenses</h3>
75+
<table>
76+
<thead>
77+
<tr>
78+
<th>Line Item Category</th>
79+
</tr>
80+
<tr>
81+
<th>Expenditures</th>
82+
</tr>
83+
<tr>
84+
<th>Notes</th>
85+
</tr>
86+
</thead>
87+
<tbody>
88+
<#list submission.data.personnelExpenses as expense>
89+
<tr>
90+
<td>${expense.category!""}</td>
91+
<td>${expense.actual!""}</td>
92+
<td>${expense.notes!""}</td>
93+
</tr>
94+
</#list>
95+
</tbody>
96+
</table>
97+
98+
<h3>Direct Costs</h3>
99+
<table>
100+
<thead>
101+
<tr>
102+
<th>Line Item Category</th>
103+
</tr>
104+
<tr>
105+
<th>Expenditures</th>
106+
</tr>
107+
<tr>
108+
<th>Notes</th>
109+
</tr>
110+
</thead>
111+
<tbody>
112+
<#list submission.data.directCosts as expense>
113+
<tr>
114+
<td>${expense.category!""}</td>
115+
<td>${expense.actual!""}</td>
116+
<td>${expense.notes!""}</td>
117+
</tr>
118+
</#list>
119+
</tbody>
120+
</table>
121+
122+
<h3>Encumbrances</h3>
123+
<table>
124+
<thead>
125+
<tr>
126+
<th>Line Item Category</th>
127+
</tr>
128+
<tr>
129+
<th>Expenditures</th>
130+
</tr>
131+
<tr>
132+
<th>Notes</th>
133+
</tr>
134+
</thead>
135+
<tbody>
136+
<#list submission.data.encumbrances as expense>
137+
<tr>
138+
<td>${expense.category!""}</td>
139+
<td>${expense.amount!""}</td>
140+
<td>${expense.notes!""}</td>
141+
</tr>
142+
</#list>
143+
</tbody>
144+
</table>
145+
146+
</body>
147+
</html>

tests/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@
267267
<script type="text/javascript" src="js/testNodeTransaction3.js"></script>
268268
<script type="text/javascript" src="js/testNodeTransaction4.js"></script>
269269

270+
<!-- pdf generation -->
271+
<script type="text/javascript" src="js/testNodePdfGeneration1.js"></script>
272+
270273
</head>
271274
<body>
272275
<h1 id="qunit-header">Gitana JavaScript Driver Test Suite</h1>

0 commit comments

Comments
 (0)