public function getConexion()
 {
     /*
      * si no indica los datos de la conexión el 
      * reporte saldrá en blanco
      * */
     return PJRUConexion::get('mysql', 'localhost', '', 'producto', 'admin', 'admin');
 }
 public function getConexion()
 {
     return PJRUConexion::get('xml://productos.xml');
 }
 public function getConexion()
 {
     return PJRUConexion::get('excel://municipios.xls');
 }
Example #4
0
 /**
  * ejecuta un reporte que se haya cargado como una extension
  * 
  * @param string $extensionName nombre de la extension que va a generar el reporte
  * @param string $type tipo de reporte a generar (pdf, odt, html)
  * @return string 
  * 	nombre de la exension o false si no se genera el reporte
  * */
 public function RunToFile($extensionName, $type)
 {
     $extension = null;
     if (!$this->extensionFolder) {
         $this->extensionFolder = realpath('.') . '/';
     }
     if (!$this->reportOutDir) {
         $this->reportOutDir = $this->extensionFolder;
     }
     if (!$this->inExtension($extensionName)) {
         $extension = ExtensionManager::loadExtension($extensionName, $this->extensionFolder, $this->typeExtension);
         if ($extension) {
             $this->addExtension($extension);
         } else {
             return false;
         }
     }
     //instancia el reporte
     $report = new PJRU();
     $conn = $extension->getConexion();
     if (!$conn) {
         $conn = PJRUConexion::get();
     }
     $reportName = uniqid() . '.' . $type;
     $sqlSentence = $extension->getSqlSentence();
     $outfilename = $this->reportOutDir . $reportName;
     if ($extension->beforeRun() === false) {
         return false;
     }
     $parameters = $extension->getParam();
     if ($sqlSentence) {
         $methodName = 'run' . ucfirst($type) . 'FromSql';
         $reportFileName = $extension->reportFileName . '.jrxml';
     } else {
         $methodName = 'runReportTo' . ucfirst($type) . 'File';
         $reportFileName = $extension->reportFileName . '.jasper';
     }
     if (get_class($conn) == 'JdbcConnection') {
         $conn = $conn->getConnection();
     }
     $result = $report->{$methodName}(realpath($this->extensionFolder) . '/' . $reportFileName, $outfilename, $parameters, $sqlSentence, $conn);
     $extension->afterRun($outfilename);
     if ($result) {
         return $outfilename;
     } else {
         return false;
     }
 }