Jump to content

Adding "total invoices" in generated invoices


Recommended Posts

Hi there to everyone!


When I'm generating the pdf with all invoices of a certain period, nowhere is written the total of all invoices of the period.

This is what I mean:
I'm generating the pdf of all invoices of february (1-28 february) and I got the pdf with all invoices of the month. So I got invoice 1 = 20€, invoice 2= 5€, etc. etc. But nowhere is writte the total. 

I want to add a new blank page in the beginning of pdf, where the sum of all invoices appear.

Page 1:
SUM invoices: 25€

Page 2:
Invoice 1

Page 3: 

invoice 2

etc. etc.

What and where I should add the code?

Another great thing, would be if the generated pdf, have the invoices orded by invoice number and not by the order date.

Hope somebody can help me :)

Best wishes,

Link to comment
Share on other sites

Hi there and thanks for your quickly answer!

About the total, I just need a very easy module or adding code in the generating pdf, that show me the total of all invoices.

Just 1 simply line:

Total of generated invoices: 10€

And than all pages with the invoices that you can generate in the BO.

Link to comment
Share on other sites

I think it is not so simple as it looks. Aynway, the code would be patched somewhere around processGenerateInvoicesPDF and processGenerateInvoicesPDF2 methods in /controllers/admin/AdminPdfController.php.

Link to comment
Share on other sites

Hi there!
I solved the problem with order the generated invoices by invoice number and not by order date and will share the solution if somebody need it.

Here is what I do.

public_html\classes\order\OrderInvoice.php and look for:

public static function getByDateInterval($date_from, $date_to)

Some lines down, you will find:

ORDER BY oi.date_add ASC

Change it to:

ORDER BY oi.number ASC

Hope to solve also the "problem" with creating the sum of generated invoices.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...