这是我与Jasper Reports一起使用Laravel的新手,我不知道发生了什么......我认为我需要使用ReportController给出的参数进行查询。我的申请......报告已经下载但没有数据。
有我的代码我有一些疑问,如果我的方法的参数化发布好了
public function post()
{
$idVersion = session('id_version');
$database = \Config::get('database.connections.mysql');
$output = public_path() . '/reportes/'.time().'resumen';
$ext = "pdf";
\JasperPHP::process(
public_path() . '/reportes/resumen.jasper',
$output,
array($ext),
array('idVersion' => $idVersion ),
$database,
false,
false
)->execute();
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.time().'_reportes.'.$ext);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($output.'.'.$ext));
flush();
readfile($output.'.'.$ext);
unlink($output.'.'.$ext); // deletes the temporary file
return Redirect::to('/reporting');
}
在我的.jrxml报告的来源中,我有:
<parameter name="idVersion" class="java.lang.Integer">
<parameterDescription><![CDATA[idVersion]]></parameterDescription>
</parameter>
<queryString>
<![CDATA[SELECT * FROM c9.version_resumens WHERE c9.version_resumens.`ID_VERSION` = $P{idVersion}]]>
</queryString>
如果有人帮助我,我会很有帮助