NetSuite Advance pdf/html template

Issue

i have a PO with both expense and item fields but need to pull only the epenses without inserting items on pdf template print out on NetSuite how to customise that? as i will need that template to print out the following from the transaction side without customizing many templates:

  1. PO with just an Item
  2. PO with just an Expense
  3. PO with both Item and Expense

is there a specific standard functionality to only have one PO customised pulling both information on one template?

I have tried creating duplicate templates one for having only item, one for only having expenses and one for having both items and expenses.

i am expeting to have a way to only create one template that can print out and expense without item,item without expense, both item and expense

Solution

You can detect whether you have items, expenses or both and modify the code for just the lines section of the template. The following is one where I did that for vendor bills:


<!-- start items/expenses -->


<#if (record.item?is_collection && record.item?has_content) || (record.expense?is_collection && record.expense?has_content)>
    <#assign sectionTitle = ''>
    <#assign headerRec = ''>
    <#assign idLabel = ''>
    <#assign qtyLabel = ''>

    <#if (record.item?is_collection && record.item?has_content) && (record.expense?is_collection && record.expense?has_content)>
        <#assign sectionTitle>${[email protected]}/${[email protected]}</#assign>
        <#assign headerRec = record.item[0]>
        <#assign idLabel>${record.item[0][email protected]}/${record.expense[0][email protected]}</#assign>
        <#assign qtyLabel>${record.item[0][email protected]}/${record.expense[0][email protected]}</#assign>

    <#elseif (record.item?is_collection && record.item?has_content)>
        <#assign sectionTitle = [email protected]>
        <#assign headerRec = record.item[0]>
        <#assign idLabel = record.item[0][email protected]>
        <#assign qtyLabel = record.item[0][email protected]>

    <#else>
        <#assign sectionTitle = [email protected]>
        <#assign headerRec = record.expense[0]>
        <#assign idLabel = record.expense[0][email protected]>
        <#assign qtyLabel = record.expense[0][email protected]>

    </#if>
<!-- both items and expenses machine have content -->



<span class="tabletitle">${sectionTitle}</span>

<table class="itemtable" style="width: 100%; margin-top: 10px;">
<thead>
    <tr>
    <th colspan="3">${idLabel}</th>
    <th colspan="2">${qtyLabel}</th>
    <#if anyTax1 == true>
        <th align="right">${[email protected]}</th>
        <th align="right">${[email protected]}</th>
    </#if>
    <#if anyTax2 == true>
        <th align="right">${[email protected]}</th>
    </#if>
    <th align="right">${[email protected]}</th>
    <th align="right">${[email protected]}</th>
    </tr>
</thead>
<#list record.item as item>
    <tr>
        <td colspan="3">${item.item}</td>
        <td colspan="2">${item.quantity}</td>
        
        <#if anyTax1 == true>
            <td align="right">${item.taxrate1}</td>
            <td align="right">${item.tax1amt}</td>
        </#if>
        <#if anyTax2 == true>
            <td align="right">${item.taxrate2}</td>
        </#if>
        <td align="right">${item.rate}</td>
        <td align="right">${item.amount}</td>
    </tr>
    </#list>
    <#list record.expense as expense>
    <tr>
        <td colspan="3">${expense.account}</td>
        <td colspan="2">${expense.memo}</td>
        <!-- expenses don't have quantities -->
        
        <#if anyTax1 == true>
            <td align="right">${expense.taxrate1}</td>
            <td align="right">${expense.tax1amt}</td>
        </#if>
        <#if anyTax2 == true>
            <td align="right">${expense.taxrate2}</td>
        </#if>
        <td>&nbsp;</td>
        <!-- expenses don't have rates -->
        <td align="right">${expense.amount}</td>
    </tr>
    </#list>
</table>

</#if>

Answered By – bknights

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published