Advanced PDF templates transaction item sublist amount calculation. The below sample code shows the calculation of item amount for non-negative values. The lines with zero amounts are skipped and the positive values are calculated.
<#if record.item?has_content>
<#list record.item as item>
<#if !(item.quantity?contains("-"))>
<#assign subtotalvalue+=item.amount>
</#if>
</#list>
</#if>