I had a need to display the amount.paid
on invoices (line items) on the customer statement.
Below is the solution I came up with, after i was suggested to include the toNumber function
Looking at that information, I was able to come up with a statement table that gives me what I wanted.
(see below for code)
<table>
<#list statement.lines as line>
<#if line_index==0>
<thead>
<tr>
<th>Date</th>
<th>Description</th>
<th>References #</th>
<th>Charge</th>
<th>Payment</th>
<th>Balance Due</th>
<th>Running</th>
</tr>
</thead>
</#if>
<tr>
<#function toNumber val><#if val?has_content && val?length gt 0 ><#return val?html?replace('[^0-9.]','','r')?number ><#else><#return 0 ></#if></#function>
<#assign amountpaid=(line.charge?int-line.amountremaining?int)>
<td>${line.datecol}</td>
<td>${line.description}</td>
<td>${line.otherrefnum} - ${line.custbodyjobnum}</td>
<td>${line.charge}</td>
<td><#if amountpaid gt 0>${amountpaid?string.currency}<#else>${line.payment}</#if></td>
<td>${line.amountremaining}</td>
<td>${line.balance}</td>
</tr>
</#list>
</table>