Jump to content
We've recently updated our Privacy Statement, available here ×

Report generation interval of dates in iRepor and PHP


ptm1236

Recommended Posts

Hello!

Doubt iReport (5.6.0) and PHP (5.3.5)
Report generation interval of dates:

--------
In iReport, SQL,
Field: cpagar.`dtvenc` -> java.sql.Date
parameters: date1 and date2 -> java.util.Date

...Where - >  cpagar.`dtvenc` between $P{data1} and $P{data2}

In IReport the report is generated normally.

In PHP does not work. See PHP code below.
Any tips?
Thanks

<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
include_once('../class/tcpdf/tcpdf.php');
include_once("../class/PHPJasperXML.inc.php");
include_once ('../class/setting.php');

//
$xml =  simplexml_load_file("relCPagar01.jrxml");
$PHPJasperXML = new PHPJasperXML();
//$PHPJasperXML->debugsql=false;

// receives the dates as parameters in string
$data1=$_GET["data1"];
$data2=$_GET["data2"];

// convert to format MySQl (yyyy-mm-dd)
$WD1 = implode("-",array_reverse(explode("/",$data1)));
$WD2 = implode("-",array_reverse(explode("/",$data2)));


// passes the parameters with formatted date MYSQL
$PHPJasperXML->arrayParameter=array("data1"=>$WD1);
$PHPJasperXML->arrayParameter=array("data2"=>$WD2);

//
$PHPJasperXML->xml_dismantle($xml);
$PHPJasperXML->transferDBtoArray($server,$user,$pass,$db);
$PHPJasperXML->outpage("I");    //page output method I:standard output  D:Download file

?>

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...