Identifying the Grid Print Template Elements
This section identifies the elements included in the grid print templates. Refer to the following tables to help you create custom grid print templates.
FreeMarker Objects in the Grid Print Templates
This table lists the FreeMarker objects used in the source code of the grid print templates. These records appear only when you print transactions using grid printing.
FreeMarker Objects |
Description |
---|---|
parameters |
Contains the following values based on the number format you select on your user preferences:
|
currencyRec |
Currency record used in the transaction |
{FTLUtil} |
Contains codes from WD_GridOE_TemplateUtils.xml located in SuiteBundles > Bundle 41296 > src > GridPrinting on the File Cabinet. |
{cssContent} |
Contains codes from the following CSS files in the File Cabinet:
|
Custom Fields in the Transaction Record
This table lists the custom fields in the transaction record that references information from the item record.
Field Name |
Field ID |
Description |
---|---|---|
Parent Name |
custcol_gridoe_hidden_parentname |
Item’s Subitem Of field value |
Parent Display Name |
custcol_gridoe_hidden_parentdispname |
Parent item’s Display Name/Code field value |
Display Name |
custcol_gridoe_hidden_displayname |
Item’s Display Name/Code field value |
FreeMarker Functions in the Template Utility
This table lists the FreeMarker functions used in the WD_GridOE_TemplateUtils.xml template utility file. This file is located in the SuiteBundles > Bundle 41296 > src > GridPrinting folder on the File Cabinet.
Before using other functions, you must first call getItemDetails
or getItemOrderedShippedQty
functions. Other functions in the utility file depend on the item details in the JSON data.
You can find the following FreeMarker functions in the utility file when you create custom grid print templates.
FreeMarker Function |
Parameters |
Description |
Sample |
---|---|---|---|
min(val1, val2) |
val1, val2 – compares numeric values |
This function returns the lower value between parameters val1 and val2. |
FTL:
Output: 1 |
getItemDetails(items) |
items – accepts record.item, which is the current transaction’s item list |
This function traverses through the item lines in the transaction. Then this function returns a JSON data with the following pattern:
The JSON data stores the same items with collated quantities. If the item rates differ, the JSON data stores the rate of the item’s latest entry. |
record.item:
FTL:
Output:
|
get |
salesorder – corresponding sales order or transfer order transaction record of the current item fulfillment items – accepts record.item, which is the current transaction's item list |
You can use this function in packing slips. This function traverses through the item lines in the current sales order or transfer order related to the item fulfillment. Then, this function returns a JSON data with the following pattern:
The JSON data stores only the items found in both item fulfillment and sales order or transfer order transactions. The JSON data also stores the same items with collated quantities, shipped quantities, and backordered quantities. |
salesorder.item:
record.item: (IF)
FTL:
Output:
|
getRowColLabel |
gridData – grid data from record.custbody_ |
When the gridData.type is “MI”, the output returns the label stored in gridData.grid.rowcollabel. When the gridData.type is not “MI”, the output returns “gridData.grid.rowlabel / gridData.grid.collabel”. |
gridData[0]:
gridData[1]:
FTL:
Output: "Main Label" "Color / Size" |
getRowColumnData(row, col, subcolumn) |
row – accepts gridData.grid.data element col – accepts gridData. subcolumn – accepts subcolumns (Rate, Qty) |
The loop for gridData.grid.data that traverses the rows and columns must call this function. This function gets the corresponding subcolumn data for the current row and column of the loop from itemDetails. When subcolumn is picked, the output returns blank. When subcolumn is rate, the output formats to currency 0.00. |
itemDetails:
FTL:
Output: 100.00 999 "" |
getRowTotal(row, subcolumn) |
row – accepts gridData.grid.data element subcolumn – accepts subcolumns (Rate, Qty) |
The loop for gridData.grid.data that traverses the rows and columns must call this function. This function gets the corresponding subcolumn total for the current row of the loop from itemDetails. |
gridData.grid.data:
itemDetails:
FTL:
Output: 200 1000 |
getColumnTotal (rows, column, subcolumn) |
row – accepts gridData.grid.data column – accepts gridData. subcolumn – accepts subcolumn (Rate, Qty) |
The loop for gridData.grid.data.columnids that traverses the rows and columns must call this function. This function gets the corresponding subcolumn total for the current column of the loop from itemDetails. |
gridData[0].grid.data::
gridData[1].grid.data:
itemDetails:
FTL:
Output: 200 1000 |
JSON Codes for the Grid Table
This section provides the JSON codes that contain the data for the grid table in the grid print templates. You can use this information to identify the grid table elements for each transaction.
Before using these JSON codes, consider the following tips in customizing the grid table in the template:
-
Item details come from the item sublist in the transaction record. To display the item details, you must use the record.item field. The fields
record.custbody_gridoe_productgrpdata
andrecord.custbody_gridoe_trantemplatedata
do not contain item details. -
You may overwrite the CSS file by updating the
{cssContent}
inside the style tag. -
To change the maximum number of column attributes for each table, update the value in the
<#assign maxcol =6>
line.
Grid Table for Standard Grid Order Printing
The grid print templates for purchase order and sales order transactions contain the record.custbody_gridoe_productgrpdata
field. This field contains the data for the grid table. Refer to the following information to learn more about this field.
JSON Code Snippet for Standard Grid Order Printing
The following JSON code snippet shows a sample 2x2 grid table from record.custbody_gridoe_productgrpdata
:
[
{
"type": "MI",
"nameId": "2369",
"name": "Basic Crew Neck T-shirt",
"category": "Color, Size",
"rowattr": "custitem2",
"colattr": "custitem1",
"grid": {
"rowlabel": "Color",
"collabel": "Size",
"rowcollabel": "Matrix Item Option",
"header": [
{
"id": "Column1",
"colAttr": "1",
"name": "Small",
"percentage": "0.0"
},
{
"id": "Column2",
"colAttr": "2",
"name": "Medium",
"percentage": "0.0"
}
],
"data": [
{
"id": "Row1",
"rowattributeid": "1",
"rowattribute": "Red",
"rowpercents": 0,
"columnids": [
"Column1",
"Column2"
],
"columnpercents": [
0,
0
],
"Column1": {
"internalid": 4220,
"defaultpercent": 25
},
"Column2": {
"internalid": 4222,
"defaultpercent": 25
}
},
{
"id": "Row2",
"rowattributeid": "2",
"rowattribute": "Blue",
"rowpercents": 0,
"columnids": [
"Column1",
"Column2"
],
"columnpercents": [
0,
0
],
"Column1": {
"internalid": 4221,
"defaultpercent": 25
},
"Column2": {
"internalid": 4223,
"defaultpercent": 25
}
}
]
}
}
]
Sample 2x2 Grid Table Representation for Standard Grid Order Printing
For grid tables in standard grid order printing, consider the following details:
-
The index of the grid in
record.custbody_gridoe_productgrpdata
is the same as the item's grid ID column in item sublist. -
The template may contain an empty
record.custbody_gridoe_productgrpdata
field. -
The template may contain an empty
{}
entry member inrecord.custbody_gridoe_productgrpdata
. If the entry member is empty, it means that the whole template and its items are deleted in item sublist.
The following table represents the sample JSON code into a 2x2 grid table in purchase order and sales order printouts.
Matrix Item Option
|
Small
|
Medium
|
Blue
|
Row 1 Col 1 Item ID:
|
Row 1 Col 2 Item ID:
|
Red
|
Row 2 Col 1 Item ID:
|
Row 2 Col 2 Item ID:
|
Grid Table for Grid Print Templates
The grid print templates for cash sale, invoice, picking ticket, packing slip and quote transactions contain the record.custbody_gridoe_trantemplatedata
field. This field contains the data for the grid table. Refer to the following information to learn more about this field.
JSON Code Snippet for Grid Print Templates
The following JSON code snippet shows a sample 2x2 grid table from record.custbody_gridoe_trantemplatedata
:
{1:
{
"type": "MI",
"nameId": "4",
"name": "Basic Crew Neck Tee"
"grid": {
"rowlabel": "Color",
"collabel": "Size",
"rowcollabel": "Matrix Item Options",
"header": [
{
"id": "Column1",
"colAttr": "1",
"name": "Small"
},
{
"id": "Column2",
"colAttr": "2",
"name": "Medium"
}
],
"data": [
{
"id": "Row1",
"rowattributeid": "1",
"rowattribute": "blue"
"columnids": [
"Column1",
"Column2"
],
"Column1": {"internalid": 6316},
"Column2": {"internalid": 6318},
},
{
"id": "Row2",
"rowattributeid": "2",
"rowattribute": "red",
"columnids": [
"Column1",
"Column2"
],
"Column1": {"internalid": 6317},
"Column2": {"internalid": 6319}
}
]
}
}
}
Sample 2x2 Grid Table Representation for Grid Print Templates
For grid tables in grid print templates, note that the template may contain an empty record.custbody_gridoe_trantemplatedata
field.
The following table represents the sample JSON code into a 2x2 grid table in cash sale, invoice, packing slip, picking ticket, and quote printouts.
Matrix Item Option
|
Small
|
Medium
|
Blue
|
Row 1 Col 1 Item ID:
|
Row 1 Col 2 Item ID:
|
Red
|
Row 2 Col 1 Item ID:
|
Row 2 Col 2 Item ID:
|