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/
Update by #le_top ¶
You can get my update here: Updated ireport extension and you can also Try the updated demo
PHPJasperXML
Thanks for porting PHPJasperXML to Yii.
It seems to be a promising solution to combine TCPDF and a good (Java based) report designer to build a PHP reporting solution without the need to install the Jasper server. I have tried PHPJasperXML a year ago - it was really 'beta' - but worked for simple reports. Now I will test it again with your extension.
Please add some explanation and resource links about PHPJasperXML/TCPDF/iReport, because not everyone here knows about it.
And at least you should add links to the requirements:
how to use this using database
Hi,
Can you show me how to use this using database?
Thanks
how to use this using database
nemo It uses the compnent DB application, consultation should be made within the report.
Just this week I'll put an example of using
joblo This extension is based on PHPJasperXML simply did so portability to be used within the yii. Thanks for the tips
Teste com o ireportdemo.zip
Peguei o demo p/ testar e recebi o seguinte erro:
Use of undefined constant positionType - assumed 'positionType'
C:\xampp\htdocs\ireport\protected\extensions\ireport\IReportParser.php(455)
Coloquei o tcpdf dentro do diretório da extensão ireport e criei a base de dados de teste.
E aproveitando....Parabéns pelo trabalho!!!
Teste com o ireportdemo.zip
error when test ireportdemo
i have try the ireportdemo, and I get this error :
Fatal error: Cannot access protected property _TCPDF::$CurrentFont in D:\xampp\htdocs\ireport\protected\extensions\ireport\IReportRender.php on line 180
How to solve it?
error when test ireportdemo
darwin88
What version of TCPDF it ta you using?
error when test ireportdemo
I use Tcpdf 5.9.132
First, i try the ireportdemo and I got the error, but when I write code for my application, thats no error. I have try to create simple report with Yii db connection and is done, but..now the problem is the report couldnt show the column header band..
não tá funcionando..
catataw,
se der, tenta rever sua extensão pois nem o demo funciona...
preciso muuuuuuuuuuuito dela!!!!
gostaria de saber se tem alguma previsão p/ lançar uma correção ou nos dizer o q fazer p/ funcionar...
obrigado!!!!
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.
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
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
erros
Catataw,
aguardando!!!!!!!!!!!!!!!!
tem alguma previsão?
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.
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
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.
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
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;
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
This extension was based on PHPJasperXML ?
Does this extension depend on PHPJasperXML, or is it merely inspired by PHPJasperXML ?
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.
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
demo doesn't work
ireport demo doesn't work.
Undefined index: gname
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);
hyde82
tKS
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
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 :
~~~
[xml]
<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 ? ```php Undefined variable: Essai case "groupHeader": //$this->pointer = &$this->group[${$xml_path["name"]}]["groupHeader"]; $this->pointer = &$this->grouphead; ```
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.
Several issues
@le_top Hello Thank you for the corrections, this week already be making changes.
att
Passing parameters from PHP Application
Thank you for the extension,it is really working for me
Please can you help me pass parameters
Barcode
Alguien ha intentado imprimir un barcode? code128(A,B) o cualquiera de esta codificacion?
Logro que me imprima todo pero el barcode, no aparece...!!!
I have a problem with font.
I would like to display thai font by tahoma.ttf how to set other font.
I get error : tcpdf error could not include font definition file tahoma.ttf.
when I embed tahoma.ttf with ireport.
Partially working
After strugling to find an older version of tcpdf as the latest gave an error my report finally renders.
No title displayed, no chart, no report footer, column headers are not displayed on a new report, in demo they are.
Grouping gives errors.
Maybe I expect too much out of the box.
If anyone found fixes for this erros please share.
Laravel ireport
Hi everibody, in yii2 is posible use composer to download https://github.com/cossou/JasperPHP but the code is developed to be used in laravel, i wonder if somebaody could work with it and help to every body to use it in yii2.
Laravel ireport
Hello ja unfortunately not work more with PHP, I'm out of date (; sorry
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.