0

I have a credit memo template for which I want to include what invoices this credit has been applied to (This information is in a sublist on the record under ITEM > Apply )

I currently have the below code in the template, which only seems to show the first invoice in the sublist?? I can't figure why.

    <#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>

I don't have access to any suitescript or serverscript or anything like that, so I need a solution to the source code in the PDF/HTML Template (if possible)

4

1 回答 1

2

你有 <#if apply_index==3>,这只有一次。它应该是 <#if apply_index==0> 并且应该在定义 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>
于 2016-11-10T14:31:44.107 回答