mathematical functions inside PDF Templates

hi,

i would like to make math operations between fields retrieved by the PDF template

ex: i retrieve amount and taxes and from there i can have the taxes included amount

Does anyone know how to do that ?

I tried to modify the HTML file directly but it didn’t work

thanks

multicrm

You can do simple math from within Workflows using Calculated Fields. Or you could do the same from a logic hook using all the power of PHP.

If you use these to pre-calculate your totals then you can use the information in a report.

hi pgr

I tried to use the workflow module to fill a field that should hold my currency but it does not seem to work

This is my forkflow formula: {add({divide({multiply(P0; P1)}; 100)}; P1)}
Where P0 and P1 are both currencies

i have not set up any conditions yet

the issue is that my field value stays to 0.00

do you see what i did wrong ?

Thanks again

multicrm

I guess it should work, but I have little experience with Calculated Fields.

It could be a problem with regional formats (1.23 versus 1,23) or field data types… but I don’t know.

Either you can go in the code and check how it’s failing, or I suggest you use an after_save Logic hook where the syntax will be much clearer.