The client would like to print the proforma invoice from the sales order record.
We have created a custom button in the sales order record and on clicking the Print proforma invoice button the pdf will be printed.
<?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=”2″ style=”padding-top: -29px;padding-right:-5px;margin-left:8px;”><img src=”${subsidiary.logo@url}” style=”float: left; margin: 6px; width:216px; height:90px” /> </td>
<td align=”right”><span style=”font-weight: bold; font-size: 20pt;”>Proforma Invoice</span><br /> </td> –>
</tr>
<tr>
<td align=”right“ style=”padding: 0;“>
<table border=”1“><tr line-height=”210%“>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”width:70px;“>Date</td>
<td align=”center“ border-bottom=”1 px solid black“ style=”width:70px;“>Invoice #</td>
</tr>
<tr line-height=”210%“>
<td align=”center“ border-right=”1 px solid black“ style=”width:70px;“> ${record.trandate} </td>
<td align=”center“ style=”width:70px;“> ${record.tranid} </td>
</tr></table>
</td>
</tr>
<tr>
<td style=”padding-right:-5px;margin-left:-1px;padding-top:-20px;line-height:17px;“>East Electronics<br />48273 Lakeview Blvd Fremont, CA 94538<br />Phone # 510-413-0002<br />Fax # 510-413-0010<br /><span style=”font-size:9pt;“>http://east-elec.com</span></td>
</tr></table>
</macro>
<macro id=”nlfooter“>
<table class=”footer“ style=”width: 100%;“><tr>
<td colspan=”13“>
<p style=”font-size:9.7px;“>For any Invoice over 30 days past due, there will be a 1% late charge assessed each month on the accruing balance. Please note that all unpaid interest will be documented on a "Past Due Interest Statement", and will remain owed until paid. Any quantity discrepancy or discrepancies between packing slip and received quantity shall be submitted to MynTahl within five (5) working days after receipt of goods, otherwise the shipment shall be considered as received in full.</p>
</td>
</tr>
<tr>
<td colspan=”13“ align=”right“ style=”padding-right:-24px;“><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: 8pt;
vertical-align: middle;
padding: 5px 6px 3px;
background-color: #e3e3e3;
color: #333333;
}
td {
padding: 4px 6px;
}
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 {
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%;
}
</style>
</head>
<body header=”nlheader“ header-height=”19%“ footer=”nlfooter“ footer-height=”8%“ padding=”0.5in 0.5in 0.5in 0.5in“ size=”Letter“>
<table style=”width: 100%; margin-top: 14px;width:100%;padding-right:-5px;margin-left:35px;“><tr>
<td class=”addressheader“ colspan=”3“ style=”font-weight: bold;“>${record.billaddress@label}:</td>
<td class=”addressheader“ colspan=”3“ style=”font-weight: bold;“>${record.shipaddress@label}:</td>
</tr>
<tr>
<td class=”address“ colspan=”3“ rowspan=”2“ style=”line-height:14px;“>${record.billaddress}</td>
<td class=”address“ colspan=”3“ rowspan=”2“ style=”line-height:14px;“>${record.shipaddress}</td>
</tr></table>
<table class=”body“ style=”width: 100%; margin-top: 10px;“><tr>
<td align=”center“ border=”1px solid black“ style=”vertical-align:middle;“>P.O.No.</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ border-top=”1px solid black“ style=”vertical-align:middle;“>${record.terms@label}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ border-top=”1px solid black“ style=”vertical-align:middle;“>Ship Date</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ border-top=”1px solid black“ style=”vertical-align:middle;“>Due Date</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ border-top=”1px solid black“ style=”vertical-align:middle;“>Ship Via</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ border-top=”1px solid black“ style=”vertical-align:middle;“>Shipping Point</td>
</tr>
<tr>
<td align=”center“ border-bottom=”1 px solid black“ border-left=”1px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.otherrefnum}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.terms}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.trandate}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.enddate}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.shipmethod}</td>
<td align=”center“ border-bottom=”1 px solid black“ border-right=”1 px solid black“ style=”vertical-align:middle;“>${record.location}</td>
</tr></table>
<#assign customerDepositTotal = 0>
<#if record.links?has_content>
<table style=”width: 100%;“>
<#list record.links as lineitem>
<#if lineitem.type == “Customer Deposit”>
<#assign customerDepositTotal = customerDepositTotal + lineitem.total>
</#if>
</#list>
</table>
</#if>
<#if record.item?has_content>
<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“ border=”1 px solid black;“ colspan=”6“ style=”font-weight: bold;“>${item.item@label}</th>
<th align=”center“ colspan=”10“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>Description</th>
<th align=”center“ colspan=”3“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>${item.quantity@label}</th>
<th align=”center“ colspan=”3“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>${item.rate@label}</th>
<th align=”center“ colspan=”4“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>Ordered</th>
<th align=”center“ colspan=”4“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>Prev. Inv'd</th>
<th align=”center“ colspan=”5“ style=”border-top:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;font-weight: bold;“>${item.amount@label}</th>
</tr>
</thead>
</#if><tr>
<td colspan=”6“ line-height=”130%“ style=”border-left:1 px solid black;border-right:1 px solid black;border-bottom:1px solid black;vertical-align:middle;“>${item.item}</td>
<td colspan=”10“ style=”border-right:1 px solid black;border-bottom:1px solid black;vertical-align:middle;“>${item.description}</td>
<td colspan=”3“ align=”center“ style=”border-right:1 px solid black;border-bottom:1px solid black ;vertical-align:middle;“>${item.quantity}</td>
<td colspan=”3“ align=”center“ style=”border-right:1 px solid black;border-bottom:1px solid black ;vertical-align:middle;“>${item.rate}</td>
<td colspan=”4“ style=”border-right:1 px solid black;border-bottom:1px solid black ;vertical-align:middle;“> </td>
<td colspan=”4“ style=”border-right:1 px solid black;border-bottom:1px solid black ;vertical-align:middle;“> </td>
<td align=”right“ colspan=”5“ style=”border-right:1 px solid black;border-bottom:1px solid black ;vertical-align:middle;“>${item.amount}</td>
</tr>
</#list><!– end items –>
<tr height=”3%“>
<td colspan=”20“> </td>
<td align=”center“ colspan=”9“ style=”border-bottom: 1px solid black; border-left: 1px solid black; border-right: 1px solid black; vertical-align: middle;“><b>Total</b></td>
<#assign invoiceTotal = record.total?replace(‘$’, ”)>
<td align=”right“ vertical-align=”middle“ colspan=”6“ style=”border-right: 1px solid black; border-bottom: 1px solid black“>
<#if record.currency.symbol == “USD” || record.currency.symbol == “CAD”>
$${invoiceTotal}
<#else>
${invoiceTotal}
</#if>
</td>
</tr>
<tr height=”3%“>
<td colspan=”20“> </td>
<td align=”center“ colspan=”9“ style=”border-bottom: 1px solid black; border-left: 1px solid black; vertical-align: middle; border-right: 1px solid black;“><b>Payments/Credits</b></td>
<#assign currencySymbol = {“USD”: “$”, “EUR”: “€”, “GBP”: “£”, “CAD”: “$”}>
<#assign currentCurrency = record.currency.symbol?string>
<td align=”right“ vertical-align=”middle“ colspan=”6“ style=”border-right: 1px solid black; border-bottom: 1px solid black“>
${currencySymbol[currentCurrency]}${customerDepositTotal?string(“###,###,###,##0.00;(###,###,###,##0.00)”)}
</td>
</tr>
<tr height=”3%“>
<td colspan=”20“> </td>
<td align=”center“ colspan=”9“ style=”border-bottom: 1px solid black; border-left: 1px solid black; vertical-align: middle; border-right: 1px solid black;“><b>Balance Due</b></td>
<#assign resultValue = (record.total – customerDepositTotal)?number>
<td align=”right“ valign=”middle“ colspan=”6“ style=”border-right: 1px solid black; border-bottom: 1px solid black“>
${currencySymbol[currentCurrency]}${resultValue?string(“###,###,###,##0.00;(###,###,###,##0.00)”)}
</td>
</tr>
</table>
</#if>
</body>
</pdf>