Skip to content

Commit f3bc3ae

Browse files
gpascucciclaude
andcommitted
fix(schedule2): address PR #341 review — footer page count + label clipping
- Page footer: replace the single "Page N of N" textField (both terms evaluated at page time) with the sibling four-element block (schedule5/schedule11) — separate evaluationTime="Report" total → "Page: X of Y", consistent with the other sections in the combined PDF. - Long cross-schedule labels no longer clip: switch schedule2.jrxml to LANDSCAPE (842x595) like the rebuilt sibling sections, widening the label column to 520 so "Purchased / Private Wood Overhead (Schedule 3, Woodlands Subtotal):" and "Total Company Logging Costs (Including total Silviculture Cost):" render in full. - PrintScheduleIT: assert both longest labels IN FULL so a future clip breaks the test instead of shipping a truncated label. PrintScheduleIT green (20/20) under Oracle Testcontainers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e89c3f5 commit f3bc3ae

2 files changed

Lines changed: 68 additions & 47 deletions

File tree

backend/src/main/resources/reports/schedule2.jrxml

Lines changed: 63 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@
77
PRE-FORMATTED as Strings (Schedule2SectionMapper; legacy SchedulesPrinter pre-formatted to String
88
and substituted "-" for null), so the template binds String fields and never masks a number itself.
99
10-
The cross-schedule provenance (Schedule 3 Woodlands Subtotal, Schedule 1) is carried in the row
11-
LABELS verbatim, not in separate cells — the figures are already folded into the seven blocks by
12-
Schedule2Service. p_do_print_body gates the cost table; p_do_print_comment gates the Comments block.
10+
LANDSCAPE (842x595), matching the rebuilt sibling sections (5/6/7A/7B/9/11) so the combined PDF is
11+
visually consistent and the wide cross-schedule labels (e.g. "Purchased / Private Wood Overhead
12+
(Schedule 3, Woodlands Subtotal):") render without clipping. The cross-schedule provenance is
13+
carried in the row LABELS verbatim, not in separate cells — the figures are already folded into the
14+
seven blocks by Schedule2Service. p_do_print_body gates the cost table; p_do_print_comment gates the
15+
Comments block.
1316
-->
1417
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
15-
name="schedule2" pageWidth="595" pageHeight="842" orientation="Portrait"
16-
whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20"
18+
name="schedule2" pageWidth="842" pageHeight="595" orientation="Landscape"
19+
whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20"
1720
topMargin="30" bottomMargin="30">
1821
<style name="bold" bold="true"/>
1922
<parameter name="millTitleBlock" class="java.lang.String"/>
@@ -53,171 +56,172 @@
5356
<expression><![CDATA[$P{bookmarkTitle}]]></expression>
5457
<anchorNameExpression><![CDATA[$P{bookmarkTitle}]]></anchorNameExpression>
5558
</element>
56-
<element kind="staticText" style="bold" x="0" y="0" width="555" height="15" hTextAlign="Center">
59+
<element kind="staticText" style="bold" x="0" y="0" width="802" height="15" hTextAlign="Center">
5760
<text><![CDATA[Government of British Columbia]]></text>
5861
</element>
59-
<element kind="textField" x="0" y="15" width="555" height="15" hTextAlign="Center">
62+
<element kind="textField" x="0" y="15" width="802" height="15" hTextAlign="Center">
6063
<expression><![CDATA[$P{year} + " Annual Interior Logging Cost Report"]]></expression>
6164
</element>
6265
</title>
6366
<pageHeader height="34">
64-
<element kind="staticText" style="bold" x="0" y="0" width="555" height="15">
67+
<element kind="staticText" style="bold" x="0" y="0" width="802" height="15">
6568
<text><![CDATA[Schedule 2: Purchased/Private Log Costs & Sales]]></text>
6669
</element>
67-
<element kind="textField" x="0" y="16" width="555" height="15" hTextAlign="Left" blankWhenNull="true">
70+
<element kind="textField" x="0" y="16" width="802" height="15" hTextAlign="Left" blankWhenNull="true">
6871
<expression><![CDATA[$P{millTitleBlock}]]></expression>
6972
</element>
7073
</pageHeader>
7174
<detail>
7275
<band height="270">
73-
<!-- Column headers (body-gated). -->
74-
<element kind="staticText" style="bold" x="355" y="0" width="62" height="15" hTextAlign="Right">
76+
<!-- Column headers (body-gated). Label column is 520 wide so the long cross-schedule labels
77+
render without clipping; the three value columns are right-aligned in the remaining width. -->
78+
<element kind="staticText" style="bold" x="525" y="0" width="90" height="15" hTextAlign="Right">
7579
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
7680
<text><![CDATA[Volume m³]]></text>
7781
</element>
78-
<element kind="staticText" style="bold" x="422" y="0" width="62" height="15" hTextAlign="Right">
82+
<element kind="staticText" style="bold" x="620" y="0" width="90" height="15" hTextAlign="Right">
7983
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
8084
<text><![CDATA[Cost $]]></text>
8185
</element>
82-
<element kind="staticText" style="bold" x="489" y="0" width="66" height="15" hTextAlign="Right">
86+
<element kind="staticText" style="bold" x="715" y="0" width="87" height="15" hTextAlign="Right">
8387
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
8488
<text><![CDATA[$/m³]]></text>
8589
</element>
8690

8791
<!-- Row 1: Purchased / Private Log Costs -->
88-
<element kind="staticText" x="0" y="24" width="350" height="16" hTextAlign="Left">
92+
<element kind="staticText" x="0" y="24" width="520" height="16" hTextAlign="Left">
8993
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
9094
<text><![CDATA[Purchased / Private Log Costs: ]]></text>
9195
</element>
92-
<element kind="textField" x="355" y="24" width="62" height="16" hTextAlign="Right">
96+
<element kind="textField" x="525" y="24" width="90" height="16" hTextAlign="Right">
9397
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
9498
<expression><![CDATA[$F{purchasedLogCostVol}]]></expression>
9599
</element>
96-
<element kind="textField" x="422" y="24" width="62" height="16" hTextAlign="Right">
100+
<element kind="textField" x="620" y="24" width="90" height="16" hTextAlign="Right">
97101
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
98102
<expression><![CDATA[$F{purchasedLogCostCos}]]></expression>
99103
</element>
100-
<element kind="textField" x="489" y="24" width="66" height="16" hTextAlign="Right">
104+
<element kind="textField" x="715" y="24" width="87" height="16" hTextAlign="Right">
101105
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
102106
<expression><![CDATA[$F{purchasedLogCostCal}]]></expression>
103107
</element>
104108

105109
<!-- Row 2: Purchased / Private Wood Overhead (Schedule 3, Woodlands Subtotal) -->
106-
<element kind="staticText" x="0" y="46" width="350" height="16" hTextAlign="Left">
110+
<element kind="staticText" x="0" y="46" width="520" height="16" hTextAlign="Left">
107111
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
108112
<text><![CDATA[Purchased / Private Wood Overhead (Schedule 3, Woodlands Subtotal): ]]></text>
109113
</element>
110-
<element kind="textField" x="355" y="46" width="62" height="16" hTextAlign="Right">
114+
<element kind="textField" x="525" y="46" width="90" height="16" hTextAlign="Right">
111115
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
112116
<expression><![CDATA[$F{purchasedWoodOverheadVol}]]></expression>
113117
</element>
114-
<element kind="textField" x="422" y="46" width="62" height="16" hTextAlign="Right">
118+
<element kind="textField" x="620" y="46" width="90" height="16" hTextAlign="Right">
115119
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
116120
<expression><![CDATA[$F{purchasedWoodOverheadCos}]]></expression>
117121
</element>
118-
<element kind="textField" x="489" y="46" width="66" height="16" hTextAlign="Right">
122+
<element kind="textField" x="715" y="46" width="87" height="16" hTextAlign="Right">
119123
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
120124
<expression><![CDATA[$F{purchasedWoodOverheadCal}]]></expression>
121125
</element>
122126

123127
<!-- Separator above Subtotal. -->
124-
<element kind="line" x="355" y="66" width="200" height="1">
128+
<element kind="line" x="525" y="66" width="277" height="1">
125129
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
126130
</element>
127131
<!-- Row 3: Subtotal -->
128-
<element kind="staticText" x="0" y="68" width="350" height="16" hTextAlign="Left">
132+
<element kind="staticText" x="0" y="68" width="520" height="16" hTextAlign="Left">
129133
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
130134
<text><![CDATA[Subtotal: ]]></text>
131135
</element>
132-
<element kind="textField" x="355" y="68" width="62" height="16" hTextAlign="Right">
136+
<element kind="textField" x="525" y="68" width="90" height="16" hTextAlign="Right">
133137
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
134138
<expression><![CDATA[$F{subtotalVol}]]></expression>
135139
</element>
136-
<element kind="textField" x="422" y="68" width="62" height="16" hTextAlign="Right">
140+
<element kind="textField" x="620" y="68" width="90" height="16" hTextAlign="Right">
137141
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
138142
<expression><![CDATA[$F{subtotalCos}]]></expression>
139143
</element>
140-
<element kind="textField" x="489" y="68" width="66" height="16" hTextAlign="Right">
144+
<element kind="textField" x="715" y="68" width="87" height="16" hTextAlign="Right">
141145
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
142146
<expression><![CDATA[$F{subtotalCal}]]></expression>
143147
</element>
144148

145149
<!-- Row 4: (less) Log Sales -->
146-
<element kind="staticText" x="0" y="90" width="350" height="16" hTextAlign="Left">
150+
<element kind="staticText" x="0" y="90" width="520" height="16" hTextAlign="Left">
147151
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
148152
<text><![CDATA[(less) Log Sales: ]]></text>
149153
</element>
150-
<element kind="textField" x="355" y="90" width="62" height="16" hTextAlign="Right">
154+
<element kind="textField" x="525" y="90" width="90" height="16" hTextAlign="Right">
151155
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
152156
<expression><![CDATA[$F{lessLogSalesVol}]]></expression>
153157
</element>
154-
<element kind="textField" x="422" y="90" width="62" height="16" hTextAlign="Right">
158+
<element kind="textField" x="620" y="90" width="90" height="16" hTextAlign="Right">
155159
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
156160
<expression><![CDATA[$F{lessLogSalesCos}]]></expression>
157161
</element>
158-
<element kind="textField" x="489" y="90" width="66" height="16" hTextAlign="Right">
162+
<element kind="textField" x="715" y="90" width="87" height="16" hTextAlign="Right">
159163
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
160164
<expression><![CDATA[$F{lessLogSalesCal}]]></expression>
161165
</element>
162166

163167
<!-- Separator above Net Purchased. -->
164-
<element kind="line" x="355" y="110" width="200" height="1">
168+
<element kind="line" x="525" y="110" width="277" height="1">
165169
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
166170
</element>
167171
<!-- Row 5: Net Purchased / Private Log Cost -->
168-
<element kind="staticText" x="0" y="112" width="350" height="16" hTextAlign="Left">
172+
<element kind="staticText" x="0" y="112" width="520" height="16" hTextAlign="Left">
169173
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
170174
<text><![CDATA[Net Purchased / Private Log Cost: ]]></text>
171175
</element>
172-
<element kind="textField" x="355" y="112" width="62" height="16" hTextAlign="Right">
176+
<element kind="textField" x="525" y="112" width="90" height="16" hTextAlign="Right">
173177
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
174178
<expression><![CDATA[$F{netPurchasedVol}]]></expression>
175179
</element>
176-
<element kind="textField" x="422" y="112" width="62" height="16" hTextAlign="Right">
180+
<element kind="textField" x="620" y="112" width="90" height="16" hTextAlign="Right">
177181
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
178182
<expression><![CDATA[$F{netPurchasedCos}]]></expression>
179183
</element>
180-
<element kind="textField" x="489" y="112" width="66" height="16" hTextAlign="Right">
184+
<element kind="textField" x="715" y="112" width="87" height="16" hTextAlign="Right">
181185
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
182186
<expression><![CDATA[$F{netPurchasedCal}]]></expression>
183187
</element>
184188

185189
<!-- Row 6: Total Company Logging Costs (Schedule 1) -->
186-
<element kind="staticText" x="0" y="134" width="350" height="16" hTextAlign="Left">
190+
<element kind="staticText" x="0" y="134" width="520" height="16" hTextAlign="Left">
187191
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
188192
<text><![CDATA[Total Company Logging Costs (Schedule 1): ]]></text>
189193
</element>
190-
<element kind="textField" x="355" y="134" width="62" height="16" hTextAlign="Right">
194+
<element kind="textField" x="525" y="134" width="90" height="16" hTextAlign="Right">
191195
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
192196
<expression><![CDATA[$F{totalCompanyLoggingVol}]]></expression>
193197
</element>
194-
<element kind="textField" x="422" y="134" width="62" height="16" hTextAlign="Right">
198+
<element kind="textField" x="620" y="134" width="90" height="16" hTextAlign="Right">
195199
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
196200
<expression><![CDATA[$F{totalCompanyLoggingCos}]]></expression>
197201
</element>
198-
<element kind="textField" x="489" y="134" width="66" height="16" hTextAlign="Right">
202+
<element kind="textField" x="715" y="134" width="87" height="16" hTextAlign="Right">
199203
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
200204
<expression><![CDATA[$F{totalCompanyLoggingCal}]]></expression>
201205
</element>
202206

203207
<!-- Separator above Total Average. -->
204-
<element kind="line" x="355" y="154" width="200" height="1">
208+
<element kind="line" x="525" y="154" width="277" height="1">
205209
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
206210
</element>
207211
<!-- Row 7: Total Company Logging Costs (Including total Silviculture Cost) -->
208-
<element kind="staticText" style="bold" x="0" y="156" width="350" height="16" hTextAlign="Left">
212+
<element kind="staticText" style="bold" x="0" y="156" width="520" height="16" hTextAlign="Left">
209213
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
210214
<text><![CDATA[Total Company Logging Costs (Including total Silviculture Cost): ]]></text>
211215
</element>
212-
<element kind="textField" style="bold" x="355" y="156" width="62" height="16" hTextAlign="Right">
216+
<element kind="textField" style="bold" x="525" y="156" width="90" height="16" hTextAlign="Right">
213217
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
214218
<expression><![CDATA[$F{totalAverageVol}]]></expression>
215219
</element>
216-
<element kind="textField" style="bold" x="422" y="156" width="62" height="16" hTextAlign="Right">
220+
<element kind="textField" style="bold" x="620" y="156" width="90" height="16" hTextAlign="Right">
217221
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
218222
<expression><![CDATA[$F{totalAverageCos}]]></expression>
219223
</element>
220-
<element kind="textField" style="bold" x="489" y="156" width="66" height="16" hTextAlign="Right">
224+
<element kind="textField" style="bold" x="715" y="156" width="87" height="16" hTextAlign="Right">
221225
<printWhenExpression><![CDATA[$P{p_do_print_body}]]></printWhenExpression>
222226
<expression><![CDATA[$F{totalAverageCal}]]></expression>
223227
</element>
@@ -227,15 +231,27 @@
227231
<printWhenExpression><![CDATA[$P{p_do_print_comment}]]></printWhenExpression>
228232
<text><![CDATA[Comments:]]></text>
229233
</element>
230-
<element kind="textField" x="0" y="203" width="555" height="15" textAdjust="StretchHeight" blankWhenNull="true">
234+
<element kind="textField" x="0" y="203" width="802" height="15" textAdjust="StretchHeight" blankWhenNull="true">
231235
<printWhenExpression><![CDATA[$P{p_do_print_comment}]]></printWhenExpression>
232236
<expression><![CDATA[$F{comments}]]></expression>
233237
</element>
234238
</band>
235239
</detail>
236240
<pageFooter height="15">
237-
<element kind="textField" x="0" y="0" width="555" height="15" hTextAlign="Right">
238-
<expression><![CDATA["Page " + $V{PAGE_NUMBER} + " of " + $V{PAGE_NUMBER}]]></expression>
241+
<!-- Reused verbatim from schedule5.jrxml / schedule11.jrxml so this section's footer matches the
242+
neighbouring sections in the combined PDF ("Page: X of Y") and the total is evaluated at
243+
Report time (evaluationTime="Report") rather than the current page. -->
244+
<element kind="staticText" x="700" y="0" width="32" height="15" vTextAlign="Bottom">
245+
<text><![CDATA[Page:]]></text>
246+
</element>
247+
<element kind="textField" x="734" y="0" width="22" height="15" hTextAlign="Center" vTextAlign="Bottom">
248+
<expression><![CDATA[$V{PAGE_NUMBER}]]></expression>
249+
</element>
250+
<element kind="staticText" x="756" y="0" width="21" height="15" hTextAlign="Center" vTextAlign="Bottom">
251+
<text><![CDATA[of]]></text>
252+
</element>
253+
<element kind="textField" x="777" y="0" width="22" height="15" hTextAlign="Center" vTextAlign="Bottom" evaluationTime="Report">
254+
<expression><![CDATA[$V{PAGE_NUMBER}]]></expression>
239255
</element>
240256
</pageFooter>
241257
</jasperReport>

backend/src/test/java/ca/bc/gov/nrs/ilcr/reporting/PrintScheduleIT.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,11 @@ void schedule2_rendersWithOneBookmark() throws Exception {
430430
assertThat(text).contains("Schedule 2: Purchased/Private Log Costs & Sales");
431431
assertThat(text).contains("Sch2 Read Milling"); // mill title block (name-number)
432432
assertThat(text).contains("Net Purchased / Private Log Cost:"); // a fixed row label (body)
433+
// The two longest labels asserted IN FULL: if the label column ever clips them, pdfbox won't
434+
// find the whole string and this breaks — catching a truncated label rather than shipping it.
435+
assertThat(text)
436+
.contains("Purchased / Private Wood Overhead (Schedule 3, Woodlands Subtotal):");
437+
assertThat(text).contains("Total Company Logging Costs (Including total Silviculture Cost):");
433438
assertThat(text).contains("500,000"); // purchased log cost (621 item 25)
434439

435440
assertThat(topLevelBookmarks(pdf)).containsExactly(ScheduleKey.SCHEDULE_2.bookmarkTitle());

0 commit comments

Comments
 (0)