Use Case:
Advanced PDF/HTML Templates support HTML and CSS formatting, allowing users to customize the appearance of printed transaction forms.
Users can apply alternating background colors to item rows to improve readability of item tables.
How It Works:
- Navigate to Customization > Forms > Advanced PDF/HTML Templates
- Locate the preferred Advanced PDF/HTML Template and click Edit
- On the upper-right corner, toggle Source Code
- Locate the following code:
<table><!-- 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 align="right" colspan="4">${item.rate@label}</th>
<th align="right" colspan="4">${item.amount@label}</th>
</tr>
</thead>
</#if>
<tr>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span>${item.item}</span><br />${item.description}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount?replace("($","$(")}</td>
</tr>
</#list><!-- end items -->
</table>
5. Update the code with the following:
<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>
6. Click Save