diff --git a/admin/helper_functions.inc.php b/admin/helper_functions.inc.php
new file mode 100644
index 00000000..88ddcddd
--- /dev/null
+++ b/admin/helper_functions.inc.php
@@ -0,0 +1,29 @@
+
+function generate_pdf($template_id=1, $inputs=[]){
+
+ $inputs = array($inputs);
+
+
+ $data = array(
+ 'template_id' => $template_id,
+ 'inputs' => $inputs
+ );
+ $postfields_json = json_encode($data);
+
+ $ch = curl_init();
+ error_log($postfields_json);
+ curl_setopt($ch, CURLOPT_URL,"http://10.15.183.210:3000/api/generate_pdf");
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields_json);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Connection: Keep-Alive'
+ ));
+
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+
+ $server_output = curl_exec($ch);
+
+ curl_close($ch);
+}
+?>
\ No newline at end of file
diff --git a/admin/index.php b/admin/index.php
index 48e32b3d..555fe335 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -67,7 +67,7 @@ echo " \n";
echo '
';
echo ' ' . theme_icon('print/export_reports') . ' ' . i18n('Print / Export Reports') . ' | ';
echo ' ' . theme_icon('print_awards_ceremony_scripts') . ' ' . i18n('Print Award Ceremony Scripts') . ' | ';
-//echo ' ' . theme_icon('report_management') . ' ' . i18n('Report Management') . ' | ';
+echo ' ' . theme_icon('report_management') . ' ' . i18n('Report Management') . ' | ';
//echo ' ' . theme_icon('translations_management') . ' ' . i18n('Translations Management') . ' | ';
echo '';
diff --git a/admin/reports.inc.php b/admin/reports.inc.php
index f230b724..49644e78 100644
--- a/admin/reports.inc.php
+++ b/admin/reports.inc.php
@@ -37,6 +37,7 @@
require_once("reports_tours.inc.php");
require_once("reports_fairs.inc.php");
require_once("reports_fundraising.inc.php");
+ require_once("helper_functions.inc.php");
//require_once('../lpdf.php');
require_once('../lcsv.php');
@@ -628,6 +629,12 @@ foreach($report['col'] as $v)
break;
case 'pdf': case '':
/* FIXME: handle landscape pages in here */
+ $inputs = array(
+ "fairname" => i18n($config['fairname']),
+ );
+
+ generate_pdf($_GET['id'], $inputs);
+
$label_stock = $report_stock[$report['option']['stock']];
$rep=new lpdf( i18n($config['fairname']),
i18n($report['name']),
diff --git a/admin/reports_editor.php b/admin/reports_editor.php
index 8b331176..f9774e4d 100644
--- a/admin/reports_editor.php
+++ b/admin/reports_editor.php
@@ -38,7 +38,7 @@ require_once ('reports_tours.inc.php');
require_once ('reports_fairs.inc.php');
require_once ('reports_fundraising.inc.php');
require_once ('reports.inc.php');
-require_once ('../tcpdf.inc.php');
+// require_once ('../tcpdf.inc.php');
$fields = array();
$locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h', 'Lines' => 'lines');