To display item table in pdf based on date created using advanced pdf/html template. The button is available in invoice record. The date considered should be the created date in the related sales order.
<#if record.item?has_content>
<#assign cutoffDate = "01/02/2025"?date("dd/MM/yyyy")>
<#assign createdFromDate = record.createdfrom.trandate>
<#if createdFromDate?has_content>
<#assign soDate = createdFromDate>
<#if soDate < cutoffDate>
<table class="itemtable" style="width: 100%; margin-top: 10px; border: 2px solid #cacaca;">
<!-- start items -->
<#list record.item as item>
<#if item.item != "Enduro Wholesale Discount">
<#if item_index==0>
<thead>
<tr>
<th colspan="4" style = "align: center; border-right: 2px solid #cacaca;">Item Code</th>
<th colspan="5" style = "align: center; border-right: 2px solid #cacaca;">Description</th>
<th colspan="2" style = "align: center; border-right: 2px solid #cacaca; color:">Pall <br/> Qty</th>
<th colspan="2" style = "align: center; border-right: 2px solid #cacaca;" >Qty<br/> Per<br/>Pall</th>
<th colspan="2" style = "align: center; border-right: 2px solid #cacaca; ">Qty</th>
<th colspan="3" style = "align: center; border-right: 2px solid #cacaca; ">Base<br/>Price</th>
<th colspan="2" style = "align: center; border-right: 2px solid #cacaca; ">Disc</th>
<th colspan="3" style = "align: center; border-right: 2px solid #cacaca; ">Selling<br/>Price</th>
<th colspan="5" style = "align: center; border-right: 2px solid #cacaca; ">Amount<br/></th>
<th colspan="4" style = "align: center; border-right: 2px solid #cacaca;">${item.tax1amt@label}</th>
<th colspan="5" style = "align: center;">Gross<br/>Amount</th>
</tr>
</thead>
</#if>
<#if item.itemtype != "Discount">
<tr>
<td colspan="4" style = "align: left; colspan: 3; border-right: 2px solid #cacaca;">${item.custcol1}</td>
<td colspan="5" style = "align: left; colspan: 5; border-right: 2px solid #cacaca;">${item.description}</td>
<td colspan="2" style = "align: center; colspan: 2; border-right: 2px solid #cacaca;">${item.custcol_jj_pallet_qty}</td>
<td colspan="2" style = "align: center; colspan: 3; border-right: 2px solid #cacaca;">${item.custcol_jj_qty_per_pallet}</td>
<td colspan="2" style = "align: center; colspan: 2; border-right: 2px solid #cacaca;">${item.quantity}</td>
<!-- base price -->
<td colspan="3" style = "align: right; colspan: 2; border-right: 2px solid #cacaca;">${item.rate}</td>
<#if item.custcol_jj_discount_value_epfna46?has_content>
<#if item.custcol_jj_discount_value_epfna46?contains("%")>
<td colspan="2" style = "align: right; colspan: 2; border-right: 2px solid #cacaca;">${item.custcol_jj_discount_value_epfna46}</td>
<#else>
<td colspan="2" style = "align: right; colspan: 2; border-right: 2px solid #cacaca;">$${item.custcol_jj_discount_value_epfna46}</td>
</#if>
<#else>
<td colspan="2" style = "align: right; colspan: 2; border-right: 2px solid #cacaca;">$0</td>
</#if>
<#assign sellingPrice = item.rate />
<#assign amount = item.amount />
<#assign gst = item.tax1amt />
<#assign grossAmount = item.grossamt />
<#if item?has_next>
<#assign nextItemType = (record.item[item_index+1].itemtype) />
<#if nextItemType == "Discount">
<#assign amount = (item.amount + (record.item[item_index+1].amount)) />
<!-- <#assign sellingPrice = (amount / item.quantity) /> -->
<#assign sellingPrice = item.custcol_jj_rate_custom_epfna46 />
<#assign gst = (item.tax1amt + (record.item[item_index+1].tax1amt)) />
<#assign grossAmount = (item.grossamt + (record.item[item_index+1].grossamt)) />
</#if>
</#if>
<!-- selling price -->
<td colspan="3" style="align: right; colspan: 2; border-right: 2px solid #cacaca;">
$${(sellingPrice?string("0.00"))?replace("$", "")}
</td>
<!-- amount -->
<td colspan="5" style="align: right; colspan: 2; border-right: 2px solid #cacaca;">
$${amount?replace("$", "")}
</td>
<!-- tax amount - GST -->
<td colspan="4" style="align: right; colspan: 2; border-right: 2px solid #cacaca;">
$${gst?replace("$", "")}
</td>
<!-- gross amount -->
<td colspan="5" style="align: right; colspan: 2;">
$${(grossAmount?string("0.00"))?replace("$", "")}
</td>
</tr>
</#if>
</#if>
</#list>
<!-- end items -->
</table>