Luis
06/28/2023, 5:29 AMLuis
06/28/2023, 5:31 AM<#assign previousJob = "">
<#list record.item?sort_by('job') as item>
<#if item.job != previousJob>
<#assign currentJob = item.job>
<#if item.custcol_abc?has_content && item.amount gt 0><p>${currentJob}</p></#if>
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#if item_index==0>
<thead>
<tr>
<th colspan="2">Date</th>
<th colspan="5">Memo</th>
<th colspan="3">Item</th>
<th colspan ="2" align="center">Employee<br />Rate</th>
<th align="center" colspan="2">Rate</th>
<th colspan="2">Quantity</th>
<th align="right" colspan="2">Amount<br />(ex GST)</th>
</tr>
</thead>
</#if>
<#list record.item?sort_by('job') as item>
<#if item.job == currentJob>
<#if item.custcol_abc?has_content && item.amount gt 0><#assign totalTime = totalTime + item.amount><tr>
<td colspan="2"><#if item.billeddate?has_content>${item.billeddate}<#else>${item.custcol1}</#if></td>
<td colspan="5">${item.description}</td>
<td colspan="3">${item.custcol_display_name}</td>
<td colspan="2">${item.custcol_pr_pcst}</td>
<td align="right" colspan="2">${item.rate}</td>
<td colspan="2">${item.quantity}</td>
<td align="right" colspan="2">${item.amount}</td>
</tr>
</#if></#if></#list><!-- end items --></table>
</#if>
<#assign previousJob = item.job>
</#list>
michoel
06/28/2023, 6:42 AM<table>...</thead>
to before your <#list>
. I generally do that anyways because it makes more sense to me than checking if it's the first line in every loop iterationDavid B
06/28/2023, 9:47 AMitem.job?has_content
?
If so, you could conditionally skip these lines (<#if !item.job?has_content><#continue></#if>
), or you could use the ?drop_while
sequence built-inDavid B
06/28/2023, 9:49 AMDavid B
06/28/2023, 9:58 AM<#list>
directives which are not necessary. You could use something like this instead (untested):Luis
06/28/2023, 10:54 AMLuis
07/05/2023, 5:20 AMLuis
07/05/2023, 5:20 AM