Currently we have a PDF invoice template set up which prints out the line item detail onto the invoice. This all works fine. However, our Finance team would now also like summary invoices to be printed, if a tick box is ticked on the Sales Order/Invoice. I've created the tick box and displayed it on the Sales Order and Invoice (the tick box field name is custbody_summaryinvoice). In our previous NetSuite system we had seperate forms for detailed and summary invoices, but in our new system we'd like to just have one form which handles both. This is to be based on if the tick box is checked or not.
The current code for printing the detail in the invoice is:
<#if record.item?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;">
<#list record.item as item> <!-- start items -->
<#if item_index==0> <!-- header line -->
<thead>
<tr>
<th colspan="18">${item.description@label}</th>
<th align="center" colspan="4">${item.quantity@label}</th>
<th align="center" colspan="5">${item.rate@label}</th>
<th align="right" colspan="5">${item.amount@label}</th>
</tr>
</thead>
</#if>
<tr>
<td colspan="18">${item.description}</td>
<#if item.item == "Description Line">
<td align="center" colspan="4"></td>
<td align="center" colspan="5"></td>
<td align="right" colspan="5"></td>
<#else>
<td align="center" colspan="4"><#if item.quantity lt 0>(${item.quantity?string?replace("-","")})<#else>${item.quantity?string}</#if></td>
<td align="center" colspan="5"><#if item.rate lt 0>(${item.rate?string[",##0.00"]?replace("-","")})<#else>${item.rate?string[",##0.00"]}</#if></td>
<td align="right" colspan="5"><#if item.amount lt 0>(${item.amount?string[",##0.00"]?replace("-","")})<#else>${item.amount?string[",##0.00"]}</#if></td>
</#if>
</tr>
</#list><!-- end items -->
</table>
And the code from the old summary invoice template is:
<table class="itemtable" style="width: 100%; margin-top: 10px;">
<thead>
<tr>
<!-- For summary invoice we need to print the Description and Amount -->
<th colspan="12">Description</th>
<th align="right" colspan="4">Amount</th>
</tr>
</thead>
<tr>
<!-- For Summary Invoice, the description is Subscription Fee and Subtotal -->
<td colspan="12">Subscription Fee</td>
<td align="right" colspan="4">${record.subtotal?string[",##0.00"]}</td>
</tr>
<tr>
How do I effectively combine the two pieces of code so that if the tick box is ticked, a summary invoice is printed (showing just the Descripton field and Amount) and if the box is unticked, the full item detail is printed? I've tried to combine them but keep getting various error messages, so obviously I'm not doing something right!
Thanks in advance!
James