public function setBinnacleEntity(eUserLog $eUserLog)
 {
     $this->id_binnacle = $eUserLog->id;
     $this->info = $eUserLog->info;
     $this->date_time = Helper_Fecha::setFomratDate($eUserLog->date_time);
     $this->url = $eUserLog->url;
     $this->ip = $eUserLog->ip;
     if ($eUserLog->action == 'ACTION_DEFAULT') {
         $this->action = Helper_App_Log::LOG_DEFAULT;
     }
     if ($eUserLog->action == 'ACTION_LOGIN') {
         $this->action = Helper_App_Log::LOG_LOGIN;
     }
     if ($eUserLog->action == 'ACTION_INSERT') {
         $this->action = Helper_App_Log::LOG_INSERT;
     }
     if ($eUserLog->action == 'ACTION_UPDATE') {
         $this->action = Helper_App_Log::LOG_UPDATE;
     }
     if ($eUserLog->action == 'ACTION_DELETE') {
         $this->action = Helper_App_Log::LOG_DELETE;
     }
     $this->browser = $eUserLog->browser;
     $this->time = Helper_Fecha::getIntervalDate($eUserLog->date_time);
 }
 private function loadDay()
 {
     $resAjax = new Response_Ajax();
     //$MY =& MY_Controller::get_instance();
     $year = $this->input->post('year');
     $month = $this->input->post('month');
     $resAjax->data('day', Helper_Fecha::getArrayDay($year, $month));
     echo $resAjax->toJsonEncode();
 }
Example #3
0
 public function index()
 {
     print_r(Helper_Fecha::getArrayMonth());
     print_r(Helper_Fecha::getArrayYear());
     print_r(Helper_Fecha::getMonth_Translate());
     print_r(Helper_Fecha::getLastDay_By_YearMonth());
     print_r(Helper_Fecha::getArrayDay(null, null));
     /*$test = Helper_Fecha::getArrayYear(2); //los años a adelantar lo cambias logicamente.
       foreach($test as $k => $v){
           echo "[$k] = ($v[0], $v[1])<br />";
       }*/
 }
 public function isValid()
 {
     $this->clearErrors();
     if (empty($this->name)) {
         $this->addError('name', 'Campo no debe estar vacío');
     }
     if (empty($this->surname)) {
         $this->addError('surname', 'Campo no debe estar vacío');
     }
     if (empty($this->tipo_documento)) {
         $this->addError('tipo_documento', 'Campo no debe estar vacío');
     }
     if (empty($this->document)) {
         $this->addError('document', 'Campo no debe estar vacío');
     }
     if (empty($this->birthday)) {
         $this->addError('birthday', 'Campo no debe estar vacío');
     } else {
         if (Helper_Fecha::validar_fecha($this->birthday) === false) {
             $this->addError('birthday', 'Ingrese una fecha válida');
         }
     }
     if (empty($this->gender)) {
         $this->addError('gender', 'Campo no debe estar vacío');
     }
     if (empty($this->address)) {
         $this->addError('address', 'Campo no debe estar vacío');
     }
     /*if( empty($this->phone_cell) )
       {
           $this->addError('phone_cell', 'Campo no debe estar vacío');
       }*/
     if (empty($this->email)) {
         $this->addError('email', 'Campo no debe estar vacío');
     }
     if (empty($this->estado_civil)) {
         $this->addError('estado_civil', 'Campo no debe estar vacío');
     }
     if (empty($this->tipo_sangre)) {
         $this->addError('tipo_sangre', 'Campo no debe estar vacío');
     }
     return $this->isErrorEmpty();
 }
 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 _resumen_camera()
 {
     $dateBegin = NULL;
     $dateEnd = date('Y-m-d') . ' 00:00:00';
     $arrDataProcess = array();
     /*
      * Inicio del proceso de Resumen de Camaras
      */
     $DateTime_ResumenCamera_Begin = date('Y-m-d H:i:s');
     $cont_P_ResumenCamera = 0;
     while ($cont_P_ResumenCamera < 2) {
         $oRes = Business_Process_Generate::loadResumenCamera($dateEnd, $dateBegin);
         if ($oRes->isSuccess()) {
             break;
         }
         $cont_P_ResumenCamera++;
     }
     if (!$oRes->isSuccess()) {
         Helper_Process_Log::write($oRes->message());
     }
     $arrDataProcess[Helper_Config::getFTTProcessResumenCamera()] = array('isSuccess' => $oRes->isSuccess(), 'message' => $oRes->message(), 'timestamp' => Helper_Fecha::getDiff_DateTime($DateTime_ResumenCamera_Begin));
     /*-----------------------------------------------------------------*/
     Helper_Log::write($arrDataProcess);
     //print_r($arrDataProcess);
 }
 public function index()
 {
     $arrTimePar = Helper_Fecha::getArrayTime();
     //Helper_Log::write($arrTimePar);
     Helper_App_View::layout('app/html/pages/system_setting_param/page', array('arrTime' => $arrTimePar));
 }
 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;
     }
 }
 public function isValid()
 {
     $this->clearErrors();
     //PERSON
     if (empty($this->name)) {
         $this->addError('name', 'Campo no debe estar vacío');
     }
     if (empty($this->surname)) {
         $this->addError('surname', 'Campo no debe estar vacío');
     }
     if (empty($this->tipo_documento)) {
         $this->addError('tipo_documento', 'Campo no debe estar vacío');
     }
     if (empty($this->document)) {
         $this->addError('document', 'Campo no debe estar vacío');
     }
     if (empty($this->birthday)) {
         $this->addError('birthday', 'Campo no debe estar vacío');
     } else {
         if (Helper_Fecha::validar_fecha($this->birthday) === false) {
             $this->addError('birthday', 'Ingrese una fecha válida');
         }
     }
     if (empty($this->gender)) {
         $this->addError('gender', 'Campo no debe estar vacío');
     }
     if (empty($this->address)) {
         $this->addError('address', 'Campo no debe estar vacío');
     }
     if (empty($this->email)) {
         $this->addError('email', 'Campo no debe estar vacío');
     }
     if (empty($this->estado_civil)) {
         $this->addError('estado_civil', 'Campo no debe estar vacío');
     }
     if (empty($this->tipo_sangre)) {
         $this->addError('tipo_sangre', 'Campo no debe estar vacío');
     }
     //USER
     if (empty($this->id_user)) {
         if (empty($this->username)) {
             $this->addError('username', 'Campo no debe estar vacío');
         }
         if (empty($this->password_new)) {
             $this->addError('password_new', 'Campo no debe estar vacío');
         } elseif ($this->password_new != $this->password_new_repeat) {
             $this->addError('password_new', 'Comprobación incorrecta');
             $this->addError('password_new_repeat', 'Comprobación incorrecta');
         } elseif (strlen($this->password_new) < 6) {
             $this->addError('password_new', '6 mínimo tamaño contraseña');
             $this->addError('password_new_repeat', '6 mínimo tamaño contraseña');
         }
     } else {
         if (!empty($this->password_new)) {
             if ($this->password_new != $this->password_new_repeat) {
                 $this->addError('password_new', 'Comprobación incorrecta');
                 $this->addError('password_new_repeat', 'Comprobación incorrecta');
             } elseif (strlen($this->password_new) < 6) {
                 $this->addError('password_new', '6 mínimo tamaño contraseña');
                 $this->addError('password_new_repeat', '6 mínimo tamaño contraseña');
             }
         }
     }
     //PROFILE
     if (empty($this->id_profile)) {
         $this->addError('id_profile', 'Campo no debe estar vacío');
     }
     //COMPANY_BRANCH
     if (empty($this->id_company_branchs)) {
         $this->addError('id_company_branchs', 'Campo no debe estar vacío');
     }
     return $this->isErrorEmpty();
 }