Sort item details on the Picking Ticket first by bin number and then alphabetically by item name in the advanced PDF template

<#if record.item?has_content>
<#assign itemsWithBin = record.item?filter(i -> i.inventorydetail?has_content)>
<#assign itemsWithoutBin = record.item?filter(i -> !i.inventorydetail?has_content)>
<#assign sortedItemsWithBin = itemsWithBin?sort_by('inventorydetail')>
<#assign sortedItemsWithoutBin = itemsWithoutBin?sort_by('item')>
<#assign sortedItems = sortedItemsWithBin + sortedItemsWithoutBin>
<table style="width: 100%; margin-top: 5px; margin-left: 4px; margin-right: 4px"><!-- start items --><#list sortedItems as item><#if item_index==0>
<thead>
	<tr>
	<th colspan="4">Bin Number</th>
	<th colspan="6" style="padding: 10px 6px;">${item.item@label}</th>
	<th colspan="10" style="padding: 10px 6px;">Description</th>
	<th align="center" colspan="4" style="padding: 10px 6px;">${item.quantitycommitted@label}</th>
	<!-- <th align="right" colspan="6" style="padding: 10px 6px;">Exp.<br />Completion<br />Date</th> --></tr>
</thead>
</#if><tr>
	<td colspan="4">${item.inventorydetail}</td>
	<td colspan="6">${item.item}</td>
	<td colspan="10">${item.description}</td>
	<td align="center" colspan="4" line-height="150%">${item.quantitycommitted}</td>
	<!-- <td align="right" colspan="6">${item.expectedshipdate}</td> --></tr>
	</#list><!-- end items --></table>

Leave a comment

Your email address will not be published. Required fields are marked *