function buscar2($busquedaArray) { $valor = ""; $id_listar = ""; if (isset($_SESSION['id_lista'])) { $id_listar = $_SESSION['id_lista']; } $page = $busquedaArray['page']; $rp = $busquedaArray['rp']; $sortname = $busquedaArray['sortname']; $sortorder = $busquedaArray['sortorder']; // // $fon_id = $busquedaArray['fon_id']; // Search $archivo = new archivo(); $tarchivo = new tab_archivo(); $tarchivo->setRequest2Object($_REQUEST); $page = $_REQUEST['page']; $rp = $_REQUEST['rp']; $sortname = $_REQUEST['sortname']; $sortorder = $_REQUEST['sortorder']; if (!$sortname) { $sortname = 'fil_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 = ""; if ($query) { if ($qtype == 'fil_id') { $where = " WHERE {$qtype} = '{$query}' "; } else { $where = " WHERE {$qtype} LIKE '%{$query}%' "; } $sql = "SELECT *\r\n FROM tab_rol\r\n {$where} AND\r\n rol_estado = 1 {$sort} {$limit} "; } else { $sql = "SELECT *\r\n FROM tab_rol\r\n WHERE rol_estado = 1 {$sort} {$limit} "; } $usu_id = $_SESSION['USU_ID']; $select = "SELECT\r\n tab_archivo.fil_id,\r\n (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) AS fon_codigo,\r\n tab_unidad.uni_descripcion,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n f.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_id,\r\n tab_expediente.exp_codigo,\r\n tab_cuerpos.cue_codigo,\r\n tab_archivo.fil_codigo,\r\n tab_cuerpos.cue_descripcion,\r\n tab_archivo.fil_titulo,\r\n tab_archivo.fil_subtitulo,\r\n tab_archivo.fil_proc,\r\n tab_archivo.fil_firma,\r\n tab_archivo.fil_cargo,\r\n tab_archivo.fil_nrofoj,\r\n tab_archivo.fil_tomovol,\r\n tab_archivo.fil_nroejem,\r\n tab_archivo.fil_nrocaj,\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_cuerpo,\r\n tab_archivo.fil_balda,\r\n tab_archivo.fil_tipoarch,\r\n tab_archivo.fil_mrb,\r\n tab_archivo.fil_ori,\r\n tab_archivo.fil_cop,\r\n tab_archivo.fil_fot,\r\n (CASE tab_exparchivo.exa_condicion\r\n WHEN '1' THEN 'DISPONIBLE'\r\n WHEN '2' THEN 'PRESTADO' END) AS disponibilidad,\r\n (SELECT fil_nomoriginal FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_nomoriginal,\r\n (SELECT fil_extension FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_extension,\r\n (SELECT fil_tamano/1048576 FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_tamano,\r\n (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur,\r\n (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto,\r\n tab_archivo.fil_obs"; $from = "FROM\r\n tab_fondo as f\r\n INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n WHERE\r\n f.fon_estado = 1 AND\r\n tab_unidad.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_archivo.fil_estado = 1 AND\r\n tab_exparchivo.exa_estado = 1 AND\r\n tab_expusuario.eus_estado = 1 AND\r\n tab_expusuario.usu_id='{$usu_id}'"; $where = ""; // if (strlen($fon_id)> 0 && $fon_id!='null') { // $where .= " AND tab_fondo.fon_id='$fon_id' "; // } // Search addwords if ($id_listar != "") { $explode = explode(",", $id_listar); $cantidad = count($explode); for ($i = 0; $i < $cantidad; $i++) { $valor .= "tab_archivo.fil_id=" . $explode[$i]; if ($i < $cantidad - 1) { $valor .= " or "; } } $where .= " AND {$valor} "; } $sql = "{$select} {$from} {$where} {$sort} {$limit}"; $result = $tarchivo->dbSelectBySQL($sql); //print $sql; $sql_c = "SELECT COUNT(tab_archivo.fil_id) {$from} {$where} "; $total = $tarchivo->countBySQL($sql_c); $exp = new expediente(); 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; $j = 1; foreach ($result as $un) { if ($rc) { $json .= ","; } $json .= "\n{"; $json .= "id:'" . $un->fil_id . "',"; //$json .= "cell:['" . $un->fil_id . "'"; $json .= "cell:["; $json .= "'<input id=\"chkid_" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"fil_chk" . $j . "\" type=\"checkbox\" value=\"" . $un->fil_id . "\" checked=\"checked\" />'"; if ($un->fil_confidencialidad == 3) { $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFileP icon\" />'"; } else { //$json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'"; $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-{$un->fil_extension}.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'"; ///web/lib/32/document-". $una->fil_extension .".png' } if ($un->fil_confidencialidad == 3) { $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewP icon\" />'"; } else { //$json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'"; $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"view icon\" />'"; ///web/lib/32/document-". $una->fil_extension .".png' } $json .= ",'" . $un->fil_id . "'"; $json .= ",'" . addslashes($un->fon_codigo) . "'"; $json .= ",'" . addslashes(utf8_decode($un->uni_descripcion)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->ser_categoria)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->exp_titulo)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->cue_descripcion)) . "'"; $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo . DELIMITER . $un->exp_codigo . DELIMITER . $un->cue_codigo . DELIMITER . $un->fil_codigo) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_titulo)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_proc)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_firma)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_cargo)) . "'"; $json .= ",'" . addslashes($un->fil_nrofoj) . "'"; $json .= ",'" . addslashes($un->fil_nrocaj) . "'"; $json .= ",'" . addslashes($un->fil_sala) . "'"; $json .= ",'" . addslashes($un->fil_estante) . "'"; $json .= ",'" . addslashes($un->fil_cuerpo) . "'"; $json .= ",'" . addslashes($un->fil_balda) . "'"; $json .= ",'" . addslashes($un->fil_tipoarch) . "'"; $json .= ",'" . addslashes($un->fil_mrb) . "'"; $json .= ",'" . addslashes($un->fil_ori) . "'"; $json .= ",'" . addslashes($un->fil_cop) . "'"; $json .= ",'" . addslashes($un->fil_fot) . "'"; $json .= ",'" . addslashes($un->fil_nur) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_asunto)) . "'"; $json .= ",'" . addslashes($un->disponibilidad) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_nomoriginal)) . "'"; $json .= ",'" . addslashes($un->fil_tamano) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_obs)) . "'"; $json .= "]}"; $rc = true; $i++; $j++; } $json .= "]\n"; $json .= "}"; echo $json; }
function rpteBuscar() { $archivo = new archivo(); $tarchivo = new tab_archivo(); $tarchivo->setRequest2Object($_REQUEST); $where = ""; // if (isset($_REQUEST ['fon_id'])) { // $where .= " AND tab_fondo.fon_id='$_REQUEST ['fon_id']' "; // } // if (isset($_REQUEST ['uni_id'])) { // $where .= " AND tab_unidad.uni_id='$_REQUEST ['uni_id']' "; // } // if (isset($_REQUEST ['ser_id'])) { // $where .= " AND tab_series.ser_id='$ser_id' "; // } // if (!is_null($_REQUEST ['tra_id'])) { // $where .= " AND tab_tramite.tra_id='$tra_id' "; // } // if (!is_null($_REQUEST ['cue_id'])) { // $where .= " AND tab_cuerpos.cue_id='$cue_id' "; // } // if (!is_null($_REQUEST ['exp_titulo'])) { // $where .= " AND tab_expisadg.exp_titulo='$exp_titulo' "; // } // if (!is_null($_REQUEST ['exf_fecha_exi'])) { // $where .= " AND tab_expisadg.exp_fecha_exi='$exf_fecha_exi' "; // } // if (!is_null($_REQUEST ['exf_fecha_exf'])) { // $where .= " AND tab_expisadg.exf_fecha_exf='$exf_fecha_exi' "; // } $usu_id = $_SESSION['USU_ID']; $select = "SELECT\r\n tab_archivo.fil_id,\r\n (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) AS fon_codigo,\r\n tab_unidad.uni_descripcion,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n f.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_id,\r\n tab_expediente.exp_codigo,\r\n tab_cuerpos.cue_codigo,\r\n tab_archivo.fil_codigo,\r\n tab_cuerpos.cue_descripcion,\r\n tab_archivo.fil_titulo,\r\n tab_archivo.fil_proc,\r\n tab_archivo.fil_firma,\r\n tab_archivo.fil_cargo,\r\n tab_archivo.fil_nrofoj,\r\n tab_archivo.fil_tomovol,\r\n tab_archivo.fil_nroejem,\r\n tab_archivo.fil_nrocaj,\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_cuerpo,\r\n tab_archivo.fil_balda,\r\n tab_archivo.fil_tipoarch,\r\n tab_archivo.fil_mrb,\r\n tab_archivo.fil_ori,\r\n tab_archivo.fil_cop,\r\n tab_archivo.fil_fot,\r\n (CASE tab_exparchivo.exa_condicion \r\n WHEN '1' THEN 'DISPONIBLE' \r\n WHEN '2' THEN 'PRESTADO' END) AS disponibilidad,\r\n (SELECT fil_nomoriginal FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_nomoriginal,\r\n (SELECT fil_extension FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_extension,\r\n (SELECT fil_tamano/1048576 FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_tamano,\r\n (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur, \r\n (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto, \r\n tab_archivo.fil_obs"; $from = "FROM\r\n tab_fondo as f\r\n INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n WHERE\r\n f.fon_estado = 1 AND\r\n tab_unidad.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_archivo.fil_estado = 1 AND\r\n tab_exparchivo.exa_estado = 1 AND\r\n tab_expusuario.eus_estado = 1 AND\r\n tab_expusuario.usu_id='{$usu_id}' "; // if (isset($_REQUEST ['fon_id'])) { // $where .= " AND tab_fondo.fon_id='$fon_id' "; // } // if (isset($_REQUEST ['uni_id'])) { // $where .= " AND tab_unidad.uni_id='$uni_id' "; // } // if (isset($_REQUEST ['ser_id'])) { // $where .= " AND tab_series.ser_id='$ser_id' "; // } // if (!is_null($_REQUEST ['tra_id'])) { // $where .= " AND tab_tramite.tra_id='$tra_id' "; // } // if (!is_null($_REQUEST ['cue_id'])) { // $where .= " AND tab_cuerpos.cue_id='$cue_id' "; // } // if (!is_null($_REQUEST ['exp_titulo'])) { // $where .= " AND tab_expisadg.exp_titulo='$exp_titulo' "; // } // if (!is_null($_REQUEST ['exf_fecha_exi'])) { // $where .= " AND tab_expisadg.exp_fecha_exi='$exf_fecha_exi' "; // } // if (!is_null($_REQUEST ['exf_fecha_exf'])) { // $where .= " AND tab_expisadg.exf_fecha_exf='$exf_fecha_exi' "; // } // $fil_nur // $fil_nur // $fil_titulo // $fil_descripcion $sql = "{$select} {$from} {$where} "; $result = $tarchivo->dbSelectBySQL($sql); $this->usuario = new usuario(); // PDF // Landscape require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Buscar Archivo '); $pdf->SetSubject('Reporte de Buscar Archivo '); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // aumentado $pdf->SetKeywords('Castellon, SISTEMA DE PASAJES Y VIÁTICOS'); // set default header data $pdf->SetHeaderData('logo2.png', 20, 'MPD', 'Administradora Boliviana de Carreteras'); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // $pdf->SetMargins(10, 30, 10); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); // $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 15); // $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->SetFont('helvetica', '', 6); // add a page $pdf->AddPage(); // Report $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false); $cadena = "<br/><br/><br/><br/><br/><br/>"; $cadena .= '<table width="780" border="0" >'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 30px;font-weight: bold;">'; $cadena .= 'Reporte de Búsqueda de Documentos'; $cadena .= '</span>'; $cadena .= '</td></tr>'; foreach ($result as $fila) { $cadena .= '<tr><td align="left">Código: ' . "" . '</td></tr>'; $cadena .= '<tr><td align="left">Sección Remitente: ' . "" . '</td></tr>'; $cadena .= '<tr><td align="left">Dirección y Teléfono: ' . "" . '</td></tr>'; $cadena .= '</table>'; break; } // Header $cadena .= '<table width="700" border="1">'; $cadena .= '<tr>'; $cadena .= '<td width="20"><div align="center"><strong>Nro.</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Fondo</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Sección</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Serie</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Expediente</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Tipo Doc.</strong></div></td>'; $cadena .= '<td width="80"><div align="center"><strong>Cod.Doc.</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Titulo</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Proc.</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Firma</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Cargo</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Nro.Foj.</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Nro.Caja</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Sala</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Estante</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Cuerpo</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Balda</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Tipo</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Estado</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Nro.Ori</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Nro.Cop</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Nro.Fot</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>NUR/NURI</strong></div></td>'; $cadena .= '<td width="30"><div align="center"><strong>Asunto/Ref.</strong></div></td>'; $cadena .= '<td width="40"><div align="center"><strong>Disponibilidad</strong></div></td>'; $cadena .= '<td width="50"><div align="center"><strong>Doc.Digital</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Tamaño</strong></div></td>'; $cadena .= '<td width="20"><div align="center"><strong>Obs.</strong></div></td>'; $cadena .= '</tr>'; $numero = 1; foreach ($result as $fila) { $cadena .= '<tr>'; $cadena .= '<td width="20"><div align="center">' . $numero . '</div></td>'; $cadena .= '<td width="20">' . $fila->fon_codigo . '</td>'; $cadena .= '<td width="50">' . $fila->uni_descripcion . '</td>'; $cadena .= '<td width="50">' . $fila->ser_categoria . '</td>'; $cadena .= '<td width="50">' . $fila->exp_titulo . '</td>'; $cadena .= '<td width="50">' . $fila->cue_descripcion . '</td>'; $cadena .= '<td width="80">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->cue_codigo . DELIMITER . $fila->fil_codigo . '</td>'; $cadena .= '<td width="50">' . $fila->fil_titulo . '</td>'; $cadena .= '<td width="20">' . $fila->fil_proc . '</td>'; $cadena .= '<td width="20">' . $fila->fil_firma . '</td>'; $cadena .= '<td width="20">' . $fila->fil_cargo . '</td>'; $cadena .= '<td width="20">' . $fila->fil_nrofoj . '</td>'; $cadena .= '<td width="20">' . $fila->fil_nrocaj . '</td>'; $cadena .= '<td width="20">' . $fila->fil_sala . '</td>'; $cadena .= '<td width="30">' . $fila->fil_estante . '</td>'; $cadena .= '<td width="30">' . $fila->fil_cuerpo . '</td>'; $cadena .= '<td width="20">' . $fila->fil_balda . '</td>'; $cadena .= '<td width="20">' . $fila->fil_tipoarch . '</td>'; $cadena .= '<td width="30">' . $fila->fil_mrb . '</td>'; $cadena .= '<td width="30">' . $fila->fil_ori . '</td>'; $cadena .= '<td width="30">' . $fila->fil_cop . '</td>'; $cadena .= '<td width="30">' . $fila->fil_fot . '</td>'; $cadena .= '<td width="30">' . $fila->fil_nur . '</td>'; $cadena .= '<td width="30">' . $fila->fil_asunto . '</td>'; $cadena .= '<td width="40">' . $fila->disponibilidad . '</td>'; $cadena .= '<td width="50">' . $fila->fil_nomoriginal . '</td>'; $cadena .= '<td width="20">' . $fila->fil_tamano . '</td>'; $cadena .= '<td width="20">' . $fila->fil_obs . '</td>'; $cadena .= '</tr>'; $numero++; } $cadena .= '</table>'; $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_buscar_archivo.pdf', 'I'); }
function loadDoc() { // Search $usuario = new usuario(); $tarchivo = new tab_archivo(); $tarchivo->setRequest2Object($_REQUEST); // Hasta aqui $valor = ""; $id_listar = ""; if (isset($_SESSION['id_lista'])) { $id_listar = $_SESSION['id_lista']; } $page = $_REQUEST['page']; $rp = $_REQUEST['rp']; $sortname = $_REQUEST['sortname']; $sortorder = $_REQUEST['sortorder']; if (!$sortname) { $sortname = " f.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_series.ser_orden,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo::int,\r\n tab_archivo.fil_nro::int "; } else { $sortname = $sortname; } if (!$sortorder) { $sortorder = 'desc'; } $sort = "ORDER BY {$sortname} {$sortorder}"; if (!$page) { $page = 1; } if (!$rp) { $rp = 20; } $start = ($page - 1) * $rp; $limit = "LIMIT {$rp} OFFSET {$start} "; $query = $_REQUEST['query']; $qtype = $_REQUEST['qtype']; $where = ""; if ($query) { if ($qtype) { } } $whereUsuario = ""; $usu_id = $_SESSION['USU_ID']; if ($_SESSION['ROL_COD'] != 'AA') { $whereUsuario = " AND tab_expusuario.usu_id=" . $_SESSION['USU_ID'] . ""; } // Search docs $select = "SELECT\r\n tab_expediente.exp_id,\r\n tab_archivo.fil_id,\r\n f.fon_codigo,\r\n f.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n tab_archivo.fil_nro,\r\n tab_unidad.uni_descripcion,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n tab_cuerpos.cue_descripcion,\r\n tab_archivo.fil_confidencialidad,\r\n tab_archivo.fil_titulo,\r\n tab_archivo.fil_subtitulo,\r\n tab_archivo.fil_proc,\r\n tab_archivo.fil_firma,\r\n tab_archivo.fil_cargo,\r\n tab_archivo.fil_nrofoj,\r\n tab_archivo.fil_tomovol,\r\n tab_archivo.fil_nroejem,\r\n tab_archivo.fil_nrocaj,\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_cuerpo,\r\n tab_archivo.fil_balda,\r\n tab_archivo.fil_tipoarch,\r\n tab_archivo.fil_mrb,\r\n tab_archivo.fil_ori,\r\n tab_archivo.fil_cop,\r\n tab_archivo.fil_fot,\r\n (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur,\r\n (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto,\r\n tab_archivo.fil_obs,\r\n tab_expusuario.usu_id"; $from = "FROM\r\n tab_fondo as f\r\n INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n LEFT JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n WHERE\r\n f.fon_estado = 1 AND\r\n tab_unidad.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_archivo.fil_estado = 1 AND\r\n tab_exparchivo.exa_estado = 1 AND\r\n tab_expusuario.eus_estado = 1\r\n {$whereUsuario} "; $where = ""; // Search addwords if ($id_listar != "") { $explode = explode(",", $id_listar); $cantidad = count($explode); if ($cantidad > 0) { $valor .= "tab_archivo.fil_id=0 OR "; for ($i = 0; $i < $cantidad; $i++) { $valor .= "tab_archivo.fil_id=" . $explode[$i]; if ($i < $cantidad - 1) { $valor .= " or "; } } } $where .= " AND {$valor} "; } // MODIFICADO //$sort = "ORDER BY tab_expediente.exp_id, tab_cuerpos.cue_id, tab_archivo.fil_nro "; //$sort = "ORDER BY tab_series.ser_orden, tab_expediente.exp_codigo::int, tab_archivo.fil_nro::int "; $sql = "{$select} {$from} {$where} {$sort} {$limit}"; $result = $tarchivo->dbSelectBySQL($sql); //print $sql; $sql_c = "SELECT COUNT(tab_archivo.fil_id) {$from} {$where} "; $total = $tarchivo->countBySQL($sql_c); $exp = new expediente(); 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; $j = 1; $exp_titulo = ""; foreach ($result as $un) { // Documento if ($rc) { $json .= ","; } $json .= "\n{"; $json .= "id:'" . $un->fil_id . "',"; $json .= "cell:["; $json .= "'<input id=\"chkid_" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"fil_chk" . $j . "\" type=\"checkbox\" value=\"" . $un->fil_id . "\" checked=\"checked\" />'"; // $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-$un->fil_extension.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'"; $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'"; $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"view icon\" />'"; $json .= ",'" . $un->fil_id . "'"; $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo . DELIMITER . $un->exp_codigo . DELIMITER . $un->fil_nro) . "'"; $json .= ",'" . addslashes($usuario->getRol($un->usu_id)) . "'"; $json .= ",'" . addslashes($un->fon_codigo) . "'"; $json .= ",'" . addslashes(utf8_decode($un->uni_descripcion)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->ser_categoria)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->exp_titulo)) . "'"; //$json .= ",'" . addslashes(utf8_decode($un->cue_descripcion)) . "'"; if ($un->fil_subtitulo) { $json .= ",'" . addslashes(utf8_decode($un->fil_titulo . " - " . $un->fil_subtitulo)) . "'"; } else { $json .= ",'" . addslashes(utf8_decode($un->fil_titulo)) . "'"; } $json .= ",'" . addslashes($un->fil_tomovol) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_proc)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_firma)) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_cargo)) . "'"; $json .= ",'" . addslashes($un->fil_nrofoj) . "'"; $json .= ",'" . addslashes($un->fil_nrocaj) . "'"; $json .= ",'" . addslashes($un->fil_sala) . "'"; $json .= ",'" . addslashes($un->fil_estante) . "'"; $json .= ",'" . addslashes($un->fil_cuerpo) . "'"; $json .= ",'" . addslashes($un->fil_balda) . "'"; $json .= ",'" . addslashes($un->fil_tipoarch) . "'"; $json .= ",'" . addslashes($un->fil_mrb) . "'"; $json .= ",'" . addslashes($un->fil_ori) . "'"; $json .= ",'" . addslashes($un->fil_cop) . "'"; $json .= ",'" . addslashes($un->fil_fot) . "'"; //palabras clave $palclave = new palclave(); $fil_palclave = $palclave->listaPCFile($un->fil_id); $json .= ",'" . addslashes($fil_palclave) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_obs)) . "'"; // SIACO $json .= ",'" . addslashes($un->fil_nur) . "'"; $json .= ",'" . addslashes(utf8_decode($un->fil_asunto)) . "'"; $json .= "]}"; $rc = true; $i++; $j++; } $json .= "]\n"; $json .= "}"; echo $json; }