Standard PDF invoice

Jira Code: FEN-81

Need to create to PDF Invoice which will display the data from the Invoice record. We also want to fetch the kit components separately.Standard invoice PDF/HTML template is used for the requirement.

Normal Item Template

<?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%; font-size: 10pt;">
              <tr>
                <td rowspan="2" style="width: 429px;">
                  <#if companyInformation.logoUrl?length != 0></#if>
                  <table border="0" cellpadding="1" cellspacing="1" style="height: 85px; width: 762px;">
                    <tr>
                      <td style="width: 450px; height: 91px;">
                        <span style="font-size:14px;">
                          <strong>${companyinformation.companyname}</strong>
                        </span><br /><br />
                        <span style="font-size:9px;">${companyinformation.mainaddress_text}<br />${companyinformation.url}<br />${companyinformation.adminemail}</span>
                      </td>
                      <td style="width: 300px; height: 50px;">
                        <img src="${companyInformation.logoUrl}" style="width: 200px; height: 90px; float: left; margin-left: 0px; margin-right: 0px;" />
                      </td>
                    </tr>
                  </table><br /><br /><br />&nbsp;
                </td>
              </tr>
          </table>
        </macro>
        <macro id="nlfooter">
            <span style="font-size:9px;"><strong>Bank Details:</strong></span> <span style="font-size:8px;">Fenetti GmbH Stefanusstrasse 6 a D - 82166 Graefelfing Registered office address <strong>VAT Number:</strong> DE815855048 <strong>Steuer ID:</strong> DE815855048 <strong>Company Number:</strong> HRB 225348 <strong>EROI Number:</strong> DE 336 682 058 514063 <strong>Bank account number:</strong> DE69200303000299180001 <strong>BIC:</strong> CHDBDEHHXXX </span>

<hr style="background-color: black;width:100%;align:left" />
<table style="width:850px;">
            <tr>
              <td style="width: 100px;">
                <span style="font-size:9px;">&nbsp; Fenetti GmbH<br />&nbsp; Stefanusstrasse 6a<br />&nbsp;82166 Grafelfing<br />&nbsp;Germany</span>
              </td>
              <td style="width: 96px;">
                <span style="font-size:9px;">Geschaftsfuhrer:<br />Christopher Rice </span>
              </td>
              <td style="width: 101px;">
                <span style="font-size:9px;">Umsatzsteuer-ID-<br />Steuernummer:<br />DE815855048</span>
              </td>
              <td style="width: 106px;">
                <span style="font-size:9px;">Handelsregisternummer<br />HRB 225348<br />Handelsregister Munchen</span>
              </td>
              <td align="left" style="width: 286px;">
                <barcode codetype="code128" width="150px" showtext="true" value="${record.tranid}"/>
                <p style="text-align:center;margin-left:60px;"><pagenumber/> von <totalpages/></p>
              </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;
        border-radius: 10px;
        }
        th {
        font-weight: bold;
        font-size: 8pt;
        vertical-align: middle;
        padding: 5px 6px 3px;
        background-color: #e3e3e3;
        color: #333333;
        }
        td {
        padding: 4px 6px;
        }
        td p { align:left }
        b {
        font-weight: bold;
        color: #333333;
        }
        table.header td {
        padding: 0px;
        font-size: 10pt;
        }
        table.footer td {
        padding: 0px;
        font-size: 8pt;
        }
        table.itemtable th {
        padding-bottom: 10px;
        padding-top: 10px;
        }
        table.body td {
        padding-top: 2px;
        }
        table.total {
        page-break-inside: avoid;
        }
        tr.totalrow {
        background-color: #e3e3e3;
        line-height: 200%;
        }
        td.totalboxtop {
        font-size: 12pt;
        background-color: #e3e3e3;
        }
        td.addressheader {
        font-size: 8pt;
        padding-top: 6px;
        padding-bottom: 2px;
        }
        td.address {
        padding-top: 0px;
        }
        td.totalboxmid {
        font-size: 28pt;
        padding-top: 20px;
        background-color: #e3e3e3;
        }
        td.totalboxbot {
        background-color: #e3e3e3;
        font-weight: bold;
        }
        span.title {
        font-size: 28pt;
        }
        span.number {
        font-size: 16pt;
        }
        span.itemname {
        font-weight: bold;
        line-height: 150%;
        }
        hr {
        width: 100%;
        color: #d3d3d3;
        background-color: #d3d3d3;
        height: 1px;
        }
        table tr td.component{
        color: #A9A9A9;
        font-size: 9pt;
          }
</style>
</head>
<body header="nlheader" header-height="10%" footer="nlfooter" footer-height="8%" padding="0.5in 0.5in 0.5in 0.5in" size="Letter">
    <table border="0" cellpadding="1" cellspacing="1" style="width: 750px;height:130px;"><tr>
	<td style="width: 466px; height: 130px;">
	<table border="1" cellpadding="1" cellspacing="1" style="height: 156px; width: 445px;corner-radius: 8px"><tr>
		<td style="height: 22px; width: 220px; vertical-align: top;"><strong>Customer Name &amp; Address</strong></td>
		<td style="height: 22px; width: 206px; vertical-align: top;"><strong>Delivery Address</strong></td>
		</tr>
		<tr>
		<td style="height: 157px; width: 220px;">${record.entity}<br />${record.billaddress}</td>
		<td style="height: 157px; width: 206px;">${record.shipaddress}</td>
		</tr></table>
	</td>
	<td style="width: 306px; height: 155px;">
	<table align="left" border="1" cellpadding="1" cellspacing="1" style="height: 100px; width: 205.177px;corner-radius: 8px">
      <tr>
		<td  align="left" style="height: 162px; width: 198px;"><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;INVOICE</strong>
		<hr style="background-color: black;" /> <strong>FAO:</strong>${record.entity}<br />
          <br /><strong>Invoice Date:</strong>${record.trandate}<br />
          <br /><strong>Your Acc No:</strong>${record.accountnumber}<br />
          <br /><strong>Supp Ref:</strong>${record.otherrefnum}<br />
          <br /><strong>Order No</strong>:

		<hr style="background-color: black;" /> <span style="font-size:12px;"> <strong>Invoice No:</strong></span>${record.tranid}</td>
		</tr></table>
	</td>
	</tr></table>

<table border=".75" class="body" style="margin-top:10px;width:675px;">
<thead>
	<tr>
	<td style="width: 30px;"><span style="font-size:9px;"><strong>Qty</strong></span></td>
	<td style="width: 50px;"><span style="font-size:9px;"><strong>Code</strong></span></td>
	<td align="center" style="width: 337px;"><span style="font-size:9px;"><strong>Description</strong></span></td>
	<td style="width: 38px;"><span style="font-size:9px;"><strong>Price each</strong></span></td>
	<td style="width: 39px;"><span style="font-size:9px;"><strong>Line Total</strong></span></td>
	<td style="width: 23px;"><span style="font-size:9px;"><strong>VAT %</strong></span></td>
	<td style="width: 35px;"><span style="font-size:9px;"><strong>Line VAT</strong></span></td>
	</tr>
</thead>
</table>

<table style="width: 704px;"><tr>
	<td align="left" colspan="6" style="width: 165px;"><strong>Order No.</strong></td>
	<td align="left" colspan="10" style="width: 257px;"><strong>Order Reference:</strong></td>
	<td align="left" colspan="4" style="width: 229px;"><strong>Order Date:</strong></td>
	</tr></table>

<hr style="background-color: black;" />
<table><tr>
	<td><strong>Delivery No:</strong></td>
	</tr></table>
<#if record.item?has_content>

<table><#list record.item as item><#if item.amount!=0 ><#assign component = true><tr>
	<td align="center" colspan="1" line-height="150%">${item.quantity}</td>
	<td colspan="6">${item.item}</td>
	<td colspan="5" style="width: 50px;">${item.description}</td>
	<td colspan="6" style="width: 35px;">${item.rate}</td>
	<td colspan="6">${item.amount}</td>
	<td colspan="6">${item.taxrate1}</td>
	<td colspan="7">${item.tax1amt}</td>
	</tr>
	<tr style="border-bottom:0.25px solid #dddddd; "></tr>
	<#else><#if component=true>
	<tr>
	<td align="right" colspan="5" style="margin-right:-4px;"><strong>Components:</strong></td>
	</tr>
	<#assign component=false></#if>
	<tr>
	<td colspan="2">&nbsp;</td>
	<td align="center" class="component" colspan="1" line-height="150%">${item.quantity}</td>
	<td class="component" colspan="6">${item.item}</td>
	<td class="component" colspan="4" style="width: 50px;">${item.description}</td>
	<td class="component" colspan="6" style="width: 35px;">${item.rate}</td>
	<td class="component" colspan="6">${item.amount}</td>
	<td class="component" colspan="6">${item.taxrate1}</td>
	<td class="component" colspan="7">${item.tax1amt}</td>
	</tr>
	</#if></#list></table>
</#if><span style="font-size:9px;">&nbsp;DELIVERY</span>

<hr style="background-color: black; width:750%;" />&nbsp;
<table border="0" cellpadding="1" cellspacing="1" style="height:200px;width:700px;"><tr>
	<td style="height: 196px; width: 258px;"><br /><br /><br /><br /><br /><br /><br /><br />&nbsp;
	<table align="left" border="0" cellpadding="1" cellspacing="1" style="height: 140px; width: 190px;corner-radius: 8px"><tr>
		<td style="height: 135px; width: 170px; border: 0.25px solid black;"><strong>&nbsp;Special Instructions:</strong><br /><br />&nbsp;${record.memo}</td>
		</tr></table>
	</td>
	<td style="height: 190px; width: 295px;"><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />&nbsp;
	<table align="center" border="0" cellpadding="1" cellspacing="1" style="height: 30px; width: 265px;"><tr>
		<td align="center" style="height: 11px; width: 240px;"><span style="font-size:11px;"><strong>&nbsp;&pound;VAT Analysis</strong></span></td>
		</tr>
		<tr>
		<td style="height: 13px; width: 240px;">
		<table align="center" border="0" cellpadding="1" cellspacing="1" style="width: 267px;"><tr>
			<td style="width: 50px;"><strong>Tax Code</strong></td>
			<td style="width: 33px;"><strong>VAT%</strong></td>
			<td style="width: 42px;"><strong>Net(&pound;)</strong></td>
			<td style="width: 40px;"><strong>VAT(&pound;)</strong></td>
			</tr></table>
		</td>
		</tr>
		<tr>
		<td style="height: 8px; width: 240px;">
		<hr style="background-color: black;" /></td>
		</tr>
		<!-- <#if record.item?has_content><#list record.item as item>
        <tr>
            <td align="left" colspan="5">${item.taxcode}</td>
        </tr>
    </#list></#if>--></table>
	<span style="font-size:11px;"><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Terms: ${record.terms}</strong></span></td>
	<td style="height: 196px; width: 240px;"><br /><br /><br /><br /><br /><br /><br /><br />&nbsp;
	<table align="center" border="1" cellpadding="1" cellspacing="1" style="corner-radius:8px;height:140px;width:190px;margin-left:-6px;"><tr>
		<td align="left" colspan="4"><strong>Goods Net:</strong></td>
		<td align="right" colspan="4" style="margin-right:30px">${record.subtotal}</td>
		</tr>
		<tr>
		<td align="left" colspan="4"><strong>Delivery:</strong></td>
		<td align="right" colspan="4" style="margin-right:30px"></td>
		</tr>
		<tr>
		<td align="left" colspan="4"><strong>Order Net:</strong></td>
		<td align="right" colspan="4" style="margin-right:30px">&nbsp;</td>
		</tr>
		<tr>
		<td align="left" colspan="4"><strong>VAT:</strong></td>
		<td align="right" colspan="4" style="margin-right:30px">${record.taxtotal}</td>
		</tr>
		<tr height="26px">
		<td align="left" colspan="4"><strong>Total:</strong></td>
		<td align="right" colspan="4" style="margin-right:30px"><span style="font-size:12px;">${record.total}</span></td>
		</tr></table>
	</td>
	</tr></table>
</body>
</pdf>

Leave a comment

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