Add discount of item in PDF Invoice

Hello my friends,

I have i problem.

How can i add the red mark (discount item) to the pdf of the invoice? Between Price an Total (red in image 2)

Image1

Image 2

Thanks a lot,

With best regards

you can go to invoiceplane/view/pdf/default.php and search for the table and add another coloumn with proper information.

see here:
https://wiki.invoiceplane.com/en/1.0/templates/customize-templates

Thanks a lot my friend.

Got it working, but now i have a small problem. How can i put the Total (in red) to be the Price less the discount.

php is capable of additions or subtractions no?

so it’s probably something like: you should already have the correct strings, so just echo them with an substraction

 echo $item_total - $item_discount;

Hello Carstengrimm,

I put this <?php echo format_currency($item_total - $item_discount); ?> and in the pdf gives me 0,00€

because your variables are not correct it’s actually outputting 0 - 0 = 0

search for the foreach command where all rows will get echo’ed which looks like that.

                        <?php foreach ($items as $item) : ?>
                            
                                <?php echo $item->item_name; ?>
                                <?php echo nl2br($item->item_description); ?>
                                <?php echo format_amount($item->item_quantity); ?>
                                <?php echo format_currency($item->item_price); ?>
                                <?php echo format_currency($item->item_subtotal); ?>
                            
                        <?php endforeach ?>

I DID NOT CHECK THE CORRECT “NAME” OF THE PROPER VALUE, but you will need to replace the last line to something similar to this:

    <?php echo format_currency($item->item_subtotal - $item->item_discount); ?>

Usually you can find the proper values in one of the backend files, for this one it would be within:

application/modules/invoices/views
partial_item_table.php 

As you can find everything there as well such as:

                    
                        <?php echo format_currency($item->item_discount); ?>
                     

Work perfect.

Thanks a lot for the support :smile:

With best regards,