Friday, May 17, 2019

Add arithmetic functions in the Advanced PDF/HTML Template.

The Advanced PDF/HTML Template uses a template engine called "FreeMarker".

 

There are 4 basic mathematical functions that can be used in the Advanced PDF/HTML Template namely:

            Addition: +

            Subtraction: -

            Multiplication: *

            Division: /

           

Here's an example:

I. Create a custom body field.

            1. Navigate to Customization > Lists, Records, & Fields > Transaction Body Fields > New.

            2. Give it a name (e.g. Sample field).

Note: Take note of the field id of the custom field (e.g. custbodyxx)

 

            3. Type= Integer Number    

            4. Store Value= T

            5. In the Applies To Tab, set Sale= T.

            6. In the Display Tab, select Main in the Subtab dropdown menu.

            7. Click Save.

           

II. Create a dummy Sales Order and add a value on this custom field (e.g. Sample field= 10)

           

III. Add a freemarker code that will use the arithmetic function in the Advanced PDF/HTML Template:

            1. Navigate to Customization > Forms > Advanced PDF/HTML Templates.

            2. Click Customize on Standard Sales Order PDF/HTML Template.

            3. On any part of the template, right click and select Cell > Insert Cell After.

            4. In the blank cell, type a freemarker code shown below.

           

            ${record.custbodyxx*2}

           

            5. Click Save.

           

- Print the dummy Sales Order and use the Advanced PDF Template and it should render a value of custbodyxx*2= 20.

- Arithmetic function can also be applied to another custom field in the Template.

 

For example:

 

If custbodyxx= 10 and custbodyy= 5

 

            ${record.custbodyxx*record.custbodyy}

           

This should render the product of custbodyxx*record.custbodyy= 50 in the actual print out.

1 comment:

  1. Hello, Neat post. There is an issue along with your website in internet explorer, might test this¡K IE nonetheless is the marketplace chief and a big section of people will pass over your excellent writing due to this problem. logo design firms

    ReplyDelete