Display Subtotal, discount, total

Here my working template code for discount, on the invoice-sums section (with InvoicePlane 1.4.6) :

<?php if ($invoice->invoice_discount_percent <> "0") { ?>
    <tr>
        <td></td>
        <td <?php echo ($show_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
            <?php echo lang('discount') . "" . round($invoice->invoice_discount_percent, 2) . "%" ; ?>
        </td>
        <td class="text-right"><?php echo "-" . format_currency($invoice->invoice_item_subtotal * $invoice->invoice_discount_percent / 100); ?></td>
    </tr>

<?php } ?>

<?php if ($invoice->invoice_discount_amount <> "0") { ?>
    <tr>
        <td></td>
        <td <?php echo ($show_discounts ? 'colspan="5"' : 'colspan="4"'); ?> class="text-right">
            <?php echo lang('discount') ; ?>
        </td>
        <td class="text-right"><?php echo "-" . format_currency($invoice->invoice_discount_amount); ?></td>
    </tr>

<?php } ?>