function GuardarPeriodosSeguimiento() { $fecha = date("Y-m-d H:i:s"); $usuario = $_SESSION['session']['user']; $plano = $this->idplan; $sql = "SELECT * FROM PL_POPERATIVOS_PERIODOS WHERE PK_POPERATIVO = '{$plano}'"; $numperiodosbase = database::getNumRows($sql); $numperiodos = sizeof($this->seguimiento) - 1; if ($numperiodosbase > $numperiodos) { for ($i = $numperiodos; $i <= $numperiodosbase; $i++) { $sql = "DELETE FROM PL_POPERATIVOS_PERIODOS WHERE PK_POPERATIVO = '{$plano}' AND ORDEN='{$i}'"; database::executeQuery($sql); } } $cont = 1; for ($i = 0; $i < sizeof($this->seguimiento) - 1; $i++) { $periodo = explode("^", $this->seguimiento[$i]); $titulo = $periodo[0]; $fechai = $periodo[1]; $fechat = $periodo[2]; $sql = "SELECT * FROM PL_POPERATIVOS_PERIODOS WHERE PK_POPERATIVO = '{$plano}' AND ORDEN = '{$cont}'"; $row = database::getRow($sql); if ($row) { $this->campos = array('PERIODO' => $titulo, 'FECHA_I' => $fechai, 'FECHA_T' => $fechat, 'FECHA_M' => $fecha, 'PK_USUARIO' => $_SESSION['session']['user']); $condition = "PK_POPERATIVO = '{$plano}' AND ORDEN = '{$cont}'"; database::updateRecords("PL_POPERATIVOS_PERIODOS", $this->campos, $condition); } else { $idperiodo = strtoupper(substr(uniqid('SP'), 0, 15)); $this->campos = array('PK1' => $idperiodo, 'PERIODO' => $periodo[0], 'ORDEN' => $cont, 'FECHA_I' => $periodo[1], 'FECHA_T' => $periodo[2], 'PK_POPERATIVO' => $this->idplan, 'FECHA_R' => date("Y-m-d H:i:s"), 'FECHA_M' => NULL, 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_PERIODOS", $this->campos); } $cont++; } }
function AgregarNiveles() { foreach ($this->niveles as $row) { $this->campos = array('PK_USUARIO' => $this->usuario, 'PK_JERARQUIA' => $row); $result = database::insertRecords("USUARIOS_JERARQUIA", $this->campos); } }
function Insertar($descripcion, $idCentro, $disponible) { try { $this->campos = array('ID_STATUS' => 'A', 'DESCRIPCION' => $descripcion, 'PK_CENTRO' => $idCentro, 'DISPONIBLE' => $disponible); $result = database::insertRecords("LINEAS_INV", $this->campos); } catch (customException $e) { throw new customException($sql); } }
function Insertar($clave, $facultad) { try { $this->campos = array('CLAVE' => $clave, 'FACULTAD' => $facultad); $result = database::insertRecords("FACULTAD", $this->campos); } catch (customException $e) { throw new customException($sql); } }
function Insertar($grado, $descripcion, $disponible) { try { $this->campos = array('CLAVE' => $grado, 'DESCRIPCION' => $descripcion, 'DISPONIBLE' => $disponible); $result = database::insertRecords("GRADOS", $this->campos); } catch (customException $e) { throw new customException($sql); } }
function GuardarObjetivos($idlineae, $i) { $objetivosestrategicos = explode("|", $this->objetivos[$i]); for ($i = 0; $i < sizeof($objetivosestrategicos) - 1; $i++) { $idobjetivo = strtoupper(substr(uniqid('OE'), 0, 15)); $this->campos = array('PK1' => $idobjetivo, 'OBJETIVO' => $objetivosestrategicos[$i], 'ORDEN' => $i, 'PK_LESTRATEGICA' => $idlineae, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $result = database::insertRecords("PL_PESTRATEGICOS_OBJETIVOSE", $this->campos); } }
function Insertar($clave, $descripcion, $idfacultad) { try { $this->campos = array('CLAVE' => $clave, 'DESCRIPCION' => $descripcion, 'PK_FACULTAD' => $idfacultad); $result = database::insertRecords("CENTROS", $this->campos); } catch (customException $e) { throw new customException($sql); } }
function GuardarPlan() { $JERARQUIA = $this->jerarquia; $this->campos = array('PK1' => $this->idplan, 'TITULO' => $this->titulo, 'DESCRIPCION' => $this->descripcion, 'PK_JERARQUIA' => $this->jerarquia, 'DISPONIBLE' => $this->disponible, 'FECHA_I' => $this->fechai, 'FECHA_T' => $this->fechat, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_PESTRATEGICOS", $this->campos); //Agregarmos la alerta $this->campos = array('OBJETIVO' => "Se ha agregado un nuevo plan estrategico..", 'TIPO' => "ALERT", 'VISTO' => '0', 'URL' => "?execute=principal&method=default&Menu=F1&SubMenu=SF11#&p=1&s=25&sort=1&q=&filter=" . $JERARQUIA . "", 'PK_JERARQUIA' => $this->jerarquia, 'PK_USUARIO' => $_SESSION['session']['user'], 'FECHA_R' => date("Y-m-d H:i:s")); database::insertRecords("NOTIFICACIONES", $this->campos); }
function AgregarNiveles() { $usuario = $this->usuario; $sql = "DELETE USUARIOS_JERARQUIA WHERE PK_USUARIO = '{$usuario}'"; database::executeQuery($sql); foreach ($this->niveles as $row) { $this->campos = array('PK_USUARIO' => $this->usuario, 'PK_JERARQUIA' => $row); database::insertRecords("USUARIOS_JERARQUIA", $this->campos); } }
function permitirPermisos($rol, $permisos) { $permisos = explode("^", $permisos, -1); foreach ($permisos as $permiso) { if ($this->eliminarPermiso($rol, $permiso)) { $this->campos = array('PK_ROL' => $rol, 'PK_PERMISO' => $permiso); $result = database::insertRecords("ROLES_PERMISOS", $this->campos); } } }
function GuardarPeriodosSeguimiento() { $cont = 1; for ($i = 0; $i < sizeof($this->seguimiento) - 1; $i++) { $periodo = explode("^", $this->seguimiento[$i]); $idperiodo = strtoupper(substr(uniqid('SP'), 0, 15)); $this->campos = array('PK1' => $idperiodo, 'PERIODO' => $periodo[0], 'ORDEN' => $cont, 'FECHA_I' => $periodo[1], 'FECHA_T' => $periodo[2], 'PK_POPERATIVO' => $this->idplan, 'FECHA_R' => date("Y-m-d H:i:s"), 'FECHA_M' => NULL, 'PK_USUARIO' => $_SESSION['session']['user']); $cont++; database::insertRecords("PL_POPERATIVOS_PERIODOS", $this->campos); } }
function insertarComentario($comentario, $id) { $fechar = date("Y-m-d H:i:s"); $usuario = $_SESSION['session']['user']; $this->campos = array('COMENTARIO' => $comentario, 'PK_APOYO' => $id, 'PK_USUARIO' => $usuario, 'FECHA_R' => $fechar); database::insertRecords("PL_PL_APOYOS", $this->campos); $sql = "SELECT TOP 1 PK1 FROM PL_PESTRATEGICOS_ADJUNTOS_COMENTARIOS WHERE PK_USUARIO = '{$usuario}' AND PK_APOYO = '{$id}' AND FECHA_R = '{$fechar}' "; $row = database::getRow($sql); if (!empty($row)) { $data = $row['PK1']; return $data; } }
function Insertar() { // PASO 1. Se busca si el registro ya existe y se guarda la llave primaria. try { $sql = "SELECT TOP 1 * FROM TIPOS_CONTRATO WHERE CLAVE = '" . $this->clave . "'"; $row = database::getRow($sql); $PK1 = $row['PK1']; if ($PK1 == "") { $PK1 = -1; } } catch (customException $e) { $PK1 = -1; } $this->campos = array('CLAVE' => $this->clave, 'DESCRIPCION' => $this->descripcion, 'DISPONIBLE' => $this->disponible); // PASO 2. Si el registro YA existe se actualiza. if ($PK1 != -1) { $condition = "PK1=" . $PK1; database::updateRecords("TIPOS_CONTRATO", $this->campos, $condition); } else { $result = database::insertRecords("TIPOS_CONTRATO", $this->campos); } return TRUE; }
function GuardarUsuario() { $plan = $this->poperativo; $jerarquia = $this->jerarquia; $sql = "SELECT TITULO FROM PL_POPERATIVOS WHERE PK1='{$plan}'"; $row = database::getRow($sql); $titulo = $row['TITULO']; foreach ($this->usuarios as $usuario) { $sql = "SELECT * FROM PL_POPERATIVOS_ASIGNACIONES WHERE PK_USUARIO = '{$usuario}' AND PK_POPERATIVO = '{$plan}' "; $row = database::getRow($sql); if (!$row) { $sql = "SELECT * FROM USUARIOS WHERE PK1 = '{$usuario}' "; $row = database::getRow($sql); if ($row) { $this->campos = array('PK_POPERATIVO' => $this->poperativo, 'PK_USUARIO' => $usuario, 'ROL' => $this->rol, 'FECHA_R' => date("Y-m-d H:i:s")); $result = database::insertRecords("PL_POPERATIVOS_ASIGNACIONES", $this->campos); //Agregarmos la alerta $this->campos = array('OBJETIVO' => "Se le ha agregado un nuevo plan operativo..", 'TIPO' => "ALERT", 'VISTO' => '0', 'URL' => "?execute=operativo&method=default&Menu=F2&SubMenu=SF21#&p=1&s=25&sort=1&q=" . $titulo . "&filter=" . $jerarquia . "", 'PK_JERARQUIA' => $jerarquia, 'PK_USUARIO' => $usuario, 'FECHA_R' => date("Y-m-d H:i:s"), 'ENVIADO' => $_SESSION['session']['user']); database::insertRecords("NOTIFICACIONES", $this->campos); } } } }
function Insertar($id) { // PASO 1. Se busca si el registro ya existe y se guarda la llave primaria. try { $sql = "SELECT TOP 1 PK1 FROM CATALOGO_PRODUCTOS WHERE PK1 = '{$id}' "; $row = database::getRow($sql); $PK1 = $row['PK1']; if ($PK1 == "") { $PK1 = -1; } } catch (customException $e) { $PK1 = -1; } $this->campos = array('PRODUCTO' => $this->producto, 'CATEGORIA' => $this->categoria, 'VALORACION' => $this->valoracion, 'CAI' => $this->CAI, 'TIPO' => $this->tipo); // PASO 2. Si el registro YA existe se actualiza. if ($PK1 != -1) { $condition = "PK1={$PK1}"; database::updateRecords("CATALOGO_PRODUCTOS", $this->campos, $condition); } else { $result = database::insertRecords("CATALOGO_PRODUCTOS", $this->campos); } return TRUE; }
function GuardarNivel() { $this->campos = array('PK1' => (string) $this->idnivel, 'NOMBRE' => (string) $this->nivel, 'DESCRIPCION' => (string) $this->descripcion, 'PADRE' => (string) $this->padre, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user'], 'TIPO' => $this->tipo); $result = database::insertRecords("JERARQUIAS", $this->campos); return TRUE; }
function Insertar() { $this->campos = array('TIPO' => $this->tipo, 'DESCRIPCION' => $this->descripcion, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $result = database::insertRecords("ORGANIZACIONES_TIPOS", $this->campos); return TRUE; }
<?php require 'config.php'; require 'core/dbaccess.php'; session_start(); $campos = array('ACTIVO' => 0); $user = $_SESSION['session']['user']; $condition = "PK1 = '{$user}' "; database::updateRecords("USUARIOS", $campos, $condition); $campos = array('APLICACION' => 'SISTEMA', 'MODULO' => 'SALIDA', 'MENSAJE' => 'LOGOUT SISTEMA', 'PK_USUARIO' => $_SESSION['session']['user'], 'FECHA_R' => date("Y-m-d H:i:s")); database::insertRecords("ACTIVIDAD_USUARIO", $campos); session_destroy(); session_unset(); header('Location:index.php'); exit;
function PasarSeguimiento($idplan, $idplane) { //PASAMOS ASEGUIMIENTO $sql = "UPDATE PL_POPERATIVOS SET ESTADO = 'S' WHERE PK1 = '{$idplan}'"; $result = database::executeQuery($sql); $sql = "SELECT * FROM PL_POPERATIVOS WHERE PK1 = '{$idplan}'"; $rowplan = database::getRow($sql); $sql = "SELECT * FROM PL_POPERATIVOS_ASIGNACIONES WHERE PK_POPERATIVO = '" . $idplan . "'"; $parametros = "ESTADO=R,PLAN=" . $idplan; $result = database::executeQuery($sql); while ($row = mssql_fetch_array($result, MSSQL_ASSOC)) { $passport = new Authentication(); if ($passport->getPrivilegioRol($row['ROL'], 'P116')) { //insertamos alertas $this->campos = array('OBJETIVO' => "Plan Operativo ha pasado a SEGUIMIENTO..", 'TIPO' => "ALERT", 'VISTO' => '0', 'URL' => "?execute=operativo&method=default&Menu=F2&SubMenu=SF21#&p=1&s=25&sort=1&q=" . $rowplan['TITULO'] . "&filter=" . $rowplan['PK_JERARQUIA'] . "", 'PK_JERARQUIA' => NULL, 'PARAMETROS' => NULL, 'PK_USUARIO' => $row['PK_USUARIO'], 'FECHA_R' => date("Y-m-d H:i:s"), 'ENVIADO' => $_SESSION['session']['user']); database::insertRecords("NOTIFICACIONES", $this->campos); } } }
function insertarComentarioGeneral($comentario, $idplan, $tipo) { $fechar = date("Y-m-d H:i:s"); $usuario = $_SESSION['session']['user']; $this->campos = array('COMENTARIO' => $comentario, 'PK_POPERATIVO' => $idplan, 'PK_USUARIO' => $usuario, 'FECHA_R' => $fechar, 'TIPO' => $tipo); database::insertRecords("PL_POPERATIVOS_COMENTARIOS", $this->campos); $sql = "SELECT TOP 1 PK1 FROM PL_POPERATIVOS_COMENTARIOS WHERE PK_USUARIO = '{$usuario}' AND PK_POPERATIVO = '{$idplan}' AND FECHA_R = '{$fechar}' "; $row = database::getRow($sql); if (!empty($row)) { $data = $row['PK1']; return $data; } //Agregarmos la alerta /* $this->campos = array('OBJETIVO'=>$comentario, 'TIPO'=>"COMEN", 'VISTO'=>'0', 'URL'=>"?execute=operativo&method=default&Menu=F2&SubMenu=SF21#&p=1&s=25&sort=1&q=&filter=".$JERARQUIA."", 'PK_JERARQUIA'=>$this->jerarquia, 'PK_USUARIO'=>$_SESSION['session']['user'], 'FECHA_R'=>date("Y-m-d H:i:s"), ); database::insertRecords("NOTIFICACIONES",$this->campos);*/ }
function UploadFile() { $this->campos = array('PK1' => uniqid($this->tipo), 'TITULO' => $this->titulo, 'DESCRIPCION' => $this->descripcion, 'AUTOR' => $this->autor, 'TIPO' => $this->tipo, 'IMAGEN' => $this->imagen, 'ADJUNTO' => $this->adjunto, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => "admin"); database::insertRecords("APOYOS", $this->campos); }
function GuardarObjetivos($idlineae, $i) { $fecha = date("Y-m-d H:i:s"); $usuario = $_SESSION['session']['user']; $objetivosestrategicos = explode("|", $this->objetivos[$i]); $sql = "SELECT PK1 FROM PL_PESTRATEGICOS_OBJETIVOSE WHERE PK_LESTRATEGICA = '{$idlineae}'"; $numobjetivosbase = database::getNumRows($sql); $numobjetivos = sizeof($objetivosestrategicos) - 1; if ($numobjetivosbase > $numobjetivos) { for ($i = $numobjetivos; $i <= $numobjetivosbase; $i++) { $sql = "DELETE FROM PL_PESTRATEGICOS_OBJETIVOSE WHERE PK_LESTRATEGICA = '{$idlineae}' AND ORDEN='{$i}'"; database::executeQuery($sql); } } for ($i = 0; $i < sizeof($objetivosestrategicos) - 1; $i++) { $objetivo = $objetivosestrategicos[$i]; $sql = "SELECT * FROM PL_PESTRATEGICOS_OBJETIVOSE WHERE PK_LESTRATEGICA = '{$idlineae}' AND ORDEN = '{$i}'"; $row = database::getRow($sql); if ($row) { $this->campos = array('OBJETIVO' => $objetivo, 'FECHA_M' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $condition = "PK_LESTRATEGICA = '{$idlineae}' AND ORDEN = '{$i}'"; database::updateRecords("PL_PESTRATEGICOS_OBJETIVOSE", $this->campos, $condition); } else { $idobjetivo = strtoupper(substr(uniqid('OE'), 0, 15)); $this->campos = array('PK1' => $idobjetivo, 'OBJETIVO' => $objetivo, 'ORDEN' => $i, 'PK_LESTRATEGICA' => $idlineae, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $result = database::insertRecords("PL_PESTRATEGICOS_OBJETIVOSE", $this->campos); } } }
function UploadFile() { $usuario = $_SESSION['session']['user']; $this->campos = array('PK1' => uniqid($this->tipo), 'TITULO' => $this->titulo, 'DESCRIPCION' => $this->descripcion, 'AUTOR' => $this->autor, 'TIPO' => $this->tipo, 'IMAGEN' => $this->imagen, 'ADJUNTO' => $this->adjunto, 'PK_PESTRATEGICO' => $this->idplan, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $usuario); database::insertRecords("PL_PESTARTEGICOS_ADJUNTOS", $this->campos); }
function guardaProductos($id_proyecto, $info, $editar) { if ($editar == true) { database::deleteRecords("PROYECTOS_PRODUCTOS", "PK_PROYECTO='{$id_proyecto}'", ''); } $array_etapas = explode('|', $info); $max = sizeof($array_etapas); for ($i = 0; $i < $max; $i++) { $array_info = explode('~', $array_etapas[$i]); if (3 <= sizeof($array_info)) { $id_producto = $array_info[0]; $secuencia = $array_info[1]; $cantidad = $array_info[2]; $fecha = $array_info[3]; $otro = $array_info[4]; $this->campos = array('PK_PROYECTO' => $id_proyecto, 'PK_PRODUCTO' => $id_producto, 'SECUENCIA' => $secuencia, 'CANTIDAD' => $cantidad, 'FECHA' => $fecha, 'OTRO' => $otro); database::insertRecords("PROYECTOS_PRODUCTOS", $this->campos); } } }
function Insertar() { $this->campos = array('PK1' => $this->idficha, 'NOMBRE' => $this->ficha, 'DESCRIPCION' => $this->descripcion, 'URL' => $this->url, 'PADRE' => $this->padre, 'ORDEN' => $this->orden, 'DISPONIBLE' => $this->disponible, 'PK_PERMISO' => $this->permiso, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $result = database::insertRecords("FICHAS", $this->campos); return TRUE; }
function UploadFile() { $idplan = $this->idplan; $linea = $this->idlinea; $objetivo = $this->idobjetivo; $sql = "SELECT * FROM PL_POPERATIVOS_EVIDENCIAS WHERE PK_POPERATIVO = '{$idplan}' AND PK_LESTRATEGICA = '{$linea}' AND PK_OTACTICO = '{$objetivo}'"; $orden = database::getNumRows($sql); $usuario = $_SESSION['session']['user']; $this->campos = array('PK1' => uniqid($this->tipo), 'EVIDENCIA' => $this->titulo, 'ORDEN' => $orden, 'DESCRIPCION' => $this->descripcion, 'AUTOR' => $this->autor, 'TIPO' => $this->tipo, 'IMAGEN' => $this->imagen, 'ADJUNTO' => $this->adjunto, 'PK_POPERATIVO' => $this->idplan, 'PK_LESTRATEGICA' => $this->idlinea, 'PK_OTACTICO' => $this->idobjetivo, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $usuario); database::insertRecords("PL_POPERATIVOS_EVIDENCIAS", $this->campos); }
function Insertar() { $this->campos = array('PK1' => strtoupper(uniqid('R')), 'ROLE' => $this->rol, 'TIPO' => $this->tipo, 'DESCRIPCION' => $this->descripcion, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); $result = database::insertRecords("ROLES", $this->campos); return TRUE; }
function Salir() { $idplan = $_GET['IDPlan']; $camposM = array('APLICACION' => 'PLAN OPERATIVO', 'MODULO' => 'ELABORACION', 'MENSAJE' => 'EXIT PLAN OPERATIVO: ' . $idplan, 'PK_USUARIO' => $_SESSION['session']['user'], 'FECHA_R' => date("Y-m-d H:i:s")); database::insertRecords("ACTIVIDAD_USUARIO", $camposM); $user = $_SESSION['session']['user']; $sql = "SELECT * FROM PL_POPERATIVOS WHERE PK1='{$idplan}' AND ACTIVO = '{$user}'"; $row = database::getRow($sql); if ($row) { $sql = "UPDATE PL_POPERATIVOS SET ACTIVO = NULL WHERE PK1='{$idplan}'"; $result = database::executeQuery($sql); } else { return FALSE; } }
function GuardarObjetivos() { //$this->EliminarObjetivos(); $fecha = date("Y-m-d H:i:s"); $usuario = $_SESSION['session']['user']; $plano = $this->idPlanOpe; for ($i = 0; $i < sizeof($this->lineas) - 1; $i++) { $lineae = $this->lineas[$i]; $objetivos = explode("^", $this->objetivos[$i]); $medios = explode("~", $this->medios[$i]); $evidencias = explode("~", $this->evidencias[$i]); $sql = "SELECT * FROM PL_POPERATIVOS_OBJETIVOST WHERE PK_POPERATIVO = '{$plano}'AND PK_LESTRATEGICA = '{$lineae}' "; $numobjetivosbase = database::getNumRows($sql); $numobjetivos = sizeof($objetivos) - 1; if ($numobjetivosbase > $numobjetivos) { for ($x = $numobjetivos; $x <= $numobjetivosbase; $x++) { $sql = "DELETE FROM PL_POPERATIVOS_OBJETIVOST WHERE PK_POPERATIVO = '{$plano}' AND PK_LESTRATEGICA = '{$lineae}' AND ORDEN='{$x}'"; database::executeQuery($sql); } } for ($j = 0; $j < sizeof($objetivos) - 1; $j++) { //GUARDAMOS LOS OBJETIVOS DEL PLAN OPERATIVO $objetivo = explode("¬", $objetivos[$j]); $sql = "SELECT * FROM PL_POPERATIVOS_OBJETIVOST WHERE PK_POPERATIVO = '{$plano}' AND ORDEN = '{$j}' AND PK_LESTRATEGICA = '{$lineae}'"; $row = database::getRow($sql); if ($row) { $idObjT = $row['PK1']; $this->campos = array('OBJETIVO' => str_replace("'", "''", $objetivo[0]), 'PK_OESTRATEGICO' => $objetivo[1], 'PK_RESPONSABLE' => $objetivo[2], 'FECHA_M' => $fecha, 'PK_USUARIO' => $_SESSION['session']['user']); $condition = "PK_POPERATIVO = '{$plano}' AND ORDEN = '{$j}' AND PK_LESTRATEGICA = '{$lineae}'"; database::updateRecords("PL_POPERATIVOS_OBJETIVOST", $this->campos, $condition); } else { $idObjT = (string) strtoupper(substr(uniqid('OT'), 0, 15)); $this->campos = array('PK1' => $idObjT, 'OBJETIVO' => str_replace("'", "''", $objetivo[0]), 'ORDEN' => $j, 'PK_POPERATIVO' => $this->idPlanOpe, 'PK_LESTRATEGICA' => $this->lineas[$i], 'PK_OESTRATEGICO' => $objetivo[1], 'PK_RESPONSABLE' => $objetivo[2], 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_OBJETIVOST", $this->campos); } /////////EMPEZAMOS A GUARDAR LOS MEDIOS/////// $medios_objetivo = explode("^", $medios[$j]); $sql = "SELECT * FROM PL_POPERATIVOS_MEDIOS WHERE PK_OTACTICO = '{$idObjT}'"; $numobjetivosbase = database::getNumRows($sql); $numobjetivos = sizeof($medios_objetivo) - 1; if ($numobjetivosbase > $numobjetivos) { for ($x = $numobjetivos; $x <= $numobjetivosbase; $x++) { $sql = "DELETE FROM PL_POPERATIVOS_MEDIOS WHERE PK_OTACTICO = '{$idObjT}' AND ORDEN='{$x}'"; database::executeQuery($sql); } } for ($k = 0; $k < sizeof($medios_objetivo) - 1; $k++) { $medio = explode("¬", $medios_objetivo[$k]); $idMedio = strtoupper(substr(uniqid('M'), 0, 15)); $sql = "SELECT * FROM PL_POPERATIVOS_MEDIOS WHERE PK_OTACTICO = '{$idObjT}' AND ORDEN = '{$k}'"; $row = database::getRow($sql); if ($row) { $this->campos = array('MEDIO' => str_replace("'", "''", $medio[0]), 'PK_RESPONSABLE' => $medio[1], 'FECHA_M' => $fecha, 'PK_USUARIO' => $_SESSION['session']['user']); $condition = "PK_OTACTICO = '{$idObjT}' AND ORDEN = '{$k}'"; database::updateRecords("PL_POPERATIVOS_MEDIOS", $this->campos, $condition); } else { $this->camposM = array('PK1' => $idMedio, 'MEDIO' => str_replace("'", "''", $medio[0]), 'ORDEN' => $k, 'PK_OTACTICO' => $idObjT, 'PK_RESPONSABLE' => $medio[1], 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_MEDIOS", $this->camposM); } } /////////EMPEZAMOS A GUARDAR LAS EVIDENCIAS/////// $evidencias_objetivo = explode("^", $evidencias[$j]); $sql = "SELECT * FROM PL_POPERATIVOS_EVIDENCIAS WHERE PK_OTACTICO = '{$idObjT}'"; $numobjetivosbase = database::getNumRows($sql); $numobjetivos = sizeof($evidencias_objetivo) - 1; if ($numobjetivosbase > $numobjetivos) { for ($x = $numobjetivos; $x <= $numobjetivosbase; $x++) { $sql = "DELETE FROM PL_POPERATIVOS_EVIDENCIAS WHERE PK_OTACTICO = '{$idObjT}' AND ORDEN='{$x}'"; database::executeQuery($sql); } } for ($k = 0; $k < sizeof($evidencias_objetivo) - 1; $k++) { $sql = "SELECT * FROM PL_POPERATIVOS_EVIDENCIAS WHERE PK_OTACTICO = '{$idObjT}' AND ORDEN = '{$k}'"; $row = database::getRow($sql); if ($row) { $this->campos = array('EVIDENCIA' => str_replace("'", "''", $evidencias_objetivo[$k]), 'FECHA_M' => $fecha, 'PK_USUARIO' => $_SESSION['session']['user']); $condition = "PK_OTACTICO = '{$idObjT}' AND ORDEN = '{$k}'"; database::updateRecords("PL_POPERATIVOS_EVIDENCIAS", $this->campos, $condition); } else { $idEvidencia = strtoupper(substr(uniqid('E'), 0, 15)); $this->camposM = array('PK1' => $idEvidencia, 'EVIDENCIA' => str_replace("'", "''", $evidencias_objetivo[$k]), 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'PK_LESTRATEGICA' => $this->lineas[$i], 'PK_OTACTICO' => $idObjT, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_EVIDENCIAS", $this->camposM); } } } } /////////GUARDAMOS EL RESUMEN EJECUTIVO/////// $idplano = $this->idPlanOpe; $sql = "DELETE FROM PL_POPERATIVOS_AREAS WHERE PK_POPERATIVO = '{$idplano}' "; database::executeQuery($sql); for ($k = 0; $k < sizeof($this->areas) - 1; $k++) { $idArea = strtoupper(substr(uniqid('A'), 0, 15)); $this->camposM = array('PK1' => $idArea, 'AREA' => $this->areas[$k], 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_AREAS", $this->camposM); } $sql = "DELETE FROM PL_POPERATIVOS_FORTALEZAS WHERE PK_POPERATIVO = '{$idplano}' "; database::executeQuery($sql); for ($k = 0; $k < sizeof($this->fortalezas) - 1; $k++) { $idFortaleza = strtoupper(substr(uniqid('F'), 0, 15)); $this->camposM = array('PK1' => $idFortaleza, 'FORTALEZA' => $this->fortalezas[$k], 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_FORTALEZAS", $this->camposM); } //////ACTUALIZAMOS EL ESTADO DEL PLAN OPERATIVO A GUARDADO/// $this->campos = array('ESTADO' => $this->estado); $condition = "PK1='" . $this->idPlanOpe . "'"; database::updateRecords("PL_POPERATIVOS", $this->campos, $condition); }
function GuardarObjetivos() { $camposM = array('APLICACION' => 'PLAN OPERATIVO', 'MODULO' => 'ELABORACION', 'MENSAJE' => 'GUARDA PLAN OPERATIVO: ' . $this->idPlanOpe, 'PK_USUARIO' => $_SESSION['session']['user'], 'FECHA_R' => date("Y-m-d H:i:s")); database::insertRecords("ACTIVIDAD_USUARIO", $camposM); $this->EliminarObjetivos(); for ($i = 0; $i < sizeof($this->lineas) - 1; $i++) { $objetivos = explode("^", $this->objetivos[$i]); $medios = explode("~", $this->medios[$i]); $evidencias = explode("~", $this->evidencias[$i]); for ($j = 0; $j < sizeof($objetivos) - 1; $j++) { //GUARDAMOS LOS OBJETIVOS DEL PLAN OPERATIVO $idObjT = (string) strtoupper(substr(uniqid('OT'), 0, 15)); $objetivo = explode("¬", $objetivos[$j]); $this->campos = array('PK1' => $idObjT, 'OBJETIVO' => str_replace("'", "''", $objetivo[0]), 'ORDEN' => $j, 'PK_POPERATIVO' => $this->idPlanOpe, 'PK_LESTRATEGICA' => $this->lineas[$i], 'PK_OESTRATEGICO' => $objetivo[1], 'PK_RESPONSABLE' => $objetivo[2], 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_OBJETIVOST", $this->campos); /////////EMPEZAMOS A GUARDAR LOS MEDIOS/////// $medios_objetivo = explode("^", $medios[$j]); //print_r($medios_objetivo); for ($k = 0; $k < sizeof($medios_objetivo) - 1; $k++) { $medio = explode("¬", $medios_objetivo[$k]); $idMedio = strtoupper(substr(uniqid('M'), 0, 15)); $this->camposM = array('PK1' => $idMedio, 'MEDIO' => str_replace("'", "''", $medio[0]), 'ORDEN' => $k, 'PK_OTACTICO' => $idObjT, 'PK_RESPONSABLE' => $medio[1], 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_MEDIOS", $this->camposM); } /////////EMPEZAMOS A GUARDAR LAS EVIDENCIAS/////// $evidencias_objetivo = explode("^", $evidencias[$j]); for ($k = 0; $k < sizeof($evidencias_objetivo) - 1; $k++) { //$medio = explode("%",$medios_objetivo[$k]); $idEvidencia = strtoupper(substr(uniqid('E'), 0, 15)); $this->camposM = array('PK1' => $idEvidencia, 'EVIDENCIA' => str_replace("'", "''", $evidencias_objetivo[$k]), 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'PK_LESTRATEGICA' => $this->lineas[$i], 'PK_OTACTICO' => $idObjT, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_EVIDENCIAS", $this->camposM); } } } /////////GUARDAMOS EL RESUMEN EJECUTIVO/////// for ($k = 0; $k < sizeof($this->areas) - 1; $k++) { $idArea = strtoupper(substr(uniqid('A'), 0, 15)); $this->camposM = array('PK1' => $idArea, 'AREA' => $this->areas[$k], 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_AREAS", $this->camposM); } for ($k = 0; $k < sizeof($this->fortalezas) - 1; $k++) { $idFortaleza = strtoupper(substr(uniqid('F'), 0, 15)); $this->camposM = array('PK1' => $idFortaleza, 'FORTALEZA' => $this->fortalezas[$k], 'ORDEN' => $k, 'PK_POPERATIVO' => $this->idPlanOpe, 'FECHA_R' => date("Y-m-d H:i:s"), 'PK_USUARIO' => $_SESSION['session']['user']); database::insertRecords("PL_POPERATIVOS_FORTALEZAS", $this->camposM); } //////ACTUALIZAMOS EL ESTADO DEL PLAN OPERATIVO A GUARDADO/// $this->campos = array('ESTADO' => $this->estado); $condition = "PK1='" . $this->idPlanOpe . "'"; database::updateRecords("PL_POPERATIVOS", $this->campos, $condition); }