NetSuite:如何使用高级 PDF/HTML 模板引用分组发票中的自定义字段

问题描述 投票:0回答:2

我们正在使用 NetSuite 的高级 PDF 分组发票模板来打印发票组,并且需要在发票组中的每个发票行上包含现有的自定义字段(发票标题中的 custbody_subscription_name)。

我们可以将自定义字段添加到发票组应用程序中的视图中,但是我们如何在PDF模板中引用自定义字段呢?该模板似乎使用硬编码名称“groupedinvoices_summary”来引用每组发票,但尚不清楚如何引用自定义字段。以下是我们的自定义 HTML 模板的片段,其中包含“custbody_subscription_name”自定义字段:

<table style="width: 100%; margin-top: 10px;"><#list groupedinvoices_summary as invoice><#if invoice_index==0>
<thead>
<tr style="background-color: #d3d3d3;">
<td align="center" colspan="4" style="font-weight: bold;border-left: 1px solid; border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.custbody_subscription_name@label}</td>
<td align="center" colspan="4" style="font-weight: bold;border-left: 1px solid; border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.invoicenum@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.itemtotal@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.discounttotal@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.trantaxtotal@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.shippingcharge@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.handlingcharge@label}</td>
<td align="center" colspan="3" style="font-weight: bold;border-top: 1px solid; border-bottom: 1px solid; border-right: 1px solid ">${invoice.fxamount@label}</td>
</tr>
</thead>
</#if><tr>
<td align="left" colspan="4" style="color: #333333;border-left: 1px solid; border-bottom: 1px solid; border-right: 1px solid">${invoice.custbody_subscription_name}</td>
<td align="left" colspan="4" style="color: #333333;border-left: 1px solid; border-bottom: 1px solid; border-right: 1px solid">${invoice.invoicenum}</td>
<td align="center" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.itemtotal}</td>
<td align="center" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.discounttotal}</td>
<td align="center" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.trantaxtotal}</td>
<td align="center" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.shippingcharge}</td>
<td align="center" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.handlingcharge}</td>
<td align="right" colspan="3" style="border-bottom: 1px solid; border-right: 1px solid">${invoice.fxamount}</td>
</tr>
</#list></table>

更新#1:在尝试了各种方法之后,主要问题是,显然,只能引用默认视图中的字段。我们如何解决这个问题?

netsuite suitescript suitescript2.0
2个回答
2
投票

您可以使用 TemplateRenderer.addCustomDataSource() 方法将数据添加到 SuiteScript 中的高级 PDF 模板。

var invoiceGroupInvoiceReportRows = { groupedinvoices_summary: [<your data>] };
var invoiceDetailReportRows = { invoice_details: [<your data>] };
xmlReport.addCustomDataSource({
    format: render.DataSource.OBJECT,
    alias: 'results',
    data: invoiceGroupInvoiceReportRows
});

然后在报告 XML 中引用该数据,如下所示:

results.groupedinvoices_summary

请参阅套件答案 825864933944622 了解更多信息/


0
投票

您可以为发票组类型创建“其他记录字段”,以从子公司和客户记录中获取某些字段。

© www.soinside.com 2019 - 2024. All rights reserved.