【发布时间】:2021-02-09 22:50:34
【问题描述】:
我需要为 Freemarker(Netsuite 版本)中的特定项目金额分配一个变量,以便在发票模板的不同部分使用。
我正在努力弄清楚如何使用 来做到这一点。该项目将只使用一次,并将位于发票上的小计字段下方。
关于如何做到这一点的任何建议?
【问题讨论】:
标签: netsuite freemarker
我需要为 Freemarker(Netsuite 版本)中的特定项目金额分配一个变量,以便在发票模板的不同部分使用。
我正在努力弄清楚如何使用 来做到这一点。该项目将只使用一次,并将位于发票上的小计字段下方。
关于如何做到这一点的任何建议?
【问题讨论】:
标签: netsuite freemarker
捕获数据:
<#assign ord_number_is>Your order number is ${record.tranid}</#assign>
${ord_number_is}
设置数据:
<#assign fs_6="font-size: 6pt;" />
${fs_6}
【讨论】:
大多数(全部?)在 NetSuite 交易高级 pdf 表单中,交易项目内容的“内容”以如下行开头:
<table class="itemtable"><!-- start items --><#list record.item as item><#if item_index==0>
然后它在一个 html 表格中提供内容(通常是项目)并用结束标记结束循环:
</#list><!-- end items -->
当我需要首先从项目列表中收集信息但不实际将其打印到 pdf 中时,我喜欢遵循相同的结构减去 html 元素。对于您的情况,我认为您想识别子列表中的特定项目,然后如果它存在,请记录金额以供将来在表格中的其他地方使用。使用上面的结构,会是这样的:
<!-- assign variable to hold initial value -->
<#assign item_x_amount = 0>
<!-- populate the amount if the item is present in any row -->
<#list record.item as tmpLine>
<#if (tmpLine.item == "Consulting Services")><#assign item_x_amount = item_x_amount + tmpLine.amount></#if>
</#list>
然后,稍后在创建小计表的代码中,添加变量标签和值。导致的事务如下所示:
注意事项:
<#assign item_x_amount = item_x_amount + tmpLine.amount> 更改为<#assign item_x_amount = tmpLine.amount>
${item_x_amount?string.currency}将显示的结果格式化为货币
希望这会有所帮助!我在 NetSuite 开发中经常使用这种技术。
【讨论】: