Solution
<#assign item_arry = []>
<#list record.item?sort_by("item") as groupItem>
<#assign Qty=0/>
<#assign Rate=0/>
<#assign groupId = groupItem.item>
<#if item_arry?seq_contains(groupId)> <!-- no if body is intentional; skips item array -->
<#else>
<#assign seen_style = item_arry + [groupId]/>
<#list record.item as groupItem2>
<#if groupItem.item==groupItem2.item>
<!-- As items are grouping, the corresponding qtys needs to be added -->
<#assign Qty=Qty+groupItem2.quantity/>
<#assign Rate=Rate+groupItem2.rate/>
</#if>
</#list>
<#if record.item?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items -->
<#if groupItem_index==0>
<thead>
<tr>
<th align="center" colspan="3">${groupItem.quantity@label}</th>
<th colspan="12">${groupItem.item@label}</th>
<th colspan="3">${groupItem.options@label}</th>
<th align="right" colspan="4">${groupItem.rate@label}</th>
<th align="right" colspan="4">${groupItem.amount@label}</th>
</tr>
</thead>
</#if><tr>
<td align="center" colspan="3" line-height="150%">${Qty}</td>
<td colspan="12"><span class="itemname">${groupItem.item}</span><br />${groupItem.description}</td>
<td colspan="3">${groupItem.options}</td>
<td align="right" colspan="4">${Rate}</td>
<td align="right" colspan="4">${groupItem.amount}</td>
</tr>
<!-- end items --></table></#if>
<hr /></#if>
</#list>