Pengaturan

Gambar

Lainnya

Tentang KASKUS

Pusat Bantuan

Hubungi Kami

KASKUS Plus

© 2024 KASKUS, PT Darta Media Indonesia. All rights reserved

okzfaruoqiAvatar border
TS
okzfaruoqi
Zend Framework Lounge
Zend Framework
Quote:


Rule in here
:

Spoiler for "Rule":


Quote:


e book Zend Framework yang ane punya:

Quote:



tambahan lagi video tutorial integrasi ZF ma netbeans gan,jdi editornya netbeans :
Quote:




Quote:


download Zend Framework :
Quote:




Langkah Langkah menguasai Zend Framework :
Quote:


Quote:




Index Tutorial


Quote:


Quote:



regards...
*nb : tolong rate ya gan biar tambah awet ne lapak ...

emoticon-thumbsup

*thanks juga yg udh ngasih ijo ... emoticon-thumbsupemoticon-Big Grin


Zend Framework Lounge
0
47.4K
1.1K
GuestAvatar border
Komentar yang asik ya
Tampilkan semua post
PusHm0vAvatar border
PusHm0v
#143
Make Jasper Report dengan Zend Framework - 2
Seringkali kita make report entah dari Jasper ato Crystal Report selalu memakai database sebagai datasource na, tapi kemarin ane ada kasus ingin membuat report dimana Array sebagai datasource na...

ane akuin dokumentasi soal Jasper dengan PHPJavaBridge langka banget, kalopun ada biasana untuk Java ajah... kebetulan kemarin setelah googling2 nemu cara gimana kita make Array buat datasource ke report jasper emoticon-Smilie

PHP Code:

private 
function getReportNoDataSource($type='pdf',$data,$params,$filename='report.jrmxl',$outputname='report&#039/;)/
   
{
    
try
    
{
    
$ds = new java("net.sf.jasperreports.engine.data.JRBeanCollectionDataSource",$data); //Panggil class BeanCollectionDataSource untuk array/collection datasource
$arrayParam $this->getParam($params);
$compileManager = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
$report $compileManager->compileReport($this->reportPath $filename);

$fillManager 
= new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
$jasperPrint $fillManager->fillReport($report$arrayParam,$ds);

$outputPath 
=$this->reportPath $outputname . '.' . $type;

set_time_limit
(120); 
 
        
java_set_file_encoding("ISO-8859-1"); 
 
if ($type == 'pdf&#039/;)/
 
{
        $exporter = new java("net.sf.jasperreports.engine.export.JRPdfExporter"); 
        $exParm java("net.sf.jasperreports.engine.JRExporterParameter"); 
        $exporter->setParameter($exParm->JASPER_PRINT$jasperPrint); 
        $exporter->setParameter($exParm->OUTPUT_STREAM$this->javaOutputStream); 
        $exporter->exportReport(); 
 
        header
('Content-Type: application/pdf&#039/;)/; 
        header('Content-Transfer-Encoding: binary&#039/;)/; 
        header('Content-disposition: attachment; filename="'.$outputname.'.pdf"&#039/;)/; 
        header('Pragma: no-cache&#039/;)/; 
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0&#039/;)/; 
        header('Expires: 0&#039/;)/; 
 
        
echo java_cast($this->javaOutputStream->toByteArray(),"S"); 

 
}
 
elseif ($type == 'xls&#039/;)/
 
{
 
$exporter = new java("net.sf.jasperreports.engine.export.JExcelApiExporter"); 
        $exParm java("net.sf.jasperreports.engine.JRExporterParameter"); 
        $exXlsParm java("net.sf.jasperreports.engine.export.JRXlsExporterParameter");
        $exporter->setParameter($exParm->JASPER_PRINT$jasperPrint); 
        $exporter->setParameter($exParm->OUTPUT_STREAM$this->javaOutputStream); 
        $exporter->setParameter($exXlsParm->IS_ONE_PAGE_PER_SHEETfalse);
        $exporter->setParameter($exXlsParm->IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWStrue);
        $exporter->setParameter($exXlsParm->IS_DETECT_CELL_TYPEtrue);
        $exporter->setParameter($exXlsParm->IS_WHITE_PAGE_BACKGROUNDfalse);
        $exporter->exportReport(); 
 
        header
('Content-Type: application/xls&#039/;)/; 
        header('Content-Transfer-Encoding: binary&#039/;)/; 
        header('Content-disposition: attachment; filename="'.$outputname.'.xls"&#039/;)/; 
        header('Pragma: no-cache&#039/;)/; 
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0&#039/;)/; 
        header('Expires: 0&#039/;)/; 
 
  
       echo java_cast($this->javaOutputStream->toByteArray(),"S"); 
 
}
    
}
    
catchJavaException $e)
    
{
echo $e;
}
    



sehingga kita bisa panggil seperti ini :

PHP Code:

public function cetakreportarrayAction()
{

     $this
->_helper->viewRenderer->setNoRender();
$data = new Java("java.util.ArrayList"); //Bikin array list

        
$result $this->myModel->fetchAll("MY_CONDITION=MY_VALUE")->toArray();
       
        foreach(
$result as $key => $val)
        {
        $data->add(array(
         'field1' => $val['value1'],
         'field2' => $val['value2'],
)); //tambah data ke array list
        
}
$type == 'pdf';

    
$params = array('param1'  => 'parameter1&#039/;)/);
$this->getReportNoDataSource($type,$data,$params,'array.jrxml','Array Report&#039/;)/;



CMIIW emoticon-Big Grinemoticon-Big Grin
0