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:

  • grouping – thousand separator

  • decimal – decimal separator

  • negative – negative number symbol

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:

  • For purchase order and sales order – wd_gom_template_style.css located in SuiteBundles > Bundle 41296 > src > css.

  • For cash sale and quote – WD_GridOE_GridPrintOut.css located in SuiteBundles > Bundle 41296 > src > GridPrinting.

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:

<#assign test = min(1,9)> {test}

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:

{<item.itemid>: {rate:<item.rate>,quantity: <item.quantity>}}

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:

-[{itemid: 10, rate: 10, quantity: 10},

{itemid: 20, rate: 20, quantity: 20}.

{itemid: 10, rate: 30, quantity: 30}]

FTL:

{getItemDetails(record.item)}

Output:

{10: {rate: 30, quantity: 40}

20: {rate: 20, quantity: 20}}

getItemOrderedShippedQty(salesorder, items)

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:

{itemid: {ordered: <SO.quantity>, shipped: <IF.quantity>, backorder: <SO.backordered>}}

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:

-[{itemid: 10, rate: 10, quantity: 10, backordered: 10},

{itemid: 20, rate: 20, quantity: 20, backordered: 0}.

{itemid: 10, rate: 30, quantity: 30, backordered: 0}]

record.item: (IF)

-[{itemid: 10, quantity: 5}]

FTL:

{getItemOrderedShippedQty(salesorder, record.item)}

Output:

{10: {ordered: 40, shipped: 5, backorder: 10}}

getRowColLabel(gridData)

gridData – grid data from record.custbody_gridoe_trantemplatedata

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]:

{type: "MI", grid: {rowcollabel: "Main Label", rowlabel: "Color", collabel: "Size"}}

gridData[1]:

{type: "NA", grid: {rowcollabel: "Main Label", rowlabel: "Color", collabel: "Size"}}

FTL:

{getRowColLabel{gridData[0]}}

{getRowColLabel{gridData[1]}}

Output:

"Main Label"

"Color / Size"

getRowColumnData(row, col, subcolumn)

row – accepts gridData.grid.data element

col – accepts gridData.grid.data.columnids 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 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:

{10: {rate: 100, quantity: 999}}

FTL:

{getRowColumnData(row,col,rate)}

{getRowColumnData(row,col,quantity)}

{getRowColumnData(row,col,picked)}

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:

{column01:{ internalid: 10},

column02: { internalid: 20}}

itemDetails:

{10: {rate: 100, quantity: 999},

20: {rate: 100, quantity: 1}}

FTL:

{getRowTotal(row, rate)}

{getRowTotal(row, quantity)}

Output:

200

1000

getColumnTotal (rows, column, subcolumn)

row – accepts gridData.grid.data

column – accepts gridData.grid.data.columnids element

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::

{column01:{ internalid: 10}}

gridData[1].grid.data:

{column01:{ internalid: 20}}

itemDetails:

{10: {rate: 100, quantity: 999},

20: {rate: 100, quantity: 1}}

FTL:

{getColumnTotal(rows, col, rate)}

{getColumnTotal(rows, col, quantity)}

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 and record.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 in record.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

(record.custbody_gridoe_productgrpddata[0].grid.rowcollabel)

Small

(record.custbody_gridoe_productgrpddata[0].grid.header[0].name)

Medium

(record.custbody_gridoe_productgrpddata[0].grid.header[1].name)

Blue

(record.custbody_gridoe_productgrpddata[0].grid.data[0].rowattribute)

Row 1 Col 1 Item ID:

(record.custbody_gridoe_productgrpddata[0].grid.data[0].Column1)

Row 1 Col 2 Item ID:

(record.custbody_gridoe_productgrpddata[0].grid.data[0].Column2)

Red

(record.custbody_gridoe_productgrpddata[0].grid.data[1].rowattribute)

Row 2 Col 1 Item ID:

(record.custbody_gridoe_productgrpddata[0].grid.data[1].Column1)

Row 2 Col 2 Item ID:

(record.custbody_gridoe_productgrpddata[0].grid.data[1].Column2)

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

(record.custbody_gridoe_trantemplatedata[0].grid.rowcollabel)

Small

(record.custbody_gridoe_trantemplatedata[0].grid.header[0].name)

Medium

(record.custbody_gridoe_trantemplatedata[0].grid.header[1].name)

Blue

(record.custbody_gridoe_trantemplatedata[0].grid.data[0].rowattribute)

Row 1 Col 1 Item ID:

(record.custbody_gridoe_trantemplatedata[0].grid.data[0].Column1)

Row 1 Col 2 Item ID:

(record.custbody_gridoe_trantemplatedata[0].grid.data[0].Column2)

Red

(record.custbody_gridoe_trantemplatedata[0].grid.data[1].rowattribute)

Row 2 Col 1 Item ID:

(record.custbody_gridoe_trantemplatedata[0].grid.data[1].Column1)

Row 2 Col 2 Item ID:

(record.custbody_gridoe_trantemplatedata[0].grid.data[1].Column2)

Related Topics

Customizing the Grid Print Templates
Identifying the Printout Fields

General Notices