SugarPDF multiply currency by tax rate fails

Hi all

I am making a custom pdf template is SugarManger using Smarty inline code. This is in Sugar 9. We are currently trying to move from Sugar 7.8.2.2 and this is one of three blocks. We would like to go to V9 if possible. I want GST (15%) to show against the quoted line items. I can get the active tax rate for the quote/invoice $fields.taxrates.value but I can't multiply it in the smarty template by the taxable amount which is a currency value . The php errors with "A non-numeric value encountered" which is the currency value. I have tried to convert it to a number using smarty and I get [plugin] (secure mode) modifier 'intval' is not allowed if I have $taxable|intval

Tax rate which = .15 before the product loop

{assign var=taxrate value=$fields.taxrates.value/100}

I have tried to strip the non numeric bits out but it doesn't like that either. 

{if isset($product.total_amount)}{if isset($taxrate)}{assign var=taxable value=$product.total_amount|replace:"$":""|replace:",":"" }{ $taxable *  $taxrate}{/if}{/if}

I have tried other attempts to format it

{if isset($product.total_amount)}{if isset($taxrate)}{$converted = settype ($product.total_amount, 'integer')}{ $converted * $taxrate }{/if}{/if}

$converted comes back blank which gives a blank output

I can get the tax rate showing up or the stripped total but can't multiply them together

This is the last piece of the puzzle. I have to say SugarPDF documentation is very limited. The trap with column sizes took a long time to work out. And just confirming the correct field names takes some digging

Thanks very much

Cheers Duncan