Calculation within PDF Maker

Calculation in PDF Maker

Last week our support team has a specific requirement for the PDF Maker extension. Our customer needs a specific calculation in Productblock table. He needs multiply two columns and summary it. He needs to show a Purchase Price in PDF export and show the sum of all Purchase prices. Here is a small description how to make this. Maybe this can help some of our PDF Maker users.

There is also Video which shows how to calculate in PDF Maker, but there is only sum function.

So in this case, if we need multiply two columns and summary it, we need a start (before Productblock) with definition of variables and give them default value 0

[CUSTOMFUNCTION|setCFNumerValue|purchaseprice_product|0|CUSTOMFUNCTION]
[CUSTOMFUNCTION|setCFNumerValue|purchaseprice_total|0|CUSTOMFUNCTION]

In next step we will calculate purchaseprice_product variable as $PRODUCTQUANTITY$ * $PRODUCTS_CF_751$. Put this code inside Productblock


[CUSTOMFUNCTION|mathCFNumberValue|purchaseprice_product |=|$PRODUCTQUANTITY$|*|$PRODUCTS_CF_751$|CUSTOMFUNCTION]

Then we will sum this calculated value. Put this code inside Productblock


[CUSTOMFUNCTION|sumCFNumberValue|purchaseprice_total|purchaseprice_product |CUSTOMFUNCTION]

The last step is to show our calculated value in Productbock. Put this code inside Productblock


[CUSTOMFUNCTION|showCFNumberValue|purchaseprice_product |CUSTOMFUNCTION]

The total calculated price must be put after Productblock. Put this code outside Productblock


[CUSTOMFUNCTION|showCFNumberValue|purchaseprice_total|CUSTOMFUNCTION]

 

We hope this article can help to understand how calculation in PDF Maker works.

Your IT-Solutions4You Support Team

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *