Split SGST and CGST tax details in two lines in Tax Invoice PDF.

Split tax details in the format ‘GST:SGST & CGST x%’ in two lines in the tax invoice PDF.

PDF should be look like:

Code for splitting the SGST and CGST in two lines:

<#if record.item?has_content><!– check if record has tax amount/rate first –><#assign tax_amt = false><#assign tax_rate = false><#list record.item as item><#if (item.tax1amt?length != 0) ><#assign tax_amt = true></#if><#if (item.taxrate1?length != 0) ><#assign tax_rate = true></#if></#list><!– end check –>

<table class=”itemtable” style=”width: 100%;”><!– start items –><#list record.item as item><#if item_index==0>

<thead>

<tr>

<th colspan=”8″ style=”padding-left: 10px;”>PART NUMBER</th>

<th colspan=”8″ style=”padding-left: 0px;”>PRODUCT DESCRIPTION</th>

    <th colspan=”5″ style=”padding-left: 0px;”>${item.taxcode@label?upper_case}</th>

    <#if tax_rate><!– <th colspan=”2″>${item.taxrate1@label?upper_case}</th> –>

<th align=”center” colspan=”6″>&nbsp;TAX RATE</th></#if>

<#if tax_amt>

<th colspan=”4″ align=”right”>${item.tax1amt@label?upper_case}</th>

</#if>

<!– <th align=”center” colspan=”3″>${item.quantity@label?upper_case}</th> –>

<th align=”center” colspan=”3″ line-height=”150%”>QTY</th>

<th align=”right” colspan=”5″>${item.rate@label?upper_case}</th>

<th align=”right” colspan=”5″ style=”padding-right: 10px;”>${item.amount@label?upper_case}</th>

</tr>

</thead>

</#if>

 <#assign tax_code_parts = item.taxcode?split(‘:’)>

 <tr style=”background-color: <#if (item_index % 2) == 0>#ffffff<#else>#e1e6ee</#if>”>

<td colspan=”8″>${item.item}</td>

<td colspan=”8″ align=”left” style=”padding-left: 0px;” >${item.description}</td>

 <#assign tax_code_contains_ampersand = item.taxcode?contains(“&amp;”)>

<#if tax_code_contains_ampersand>

  <td align=”left” colspan=”5″ style=”padding-left: 0px;”>

          <#assign taxCodeParts = item.taxcode?split(‘:’)>

          <#if taxCodeParts?size gt 1>

            <#assign secondPart = taxCodeParts[1]?replace(“&amp;”, “<br/>”)?replace(“9%”, “”)>

            ${secondPart}

          <#else>

            ${item.taxcode}

          </#if>

        </td>

  

    <#if tax_rate && item.taxrate1??>

  <td align=”center” colspan=”6″>

    <#assign tax_rate_total = item.taxrate1?replace(“%”, “”)?number>

    <#assign tax_rate_split = tax_rate_total / 2>

    ${tax_rate_split?string(“0.##”)}%<br/>${tax_rate_split?string(“0.##”)}%

  </td>

</#if>

 <#if tax_amt>

  <td align=”right” colspan=”4″>

    <#assign tax_amount_total = item.tax1amt?replace(“₹ “, “”)?number>

    <#assign tax_amount_split = tax_amount_total / 2>

    ${tax_amount_split?string(“₹0.##”)}<br/>${tax_amount_split?string(“₹0.##”)}

  </td>

</#if>

   <#else>

    <td align=”left” colspan=”5″ style=”padding-left: 0px;”>${item.taxcode}</td>

     <#if tax_rate>

  <td align=”center” colspan=”6″>${item.taxrate1}</td></#if>

    <#if tax_amt>

 <td align=”right” colspan=”4″>${item.tax1amt?replace(“₹ “,”₹”)}</td></#if>

  </#if>

  <td align=”center” colspan=”3″>${item.quantity}</td>

  <td align=”right” colspan=”5″>${item.rate?replace(“₹ “,”₹”)}</td>

  <td align=”right” colspan=”5″ style=”padding-right: 10px;”>${item.amount?replace(“₹ “,”₹”)}</td>

</tr>

</#list><!– end items –></table>

</#if>

Leave a comment

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