Show/hide lines in a PDF

Hello All,

I am currently customizing a PDF template for Quotes. I started with the Quote Sample from SuiteCRM and changed many different things. Now I’m focusing on the line items, and I’d like to have some lines (Discount, Subtotal and Tax) hidden or visible depending on the context. More specifically, I don’t want Discount to be shown if it’s 0, and I don’t want Tax to appear for customers from a certain area.

I tried different solutions, but none of them worked so far…

  • My first attempt was to use Smarty modifiers, by adding some code directly in the PDF template like this:
{if $aos_quotes_area_c eq 'France'}{OK}{else}{Not OK}{\if} 

That did not work, the line was not processed and displayed as is in the PDF output.

  • My second option was to add some fields to the Quote module and embed some html into them, just like this:
$bean->discount_html_c="<table><tbody><tr><td></td><td></td><td></td><td style=\"border-style:solid;\" colspan=\"2\">Discount</td><td style=\"border-style:solid;border-width:0.5px;padding:2px 6px;height:0px;\">$discount_amount</td></tr></tbody></table>";

There again, the line was displayed without any processing

  • My third thought was to use different Quote templates, but how could I manage to have the right one picked up automatically? I don’t want the user being forced to select in a long list of templates…

I would be very grateful if someone could suggest any direction that I could take to solve this.

Thanks in advance!