function allSeriesSeleccionado($idUsuario) { $liMenu = ""; $sql = "SELECT\r\n tab_unidad.uni_id,\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_unidad.uni_descripcion\r\n FROM\r\n tab_unidad\r\n INNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\n WHERE uni_estado = '1'\r\n ORDER by fon_cod, uni_cod "; $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_id,\r\n tab_unidad.uni_cod,\r\n tab_unidad.uni_descripcion,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_id,\r\n tab_series.ser_codigo,\r\n tab_series.ser_categoria,\r\n tab_series.ser_nivel\r\n FROM\r\n tab_series\r\n INNER JOIN tab_unidad ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n WHERE tab_series.ser_estado = '1'\r\n ORDER BY tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_series.ser_orden,\r\n ser_codigo "; $rows = $this->usuario->dbselectBySQL($sql); $row1 = 1; $i = 0; $uni_id = 0; foreach ($rows as $menus) { if ($menus->uni_id != $uni_id) { $liMenu .= "<tr class='erow evenw' id='" . $menus->uni_id . "'>"; $liMenu .= "<td align='right' class='sorted'>"; $liMenu .= "<div style='text-align: right; width: 50px;'>" . "" . "</div>"; $liMenu .= "</td>"; $liMenu .= "<td align='center'>"; $liMenu .= "<div style='text-align: center; width: 50px;'> Sección</div>"; $liMenu .= "</td>"; $liMenu .= "<td align='left'>"; $liMenu .= "<div style='text-align: left; width: 150px;'>" . $menus->fon_cod . DELIMITER . $menus->uni_cod . "</div>"; $liMenu .= "</td>"; $liMenu .= "<td align='left'>"; $liMenu .= "<div style='text-align: left; width: 600px;'>" . $menus->uni_descripcion . "</div>"; $liMenu .= "</td>"; $liMenu .= "</tr>"; $row1++; $i++; $uni_id = $menus->uni_id; } else { $series = new series(); $spaces = $series->getSpaces($menus->ser_nivel); $sql3 = "SELECT\r\n tab_usu_serie.usu_id,\r\n tab_usu_serie.ser_id\r\n FROM tab_usu_serie\r\n WHERE tab_usu_serie.usu_id = '" . $idUsuario . "'\r\n AND tab_usu_serie.ser_id = '" . $menus->ser_id . "'\r\n AND tab_usu_serie.use_estado=1\r\n ORDER BY tab_usu_serie.use_id "; $chek1 = ""; $rowChek = $this->usuario->dbselectBySQL($sql3); if (count($rowChek) > 0) { $chek1 = "checked"; } $liMenu .= "<tr " . ($row1 % 2 ? "class='" . $menus->uni_id . "z'" : "class='erow " . $menus->uni_id . "z'") . " >"; $liMenu .= "<td align='right' class='sorted' >"; $liMenu .= "<div style='text-align: right; width: 50px;'>" . $menus->ser_id . "</div>"; $liMenu .= "</td>"; $liMenu .= "<td align='center'>"; $liMenu .= "<div style='text-align: center; width: 50px;'>"; $liMenu .= "<input name='lista_serie[{$i}]' type='checkbox' value='" . $menus->ser_id . "' " . $chek1 . ">"; $liMenu .= "</div>"; $liMenu .= "</td>"; $liMenu .= "<input type='hidden' name='id_menu[{$i}]' value='" . $menus->ser_id . "'>"; $liMenu .= "<td align='left'>"; $liMenu .= "<div style='text-align: left; width: 150px;'>" . $menus->fon_cod . DELIMITER . $menus->uni_cod . DELIMITER . $menus->tco_codigo . DELIMITER . $menus->ser_codigo . "</div>"; $liMenu .= "</td>"; $liMenu .= "<td align='left'>"; $liMenu .= "<div style='text-align: left; width: 600px;'>" . $spaces . $menus->ser_categoria . "</div>"; $liMenu .= "</td>"; $liMenu .= "</tr>"; $row1++; $i++; $uni_id = $menus->uni_id; } } return $liMenu; }
function loadSerie() { $this->expediente = new tab_expediente(); $this->expediente->setRequest2Object($_REQUEST); $page = $_REQUEST['page']; $rp = $_REQUEST['rp']; $sortname = $_REQUEST['sortname']; $sortorder = $_REQUEST['sortorder']; if (!$sortname) { $sortname = " tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n s.ser_orden,\r\n s.ser_codigo "; } if (!$sortorder) { $sortorder = 'desc'; } $sort = "ORDER BY {$sortname} {$sortorder}"; if (!$page) { $page = 1; } if (!$rp) { $rp = 10; } $start = ($page - 1) * $rp; $limit = "LIMIT {$rp} OFFSET {$start} "; $query = strtoupper(trim($_REQUEST['query'])); $qtype = $_REQUEST['qtype']; $where = ""; if ($query != "") { $_SESSION["SER_ID"] = null; if ($qtype == 'ser_id') { $where .= " and s.ser_id = '{$query}' "; } elseif ($qtype == 'ser_categoria') { $where .= " and s.ser_categoria LIKE '%{$query}%' "; } elseif ($qtype == 'uni_descripcion') { $where .= " and tab_unidad.uni_descripcion LIKE '%{$query}%' "; } elseif ($qtype == 'fon_codigo') { $where .= " and tab_fondo.fon_descripcion LIKE '%{$query}%' "; } else { $where .= " and {$qtype} LIKE '%{$query}%' "; } } else { // Serie if (VAR3) { $_SESSION["SER_ID"] = VAR3; } // else{ // $_SESSION ["SER_ID"] = null; // } } if ($_SESSION["SER_ID"]) { $where .= " AND s.ser_id='" . $_SESSION['SER_ID'] . "'"; } $usu_id = $_SESSION['USU_ID']; if ($_SESSION["ROL_COD"] != 'AA') { $where .= " AND tab_usu_serie.usu_id={$usu_id} "; } $sql = "SELECT\tdistinct\r\n tab_fondo.fon_codigo,\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_unidad.uni_descripcion,\r\n tab_tipocorr.tco_codigo,\r\n s.ser_id,\r\n s.ser_par,\r\n s.ser_codigo,\r\n s.ser_categoria,\r\n s.ser_orden,\r\n s.ser_nivel\r\n FROM\r\n tab_series AS s\r\n INNER JOIN tab_unidad ON tab_unidad.uni_id = s.uni_id\r\n INNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = s.tco_id\r\n INNER JOIN tab_usu_serie ON tab_usu_serie.ser_id = s.ser_id\r\n WHERE\r\n s.ser_estado = '1'\r\n AND tab_usu_serie.use_estado = '1'\r\n {$where}\r\n {$sort}\r\n {$limit} "; $result = $this->expediente->dbSelectBySQL($sql); $total = $this->expediente->countBySQL("SELECT COUNT (distinct s.ser_id)\r\n FROM\r\n tab_series AS s\r\n INNER JOIN tab_unidad ON tab_unidad.uni_id = s.uni_id\r\n INNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = s.tco_id\r\n INNER JOIN tab_usu_serie ON tab_usu_serie.ser_id = s.ser_id\r\n WHERE\r\n s.ser_estado = '1'\r\n AND tab_usu_serie.use_estado = '1'\r\n {$where}"); 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; foreach ($result as $un) { if ($rc) { $json .= ","; } $json .= "\n{"; $json .= "id:'" . $un->ser_id . "',"; $json .= "cell:['" . $un->ser_id . "'"; $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo) . "'"; $json .= ",'" . addslashes($un->fon_codigo) . "'"; $json .= ",'" . addslashes($un->uni_descripcion) . "'"; if ($un->ser_par == '-1') { $json .= ",'" . addslashes($un->ser_categoria) . "'"; } else { $series = new series(); $spaces = $series->getSpaces($un->ser_nivel); $json .= ",'" . addslashes($spaces . " " . utf8_decode($un->ser_categoria)) . "'"; } $json .= "]}"; $rc = true; $i++; } $json .= "]\n"; $json .= "}"; echo $json; }
function loadAjaxSeries() { $uni_id = $_POST["Uni_id"]; $sql = "SELECT\r\n ser_id,\r\n ser_par,\r\n ser_nivel,\r\n ser_categoria\r\n\t\tFROM\r\n\t\ttab_series\r\n\t\tWHERE\r\n tab_series.ser_estado = '1' AND\r\n tab_series.uni_id = '{$uni_id}'\r\n ORDER BY ser_codigo "; $tab_series = new tab_series(); $result = $tab_series->dbSelectBySQL($sql); $res = array(); $series = new series(); foreach ($result as $row) { if ($row->ser_par == '-1') { $res[$row->ser_id] = $row->ser_categoria; } else { $spaces = $series->getSpaces($row->ser_nivel); $res[$row->ser_id] = $spaces . " " . $row->ser_categoria; } } echo json_encode($res); }