This page hosts a collection of sample Smart Document Templates that may be helpful for learning about Smart Document Templates, or to serve as starting points for adding do your own Infoplus site, then customizing for your exact needs.


Note that for each of these examples, the Source Code of the Smart Document Template is provided.  To add this code to a Smart Document Template on your Infoplus account, you'll need to click the Source Code button in the Code editor on the Smart Document table's Create/Edit screen, as shown here:




Example ASN Smart Documents


ASN Smart Documents can come in handy if your operation needs a physical document to initiate or review an inbound ASN. Note that paper documentation is not necessary to begin receiving within the Infoplus app, our mobile receiving app will allow our users to search for SKU's, PO's, Vendors, Custom Fields etc.  All fields but the SKU field are 'wildcard' searches meaning you can search for parts of value without having to have an exact match. 


The example below utilizes standard ASN fields coupled with a simple Smart Document script that gives the document access to more data, such as warehouse and vendor records. 



Source Code - You can copy and paste the code below into the source code editor (the <> option in the toolbar). Note you will need to update your logo and any other hard coded values such as 'Infoplus Commerce' in the ship to section. 


<p></p>
<table style="font-size: 1.1em; margin-left: auto; margin-right: auto;" width="97%">
<tbody>
<tr>
<td style="text-align: left;">YOUR LOGO HERE</td>
<td style="font-size: 1.1em; width: 40%; text-align: right; vertical-align: top;"><strong>PO No: </strong>${record.poNo}<br /><strong>Issue Date: </strong>${scriptOutput.shortOrderDate}</td>
<td style="font-size: 1.1em; text-align: right; vertical-align: top;"><img style="float: right;" src="$barcodes.poNo" alt="" width="200" height="42" /></td>
</tr>
</tbody>
</table>
<table style="margin-left: auto; margin-right: auto;" width="97%">
<tbody>
<tr>
<td style="font-size: 1.1em; width: 20%; vertical-align: top;"><strong><br />Ship To:</strong><br />Infoplus Commerce<br />$scriptOutput.warehouse.street1<br />$scriptOutput.warehouse.city, $scriptOutput.warehouse.state  $scriptOutput.warehouse.zip<br /><br /><br /></td>
<td style="font-size: 1.1em; width: 50%;"><strong>Vendor:</strong>  $scriptOutput.vendor.name<br /><strong>Total Lines:</strong> #if($scriptOutput.totalLines) ${scriptOutput.totalLines} #else N/A #end<br /><strong>Total Qty:</strong> $scriptOutput.totalQty</td>
</tr>
</tbody>
</table>
<table style="margin-left: auto; margin-right: auto;" width="97%" cellpadding="3">
<tbody>
<tr>
<td style="font-size: .95em;"><strong>SKU</strong></td>
<td style="font-size: .95em;"><strong>Description</strong></td>
<td style="font-size: .95em;"><strong>Exp Qty</strong></td>
</tr>
<!--
         #set($total = $utils.newBigDecimal("0.00"))
         #foreach($lineItem in $record.lineItems)
            #set($item = $scriptOutput.itemMap.get($lineItem.sku))
            #set($quantityBigDecimal = "")
            #set($quantityBigDecimal = $utils.newBigDecimal($lineItem.orderQuantity.toString()))
            #if($lineItem.cost)
               #set($extended = $lineItem.cost.multiply($quantityBigDecimal))
               #set($total = $total.add($extended))
            #else
               #set($extended = false)</div>
            #end
      -->
<tr>
<td style="font-size: .95em; border-top: 1px solid black;">$lineItem.sku</td>
<td style="font-size: .95em; border-top: 1px solid black;">$lineItem.fullDescription</td>
<td style="font-size: .95em; border-top: 1px solid black;">$lineItem.orderQuantity</td>
</tr>
<!--
        #end
      -->
<tr>
<td style="font-weight: bold; border-top: 1px solid black;"></td>
<td style="font-weight: bold; border-top: 1px solid black; text-align: right;" colspan="2"></td>
</tr>
</tbody>
</table>
<table style="font-size: 1.1em; height: 99px; margin-left: auto; margin-right: auto;" width="97%">
<tbody>
<tr>
<td style="width: 30%;">
<p><strong>Bill To:<br /></strong>Infoplus Commerce<br />#if($record.billingStreet1) $record.billingStreet1 #else N/A #end #if($record.billingStreet2), $record.billingStreet2 #else #end<br />#if($record.billingCity)$record.billingCity, $record.billingState $record.billingZipCode #else #end</p>
</td>
<td>
<p><strong>Email:</strong> #if($scriptOutput.vendor.arEmail) $scriptOutput.vendor.arEmail #else N/A #end<br /><strong>Phone: </strong>#if($record.billingPhone) $record.billingPhone #else N/A #end</p>
</td>
</tr>
</tbody>
</table>
<table style="margin-left: auto; margin-right: auto;" width="97%">
<tbody>
<tr>
<td style="font-size: 1.1em; border-top: 1px solid black;"><strong>Notes</strong><br /><br /><br /></td>
</tr>
</tbody>
</table>

ASN Smart Document Script - This script can be copy and pasted and then referenced via the Smart Document script field.  Custom fields will need to be updated but the code should otherwise work for everyone.


// this script is used to get extra data and expose it to the ASN smart document
// script record type = smart document

// get vendor object
var vendor = infoplusApi.getById("vendor", asn.vendorId);
if(vendor != null)
{
output.put("vendor", vendor);
}

// get warehouse object
var warehouse = infoplusApi.getById("warehouse", asn.warehouseId);
utils.log("Found Warehouse " + warehouse.name);
output.put("warehouse", warehouse);

// query for all items on asn and put into map
var skuList = [];
for(var i=0; i<asn.lineItems.size(); i++)
{
skuList.push(asn.lineItems.get(i).sku);
}

var totalQty = 0;
// query for all items and find total Qty
for(var j=0; j<asn.lineItems.size(); j++)
{
var getLine = asn.lineItems.get(j);
var getQty = getLine.orderQuantity;
totalQty += +getQty;
}
utils.log("Found Total Quantity of " + totalQty + ".");
output.put("totalQty", totalQty);

// create a filter for the SKU's in the ASN
var filter = "sku in ('" + skuList.join("','") + "')";
utils.log("Searching for items with [" + filter + "]");
var itemList = infoplusApi.search("item", filter, null, 250, null);

//create a map of unique items
var itemMap = {};
var totalLines = itemList.size();
output.put("totalLines", totalLines);
for(var k=0; k<itemList.size(); k++)
{
var item = itemList.get(k);
utils.log("Found item [" + item.sku + "]");
itemMap["sku_"+item.sku] = item;
itemMap["color_"+item.sku] = item.customFields.get("color");
}
output.put("itemMap", itemMap);

// format the custom field for estimated pickup date
var estPickupDate = record.customFields.get("estPickupDate");
var convertedDate = new Date(estPickupDate);
var month = convertedDate.getMonth() + 1;
var day = convertedDate.getDate() + 1;
var year = convertedDate.getFullYear();
var shortPickupDate = month + "/" + day + "/" + year;
utils.log("Formatted Pickup Date is: " +shortPickupDate);
output.put("shortPickupDate", shortPickupDate);

// format the asn order date
var convertedOrderDate = new Date(record.orderDate);
var month = convertedOrderDate.getMonth() + 1;
var day = convertedOrderDate.getDate();
var year = convertedOrderDate.getFullYear();
var shortOrderDate = month + "/" + day + "/" + year;
utils.log("Formatted Order Date is: " +shortOrderDate);
output.put("shortOrderDate", shortOrderDate);


// if you need to pull in custom fields, you can do so using the code below
var shippingContainer = record.customFields.get("shippingContainer");
if(shippingContainer == "True")
{
output.put("shippingContainer", shippingContainer);
var transferNotes = record.customFields.get("transferNotes");
}

if(transferNotes == "True")
{
output.put("transferNotes", transferNotes);
}


ASN Setup



Script Setup


Example Invoice Worksheet Smart Documents




3PL Billing - Invoice Worksheet

Sample file:

Source Code:

<!--
#set($dollarSign = "$")

#if($record.startDate)
#set($startDateMonth = $record.startDate.getMonth() + 1)
#set($startDateYear = $record.startDate.getYear() + 1900)
#set($startDate = "${startDateMonth}/${record.startDate.getDate()}/${startDateYear}")
#end

#if($record.endDate)
#set($endDateMonth = $record.endDate.getMonth() + 1)
#set($endDateYear = $record.endDate.getYear() + 1900)
#set($endDate = "${endDateMonth}/${record.endDate.getDate()}/${endDateYear}")
#end

#if($record.issueDate)
#set($issueDateMonth = $record.issueDate.getMonth() + 1)
#set($issueDateYear = $record.issueDate.getYear() + 1900)
#set($issueDate = "${issueDateMonth}/${record.issueDate.getDate()}/${issueDateYear}")
#end
-->
<div style="line-height: 1.5em; font-family: sans-serif, helvetica, arial; padding: 20px;">
<table>
<tbody>
<tr>
<td><img src="https://s3.amazonaws.com/client-branding.infopluswms.com/carlscandy/0F2794BF-723E-4E83-A010-436CB49B3140/homepagelogo_carlscandy__1__jpg__400%C3%97240_.png" alt="Carls Candy Logo" width="180" height="108" /></td>
<td style="padding: 0px; padding-left: 10px;">
<h1 style="margin-top: 0px; margin-bottom: 8px;">Invoice</h1>
<strong>$!{record.name}</strong></td>
</tr>
</tbody>
</table>
<div style="padding-bottom: 30px; font-family: sans-serif, helvetica, arial;"><strong><br />Invoice No: </strong>$!{record.invoiceNo} $!{record.description}<br /> <strong>Period: </strong> <!--#if($record.startDate && $record.endDate) --> $!{startDate} - $!{endDate} #else -- #end<br /> <strong>Issued: </strong>#if($record.issueDate)) $issueDate #else -- #end<br /><strong>Terms: </strong>$!{utils.nvl($record.terms, "--")}</div>
<table style="line-height: 1.2em; border-collapse: collapse; margin-bottom: 30px;" width="100%" cellspacing="0" cellpadding="8">
<tbody>
<tr>
<td style="border: 1px solid gray;" width="50%"><strong>Bill To:</strong>
<div style="padding: 20px 20px 10px 20px;">#if("$!{record.billToCompany}" != "") ${record.billToCompany}<br /> #end #if("$!{record.billToAttention}" != "") ATTN: ${record.billToAttention}<br /> #end #if("$!{record.billToStreet}" != "") ${record.billToStreet}<br /> #end #if("$!{record.billToStreet2}" != "") ${record.billToStreet2}<br /> #end #if("$!{record.billToStreet3}" != "") ${record.billToStreet3}<br /> #end #if("$!{record.billToCity}" != "") ${record.billToCity}, #end #if("$!{record.billToState}" != "") ${record.billToState} #end #if("$!{record.billToZip}" != "") ${record.billToZip} #end <br /> #if("$!{record.billToCountry}" != "") ${record.billToCountry}<br /> #end #if("$!{record.billToPhone}" != "") ${record.billToPhone}<br /> #end #if("$!{record.billToEmail}" != "") ${record.billToEmail}<br /> #end</div>
</td>
<td style="border: 1px solid gray;" width="50%"><strong>Remit To:</strong>
<div style="padding: 20px 20px 10px 20px;">#if("$!{record.remitToCompany}" != "") ${record.remitToCompany}<br /> #end #if("$!{record.remitToAttention}" != "") ATTN: ${record.remitToAttention}<br /> #end #if("$!{record.remitToStreet}" != "") ${record.remitToStreet}<br /> #end #if("$!{record.remitToStreet2}" != "") ${record.remitToStreet2}<br /> #end #if("$!{record.remitToStreet3}" != "") ${record.remitToStreet3}<br /> #end #if("$!{record.remitToCity}" != "") ${record.remitToCity}, #end #if("$!{record.remitToState}" != "") ${record.remitToState} #end #if("$!{record.remitToZip}" != "") ${record.remitToZip} #end <br /> #if("$!{record.remitToCountry}" != "") ${record.remitToCountry}<br /> #end #if("$!{record.remitToPhone}" != "") ${record.remitToPhone}<br /> #end #if("$!{record.remitToEmail}" != "") ${record.remitToEmail}<br /> #end</div>
</td>
</tr>
</tbody>
</table>
<table style="line-height: 1.5em; border-collapse: collapse;" width="100%" cellspacing="0" cellpadding="5">
<thead>
<tr style="font-weight: bold; border-bottom: 1px solid gray;">
<td style="border-bottom: 1px solid gray;" width="40%">Description</td>
<td style="border-bottom: 1px solid gray;" width="20%">Account Code</td>
<td style="border-bottom: 1px solid gray;" align="right" width="10%">Quantity</td>
<td style="border-bottom: 1px solid gray;" align="right" width="15%">Unit Cost</td>
<td style="border-bottom: 1px solid gray;" align="right" width="15%">Line Total</td>
</tr>
</thead>
<tbody><!-- #foreach($line in $record.invoiceWorksheetLineItemList) -->
<tr style="border-bottom: 1px solid gray;">
<td style="border-bottom: 1px solid gray; font-family: sans-serif, helvetica, arial;" width="40%">$!{utils.nvl($line.description, "--")}</td>
<td style="border-bottom: 1px solid gray;" width="20%">$!{utils.nvl($line.accountCode, "--")}</td>
<td style="border-bottom: 1px solid gray;" align="right" width="10%">$!{utils.nvl($utils.formatCommas($line.quantity.intValue()), "--")}</td>
<td style="border-bottom: 1px solid gray;" align="right" width="15%">${dollarSign}$!{utils.nvl($utils.formatMoneyCommas($line.chargeRate), "--")}</td>
<td style="border-bottom: 1px solid gray;" align="right" width="15%">${dollarSign}$!{utils.nvl($utils.formatMoneyCommas($line.extendedCharge), "--")}</td>
</tr>
<!-- #end --></tbody>
<tfoot>
<tr>
<td colspan="5" align="right"><strong>${dollarSign}$!{utils.formatMoneyCommas($record.total)}</strong></td>
</tr>
</tfoot>
</table>
<p><strong>Notes: </strong><br /> $!{utils.nvl($record.notes, "--")}</p>
</div>