Page 1 of 1

How to run report PDF generation from a procedure?

Posted: Sun Sep 15, 2019 6:13 pm
by chpwebmaster
Reading https://forums.nubuilder.cloud/viewtopic.php?f=21&t=9905 I've managed to create a button to email a report for the current record on a button press. If a custom cookie ("ReportFormID") is passed when nuRunPDF.php is called it creates a PDF file with the passed current record's ID (Report-ID.pdf) then checks if the file exists and sends the email. What I want to be able to do is push a button from an administration form that runs a query to get a list of record ID's that match a criteria (EmailStatements) and generate Statement-ID.pdf then email Statement-Month_Year.pdf.

What I need to know is if there is a way to call nuRunPDF.php and pass the report name and ID and have it generate the PDF using my existing modification?

Code: Select all

if(isset($_COOKIE['ReportFormID'])){
	$PDF->Output(__DIR__ .  '/nuEmailReports/' . $_COOKIE['ReportFormID'] . '-report.pdf', 'F');
}

Re: How to run report PDF generation from a procedure?

Posted: Mon Sep 16, 2019 5:44 pm
by Janusz
Hi,
Please find enclosed not solution but maybe some other ideas to consider:

Consider JS:

Code: Select all

in SQL Builder:

SELECT ........
WHERE con_part='#parts_id2#'
-------------------------------------
on the form you can create temp input box parts_id2
-----------------------
and run in sequnce ex.:
from the onclick button or any JS

$('#parts_id2').val('5d7f8b2b4333c3d').change();
nuRunReport('FR_PART_RAP');
$('#parts_id2').val('c15686241200321002').change();
nuRunReport('FR_PART_RAP');
In this specific case you would have 2 raports generated. You can generate in the loop as many raport as you want.
Additionally you would need to adjust other code to get what you want.

But sometimes reworking is more difficult then writing new module so you can consider as well tcpdf (it's part on nuBuilder)
to write your own specific raport generator.
https://www.youtube.com/watch?v=m50DZkIwd-s

Re: How to run report PDF generation from a procedure?

Posted: Wed Oct 09, 2019 6:31 am
by admin
.