【问题标题】:NetSuite: How to Reference Custom Fields in Grouped Invoices Using Advanced PDF/HTML TemplatesNetSuite:如何使用高级 PDF/HTML 模板在分组发票中引用自定义字段
【发布时间】:2021-03-26 12:36:12
【问题描述】:

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

我们可以将自定义字段添加到 Invoice Group 应用程序的视图中,但是我们如何引用 PDF 模板中的自定义字段?该模板似乎使用硬编码名称“groupedinvoices_summary”来引用每组发票,但不清楚如何引用自定义字段。这是我们的自定义 HTML 模板的 sn-p,其中包含我们的 '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


    【解决方案1】:

    您可以使用 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/

    【讨论】:

      猜你喜欢
      • 2019-08-17
      • 2020-12-26
      • 2018-10-20
      • 2023-01-31
      • 2018-01-10
      • 2017-04-05
      • 2019-07-18
      • 2017-02-19
      • 2018-01-29
      相关资源
      最近更新 更多