Reporting Library

  • is a sahana library which enables module developers to generate module specific reports in ods, pdf, and xhtml file formats.
  • Include the function to the script,
include_once $global['approot']."/inc/reporting/";

Generate reports

Starting a report

  • parameters :
  1. $file_format – (data type = String) - File format of the report. OpenDocument Spreadsheet = ods, PDF = pdf, MS EXCEL = xls and XHTML = xhtml
  2. $file_name – (data type = String) - File name of the report. This is used when the report is downloaded.
  3. $keyword_in – (data Type = Array) - This can be used to specify keywords for the report. This keywords would be helpful to search reports later.
  4. $dynamic_enable – (data type = String) - This is to specify whether this report is dynamically generated one or not.
eg: shn_report_fopen('pdf',“myreport”,array('key1'=>'myreport','mod'=>'catalogue'),false);

Add a title to the report

  • parameters :
  1. $title – (data type = String) - This is to specify the title of the report.
eg:shn_report_add_title('Inventory Report')

Add a table to the report

  • parameters :
  1. $headerArray – (data type = Array) - This is to specify headers of the table
  2. $dataArray – (data type = Array) - This is to specify the data of the table. Each row of the table is represented by an array and all those arrays should be pushed in to one array.
eg:$headerArray = array('column1header','column2header','column3header');
$dataArray = array(

Add a paragraph to the report

  • parameters :
  1. $summery – (data type = String) - This is to insert paragraphs, summaries to the report.
eg: $summary= “This is an example for inserting a summary/paragraph to the report”;

Close the report

  • This function call will complete the report creation.
  • parameters :
  1. $report_id – (data type = String) returns the report download link.

QR Code
QR Code dev:reportinglib (generated for current page)