ireport

IReport is a PHP class allow us to design PDF report easily via Java based iReport designer.
24 followers

This extension was based on PHPJasperXML. Is in Beta

Requirements

Usage

Yii::import('application.ext.extensions.ireport.*');

$AReport = new IReport('sample2.jrxml');

$AReport->parameters = array("parameter1"=>1);

$AReport->execute();

Source

http://code.google.com/p/yii-ext-ireport/

by Questor Sistemas

Update by #le_top

You can get my update here: Updated ireport extension and you can also Try the updated demo

Total 20 comments

#11436 report it
catataw at 2013/01/14 04:57am
Several issues

@le_top Hello Thank you for the corrections, this week already be making changes.

att

#11420 report it
le_top at 2013/01/13 07:56am
Several issues (in strict mode), fixed / using phpjasperxml

Hi

My dev environment is using strict php settings, so I easily run into any errors like missing variables, ... (in my 'php.ini' I have 'error_reporting = E_ALL | E_STRICT')

I fixed that so that the demo at least generates PDF files except for Sample1 where TCPDF complains that it can not find the 'jpg' file. I also set up the demo using an sqlite3 database. I am not sure that the rendering is perfect, but it renders.

You can get my update here: Updated ireport extension and you can also Try the updated demo

The demo is supposed to be in the 'demo' directory, and the 'index.php' may need an update to reference 'yii'.

Update: I decided to try the original 'phpjasperxml' library and I managed wrapping it. I included it in the above reference zip and demo. This way we'll be able to follow evolutions of 'phpjasperxml' directly and save the effort of modifying a derived version of it.

#10220 report it
CedSha at 2012/10/11 10:08pm
Undefined variable: nameOfTheGroup

I do not know how to directly answer your msg ! Please find copy of report here

http://pastebin.com/xmwEnty8

Here we have the group :

<group name="Essai">

and the error message and culprit lines are following. I finally comment the line and the report could be edited. I am not sure if I loose fonctionality or not ?

Undefined variable: Essai 
case "groupHeader":
    //$this->pointer = &$this->group[${$xml_path["name"]}]["groupHeader"];
    $this->pointer = &$this->grouphead;
#10192 report it
CedSha at 2012/10/10 04:13am
Undefined index: gname

This error occur when there is no group in the report. (gname = group Name) However I created a group and now I am stuck one step further with an error : Undefined variable: nameOfTheGroup

#8582 report it
catataw at 2012/06/12 08:35pm
hyde82

tKS

#8575 report it
hyde82 at 2012/06/12 11:19am
print different format

if you want to use different format page. IReportRender construct: your array $conf is not processed by TCPDF.So you cannot use different format page than A4. I replaced this line :

if ($this->RParser->pageSetting["orientation"] == "P")   
 
            $conf = array(
                    $this->RParser->pageSetting["pageWidth"],
                    $this->RParser->pageSetting["pageHeight"]);            
 
         else
            $conf = array(
                    $this->RParser->pageSetting["pageHeight"],
                    $this->RParser->pageSetting["pageWidth"]);
 
        $this->pdf = new _TCPDF($this->RParser->pageSetting["orientation"], 'pt',$conf);

with:

if ($this->RParser->pageSetting["orientation"] == "P")   
 
            $conf = array(
                    (string)$this->RParser->pageSetting["pageWidth"],
                (string)$this->RParser->pageSetting["pageHeight"]);            
 
         else
            $conf = array(
                    (string)$this->RParser->pageSetting["pageHeight"],
                    (string)$this->RParser->pageSetting["pageWidth"]);
 
        $this->pdf = new _TCPDF($this->RParser->pageSetting["orientation"], 'px',$conf);
#8512 report it
banamlehsb at 2012/06/08 03:03pm
demo doesn't work

ireport demo doesn't work. Undefined index: gname

#7462 report it
russellfeeed at 2012/03/23 12:45pm
Error Reporting is the issue

Thanks catataw

I found some help on the PHPJasperXML forum, and even tried using PHPJasperXML without your extension. The errors go away if I use

error_reporting(0);

Like this:

public function actionMonthlyreport() {
        Yii::import('ext.ireport.*');
        $reportdef =  dirname(__FILE__) . '/../reports/report2.jrxml';
 
        error_reporting(0);
        $AReport = new IReport($reportdef);
        $AReport->parameters = array("parameter1"=>1);
        $AReport->execute();
    }

So now your iReport extension is pumping out a .PDF for me now... I've just got to work out why is blank ;-)

Thanks again

#7461 report it
catataw at 2012/03/23 12:08pm
This extension was based on PHPJasperXML ?

@russellfeeed Hello this extension was based on PHPJasperXML, referring to the errors must be because of the php.ini configuration is able to send me your php.ini so I can check and correct errors.

#7460 report it
russellfeeed at 2012/03/23 10:58am
This extension was based on PHPJasperXML ?

Does this extension depend on PHPJasperXML, or is it merely inspired by PHPJasperXML ?

#7458 report it
russellfeeed at 2012/03/23 10:07am
Is this compatible with iReport v4.5.1?

Like @kokoadi (http://www.yiiframework.com/extension/ireport/#c7390) I too had the error with

switch ($data[scaleImage])

which was easily fixed by replacing it with

switch ($data['scaleImage'])

but now I'me getting all sorts of errors trying to render a iReport 4.5.1 generated .jrxml

e.g.

2012/03/23 13:49:36 [error] [php] Undefined variable: imagetype
(C:\xampp\htdocs\mdfs-trunk\protected\extensions\ireport\IReportParser.php:349)
 
2012/03/23 13:52:32 [error] [php] Undefined index: hidden_type
(C:\xampp\htdocs\mdfs-trunk\protected\extensions\ireport\IReportRender.php:97)
 
2012/03/23 13:55:34 [error] [php] Undefined index: rotation
(C:\xampp\htdocs\mdfs-trunk\protected\extensions\ireport\IReportRender.php:518)
 
2012/03/23 13:57:06 [error] [php] Undefined index: type
(C:\xampp\htdocs\mdfs-trunk\protected\extensions\ireport\IReportRender.php:540)

Any ideas what I'm doing wrong?

Thanks in advance Russell

#7390 report it
kokoadi at 2012/03/19 07:58pm
PHP notice

Use of undefined constant scaleImage - assumed 'scaleImage' how to solve this?

private function ParserElementImage($data) {
327         $imagepath = $data->imageExpression;
328         switch ($data[scaleImage]) {
329             case "FillFrame":
330                 $this->pointer[] = array(
331                     "type" => "Image",
332                     "path" => $imagepath,
333                     "x" => $data->reportElement["x"] + 0,
334                     "y" => $data->reportElement["y"] + 0,
335                     "width" => $data->reportElement["width"] + 0,
336                     "height" => $data->reportElement["height"] + 0,
337                     "imgtype" => $imagetype,
338                     "link" => substr($data->hyperlinkReferenceExpression, 1, -1),
339                     "hidden_type" => "image");
340                 break;
#6351 report it
catataw at 2012/01/02 06:01am
usando oracle

Ola Renata, para conectar e pegar os dados uso o proprio yii tenta fazer uma aplicacao e usar o seguinte codigo

private function buildsql($IReportParserXML) {
        $sql = $IReportParserXML->sql;
        if (isset($IReportParserXML->parameters)) {
            foreach ($IReportParserXML->parameters as $v => $a) {
                $sql = str_replace('$P{' . $v . '}', $a, $sql);
            }
        }
        return $sql;
    }
 
    public function execute($IReportParserXML) {
        $this->m = 0;
        $command = $this->connection->createCommand($this->buildsql($IReportParserXML));
        $reader = $command->query();
        foreach ($reader as $row) {
            foreach ($IReportParserXML->fields as $out) {
                $this->data[$this->m]["$out"] = $row["$out"];
            }
            $this->m++;
        }
    }

att

#6323 report it
renata at 2011/12/29 10:23am
Usando com o Oracle

Olá catataw,

Criei um relatório no IReport conectado com o oracle e fiz um simples select para exibir uns campos da tabela. Quando chamo o relatório no Yii ocorre o erro abaixo :

"General error: 24337 OCIStmtExecute: ORA-24337: handle de instrução não preparado"

O código da chamada:

$AReport = new IReport('report1.jrxml'); $AReport->execute();

Alguma idéia do que pode ser?

Obrigada.

#6318 report it
catataw at 2011/12/28 05:07pm
Usando com o Oracle

Ola Renata, praticamente o yii report ele usa a conecao do yii então se sua aplicação ja estiver conectando no oracle ele conseguira fazer os relatórios

att

#6317 report it
renata at 2011/12/28 02:21pm
Usando com o Oracle

Estou precisando usar o IReport com o Oracle, então gostaria de saber se essa classe funcionará? Caso não, se alguém tiver a classe adaptada para o Oracle seria possível me repassar e como seria sua chamada através do YII?

Obrigada.

#6043 report it
Bruno Piaui at 2011/12/07 10:45am
erros

Catataw, aguardando!!!!!!!!!!!!!!!! tem alguma previsão?

#6042 report it
catataw at 2011/12/07 10:39am
erros

brunopiaui at 2011/11/16 07:00am

Ola Bruno referente aos erros apontandos bem provavel seja configuracao do seu php, porem ja estou trabalhadno para que nao de estes erros indiferente da configuracao do php.

att

#5818 report it
Bruno Piaui at 2011/11/16 07:00am
lista de erros

falae catataw, obrigado pela atenção!! estou usando o seu demo como base de teste. criei a base com o mesmo nome do arquivo de configuração p/ não ter q mexer em nada do seu demo. baixei o "tcpdf" e coloquei no dentro do diretório "ireport\protected\extensions\ireport". no "Sample 1", "Sample 2" e "Sample 3" o erro é o mesmo: "Use of undefined constant positionType - assumed 'positionType'" o erro é no arquivo "IReportParser.php", linha 455. no "Sample 5" e "Sample 8" o erro é o mesmo: "Undefined index: gname" o erro é no arquivo "IReportParser.php", linha 703. no "Sample 6" o erro é: "Undefined variable: groupdate" o erro é no arquivo "IReportParser.php", linha 130. espero que com isso você consiga me dar uma luz... vlw

#5813 report it
catataw at 2011/11/15 05:04pm
não tá funcionando..

Ola Bruno me diga qual e o erro que esta dando, eu pretendo da uma nova mexida nela novamente ate o final do mes.

Leave a comment

Please to leave your comment.

Create extension