Downloaded invoice differs from sent invoice

Because i did not see the use of showing the paid amount and invoice balance on a first invoice, i made a change to the pdf-template to have these lines printed only when the amount paid (invoice_paid) was greater then 0.
Below you see the code i used to get the result i wanted. Only the first and last line are inserted by me to get the conditional print of this part of the table.

	<?php if ($invoice->invoice_paid > 0){ ?>
	<tr>
            <td <?php echo($show_item_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
                <?php _trans('paid'); ?>
            </td>
            <td class="text-right">
                <?php echo format_currency($invoice->invoice_paid); ?>
            </td>
        </tr>
        <tr>
            <td <?php echo($show_item_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
                <b><?php _trans('balance'); ?></b>
            </td>
            <td class="text-right">
                <b><?php echo format_currency($invoice->invoice_balance); ?></b>
            </td>
        </tr>
	<?php } else{} ?>

The invoice pdf is okay when i download the pdf. But when the pdf is sent via e-mail, the paid amount and invoice balance lines are still printed.
Anyone out there who could explain the difference in the downloaded and sent template?

Depends on what you mean with sent template? There are three different ones in the system: PDF templates, web templates and email templates.

Seems you edited the PDF template. Please keep in mind that if you change one template you would have to change all other ones too because the system uses different templates for different statuses: normal, paid, overdue.
You can choose which templates to use in the system settings.

Hi Kovah, many thanks for your reply.

I edited the pdf template and use the same template for all three kind of invoices (normal, paid and overdue).
When i download the pdf invoice the code works and the lines are not printed (this is okay and as intended).
However in the pdf invoice that is sent as an attachment to the e-mail, the lines are printed (???).
Both downloadiing and sending the e-mail are done via the options button in the invoice overview.

Could you just output the variable $invoice->invoice_paid for the template and do both a normal print and one via email? So we can compare the values. Must be different ones then.

Thanks Kovah, you put me on the right track. Printing the variable was also not reflected in the invoice that was sent by e-mail. So it was clear that there must be an other template used for sending the e-mail.
After all i found (and remembered) the setting of the pdf template selection under e-mail templates.
Sorry for bothering you with this…