Highlight Item Rows Alternatively Using Advanced PDF/HTML Template

Printing transactions using the Advanced PDF/HTML Template leverages the HTML and CSS syntax. As a result, it is feasible to create a table which uses an alternating background format when printing item tables.
<table class="itemtable" ><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
	<tr>
	<th align="center" colspan="3">${‌item.quantity@label}</th>
	<th colspan="12">${‌item.item@label}</th>
	<th colspan="3">${‌item.options@label}</th>
	<th colspan="1">${‌item.istaxable@label}</th>
	<th align="right" colspan="4">${‌item.rate@label}</th>
	<th align="right" colspan="4">${‌item.amount@label}</th>
	</tr>
</thead>
</#if><tr style="background-color: <#if (item_index % 2) == 0>white<#else>gray</#if>">
        <td align="center" colspan="3" line-height="150%">${‌item.quantity}</td>
	<td colspan="12"><span class="itemname">${‌item.item}</span><br />${‌item.description}</td>
	<td colspan="3">${‌item.options}</td>
	<td colspan="1">${‌item.istaxable}</td>
	<td align="right" colspan="4">${‌item.rate}</td>
	<td align="right" colspan="4">${‌item.amount}</td>
	</tr>
	</#list><!-- end items -->
</table>

Leave a comment

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