#--
QQQ - Low-code Application Framework for Engineers.
Copyright (C) 2021-2025. Kingsrook, LLC
651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
contact@kingsrook.com
https://github.com/Kingsrook/
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<#--
Starter packing slip. It prints only what is listed here; it never enumerates the record, so
ownership, security and other internal fields are not shown. Everything below is optional and a missing value is
simply omitted. Edit this source freely, or use "Select context script" to supply the values.
Context a script (or the editor) may provide, in addition to the selected source record as "record":
reference text document reference; default is the first of record number, orderNumber, reference, name, id
sender text or {name, line1, line2, city, region, postalCode, country}
shipTo text or {name, line1, line2, city, region, postalCode, country}
notes text
lines list of {sku, description, quantity}
-->
<#macro show value>
<#if value?is_number>${value?c}<#elseif value?is_string>${value}<#elseif value?is_boolean>${value?c}#if>
#macro>
<#macro party title value>
${title}
<#if value?is_string>
${value}
<#elseif value?is_hash>
<#list ["name", "line1", "line2"] as key><#if value[key]?? && value[key]?is_string && value[key] != "">
${value[key]}
#if>#list>
<#assign place = []>
<#list ["city", "region", "postalCode"] as key><#if value[key]?? && value[key]?is_string && value[key] != ""><#assign place = place + [value[key]]>#if>#list>
<#if place?size gt 0>
<#list place as part>${part}<#sep> #list>
#if>
<#if value.country?? && value.country?is_string && value.country != "">
${value.country}
#if>
#if>
#macro>
<#assign ref = "">
<#if reference??><#assign ref = reference><#else>
<#list ["number", "orderNumber", "reference", "name", "id"] as key>
<#if ref?is_string && ref == "" && record?? && record[key]??><#assign ref = record[key]>#if>
#list>
#if>
Packing slip
<#if ref?is_number || (ref?is_string && ref != "")>Order <@show ref/>
#if>
<#if (sender?? && (sender?is_string || sender?is_hash)) || (shipTo?? && (shipTo?is_string || shipTo?is_hash))>
| <#if sender?? && (sender?is_string || sender?is_hash)><@party "From" sender/>#if> |
<#if shipTo?? && (shipTo?is_string || shipTo?is_hash)><@party "Ship to" shipTo/>#if> |
#if>
<#if lines?? && lines?is_sequence && lines?size gt 0>
|
| SKU | Description | Qty |
|
<#list lines as line><#if line?is_hash>
| <#if line.sku??><@show line.sku/>#if> | <#if line.description??><@show line.description/>#if> | <#if line.quantity??><@show line.quantity/>#if> |
#if>#list>
#if>
<#if notes?? && notes?is_string && notes != "">#if>