如何使项目始终出现在列表的最后(Netsuite Advanced PDF)

How to make an item always appear last on list (Netsuite Advanced PDF)

如果某个项目出现在发票(高级 PDF、NetSuite)中,我正在尝试使它出现在列表的最后。

我正在考虑尝试对项目名称进行排序并添加一些 ZZZ,但那是因为除了基本 HTML。

我真的不太了解

任何帮助将不胜感激。 下面是我正在处理的 table 代码。

 <table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
    <tr>
    <th align="center" colspan="3">${item.quantity@label}</th>
    <th colspan="12">${item.item@label}</th>
    <th colspan="3">${item.options@label}</th>
    <th align="right" colspan="4">${item.rate@label}</th>
    <th align="right" colspan="4">${item.amount@label}</th>
    </tr>
</thead>
</#if><tr>
    <td align="center" colspan="3" line-height="150%">${item.quantity}</td>
    <td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
    <td colspan="3">${item.options}</td>
    <td align="right" colspan="4">${item.rate}</td>
    <td align="right" colspan="4">${item.amount}</td>
    </tr>
    </#list>

我需要能够选择始终显示在底部的特定项目名称。

您可以尝试循环 2 次。

<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
    <tr>
    <th align="center" colspan="3">${item.quantity@label}</th>
    <th colspan="12">${item.item@label}</th>
    <th colspan="3">${item.options@label}</th>
    <th align="right" colspan="4">${item.rate@label}</th>
    <th align="right" colspan="4">${item.amount@label}</th>
    </tr>
</thead>
</#if><#if ${item.item}!="Your Item"><tr>
    <td align="center" colspan="3" line-height="150%">${item.quantity}</td>
    <td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
    <td colspan="3">${item.options}</td>
    <td align="right" colspan="4">${item.rate}</td>
    <td align="right" colspan="4">${item.amount}</td>
    </tr>
    </#list>
    <#list record.item as item><#if ${item.item}=="Your Item"><tr>
    <td align="center" colspan="3" line-height="150%">${item.quantity}</td>
    <td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
    <td colspan="3">${item.options}</td>
    <td align="right" colspan="4">${item.rate}</td>
    <td align="right" colspan="4">${item.amount}</td>
    </tr>
    </#list>

我还没有测试过 if 语句,祝你好运

您可以使用分配标签来保存底部项目的值。

<#assign bottomItemName = 'Bottom Item Name'>
<#assign bottomItem = {}>

<#list record.item as item>
    <#if item_index==0>
        <thead>
            <tr>
            <th align="center" colspan="3">${item.quantity@label}</th>
            <th colspan="12">${item.item@label}</th>
            <th colspan="3">${item.options@label}</th>
            <th align="right" colspan="4">${item.rate@label}</th>
            <th align="right" colspan="4">${item.amount@label}</th>
            </tr>
        </thead>
    </#if>
    <#if item.item == bottomItemName>
        <#assign bottomItem = bottomItem + item>
    <#else>
        <tr>
            <td align="center" colspan="3" line-height="150%">${item.quantity}</td>
            <td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
            <td colspan="3">${item.options}</td>
            <td align="right" colspan="4">${item.rate}</td>
            <td align="right" colspan="4">${item.amount}</td>
        </tr>
    </#if>
</#list>

<#if bottomItem.item??>
    <tr>
        <td align="center" colspan="3" line-height="150%">${bottomItem.quantity}</td>
        <td colspan="12"><span class="itemname">${bottomItem.item}</span><br />${bottomItem.description}</td>
        <td colspan="3">${bottomItem.options}</td>
        <td align="right" colspan="4">${bottomItem.rate}</td>
        <td align="right" colspan="4">${bottomItem.amount}</td>
    </tr>
</#if>