gstea96
gstea96

Reputation: 145

Is there a way of displaying backordered items on a Netsuite advanced PDF Packing Slip (freemarker)?

Basiscally we have a freemarker form (netsuite calls it Advanced PDF) for a Packing List. It displays the items shipped, with quantity ordered, quantity shipped, and quantity backordered - easy. Keep in mind, it needs to respect previous shipments, so it doesn't displays items already fulfilled. The problem is, in the process of excluding previous shipments, it excludes backordered items which haven't been shipped yet, and we would like these to display as X ordered, 0 shipped, X backordered.

Have a look at the segment below - so far I've tried adding an #elseif for when quantitybackorder+quantitycommitted gt 0, but this literally repeats each line on the fulfillment by the number of lines on the order, which is strange (ie. 8 lines ordered, 2 fulfilled- those 2 will repeat 8 times each, with each set of data on its own line)

<#if record.item?has_content>
            <table class="itemtable"><!-- start items -->
            <#list record.item as item>
                <#if item_index==0>
                    <thead>
                        <tr>
                            <th colspan="5" style="align: left;"><span style="font-size:12px;">Item Number</span></th>
                            <th colspan="12" style="align: left;"><span style="font-size:12px;">Item Description</span></th>
                            <th colspan="3"><span style="font-size:12px;">Ordered</span></th>
                            <th colspan="3"><span style="font-size:12px;">Backorder</span></th>
                            <th colspan="3"><span style="font-size:12px;">Shipped</span></th>
                            <th colspan="2"><span style="font-size:12px;">Unit</span></th>
                        </tr>
                    </thead>
                </#if>
                <#list salesorder.item as tranline>
                    <#if tranline.custcol_item_code==item.item>
                            <tr>
                                <td colspan="5"><p style="text-align: left;">${item.item}</p></td>
                                <td colspan="12"><p style="text-align: left;"><span style="font-weight: bold; line-height: 18px;">${item.description}</span><br /><em>${tranline.custcol_extra_details}</em></p></td>
                                <td colspan="3" style="align: center;">${tranline.quantity}</td>
                                <td colspan="3" style="align: center;">${tranline.quantitybackordered+tranline.quantitycommitted}</td>
                                <td colspan="3" style="align: center;">${item.quantity}</td>
                                <td colspan="2" style="align: center;">${tranline.units}</td>
                            </tr>
                    </#if>
                </#list>
            </#list>
    <!-- end items --></table>
</#if>

Does anyone have any idea how I can allow for backordered items here, or looking at it another way, just exclude the already fulfilled items leaving current fulfillment and backorders? Thanks very much for your help!

Upvotes: 0

Views: 1938

Answers (2)

gstea96
gstea96

Reputation: 145

The better way to do it, apart from my earlier answer, is to define shippednow as 0 before you start, then draw data without giving it the option of being zero. This avoids getting an indexing issue on the first line.

        <#list salesorder.item as tranline><#assign shippednow=0 >
          <#list record.item as item><#if item.orderline==tranline.line><#assign shippednow=item.quantity ></#if></#list><#assign prevship=tranline.quantityfulfilled-shippednow>
            <#if tranline.quantity==(prevship!0)><#else>
                    <tr>
                        <td colspan="5"><p style="text-align: left;">${tranline.custcol_item_code}</p></td>
                        <td colspan="12"><p style="text-align: left;"><span style="font-weight: bold; line-height: 18px;">${tranline.description}</span><br /><em>${tranline.custcol_extra_details}</em></p></td>
                        <td colspan="3" style="align: center;"><#if tranline.quantity gt 0>${tranline.quantity}<#else>0</#if></td>
                        <td colspan="3" style="align: center;">${(tranline.quantitybackordered+tranline.quantitycommitted)?string.number}</td>
                        <td colspan="3" style="align: center;">${shippednow!"0"}</td>
                        <td colspan="2" style="align: center;">${tranline.units}</td>
                      </tr></#if>
        </#list>

Upvotes: 0

gstea96
gstea96

Reputation: 145

I think it was a non-fulfillable issue, and what you've got there would fix it. I've actually moved away from that, because the pair of lists for some reason was making all the lines double-up. What I've ended up with is:

<#list salesorder.item as tranline>
    <#list record.item as item>
        <#if tranline.custcol_item_code==item.custcol_item_code><#assign shippednow=item.quantity ><#else><#assign shippednow=0 ></#if>
    </#list>
    <tr>
        <td colspan="5"><p style="text-align: left;">${tranline.custcol_item_code}</p></td>
        <td colspan="12"><p style="text-align: left;"><span style="font-weight: bold; line-height: 18px;">${tranline.description}</span><br /><em>${tranline.custcol_extra_details}</em></p></td>
        <td colspan="3" style="align: center;"><#if tranline.quantity gt 0>${tranline.quantity}<#else>0</#if></td>
        <td colspan="3" style="align: center;">${tranline.quantitybackordered+tranline.quantitycommitted}</td>
        <td colspan="3" style="align: center;">${shippednow}</td>
        <td colspan="2" style="align: center;">${tranline.units}</td>
    </tr>
</#list>

Upvotes: 1

Related Questions