Nice lookin' reports

Reply

Hi, thanks
I removed the “!” and saved the file again. Just a doubt … Need I to compile it and save also the compiled file gartes.jasper into the z_ireport_class folder ?
I deleted echoes lines and I tried both with “I” and “D” .
Now I see the select command instead of parameter but always an empty page.

Attachment

irepo.jpg

No, you don’t need the .jasper file.
But… What version of the phpjasperxml class are you using?
I just downloaded the newest version, slapt it on the server and voila… empty page!
I don’t have the time to dig into it right now, but you should try to get an older version.
The 0.8c is working for sure. :slight_smile:

jsb

Yes I’m using the last one 0.9c .
I’m quite satisfied that the problem is there . At list we are facing the same mistake.

I’ve searched for that version but I can’t find it. Have a link or please send me a zip file to giovanni.chiozza@libero.it

SC pdf reporting make use fpdf to generate its pdf reports but the interface SC created does not know how to handle complex reports.

fpdf command is very straight forward and easy to use and it give you full control. Goto http://www.fpdf.org it will explain the commands and how to use it.

however, to use it you will need to add the fpdf library into SC. the library is found in SC installation NetMake -> v7 -> wwwroot -> scriptcase -> prod - third -> fpdf

Thanks very much and lot of complimentes to Jsb that has fixed all my problems !!!
After long pregnancy…today the first SC-IReport was borned !!! WOOOOOOOOWWWWW !!

I’m using version 0.9c, it’s WORK… very nice…:),

i have same proble

Warning: simplexml_load_file(): I/O warning : failed to load external entity “/scriptcase/app/AddAcc/report/prova.jrxml” in C:\Program Files (x86)\NetMake\v71\wwwroot\scriptcase\app\AddAcc\report\sample1.php on line 14 TCPDF ERROR: Some data has already been output, can’t send PDF file

which is the solution??

thnsk

Hi Marcov,
I do not remember exactly . For your help I paste here the index.php content and the button code that call the report

<?php
session_start();

include_once(‘class/tcpdf/tcpdf.php’);
include_once(‘class/PHPJasperXML.inc.php’);

$xml = simplexml_load_file($_SESSION[‘report’][‘xml_file’]); //variable for jrxml file
//$xml = simplexml_load_file("…/z_ireport_class/gartes.jrxml");

$PHPJasperXML = new PHPJasperXML();

//$PHPJasperXML->debugsql=true;

$PHPJasperXML->arrayParameter=array(‘pdf_query’=>$_SESSION[‘report’][‘pdf_query’]); //variable for sql statement
$PHPJasperXML->xml_dismantle($xml);

$PHPJasperXML->transferDBtoArray($_SESSION[‘report’][‘host’],
$_SESSION[‘report’][‘user’],
$_SESSION[‘report’][‘pass’],
$_SESSION[‘report’][‘db’]);
$PHPJasperXML->outpage(“I”); //page output method I:standard output Download file
?>

==============================

if(!isset($_SESSION[‘report’]))
{
$_SESSION[‘report’]=array(‘host’=>[sc_glo_servidor],‘user’=>[sc_glo_usuario],‘pass’=>sc_decode([sc_glo_senha]),
‘db’=>[sc_glo_banco],‘pdf_query’=>’’,‘xml_file’=>’’);
}

$pdf_query = ‘SELECT * FROM gartes’;
$xml_file=‘gartes.jrxml’;

//$_SESSION[‘report’][‘xml_file’]=$xml_file;
$_SESSION[‘report’][‘xml_file’]="…/z_ireport_class/".$xml_file;

$_SESSION[‘report’][‘pdf_query’]=$pdf_query;

sc_redir(…/z_ireport_class/index.php);

sono italiano lo sei anche tu?

ho sempre lo stesso errore

Warning: simplexml_load_file(): I/O warning : failed to load external entity “/scriptcase/app/AddAcc/report/prova.jrxml” in C:\Program Files (x86)\NetMake\v71\wwwroot\scriptcase\app\AddAcc\report\sample1.php on line 10 TCPDF ERROR: Some data has already been output, can’t send PDF file

very good examples. Already in productions but…
How about Subreports with phpjasperxml?
Anyone had success with that?
I’m getting crazy

Hi,
With the Phpjasperxml library, It seems many properties of elements in an ireport design cannot be apply when i export to pdf file. Eg: I set the ‘vertical alignment’ text property of my static text is ‘middle’ and preview it from ireport, it ok. But when i export to pdf nothing happen, the position of my static text not change.

That’s just one of the problems I encountered when outputting to PDF.
Add one more eg: I define a new style in ireport to make alternate row background colors like this:

<style name=“Zebra” mode=“Transparent”>
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#CAC5BB" fontName=“DejaVu Sans”/>
</conditionalStyle>
</style>

and then use this style for my report elements like this:

<reportElement uuid=“494661d9-f71e-461d-a23b-dbc22610c0cc” style=“Zebra” mode=“Opaque” x=“58” y=“0” width=“223” height=“25”/>

It work on ireport preview but not on my pdf output.

Can you suggest me a way to solve this problem? Thank you!

Hi giovannino ,

I try to intregate your solution, but I have always a blank result screen(debugsql=false) or sql query displayed (debugsql=true) !!!
I detail all my codes, maybe you will have an idea for what’s happen !!

NOT: sql query displayed is not the query in sc but the query in ireports document ???

Thanks in advance
Nac

Button code in sc :

$pdf_query=“SELECT
bnotes.BNCLEUNIK AS bnotes_BNCLEUNIK,
bnotes.MONTANT AS bnotes_MONTANT,
bnotes.CASH AS bnotes_CASH,
bnotes.NROOM AS bnotes_NROOM,
bnotes.NUMERO AS bnotes_NUMERO,
bnotes.GUESTNAME AS bnotes_GUESTNAME,
bnotes.DATEFIN AS bnotes_DATEFIN,
bnotes.DATEDEB AS bnotes_DATEDEB
FROM
bnotes bnotes
WHERE
bncleunik=’”.{bncleunik}."’";

$xml_file=“facvv.jrxml”;
sc_set_global($pdf_query);
sc_set_global($xml_file);

$_SESSION[‘report’][‘xml_file’]=$xml_file;

$_SESSION[‘report’][‘pdf_query’]=$pdf_query;

sc_redir(…/ireports/index.php);

INDEX.PHP codes in ireports directory :

<?php
session_start();

include_once(‘class/tcpdf/tcpdf.php’);
include_once(‘class/PHPJasperXML.inc.php’);

$xml = simplexml_load_file($_SESSION[‘report’][‘xml_file’]); //variable for jrxml file

$PHPJasperXML = new PHPJasperXML();

$PHPJasperXML->debugsql=true;

$PHPJasperXML->arrayParameter=array(‘pdf_query’=>$_SESSION[‘report’][‘pdf_query’]); //variable for sql statement
$PHPJasperXML->xml_dismantle($xml);

$PHPJasperXML->transferDBtoArray($_SESSION[‘report’][‘host’],
$_SESSION[‘report’][‘user’],
$_SESSION[‘report’][‘pass’],
$_SESSION[‘report’][‘db’]);
$PHPJasperXML->outpage(“D”); //page output method I:standard output Download file

?>

DIRECTORIES CONTENTS:

in my project directory, I have :

ireports directory
class sub-directory (containing PHPJasperXML-master class sub-directory)
index.php
facvv.jrxml

Hi,
please change your button code to:

if(!isset($_SESSION[‘report’]))
{
$_SESSION[‘report’]=array(‘host’=>[sc_glo_servidor],‘user’=>[sc_glo_usuario],‘pass’=>sc_decode([sc_glo_senha]),
‘db’=>[sc_glo_banco],‘pdf_query’=>’’,‘xml_file’=>’’);
}

$pdf_query=“SELECT
bnotes.BNCLEUNIK AS bnotes_BNCLEUNIK,
bnotes.MONTANT AS bnotes_MONTANT,
bnotes.CASH AS bnotes_CASH,
bnotes.NROOM AS bnotes_NROOM,
bnotes.NUMERO AS bnotes_NUMERO,
bnotes.GUESTNAME AS bnotes_GUESTNAME,
bnotes.DATEFIN AS bnotes_DATEFIN,
bnotes.DATEDEB AS bnotes_DATEDEB
FROM
bnotes bnotes
WHERE
bncleunik=’”.{bncleunik}."’";

$xml_file="…/ireports/facvv.jrxml";

$_SESSION[‘report’][‘xml_file’]=$xml_file;

$_SESSION[‘report’][‘pdf_query’]=$pdf_query;

sc_redir(…/ireports/index.php);

That should do it.
jsb

Hi jsb,

Thanks for answering but nothing changed !!! I’ve put an echo for global variables, they all contains right value.
I also put an echo in index.php, you see it on the attached pdf

I’m using version 0.9b

Thanks
Nac

this the code :

if(!isset($_SESSION[‘report’]))
{
$_SESSION[‘report’]=array(‘host’=>[sc_glo_servidor],‘user’=>[sc_glo_usuario],‘pass’=>sc_decode([sc_glo_senha]),
‘db’=>[sc_glo_banco],‘pdf_query’=>’’,‘xml_file’=>’’);
}

$pdf_query=“SELECT
bnotes.BNCLEUNIK AS bnotes_BNCLEUNIK,
bnotes.MONTANT AS bnotes_MONTANT,
bnotes.CASH AS bnotes_CASH,
bnotes.NROOM AS bnotes_NROOM,
bnotes.NUMERO AS bnotes_NUMERO,
bnotes.GUESTNAME AS bnotes_GUESTNAME,
bnotes.DATEFIN AS bnotes_DATEFIN,
bnotes.DATEDEB AS bnotes_DATEDEB
FROM
bnotes bnotes
WHERE
bncleunik=’”.{bncleunik}."’";

$xml_file="…/ireports/facvv.jrxml";

$_SESSION[‘report’][‘xml_file’]=$xml_file;

$_SESSION[‘report’][‘pdf_query’]=$pdf_query;

sc_redir(…/ireports/index.php);

indexscreen.jpg

Did you change your sql-statement in iReport to $P{pdf_query}?

I think version 0.9b might have been a little buggy.
Rohmad in post #46 successfully is using vesion 0.9c, so probably a newer version would work.

jsb

Hi jsb

Yes, I forgot $p{query} : thanks…

I downloaded last version 0.9d ( cannot find 0.9c) but same result ??? What can be wrong !!!

I copied “Class” directory containing in PHPjasperXml map, into my “ireports” directory in my project map.

Do I need to do something else with PHPjasperxml ??

Thanks !!!
Nac

Your parameter in iReport has to be $P{pdf_query}.
The class folder is all you need.
Try to create a very basic pdf. Maybe just one field no formatting, just plain text.

jsb

YEEEEEEEEESSSSSSSSS !!!

In ireport , I created a blank A4 put $P{pdf_query} in query section. Add a field, give the name of a field from my SC query and it’s work !!!

Now, we’ll see what are the limitations … I 'll write what I found later…
Thanks a lot Jsb for this great help !!!

Just a question when I deploy my application, I receive an error message : sc_glo_servidor … variables not found
But, when I run it in test , works fine !!
Do I need to do somethings special for my those variables ???

Best regards
Nac

Glad you got it working.
In Application -> Global Variables set the sc_glo-variables to ‘Out’.

jsb

Hi jsb

Thanks, everything works now !!!

Here is an little invoice example made with ireport-sc

Best regards
Nac

facvv.jpg