Advanced PDF customization – Sales Order

JIra Code: DI-28

Customized a sales order PDF for Desalitech which includes standard sales order fields as well as the job number from the project ID field which shows only the Project Number.

<?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><tr>    <td align="left"><img src="http://shopping.na3.netsuite.com/core/media/media.nl?id=11&c=4300462&h=d2f25f4b7b51c0f8d857" style="width: 200px; height: 80px;padding-top:-5px;padding-left:-20px;" />${companyInformation.companyname}<br />${companyInformation.mainaddress_text}<br /> </td>    <td style="height: 79px;"><span color="#00548e" font-size="24" style="padding-left:1050px;">                                   SALES ORDER</span>    <table align="right" class="invoicebox"><tr>        <td><br /><b>Date:</b> ${record.trandate}<br /><br /><br /><b>SO #:</b> ${record.tranid}<br /><br /></td>        </tr></table>    </td>    </tr></table> </macro> <macro id="nlfooter">  <table align="center" width="100%"><tr>    <td>    <p>Questions? Please contact us at <a href="http://accounts.receivable@desalitech.com">accounts.receivable@desalitech.com</a></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;        } 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; } .invoicebox { border:1px; border-color:#779BCB; margin-top:2px;width:200px;padding-bottom:0px;padding-top:2px;min-height:80px;max-height:100px; }</style></head><body header="nlheader" header-height="20%" footer="nlfooter" footer-height="5pt" padding="0.5in 0.5in 0.5in 0.5in" size="Letter"> <table border="0" cellpadding="1" cellspacing="1" style="width:100%;"><tr>    <td style="background-color: rgb(119, 155, 203);"><b>Bill To:</b></td>    <td style="text-align: right; background-color: rgb(119, 155, 203);"><b>Ship To:</b></td>    </tr>    <tr>    <td>${record.billaddress}</td>    <td style="text-align: right;">${record.shipaddress}</td>    </tr></table>
<table align="center" class="body" style="margin-top:10px;width:100%;"><tr>    <th style="background-color: rgb(119, 155, 203); vertical-align: middle; ">PO Number</th> <th style="background-color: rgb(119, 155, 203); vertical-align: middle; "> </th>    <th style="background-color: rgb(119, 155, 203); vertical-align: middle; ">Ship Date</th> <th style="background-color: rgb(119, 155, 203); vertical-align: middle; "> </th>    <th style="background-color: rgb(119, 155, 203); vertical-align: middle;text-align:right;">Project ID</th>    </tr>    <tr>    <td style="height: 14px; text-align: center; vertical-align: middle;"><br /><b>${record.otherrefnum}</b></td> <td align="left" style="height: 14px; "><br /><b> </b></td>    <td align="left" style="height: 14px; "><br /><b>${record.shipdate}</b></td> <td align="left" style="height: 14px; "><br /><b> </b></td> <td style="text-align: right; height: 14px;" ><br /><b><#if record.custbody4?has_content><#assign prj = record.custbody4?keep_after(" ") ><#if prj?has_content> <#assign prj = prj?substring(0, 6)> ${prj}</#if></#if></b></td>    </tr></table><#if record.item?has_content><#assign n=1>
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0><thead>    <tr>    <th align="center" colspan="3" style="background-color:#779BCB">Line #</th>    <th colspan="12" style="background-color:#779BCB">Description</th>    <th colspan="3" style="background-color:#779BCB">Quantity</th>    <th align="right" colspan="4" style="background-color:#779BCB">Unit Price</th>    <th align="right" colspan="4" style="background-color:#779BCB">Extended Price</th>    </tr></thead></#if><tr>    <td align="center" colspan="3" line-height="150%">${n} <#assign n=n+1></td>    <td colspan="12">${item.description}</td>    <td colspan="3">${item.quantity}</td>    <td align="right" colspan="4">${item.rate}</td>    <td align="right" colspan="4">${item.amount}</td>    </tr>    </#list><!-- end items --></table>
<hr /></#if><table class="total" style="width: 100%; margin-top: 10px;"><tr>    <td colspan="4"> </td>    <td align="left" style="background-color:#779BCB"><b>Sales Tax:</b></td>    <td align="right" style="background-color:#779BCB">${record.taxtotal}</td>    </tr>    <tr class="totalrow">    <td background-color="#ffffff" colspan="4"> </td>    <td align="left" style="background-color:#779BCB"><b>Total:</b></td>    <td align="right" style="background-color:#779BCB">${record.total}</td>    </tr></table> 
<!--<table style="width:100%"><tr>    <td align="left" border="1" colspan="2" style="background-color:#779BCB"><font color="#333333"><b>Payment Instructions:</b></font></td>    </tr>    <tr>    <td border="1" style="text-align: left; vertical-align: top; width: 390px;">    <p><b>Pay by Checks:</b></p>
    <table border="0" cellpadding="1" cellspacing="1" style="width:200px;"><tr>        <td>Desalitech Inc.</td>        </tr>        <tr>        <td>Accounts Receivable</td>        </tr>        <tr>        <td>One Gateway Center</td>        </tr>        <tr>        <td>Suite 809</td>        </tr>        <tr>        <td>Newton, MA 02458</td>        </tr></table>    </td>    <td border="1" style="text-align: left; vertical-align: top; width: 389px;"><strong>Pay via wire transfer/ACH:</strong>    <table style="width: 388px;"><tr>        <td style="width: 85px;">Bank Name:</td>        <td style="width: 271px;">Silicon Valley Bank</td>        </tr>        <tr>        <td style="width: 85px;">Bank Address:</td>        <td style="width: 271px;">3003 Tasman Drive Santa Clara, CA 95054</td>        </tr>        <tr>        <td style="width: 85px;">Routing/Transit:</td>        <td style="width: 271px;">121140399</td>        </tr>        <tr>        <td style="width: 85px;">Account:</td>        <td style="width: 271px;">3300993126</td>        </tr>        <tr>        <td style="width: 85px;">Account Name:</td>        <td style="width: 271px;">Desalitech, Inc.</td>        </tr>        <tr>        <td style="width: 85px;">SWIFT Code:</td>        <td style="width: 271px;">SVBKUS6S</td>        </tr></table>    </td>    </tr></table><br /><span style="font-size:10px;"><font color="#333333"><b>Please reference the </b><strong>Invoice number </strong><b> with payment</b></font>  </span>-->
<table style="background-color:#779BCB" width="100%"><tr>    <td align="center"><b>Special Remarks & Comments</b></td>    </tr>    <tr>    <td align="left" style="background-color: rgb(255, 255, 255);">${record.memo}</td>    </tr></table><br /> </body></pdf>

Leave a comment

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