Exemplo n.º 1
0
 private function downloadReports()
 {
     $resAjax = new Response_Ajax();
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     $this->library_jasperstarter->dbGeneric('org.firebirdsql.jdbc.FBDriver', 'jdbc:firebirdsql://localhost:3050/C:\\FireBird\\FTT\\DIGIFORTDB.FDB', 'SYSDBA', 'masterkey');
     //$MY =& MY_Controller::get_instance();
     $date_begin = $this->input->post('date_begin');
     $date_end = $this->input->post('date_end');
     $rpte_tipo = $this->input->post('rpte_tipo');
     $rpte_grupo = $this->input->post('rpte_grupo');
     try {
         $condicion = ' AND 1=1 ';
         if ($rpte_tipo == 'RPTE_CAMARAS_GENERAL') {
             $path_file_jasper = BASEPATH . "../application/reports/camaras_general/report.jasper";
             $file_name_download = "CAMARA_EN_GENERAL";
             $file_name_output = 'camaras_general_' . uniqid();
         } else {
             if ($rpte_tipo == 'RPTE_GRUPOS_CAMARAS') {
                 $path_file_jasper = BASEPATH . "../application/reports/grupos_general/rpte_grupos_general.jasper";
                 $file_name_download = "CAMARA_EN_GENERAL";
                 $file_name_output = 'camaras_general_' . uniqid();
                 //$condicion.=' AND 1=1';
                 foreach ($rpte_grupo as $key => $value) {
                     $condicion .= "AND ( GRUPO_CAMARA = '" . $value . "' )";
                 }
             } else {
                 throw new Exception('ERROR DE EJECCIÓN<br/> COMANDO: Tipo de reporte no encontrado');
             }
         }
         $arrParameter = array('fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'condicion' => $condicion);
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, 'xls');
         if (!$oReport->isSuccess()) {
             throw new Exception('ERROR DE EJECCIÓN<br/> COMANDO: ' . $oReport->cmd());
         }
         //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
         //force_download($file_name_output, $data);
         $mime = get_mime_by_extension($oReport->fileExtension());
         //$mime = "application/pdf";
         ob_clean();
         header("Content-Type: application/force-download");
         //header("Content-Disposition: attachment; filename=$file_name_download.xls");
         header("Content-Transfer-Encoding: binary");
         //header("Content-Length: " . $size);
         header("Content-disposition: attachment; filename={$file_name_download}.xls");
         header("Content-type: {$mime}");
         readfile($oReport->filePath());
     } catch (Exception $err) {
         echo $err->getMessage();
     }
     //echo $resAjax->toJsonEncode();
 }
 public static function buildReport($name_file_jasper, $arrParameter = array(), $type_report = 'pdf')
 {
     $MY =& MY_Controller::get_instance();
     $java = Helper_Config::getBinaryJava();
     $path_jasper_starter = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'third_party' . DIRECTORY_SEPARATOR . 'jasperstarter' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'jasperstarter.jar';
     $report_jasper = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'application' . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR . $name_file_jasper . ".jasper";
     $nombre_temp = preg_split("/[\\/]+/", $name_file_jasper);
     $nombre_jasper = $nombre_temp[sizeof($nombre_temp) - 1];
     //Helper_Log::write($nombre_jasper);
     $file_output = BASEPATH . '..' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . ($nombre_jasper . microtime(true));
     //$db_host = $MY->db->hostname;
     $db_host = preg_split('/:/', $MY->db->hostname);
     $db_host = $db_host[0];
     $db_name = $MY->db->database;
     $db_user = $MY->db->username;
     $db_pass = $MY->db->password;
     $db_port = $MY->db->port;
     // ------------------------------------------------------
     // DEFAULT, deben tener todos los reportes --------------
     // ------------------------------------------------------
     $arrParameter['ci_root_path'] = BASEPATH . '../';
     // ------------------------------------------------------
     // ------------------------------------------------------
     $str_parametros = '';
     if (!empty($arrParameter)) {
         foreach ($arrParameter as $parameter => $value) {
             $str_parametros .= (empty($str_parametros) ? '' : ' ') . "{$parameter}=\"{$value}\"";
         }
     }
     if (!empty($db_pass)) {
         $db_pass = "******";
     }
     if (!empty($str_parametros)) {
         $str_parametros = "-P {$str_parametros}";
     }
     $cmd = "\"{$java}\" -Djava.awt.headless=true -jar  {$path_jasper_starter} pr {$report_jasper} -t mysql -u {$db_user} -f {$type_report} -H {$db_host} --db-port {$db_port} -n {$db_name} -o {$file_output} {$db_pass} {$str_parametros}";
     Helper_Log::write($cmd);
     exec($cmd, $output, $err);
     if (!empty($err)) {
         echo "Error de envio: {$cmd}";
         return NULL;
     }
     return $file_output . '.' . $type_report;
 }
Exemplo n.º 3
0
 public function printReport($date_begin, $date_end, $tipo_rpte, $rpte_grupo)
 {
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     $firebird_ftt = Helper_Config::getJasperStarterFirebirdTT();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     $this->library_jasperstarter->dbGeneric($firebird_ftt['db-driver'], $firebird_ftt['db-url'], $firebird_ftt['dbuser'], $firebird_ftt['dbpasswd']);
     $condicion = ' AND 1=1 ';
     $isSuccess = FALSE;
     if ($tipo_rpte == 'RPTE_CAMARAS_GENERAL') {
         $path_file_jasper = BASEPATH . "../application/reports/camaras_general/rpte_camara_general.jasper";
         $file_name_download = "CAMARA_EN_GENERAL";
         $file_name_output = 'camaras_general_' . uniqid();
         $condicion .= ' AND 1=1 ';
         $isSuccess = TRUE;
     } else {
         if ($tipo_rpte == 'RPTE_GRUPOS_CAMARAS') {
             $path_file_jasper = BASEPATH . "../application/reports/grupos_general/rpte_grupos_general.jasper";
             $file_name_download = "GRUPO_DE_CAMARA";
             $file_name_output = 'grupo_camara_' . uniqid();
             $rpte_grupo = explode("-", $rpte_grupo);
             $condicion_aux = null;
             foreach ($rpte_grupo as $key => $value) {
                 if ($value == '1') {
                     $condicion_aux .= " A2.ID_GRUPO_CAMARA = '1' OR " . "A2.ID_GRUPO_CAMARA = '2' OR " . "A2.ID_GRUPO_CAMARA = '3' OR " . "A2.ID_GRUPO_CAMARA = '4' OR " . "A2.ID_GRUPO_CAMARA = '5' OR " . "A2.ID_GRUPO_CAMARA = '6' OR ";
                 } elseif ($value == '2') {
                     $condicion_aux .= " A2.ID_GRUPO_CAMARA = '9' OR " . "A2.ID_GRUPO_CAMARA = '12' OR " . "A2.ID_GRUPO_CAMARA = '15' OR ";
                 } elseif ($value == '3') {
                     $condicion_aux .= " A2.ID_GRUPO_CAMARA = '7' OR ";
                 } elseif ($value == '4') {
                     $condicion_aux .= " A2.ID_GRUPO_CAMARA = '8' OR " . "A2.ID_GRUPO_CAMARA = '10' OR " . "A2.ID_GRUPO_CAMARA = '11' OR " . "A2.ID_GRUPO_CAMARA = '14' OR ";
                 } elseif ($value == '5') {
                     $condicion_aux .= " A2.ID_GRUPO_CAMARA = '13' OR " . "A2.ID_GRUPO_CAMARA = '16' OR ";
                 }
             }
             $condicion .= is_null($condicion_aux) ? "AND 1=1" : "AND ( " . $condicion_aux . " 1!=1 )";
             $isSuccess = TRUE;
         } else {
             if ($tipo_rpte == 'RPTE_RESUMEN_CAMARAS_GENERAL') {
                 $path_file_jasper = BASEPATH . "../application/reports/resumen_camras_general/rpte_resumen_camara_general.jasper";
                 $file_name_download = "RESUMEN_CAMARA_EN_GENERAL";
                 $file_name_output = 'resumen_camaras_general_' . uniqid();
                 $condicion .= ' AND 1=1 ';
                 $isSuccess = TRUE;
             }
         }
     }
     $arrParameter = array('fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'condicion' => $condicion);
     if ($isSuccess) {
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, 'xls');
         if ($oReport->isSuccess()) {
             //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
             //force_download($file_name_output, $data);
             $mime = get_mime_by_extension($oReport->fileExtension());
             //$mime = "application/pdf";
             ob_clean();
             header("Content-disposition: attachment; filename={$file_name_download}.xls");
             header("Content-type: {$mime}");
             readfile($oReport->filePath());
         } else {
             header('Content-Type: text/html; charset=utf-8');
             echo "ERROR DE EJECCIÓN<br/>";
             echo "COMANDO: " . $oReport->cmd();
         }
     } else {
         header('Content-Type: text/html; charset=utf-8');
         echo "ERROR DE EJECCIÓN<br/>";
         echo "TIPO DE REPORTE: " . $tipo_rpte;
     }
 }
 public function printReport($tipo_informacion, $tipo_sub_informacion, $year, $month, $day, $day_week, $area, $tipo_descarga = NULL)
 {
     if (empty($tipo_descarga)) {
         $tipo_descarga = 'xlsx';
     }
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     $postgres_ftt = Helper_Config::getJasperStarterPostgresTT();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     $this->library_jasperstarter->dbGeneric($postgres_ftt['db-driver'], $postgres_ftt['db-url'], $postgres_ftt['dbuser'], $postgres_ftt['dbpasswd']);
     $isSuccess = FALSE;
     $ci_root_path = BASEPATH . '../';
     $CI_ROOT_PATH_REPORT = $ci_root_path . "/application/reports/";
     $titulo = NULL;
     $name_tabla = NULL;
     $by_where = NULL;
     $case_group_camera = NULL;
     if ($tipo_informacion == 'INFORMATION_BY_DAY') {
         $path_file_jasper = $CI_ROOT_PATH_REPORT . 'panel_control/by_day/rpte_dynamic_by_day';
         $file_name_download = 'BY_DAY_' . $tipo_sub_informacion . uniqid();
         $file_name_output = strtolower('BY_DAY_' . $tipo_sub_informacion . uniqid());
         $date_begin = $year . '-' . $month . '-01';
         $date_end = $year . '-' . $month . '-' . Helper_Fecha::getLastDay_By_YearMonth($year, $month, TRUE);
         if ($area == 'ACCESOS_GENERALES') {
             $titulo = 'Accesos Generales';
             $name_tabla = 'access_terminal';
             $case_group_camera = "CASE " . "WHEN t_d.id_group_camera = '1' THEN " . "'Puerta 1' " . "WHEN t_d.id_group_camera = '2' THEN " . "'Puerta 2' " . "WHEN t_d.id_group_camera = '3' THEN " . "'Puerta 3' " . "ELSE " . "'NO FOUND' " . "END";
             $by_where = " AND t_d.id_group_camera BETWEEN '1' AND '3'";
         } elseif ($area == 'ARRIBO_PASAJEROS') {
             $titulo = 'Arribo de Pasajeros';
             $name_tabla = 'access_terminal';
             $case_group_camera = "CASE " . "WHEN t_d.id_group_camera = '4' THEN " . "'Puerta A' " . "WHEN t_d.id_group_camera = '5' THEN " . "'Puerta B' " . "WHEN t_d.id_group_camera = '6' THEN " . "'Puerta C' " . "ELSE " . "'NO FOUND' " . "END";
             $by_where = " AND t_d.id_group_camera BETWEEN '4' AND '6'";
         } elseif ($area == 'TORNIQUETES') {
             $path_file_jasper = $CI_ROOT_PATH_REPORT . 'panel_control/by_day/rpte_toniquete_by_day';
             $titulo = 'Torniquetes';
             $name_tabla = 'torniquete';
         } elseif ($area == 'ESCALERAS_ELECTRICAS') {
             $titulo = 'Escaleras Electricas';
             $name_tabla = 'escalera_and_ascensor';
         } elseif ($area == 'ASCENSORES') {
             $titulo = 'Ascensores';
             $name_tabla = 'escalera_and_ascensor';
         } elseif ($area == 'PATIO_COMIDAS') {
             $titulo = 'Patio de Comidas';
             $name_tabla = 'patios_comida';
         } elseif ($area == 'BANIOS') {
             $titulo = 'Baños';
             $name_tabla = 'banio';
         }
         $isSuccess = TRUE;
     } else {
         if ($tipo_informacion == 'INFORMATION_BY_HOUR') {
             $path_file_jasper = $CI_ROOT_PATH_REPORT . 'panel_control/by_hour/' . strtolower($tipo_sub_informacion) . '/';
             $file_name_download = 'BY_HOUR_' . $tipo_sub_informacion . uniqid();
             $file_name_output = strtolower('BY_HOUR_' . $tipo_sub_informacion . uniqid());
         }
     }
     $arrParameter = array('titulo' => $titulo, 'name_table' => $name_tabla, 'case_group_camera' => $case_group_camera, 'by_where' => $by_where, 'fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'ci_root_path' => $ci_root_path);
     if ($isSuccess) {
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, $tipo_descarga);
         if ($oReport->isSuccess()) {
             //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
             //force_download($file_name_output, $data);
             $mime = get_mime_by_extension($oReport->fileExtension());
             //$mime = "application/pdf";
             ob_clean();
             header("Content-disposition: attachment; filename={$file_name_download}.{$tipo_descarga}");
             header("Content-type: {$mime}");
             readfile($oReport->filePath());
         } else {
             header('Content-Type: text/html; charset=utf-8');
             echo "ERROR DE EJECCIÓN<br/>";
             echo "COMANDO: " . $oReport->cmd();
         }
     } else {
         header('Content-Type: text/html; charset=utf-8');
         echo "ERROR DE EJECCIÓN<br/>";
         echo "TIPO DE REPORTE: " . $area;
     }
 }
 public function printReport($date_begin, $date_end, $tipo_rpte, $tipo_descarga = NULL)
 {
     if (empty($tipo_descarga)) {
         $tipo_descarga = 'xlsx';
     }
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     //$firebird_ftt = Helper_Config::getJasperStarterFirebirdTT();
     $postgres_ftt = Helper_Config::getJasperStarterPostgresTT();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     //$this->library_jasperstarter->dbGeneric( $firebird_ftt['db-driver'], $firebird_ftt['db-url'], $firebird_ftt['dbuser'], $firebird_ftt['dbpasswd']);
     $this->library_jasperstarter->dbGeneric($postgres_ftt['db-driver'], $postgres_ftt['db-url'], $postgres_ftt['dbuser'], $postgres_ftt['dbpasswd']);
     $condicion = ' AND 1=1 ';
     $isSuccess = FALSE;
     if ($tipo_rpte == 'RPTE_CAMARAS_GENERAL') {
         $path_file_jasper = BASEPATH . "../application/reports/camera_general/rpte_camera_general.jasper";
         $file_name_download = "CAMARA_EN_GENERAL_" . uniqid();
         $file_name_output = 'camaras_general_' . uniqid();
         $isSuccess = TRUE;
     } else {
         if ($tipo_rpte == 'RPTE_ACCESS_TERMINAL') {
             $path_file_jasper = BASEPATH . "../application/reports/acceso_terminal/rpte_access_terminal.jasper";
             $file_name_download = "ACCESO_TERMINAL" . uniqid();
             $file_name_output = 'acceso_terminal_' . uniqid();
             $isSuccess = TRUE;
         } else {
             if ($tipo_rpte == 'RPTE_BANIOS') {
                 $path_file_jasper = BASEPATH . "../application/reports/banios/rpte_banios.jasper";
                 $file_name_download = "BAÑOS" . uniqid();
                 $file_name_output = 'baños_' . uniqid();
                 $isSuccess = TRUE;
             } else {
                 if ($tipo_rpte == 'RPTE_PATIO_COMIDA') {
                     $path_file_jasper = BASEPATH . "../application/reports/patio_comida/rpte_patio_comida.jasper";
                     $file_name_download = "PATIOS_DE_COMIDAS" . uniqid();
                     $file_name_output = 'patios_de_comidas_' . uniqid();
                     $isSuccess = TRUE;
                 } else {
                     if ($tipo_rpte == 'RPTE_ESCALERA_ASCENSOR') {
                         $path_file_jasper = BASEPATH . "../application/reports/escalera_ascensor/rpte_escalera_ascensor.jasper";
                         $file_name_download = "ESCALERAS_ASCENSORES" . uniqid();
                         $file_name_output = 'escaleras_ascensores_' . uniqid();
                         $isSuccess = TRUE;
                     } else {
                         if ($tipo_rpte == 'RPTE_TORNIQUETE') {
                             $path_file_jasper = BASEPATH . "../application/reports/torniquetes/rpte_torniquetes.jasper";
                             $file_name_download = "TORNIQUETES" . uniqid();
                             $file_name_output = 'torniquetes_' . uniqid();
                             $isSuccess = TRUE;
                         }
                     }
                 }
             }
         }
     }
     $arrParameter = array('fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'condicion' => $condicion, 'ci_root_path' => BASEPATH . '../');
     if ($isSuccess) {
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, $tipo_descarga);
         if ($oReport->isSuccess()) {
             //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
             //force_download($file_name_output, $data);
             $mime = get_mime_by_extension($oReport->fileExtension());
             //$mime = "application/pdf";
             ob_clean();
             header("Content-disposition: attachment; filename={$file_name_download}.{$tipo_descarga}");
             header("Content-type: {$mime}");
             readfile($oReport->filePath());
         } else {
             header('Content-Type: text/html; charset=utf-8');
             echo "ERROR DE EJECCIÓN<br/>";
             echo "COMANDO: " . $oReport->cmd();
         }
     } else {
         header('Content-Type: text/html; charset=utf-8');
         echo "ERROR DE EJECCIÓN<br/>";
         echo "TIPO DE REPORTE: " . $tipo_rpte;
     }
 }
 public function printReport($date_begin, $date_end, $tipo_rpte, $rpte_grupo, $tipo_descarga = NULL)
 {
     if (empty($tipo_descarga)) {
         $tipo_descarga = 'xlsx';
     }
     $this->load->library('library_jasperstarter');
     $java_bin = Helper_Config::getBinaryJava();
     //$firebird_ftt = Helper_Config::getJasperStarterFirebirdTT();
     $postgres_ftt = Helper_Config::getJasperStarterPostgresTT();
     $this->library_jasperstarter->setPathFolderOutput(BASEPATH . '../application/temp');
     $this->library_jasperstarter->setPathJavaBin($java_bin);
     //$this->library_jasperstarter->dbGeneric( $firebird_ftt['db-driver'], $firebird_ftt['db-url'], $firebird_ftt['dbuser'], $firebird_ftt['dbpasswd']);
     $this->library_jasperstarter->dbGeneric($postgres_ftt['db-driver'], $postgres_ftt['db-url'], $postgres_ftt['dbuser'], $postgres_ftt['dbpasswd']);
     $condicion = ' AND 1=1 ';
     $isSuccess = FALSE;
     if ($tipo_rpte == 'RPTE_RESUMEN_CAMARAS_GENERAL') {
         $path_file_jasper = BASEPATH . "../application/reports/resumen_camras_general/rpte_resumen_camara_general.jasper";
         $file_name_download = "RESUMEN_CAMARA_EN_GENERAL_" . uniqid();
         $file_name_output = 'resumen_camaras_general_' . uniqid();
         $condicion .= ' AND 1=1 ';
         $isSuccess = TRUE;
     } else {
         if ($tipo_rpte == 'RPTE_RESUMEN_GRUPOS_CAMARAS') {
             if ($rpte_grupo == '1') {
                 $path_file_jasper = BASEPATH . "../application/reports/accesos_generales/rpte_accesos_generales.jasper";
                 $file_name_download = "RESUMEN_ACCESOS_GENERALES_" . uniqid();
                 $file_name_output = 'resumen_accesos_generales_' . uniqid();
             } elseif ($rpte_grupo == '2') {
                 $path_file_jasper = BASEPATH . "../application/reports/viajeros_arriban/rpte_viajeros_arriban.jasper";
                 $file_name_download = "RESUMEN_VIAJEROS_ARRIBAN_" . uniqid();
                 $file_name_output = 'resumen_viajeros_arriban_' . uniqid();
             } elseif ($rpte_grupo == '3') {
                 $array = explode("-", $date_begin);
                 $year = $array[0];
                 $month = $array[1];
                 $date_begin = $date_begin . '-01';
                 $date_end = $date_end . '-' . Helper_Fecha::getLastDay_By_YearMonth($year, $month);
                 $path_file_jasper = BASEPATH . "../application/reports/corredores/rpte_corredores.jasper";
                 $file_name_download = "RESUMEN_CORREDORES_" . uniqid();
                 $file_name_output = 'resumen_corredores_' . uniqid();
             } elseif ($rpte_grupo == '4') {
                 $path_file_jasper = BASEPATH . "../application/reports/escaleras_electricas/rpte_escalera_electrica.jasper";
                 $file_name_download = "RESUMEN_ESCALERAS_ELECTRICAS_" . uniqid();
                 $file_name_output = 'resumen_escaleras_electricas_' . uniqid();
             } elseif ($rpte_grupo == '5') {
                 $path_file_jasper = BASEPATH . "../application/reports/ascensores/rpte_ascensores.jasper";
                 $file_name_download = "RESUMEN_ASCENSORES_" . uniqid();
                 $file_name_output = 'resumen_ascensores_' . uniqid();
             } elseif ($rpte_grupo == '6') {
                 $path_file_jasper = BASEPATH . "../application/reports/resumen_patio_comida/rpte_patio_comida.jasper";
                 $file_name_download = "RESUMEN_PATIO_COMIDA_" . uniqid();
                 $file_name_output = 'resumen_patio_comida_' . uniqid();
             } elseif ($rpte_grupo == '7') {
                 $path_file_jasper = BASEPATH . "../application/reports/resumen_banios/rpte_banios.jasper";
                 $file_name_download = "RESUMEN_BAÑOS_" . uniqid();
                 $file_name_output = 'resumen_baños_' . uniqid();
             } elseif ($rpte_grupo == '8') {
                 $path_file_jasper = BASEPATH . "../application/reports/resumen_torniquetes/rpte_resumen_torniquetes.jasper";
                 $file_name_download = "RESUMEN_TORNIQUETES_" . uniqid();
                 $file_name_output = 'resumen_torniquetes_' . uniqid();
             } elseif ($rpte_grupo == '9') {
                 $path_file_jasper = BASEPATH . "../application/reports/resumen_general/rpte_resumen_general.jasper";
                 $file_name_download = "RESUMEN_GENERAL" . uniqid();
                 $file_name_output = 'resumen_torniquetes_' . uniqid();
             }
             $isSuccess = TRUE;
         }
     }
     $arrParameter = array('fecha_inicio' => $date_begin, 'fecha_fin' => $date_end, 'condicion' => $condicion, 'ci_root_path' => BASEPATH . '../');
     if ($isSuccess) {
         /* @var $oReport oReport */
         $oReport = $this->library_jasperstarter->buildReport($path_file_jasper, $file_name_output, $arrParameter, $tipo_descarga);
         if ($oReport->isSuccess()) {
             //$data = file_get_contents( $oReport->filePath() ); // Read the file's contents
             //force_download($file_name_output, $data);
             $mime = get_mime_by_extension($oReport->fileExtension());
             //$mime = "application/pdf";
             ob_clean();
             header("Content-disposition: attachment; filename={$file_name_download}.{$tipo_descarga}");
             header("Content-type: {$mime}");
             readfile($oReport->filePath());
         } else {
             header('Content-Type: text/html; charset=utf-8');
             echo "ERROR DE EJECCIÓN<br/>";
             echo "COMANDO: " . $oReport->cmd();
         }
     } else {
         header('Content-Type: text/html; charset=utf-8');
         echo "ERROR DE EJECCIÓN<br/>";
         echo "TIPO DE REPORTE: " . $tipo_rpte;
     }
 }