Calculation within PDF Maker

Calculation within PDF Maker

Last week our support team has a specific requirement for PDF Maker extension. Our customer need a specific calculation in Productblock table. He needs multiply two columns and summary it. He needs show a Purchaseprice in PDF export and show the sum of all Purchaseprices. Here is a small description how to make this. Meaby this can help someof 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 acrticle 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 *


We use cookies to improve our website. By browsing this website, you agree to our use of cookies. More info