Report Classes and their Reports:

Reports 107 to 113 do not have Destination to Excel available.


  • If the EMail Report option is chosen, make sure the real_name field in the users table for the logged in user is filled. Otherwise the sender's name will be blank.
  • Forum Post - Linking Reports. reporting/includes/reporting.inc line 128, function print_link() shows how to make a link to the core report you want and manufacturing/workorder_entry.php line 64 shows how to build a report link.

Report Extensions

Fixes needed for these extensions are here and here (both needed for both).

  • Cash Flow Statement - It uses an existing security code - 'SA_BANKREP'. Make sure Bank reports and inquiries is checked in the required role.

Hiding unauthorised report links

  • Forum Post - this is an extension of the original wish list for menu options visibility discussed here.
    • In reporting/includes/reports_classes.inc in the class Report add a class property $access
    • Modify the class constructor in it as:
    function __construct($id, $name, $ar_params = null, $access = null)
        $this->id = $id;
        $this->name = $name;
        if ($ar_params) $this->set_controls($ar_params);
                $this->access = $access;
  • Just before listing the report links, ie., just before:
foreach($this->ar_reports[$class_id] as $rep_id => $report)

insert the following

if($report->access != null && !$_SESSION["wa_current_user"]->can_access($report->access) && $_SESSION["wa_current_user"]->hide_inaccessible_menu_items()) continue;
  • Modify the add_report() method to use the $access property:
function addReport($class, $id, $rep_name, $params=null,$access=null)
        unset($this->ar_reports[$class][$id]); // unset std report if any
        $this->ar_reports[$class][$id] = new Report($id, $rep_name, $params, $access);
  • Finally modify each $reports->addReport call in reporting/reports_main.php to include the $access variable, like for example, Customer Balances report (here the $access value is 'SA_CUSTPAYMREP'):
$reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'),
    array(    _('Start Date') => 'DATEBEGIN',
            _('End Date') => 'DATEENDM',
            _('Customer') => 'CUSTOMERS_NO_FILTER',
            _('Show Balance') => 'YES_NO',
            _('Currency Filter') => 'CURRENCY',
            _('Suppress Zeros') => 'YES_NO',
            _('Comments') => 'TEXTBOX',
            _('Orientation') => 'ORIENTATION',
            _('Destination') => 'DESTINATION'),'SA_CUSTPAYMREP');


Yes, indeed, there is possibility to insert watermark, or even whole externally designed blueprint in documents generated in FA.

The blueprint have to be designed as PDF-1.4 file (other pdf formats may also be supported), and you will have to put the designed watermark page in /reporting/forms folder.

Out of the box two blueprints are supported for two basic document layouts:

  • Header2.pdf - for reports 107-113, 209,210 and 409
  • Header.pdf - for all other documents

If you want to test this feature, just put attached file in the forms folder and generate Sales Invoice. In real design some small changes in repxxx.php files can be necessary.

Of course this feature does not address directly the problem of ad-hoc per document watermarks, but is ready to use if e.g. you plan to hire artist to design your invoices ;).

Third Party Reports

Large Excel Reports

  • Forum Post - Fix for Excel reports to show over 65535 rows

Adjusting Column Widths in Reports

  • Forum Post: FA v2.3 column widths for reports can be adjusted by backporting the changes in this commit in FA 2.4 when transaction numbers exceed 3 digits.

Auto Printing with no Profile

If the Printer is connected to the same computer that runs the POS, to send print directly to printer at a POS Location without going to browser preview by adding this code to line 954 of pdf_report.inc in the function End() just after the globals:

$this->IncludeJS("print();"); // force to open print dialog

EMailing parameters in Batch Files

The links like the following can be used in batch files to email reports:


or just the parameters needed like:


The following reports in FA can be emailed directly from the reports page form choices:


  • 107 - Invoices (From 0, To 1, EMail 3)
  • 113 - Credit Notes
  • 110 - Deliveries
  • 108 - Statements
  • 109 - Sales Orders
  • 111 - Sales Quotations
  • 112 - Receipts

Email Suppliers

  • 209 - Purchase Orders
  • 210 - Remittances

EMail Locations

  • 409 - Work Orders

Watermarking and background / logo merging in reports

  • Another page on Watermarking circa 2013.
  • Forum Post: Per company, per Template report watermarking is available in FrontAccounting.
  • Background / Watermark merge PDF file for Company # to be located in the folder: company/#/reporting/forms
  • The merge PDF file should be of Acrobat Reader format v5.0 (PDF format v1.4) or lower since FA uses the free FPDI v1.2.1 library released on 2008-09-11
  • Sample OpenWriter Watermark/logo file for customization is here courtesy Joe Hunt.
  • Watermark / logo PDFs can be created in MS Word 2007 => Page Layout => Watermark => Custom Watermark => File => Save As => PDF or XPS are of PDF Format v1.5 and above and needs to be printed in some virtual printer like PDFCreator or doPDF. PDFCreator generates small PDF files and is free but may try to install some nagware (optional) in the later versions.
  • Choosing standard fonts like Arial will result in non embedding of fonts in the resultant PDF making it small in size.
  • On New page creation in reports, the function setSourceFile() in reporting/includes/fpdi/fpdi.php is called and returns the number of pages in the above Header2.pdf file.
  • On New page creation in reports another possibility is to place a Header2.php file in reporting/forms folder (possibly in the company folder) as well.
  • If the Header2.pdf / Header.pdf files have more than one page, then each one is used in succession for the report and the last one is used for the remaining pages of the report.
  • Use Cases:
    • Company logo at the top of the Header.pdf.
    • Stamp underneath the existing report, such as confidential data across the page in a vague / subdued color.
    • setSourceFile() loads an existing pdf as a "background", onto which all output is "printed".
    • Incorporate a company letterhead.

Header2.php file in Watermarking and background of reports

  • The Template (eg., Header2) function is executed only at the very end of the NewPage() method in reporting/includes/pdf_report.inc.
  • The company/#/reporting/Header2.php if present will provide overrides for properties not defined in
    • the Newpage() method
    • doctext.inc
    • header2.inc
  • It will also provide values in cases where pre-defined properties in the above are not overridden (like $this->formData['br_name']).
  • Any variables (need to global them) and properties referred to in the header2.inc and doctext.inc files that are not part of the core can be provided in the Header2.php file and assigned in header2.inc and doctext.inc only if absent.
  • Example of Header2.php usage and it's effect is here.
  • The mere presence of the file company/#/reporting/includes/header2.inc does not ensure that it will be used in reports. It is necessary for the appropriate company/#/reporting/repXXX.php file to be present for it to apply to it.

Show Company Logo on Reports

Excel Reports in RTL Languages

Tips and Tricks

RTL Fonts

Suppressing Page number display

  • Forum Post: Comment out the lines 144-147 in reporting/includes/header2.inc
//        $this->NewLine(2);
//        if ($this->pageNumber > 1)
//            $this->Text($mcol + 180, _("Page") . ' ' . $this->pageNumber);

PDF Failure

  • Symptom: PDF reports has stopped working, reports to Excel/LibreOffice works.
  • Fix: On some newer internet explorer releases, you will have to set the compatibility mode. If you cannot solve this you may use another browser like Firefox or another.
  • Fix: On recent Firefox browsers, the PDF Application Viewer is set to internal preview pdfjs feature that does not yet have full Adobe PDF functionality. See Forum Post and view Article.
  • Fix: The php.ini setting of the variable max_input_vars may be increased from the default value of 1000 (even if not present in some php versions). See Forum Post.

dejavu.php missing - TCPDF Font Failure

  • Download dejavu.php
  • Extract contents to reporting/fonts folder
  • This is the default unicode font when none are defined
  • Can change this font at around line 161 in reporting/includes/class.pdf.inc

PHP < v5.3 PDF Failure

The commit on 2014-11-07 was made to accomodate PHP 5.3's preg_replace_callback() function but for those on earlier PHP versions like v5.2.17, this non existent function caused PDF failure. It's reversion for these older PHP versions will solve this issue.

Charge To / deliver To

  • Create customer: Mark
  • Create branch DD Towing under customer Mark
  • Sales quote or Order pdf will display DD Towing in Charge to and Deliver to field
  • In FA v2.3.6 (Circa 2011) it would have displayed Mark in Charge to field and DD Towing in Deliver to field
  • This was changed to make possible having branches charged directly
  • To revert to old FA v2.3.6 functionality, set the name and billing address for the branch the same as for customer (keep branch short name unique to easily recognise branches in selectors). If this is still a problem (e.g. you have big database with mostly multibranch customers) you can fix the charge data in reporting/includes/doctext.inc file about line 18-20 (the code should be self explanatory). Lines 44 and 61 can be changed from
_("Customer's Reference") => $this->formData["customer_ref"],


_("Customer's Reference") => $this->formData["name"],
  • If there is no Branch billing address, then the Customer address is used.

Report Signature

Do one of the following:

  • In Comment or Memo field
  • If this info is for all customers - add signature in the file reporting/includes/header2.inc
  • For only SALES QUOTATIONS, add the info in the file reporting/rep111.php.
if ($this->formData['doctype'] == ST_SALESQUOTE)
    $txt = "test";
    $this->TextWrapLines($ccol, $this->row, $right - $ccol, $txt, 'C')

Extra Message Lines in Delivery Note Report

Insert the following lines after line 216 in file reporting/rep110.php.

$rep->TextCol(1, 4, "_______________________________________________", -2);
$rep->TextCol(1,4, "      Signature, Company Stamp & Date", -2);

You may need to adjust the underline and text a bit. Try it on the Training Co. first. Please make a backup of the file, in case you get an update. You will then have to insert these lines again.

Extra Parameters in Reports taken from formatted notes field

Include the following function into any report or it's includes:

// Purpose: Function to parse a string into parameters
// Release Date: 2014-12-26
// Author: ApMuthu <apmuthu@usa.net>
// Usage:
$str = "PPFrt#2000 CID#6378465 TaxEx#2345-038 abcde ertrgdert COD#4253 jdegtd PIN#6473654";
$p = parse_notes_params($str);
echo print_r($p, true);

function parse_notes_params($str, $sep=" ", $delim="#") {
	$str_params = explode($sep, $str);
	$param_array=Array('notes' => '');
	foreach ($str_params AS $str_param) {
		$param_set=explode($delim, trim($str_param));
		$key = (array_key_exists(0, $param_set) ? trim($param_set[0]) : '');
		$val = (array_key_exists(1, $param_set) ? trim($param_set[1]) : '');
		if (strlen($key) > 0 && strlen($val) > 0) {
		} else {
			// stop at first missing parameter set
			// break;
			// Collect the rest into notes
			$param_array['notes'] .= (" " .  $str_param);
	$param_array['notes'] = trim($param_array['notes']);
	return $param_array;

An example of usage will be in the reporting/rep110.php file at near the end just before the last $rep-Font(); statement:

    $notes_params = parse_notes_params($branch['notes']);
    if ($packing_slip == 0 && array_key_exists('CID', $notes_params)) {
        $rep->TextCol(1, 7, "Old Customer# : " . $notes_params['CID'], - 2);


PDF Page Numbering

Site-wide report page numbering (useful particularly for multi page invoices) can be enabled by commenting out line 142 in reporting/includes/header2.inc:

//		if ($this->pageNumber > 1 && !strstr($this->filename, "Bulk"))

EMail Templating in FA v2.4 only - Current Fix for FA v2.3.x

Change line 1006 in reporting/includes/pdf_report.inc:

    $msg = _("Dear") . " " . $contact['name2'] . ",\n\n" 


    $msg = _("Dear") . " " . $contact['name'].' '.$contact['name2'] . ",\n\n" 

PDF Font Change

  • Put the 3 font files in reporting/fonts : tuffy.php, tuffy.z and tuffy.afm
  • On Linux
apt-get install ttf-tuffy
ln -s /usr/share/fonts/truetype/ttf-tuffy/* reporting/fonts
  • Edit reporting/includes/class.pdf.inc around Line 119:
// Was helvetica, now tuffy.
        $this->FontFamily = 'tuffy';
        $this->FontStyle = '';
        $this->FontSizePt = 12;

Add Page to Report

  • Forum Post for PHP >= 7
  • Example to add a page to rep109.php (Sales Order Report), say Tax Invoice not yet made:
// START my modification
here i want to write predefined html report here 
// END my modification

if ($ email == 1)
    $ rep-> End ($ email);
if ($ email == 0)
  $ rep-> End ();

Salesman Wise reports

BarCode inclusion

Audit Trail User-wise

When there are multiple users of a single role like Administrator, we track their individual actions (like who entered an order or who received cash) by using the Audit Trail report.

Old PDF Reports auto deletion time / retention

  • Raise the time from 3 minutes (180 secs) to a different value before a report is considered stale and deleted
  • Comment out the lines below to prevent it's deletion and retain it indefinitely.

Lines 1082-1085 in reporting/includes/pdf_report.inc:

// seems 3 min is enough for any report download, isn't it?
if (time()-$ftime > 180){