Batch export / print / send invoices

With the code @Unkn0wn0x posted i created a button to download all invoices that are shows on 1 page. So you just click 1 time per page and the download will go automatically.

Here the code, just paste it for example in the all invoice view page (/application/modules/invoices/views/index.php)

Between line 17 and line 19 i paste this code and i have download all invoices button in the header under the navigation next to the buttons (all/drafts/concept) etc…

DONT FORGET TO CHANGE THE LINK TO YOUR DOMAIN

The CODE:

<a class="btn btn-sm btn-primary" onclick="myFunction()">
                <i class="fa fa-arrow-down"></i> Download all invoices</a></style>
<script>
function myFunction() {
    document.querySelectorAll('a[href^="http://YOUR-LINK/invoices/generate_pdf/"]').forEach((invoice, index) => {
        setTimeout(() => {
            invoice.setAttribute('download', true);
            invoice.click();
        }, index * 2000);
    });
}
</script>

HAPPY NEW YEAR!!!

1 Like