Netsuite 客户声明 (PDF/HTML)

Netsuite Customer Statement (PDF/HTML)

我需要在客户报表的发票(行项目)上显示 amount.paid

下面是我想出的解决方案,在我被建议包括 toNumber function

之后

查看这些信息,我得出了一个声明 table 满足了我的要求。

  • 如果是发票,每行都会显示一笔费用
  • 如果是已应用付款的发票,将显示已支付的金额
  • 如果是 payment/deposit/credit,付款列将显示该笔付款的总付款额。
  • 余额列将显示一个金额,如果它是未付或部分支付的发票
  • 和 运行 列将显示 运行 语句的总数
  • (代码见下方)

    <table>
        <#list statement.lines as line>
    <#if line_index==0>
    
    <thead>
    <tr>
     <th>Date</th>
     <th>Description</th>
     <th>References #</th>
     <th>Charge</th>
     <th>Payment</th>
     <th>Balance Due</th>
     <th>Running</th>
    </tr>
    </thead>
    
    </#if>
     <tr>
     <#function toNumber val><#if val?has_content && val?length gt 0 ><#return val?html?replace('[^0-9.]','','r')?number ><#else><#return 0 ></#if></#function>
     <#assign amountpaid=(line.charge?int-line.amountremaining?int)>
      <td>${line.datecol}</td>
      <td>${line.description}</td>
      <td>${line.otherrefnum}&nbsp;-&nbsp;${line.custbodyjobnum}</td>
      <td>${line.charge}</td>
      <td><#if amountpaid gt 0>${amountpaid?string.currency}<#else>${line.payment}</#if></td>
      <td>${line.amountremaining}</td>
      <td>${line.balance}</td>
    </tr>
    </#list>
    </table>