<?php
//require __DIR__."./../phpJasperXML_2.0.1/autoload.php";
require_once("./../phpJasperXML_2.0.1/autoload.php");

use simitsdk\phpjasperxml\PHPJasperXML;

$filename = __DIR__."/voucher.jrxml";

// read parameters
$id = $_SESSION['id'] ; 	// invoice identification to obtain

// Read record
$data = array();
$rs = DB::Query("

SELECT
	p.id, 

	p.placa, 

	v.VOLUMEN_TOTAL
	
	
	
	
FROM
	pro_participante AS p
	INNER JOIN
	placas_total AS v
	ON 
		p.placa = v.PLACA
		
where 	p.id	= $id
		
		


");
while( $row= $rs->fetchAssoc() )
{
$data[] = $row;
}
$config = [
    'driver'=>'array',
    'data'=> $data
];
$parameters = [];


$type = 'Pdf';
$fileOutput= '';
$creator = 'bi-softnet';
$author = 'xbi-softnet@gmail.com';
$title = 'Consumo';
$keywords = 'PHP';
$format_intl = 'es_ES';

// $temp_file = tempnam(sys_get_temp_dir(), 'pdf');  // Create file temporal
// $fileOutput = $temp_file;

$report = new PHPJasperXML();
$report->load_xml_file($filename)    
    ->setParameter($parameters)
    ->setDataSource($config)
    ->export($type,$fileOutput,$title,$creator,$author,$keywords,$format_intl);

?>
