我有一个贷项通知单模板,我想在其中包含已应用此贷项的发票(此信息位于ITEM>应用下记录的子列表中)
我目前在模板中有以下代码,它似乎只显示子列表中的第一张发票?我无法理解为什么。
<#if record.apply?has_content>
<table>
<thead><tr><th>Applied to:</th></tr></thead></table>
<table><#list record.apply as apply><#if apply_index==3>
<thead>
<tr>
<th style="align: center;">Date</th>
<th style="align: center;">Invoice</th>
<th style="align: center;">Original Amount</th>
<th style="align: center;">Payment</th>
<th style="align: center;">Due</th>
</tr>
</thead><tr>
<td style="align: center;">${apply.duedate}</td>
<td style="align: center;">${apply.refnum}</td>
<td style="align: center;">${apply.total}</td>
<td style="align: center;">${apply.amount}</td>
<td style="align: center;"><#assign remaining=(apply.total)-(apply.amount)>${remaining?string.currency}</td>
</tr></#if></#list>
</table></#if>
我无法访问任何suitecript或者serverscript或类似内容,因此我需要PDF / HTML模板中的源代码解决方案(如果可能)
答案 0 :(得分:1)
你有&lt; #if apply_index == 3&gt;,这只是真实的一次。它应该是&lt; #if apply_index == 0&gt;这应该在定义thead之后结束。
列表循环的其余部分应该是原样。问题是你的if语句。它通常只用于在索引0处创建标题.tbody的其余部分是在if语句之外和列表循环内部生成的。
由于标题是100%静态类型,因此根本不需要if语句。您应该只在列表循环中的TBODY中包含TR部分。
<#if record.apply?has_content>
<table>
<thead><tr><th>Applied to:</th></tr></thead></table>
<table>
<thead>
<tr>
<th style="align: center;">Date</th>
<th style="align: center;">Invoice</th>
<th style="align: center;">Original Amount</th>
<th style="align: center;">Payment</th>
<th style="align: center;">Due</th>
</tr>
</thead>
<tbody>
<#list record.apply as apply>
<tr>
<td style="align: center;">${apply.duedate}</td>
<td style="align: center;">${apply.refnum}</td>
<td style="align: center;">${apply.total}</td>
<td style="align: center;">${apply.amount}</td>
<td style="align: center;"><#assign remaining=(apply.total)-(apply.amount)>${remaining?string.currency}</td>
</tr>
</#list>
</tbody>
</table>
</#if>