There is a field in Invoice item line “Invoice Group”,based on this field we have to group the item lines in invoice.
If there is value in “Invoice Group” , this value should be given as description in PDF. Also sum the amount in the other lines if the value in invoice grouping is same.
-If there is no value in invoice grouping. give the item name as the description in PDF and give the amount. (NO sum/grouping based on item).
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>
<head>
<link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
<#if .locale == "zh_CN">
<link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
<#elseif .locale == "zh_TW">
<link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
<#elseif .locale == "ja_JP">
<link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
<#elseif .locale == "ko_KR">
<link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
<#elseif .locale == "th_TH">
<link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
</#if>
<macrolist>
<macro id="nlheader">
<table class="header" style="width: 100%;">
<tr>
<td rowspan="4" style="height: 114px; width; 400px;" >
<img src="${companyInformation.logoUrl}" />
</td>
<td rowspan="4" style="height: 114px; width; 400px;" >
<#if record.class?length !=0>
<@filecabinet nstype="image" src="${record.class.custrecord_ltg_bu_logo}" />
<#else>
</#if>
</td>
<td align="right"><span class="title">${record@title}</span></td>
</tr>
<tr>
<td align="right"><span class="number">#${record.tranid}</span></td>
</tr>
</table>
</macro>
<macro id="nlfooter">
<table class="footer" style="width: 100%;">
<tr>
<td><barcode codetype="code128" showtext="true" value="${record.tranid}"/></td>
<td align="right" width="20%"><pagenumber/> of <totalpages/></td>
</tr>
</table>
</macro>
</macrolist>
<style type="text/css">* {
<#if .locale == "zh_CN">
font-family: NotoSans, NotoSansCJKsc, sans-serif;
<#elseif .locale == "zh_TW">
font-family: NotoSans, NotoSansCJKtc, sans-serif;
<#elseif .locale == "ja_JP">
font-family: NotoSans, NotoSansCJKjp, sans-serif;
<#elseif .locale == "ko_KR">
font-family: NotoSans, NotoSansCJKkr, sans-serif;
<#elseif .locale == "th_TH">
font-family: NotoSans, NotoSansThai, sans-serif;
<#else>
font-family: NotoSans, sans-serif;
</#if>
}
table {
font-size: 9pt;
table-layout: fixed;
}
th {
font-weight: bold;
font-size: 9pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #fff;
border-top: 0.5px black;
color: #333333;
}
th.tp {
font-weight: bold;
font-size: 9pt,
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #fff;
color: #fff;
}
td {
padding: 4px 6px;
}
td p { align:left }
td.bold {
font-weight: bold;
color: #333333;
}
table.header td {
padding: 0px;
font-size: 9pt;
}
table.footer td {
padding: 0px;
font-size: 9pt;
}
table.itemtable th {
padding-bottom: 10px;
padding-top: 10px;
}
table.body td {
padding-top: 10px;
}
table.total {
page-break-inside: avoid;
}
tr.totalrow {
background-color: #fff;
line-height: 200%;
}
td.totalboxtop {
font-size: 9pt;
background-color: #fff;
}
td.addressheader {
font-size: 9pt;
padding-top: 6px;
padding-bottom: 3px;
font-weight: bold;
}
td.address {
padding-top: 0px;
}
td.totalboxmid {
font-size: 28pt;
padding-top: 20px;
background-color: #fff;
}
td.totalboxbot {
background-color: #fff;
font-weight: bold;
}
span.title {
font-size: 16pt;
}
span.number {
font-size: 12pt;
}
span.itemname {
font-weight: bold;
line-height: 150%;
}
span.abn {
font-size: 9pt;
}
hr {
width: 100%;
color: #d3d3d3;
background-color: #d3d3d3;
height: 1px;
}
</style>
</head>
<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="20pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
<table style="width: 100%; margin-top: 10px">
<tr>
<td class="body td" colspan="3">${subsidiary.mainaddress_text}</td>
</tr>
</table>
<table style="width: 100%; margin-top: 10px;">
<tr>
<td class="addressheader" colspan="4">${record.billaddress@label}</td>
<td class="addressheader" colspan="4">${record.shipaddress@label}</td>
</tr>
<tr>
<td class="address" colspan="4" rowspan="2">${record.billaddress}</td>
<td class="address" colspan="4" rowspan="2">${record.shipaddress} <br /> <#if record.entity.vatregnumber?length !=0> Tax ID: ${record.entity.vatregnumber} <#else> </#if></td>
</tr>
</table>
<table class="body" style="width: 100%; margin-top: 10px;">
<tr>
<th>${record.trandate@label}</th>
<th>${record.terms@label}</th>
<th>${record.duedate@label}</th>
<th>${record.otherrefnum@label}</th>
<th>${record.currency@label}</th>
</tr>
<tr>
<td>${record.trandate}</td>
<td>${record.terms}</td>
<td>${record.duedate}</td>
<td>${record.otherrefnum}</td>
<td>${record.currency}</td>
</tr>
</table>
<#assign seen_style = []>
<#list record.item as item>
<#assign Rate=0/>
<#assign groupId = item.custcol_ltg_col_inv_group>
<#if seen_style?seq_contains(groupId) && groupId != ""> <!-- no if body is intentional; skips seen style -->
<#else>
<#assign seen_style = seen_style + [groupId]/>
<#list record.item as item2>
<#if item.custcol_ltg_col_inv_group==item2.custcol_ltg_col_inv_group>
<#assign Rate=(Rate+item2.amount)/>
</#if>
</#list>
<#if record.item?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items -->
<#if item_index==0>
<thead>
<tr>
<th align="left" colspan="8">${item.description@label}</th>
<th align="right" colspan="4">${item.amount@label}</th>
</tr>
</thead>
</#if>
<#if groupId?has_content>
<tr>
<td align="left" colspan="8" line-height="1px">${groupId}</td>
<td align="right" colspan="4" line-height="1px">$${Rate?string("0.00")}</td>
</tr>
<#else>
<tr>
<td align="left" colspan="8" line-height="1px">${item.item}</td>
<td align="right" colspan="4" line-height="1px">${item.amount}</td>
</tr>
</#if>
</#if>
<!-- end items -->
</table>
</#if>
</#list>
<!-- <table class="itemtable" style="width: 100%; margin-top: 10px;">
<#list record.item as item>
<#if item.custcol_ltg_col_inv_group=="">
<tr>
<td align="left" colspan="8" line-height="1px">${item.item}</td>
<td align="right" colspan="4" line-height="1px">${item.amount}</td>
</tr>
</#if>
</#list>
</table>-->
<table class="total" style="width: 100%; margin-top: 10px;">
<tr>
<td class="bold" colspan="4">${record.custbody_ltg_so_agreement@label}</td>
<td class="bold" align="right">${record.subtotal@label}</td>
<td align="right">${record.subtotal}</td>
</tr>
<tr>
<td colspan="4">${record.custbody_ltg_so_agreement}</td>
<td class="bold" align="right">${record.taxtotal@label}</td>
<td align="right">${record.taxtotal}</td>
</tr>
<tr class="totalrow">
<td background-color="#ffffff" colspan="4"> </td>
<td class="bold" align="right">${record.total@label}</td>
<td align="right">${record.total}</td>
</tr>
<tr>
<td background-color="#ffffff" colspan="4"> </td>
<td class="bold" align="right">${record.amountremaining@label}</td>
<td align="right">${record.amountremaining}</td>
</tr>
</table>
<table class="body" style="width: 100%; margin-top: 10px;">
<tr>
<th>${subsidiary.custrecord_ltg_sub_bank_transfer_info@label}</th>
<th>${subsidiary.custrecord_ltg_sub_cheque_info@label}</th>
</tr>
<tr>
<td>${subsidiary.custrecord_ltg_sub_bank_transfer_info}</td>
<td>${subsidiary.custrecord_ltg_sub_cheque_info}</td>
</tr>
</table>
<table class="body" style="width:100%; margin-top: 10px;">
<tr>
<td class="bold">${subsidiary.custrecord_ltg_remittance_information@label}</td>
</tr>
<tr>
<td>${subsidiary.custrecord_ltg_remittance_information}</td>
</tr>
<tr>
<td><#if record.custbody_mes_invl_end_customer_link?has_content>
<a href="${record.custbody_mes_invl_end_customer_link}" target="_BLANK">Click Here to Pay Securely via Merchant eSolutions</a>
</#if></td>
</tr>
</table>
</body>
</pdf>