Topic: Logo in reports header

Hello ,
i been searching the forums and the wiki, and i got no easy way of doing it..
i have uploaded a logo in the company setup.

how do i get it to appear in the header of the reports. ??

Kind Regards

Re: Logo in reports header

The FrontReport class property $companyLogoEnable needs to be enabled. It is false by default in it's class method Info().

In most if not all reporting/repXXX.php files there will be a line like:

$rep->Info($params, $cols, $headers, $aligns);

Just change it to:

$rep->Info($params, $cols, $headers, $aligns, , ,  true);

The actual prototype for it is:

function Info($params, $cols, $headers, $aligns,
        $cols2 = null, $headers2 = null, $aligns2 = null,
        $companylogoenable = false, $footerenable = false, $footertext = '')

@joe: Should we not have a config file switch for it or atleast a preference setting on a per company basis?

Re: Logo in reports header

This is not straight possible, because the CompanyLogoEnable can only be set for custom reports, where the headertype is set to header3. The report headers other fields are different too.

Of course it is possible to use this in the standard headertype 'header1' as well. You will have to change the /reporting/includes/pdf_report.inc file in the header1 memberfunction. You can look in header3 memberfunction how this is handled.

Joe

Re: Logo in reports header

A case insensitive search for the word companylogoenable shows that it is present only in reporting/includes/pdf_report.inc among the core FA files. The class member is populated inside the class method Info() only.

A similar search into the extensions shows that the custom report extensions set it from within the reports as in:

rep_annual_balance_breakdown/reporting/rep_annual_balance_breakdown.php
rep_annual_expense_breakdown/reporting/rep_annual_expense_breakdown.php
rep_cash_flow_statement/reporting/rep_cash_flow_statement.php

In the above files, the following code ensues:

..
..
$companylogoenable = true;
..
..
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2, $companylogoenable, $footerenable, $footertext);
$rep->SetHeaderType('Header3');
..
..

The dummy empty class method Header1() is present in reporting/includes/class.pdf.inc and not defined in the pdf_report.inc file.

The class method Header1() is defined in the TCPDF class in reporting/includes/tcpdf.php.

Re: Logo in reports header

apmuthu wrote:

The FrontReport class property $companyLogoEnable needs to be enabled. It is false by default in it's class method Info().

In most if not all reporting/repXXX.php files there will be a line like:

$rep->Info($params, $cols, $headers, $aligns);

Just change it to:

$rep->Info($params, $cols, $headers, $aligns, , ,  true);

The actual prototype for it is:

function Info($params, $cols, $headers, $aligns,
        $cols2 = null, $headers2 = null, $aligns2 = null,
        $companylogoenable = false, $footerenable = false, $footertext = '')

Thanks for your support..
i tried it.. 
so i enabled $companyLogoEnable in the pdf_report.inc line 254 ====>     $companylogoenable = true, $footerenable = true, $footertext = '')

i then used the find and replace to replace this code
$rep->Info($params, $cols, $headers, $aligns);
to this
$rep->Info($params, $cols, $headers, $aligns, , ,  true);

but the reports stopped generating...
have i done something wrong ??
"i am using Version 2.3.25"
Kind Regards.

Last edited by Alaa (04/21/2017 09:38:39 am)

Re: Logo in reports header

Please read @joe's post. There is a need for Header3 instead of the standard Header1 that is used.
Study the custom reports and do likewise.