Invoices by date report

Hi @Kovah , I’m working in an improvement for IP. It consists in a new report that allow to group invoices filtering by dates. The idea is that it generates one PDF with all the invoices.

It would be great if you asign me a ticket and I will upload it to GitHub when it will be ready.

Thank you.

[size=10]Last Update: 08.01.2016[/size]

I’m thinking about doing it with a temporal folder and some PDF and then merge them into one. Any idea of a library or something similar? Thanks.

Hi @Kovah, I have been working on that improvement and I achieved that functionality but I think that I’m not doing the procediment in the best way.

I have some doubts:

  1. How can I generate a PDF of an invoice without open it into a new URL in the browser? I have found a function called generate_pdf in invoices.php but I don’t know how can I use it directly in PHP.

  2. When I generate PDF of some invoices, those PDFs are encrypted, so I need to uncrypt it. How can I uncrypt with the mCrypt library o how can I generate PDF without encryption?

Thank you for your help.

  1. You can generate PDFs by opening the correct URL: yourdomain.com/invoices/generate_pdf/32513 where 32513 would be the internal ID of the invoice, not the invoice number.
  2. PDFs should not be encrypted by default. Please make sure that you do not have a default password set in the settings.

I know that I can generate a PDF invoice by going to an URL but, is there not other way to generate it directly from php?

At the moment I’m doing it like that:
echo “< script language=“javascript”> myWindow = window.open(”’ . $location . '","_blank"); myWindow.close();< /script>";

But the fact is that for that functionallity, is normal to generate a lot of invoices (it should be a period about 3-4 months generally). So, the code open a lot of tabs and then it closes it. I don’t really like that way for my purpose.

When I generate invoices in that way, I get some PDF but when I try to merge it into only one, there is an error telling me that the PDFs are encrypted. I have checked it and I don’t have any password set in my setting by default.

Thanks for your reply.

Please help me with that development. Thanks.

You can find everything that is related to PDF generation in the file /application/helpers/pdf_helper.php

I’m not able to guide you trough this customization as my time is hardly limited.