function save() { $tab_expediente = new tab_expediente(); $tab_expediente->setRequest2Object($_REQUEST); $exp_id = $_REQUEST['exp_id']; // obtener sub contenedor $expediente = new expediente(); $tetiq = new tab_etiquetas(); $tetiq->exp_id = $exp_id; $tetiq->usu_id = $_SESSION['USU_ID']; $tetiq->suc_id = $expediente->obtenerSucId($exp_id); $tetiq->ete_fecha_crea = date("Y-m-d"); $tetiq->ete_usu_crea = $_SESSION['USU_ID']; $tetiq->ete_estado = 1; $tetiq->insert(); echo "OK"; }
function load() { $expediente = new tab_expediente(); $expediente->setRequest2Object($_REQUEST); $usuario = new usuario(); $page = $_REQUEST['page']; $rp = $_REQUEST['rp']; $sortname = $_REQUEST['sortname']; $sortorder = $_REQUEST['sortorder']; if (!$sortname) { $sortname = 'uni_id'; } if (!$sortorder) { $sortorder = 'desc'; } $sort = "ORDER BY {$sortname} {$sortorder}"; if (!$page) { $page = 1; } if (!$rp) { $rp = 15; } $start = ($page - 1) * $rp; $limit = "LIMIT {$rp} OFFSET {$start} "; // $query = $_REQUEST['query']; $qtype = $_REQUEST['qtype']; $where = ""; $tipo = $usuario->getTipo($_SESSION['USU_ID']); $where = ""; if ($query != "") { if ($qtype == 'uni_id') { $where .= " and uni_id LIKE '{$query}' "; } elseif ($qtype == 'usu_nombres') { $where .= " and usu_nombres LIKE '%{$query}%' "; } else { $where .= " and {$qtype} LIKE '%{$query}%' "; } } $sql = "SELECT (SELECT tab_unidad.uni_id FROM tab_unidad WHERE tab_unidad.uni_id = tab_usuario.uni_id) AS uni_id, tab_usuario.usu_nombres, tab_usuario.usu_apellidos, tab_series.ser_categoria, tab_series.ser_id, tab_usuario.usu_id, tab_series.ser_tipo\r\n FROM tab_usuario Inner Join tab_usu_serie ON tab_usuario.usu_id = tab_usu_serie.usu_id Inner Join tab_series ON tab_usu_serie.ser_id = tab_series.ser_id\r\n WHERE tab_usuario.usu_estado = '1' AND tab_usu_serie.use_estado = '1' AND tab_series.ser_estado = '1' {$where} {$sort} {$limit}"; $sql2 = "SELECT (SELECT tab_unidad.uni_id FROM tab_unidad WHERE tab_unidad.uni_id = tab_usuario.uni_id) AS uni_id, tab_usuario.usu_nombres, tab_usuario.usu_apellidos, tab_series.ser_categoria, tab_usuario.usu_id, tab_series.ser_id, tab_series.ser_tipo\r\n FROM tab_usuario Inner Join tab_usu_serie ON tab_usuario.usu_id = tab_usu_serie.usu_id Inner Join tab_series ON tab_usu_serie.ser_id = tab_series.ser_id\r\n WHERE tab_usuario.usu_estado = '1' AND tab_usu_serie.use_estado = '1' AND tab_series.ser_estado = '1'"; $exp = new expediente(); $total = $expediente->dbSelectBySQL($sql2); $total = count($total); $result = $expediente->dbSelectBySQL($sql); // Header header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-type: text/x-json"); $json = ""; $json .= "{\n"; $json .= "page: {$page},\n"; $json .= "total: {$total},\n"; $json .= "rows: ["; $rc = false; $i = 0; $expusu = new Tab_expusuario(); foreach ($result as $un) { if ($rc) { $json .= ","; } $ser_id = $un->ser_id; $usu_id = $un->usu_id; // REVISED: CASTELLON // NUMBER EXPEDIENTS USER $sql = "SELECT count(tab_expusuario.eus_id) as con\r\n FROM tab_expediente Inner Join tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n WHERE tab_expediente.exp_estado = '1' AND tab_expusuario.eus_estado = '1' AND tab_expediente.ser_id = '{$ser_id}' AND tab_expusuario.usu_id = '{$usu_id}'"; $count = $expediente->dbSelectBySQL($sql); $count = $count[0]; $sDate = date("Y-m-d", time() + 0 * 24 * 60 * 60); //include 'includes/init.php'; $sql = "SELECT tab_usuario.usu_login, tab_expfondo.exf_id, tab_expfondo.exp_id, tab_expfondo.fon_id, tab_expfondo.exf_fecha_exi, tab_expfondo.exf_fecha_exf, tab_usuario.usu_login, tab_expediente.ser_id\r\n FROM tab_expfondo Inner Join tab_expusuario ON tab_expfondo.exp_id = tab_expusuario.exp_id Inner Join tab_usuario ON tab_expusuario.usu_id = tab_usuario.usu_id Inner Join tab_expediente ON tab_expfondo.exp_id = tab_expediente.exp_id\r\n WHERE tab_expfondo.fon_id = '1' AND tab_expfondo.exf_estado = '1' AND tab_expfondo.exf_fecha_exf <= '{$sDate}' AND tab_usuario.usu_estado = '1' AND tab_expediente.ser_id = '{$ser_id}' AND tab_expediente.exp_estado = '1' AND tab_usuario.usu_id = '{$usu_id}'\r\n ORDER BY tab_expfondo.exf_fecha_exf ASC"; $countF = $expediente->dbSelectBySQL($sql); if (count($countF)) { $countF = $countF[0]; $countF = $countF->conf; } else { $countF = 0; } $json .= "\n{"; $json .= "id:'" . $un->uni_id . "',"; $json .= "cell:['" . $un->uni_id . "'"; $json .= ",'" . addslashes($un->usu_nombres) . "'"; $json .= ",'" . addslashes($un->usu_apellidos) . "'"; $json .= ",'" . addslashes($un->ser_categoria) . "'"; $json .= ",'" . addslashes($un->ser_tipo) . "'"; $json .= ",'" . addslashes($count->con) . "'"; $json .= ",'" . addslashes($countF) . "'"; $json .= "]}"; $rc = true; $i++; } $json .= "]\n"; $json .= "}"; echo $json; }