function verRpte_serie() { // $tipo_orden = $_REQUEST["tipo_orden"]; $filtro_series = $_REQUEST["filtro_series"]; if (isset($_REQUEST["filtro_expediente"])) { $filtro_expediente = $_REQUEST["filtro_expediente"]; } else { $filtro_expediente = ""; } // $order_by = ""; // if ($tipo_orden == 'SERIE') { // $order_by.=" ORDER BY ts.ser_categoria ASC"; // } // if ($tipo_orden == 'NOMBRE_EXPEDIENTE') { // $order_by.=" ORDER BY te.exp_nombre ASC"; // } // if ($tipo_orden == 'CODIGO_REFERENCIA') { // $order_by.=" ORDER BY te.exp_codigo ASC"; // } // if ($tipo_orden == 'FECHA_EXI') { // $order_by.=" ORDER BY tef.exf_fecha_exi ASC"; // } // if ($tipo_orden == 'FECHA_EXF') { // $order_by.=" ORDER BY tef.exf_fecha_exf ASC"; // } //para el where $where = ""; $where .= " AND tab_usuario.usu_id = '" . $_SESSION["USU_ID"] . "' "; //filtros if ($filtro_expediente != '') { $where .= " AND tab_expediente.exp_id = '{$filtro_expediente}' "; } //para la fecha de la cabezera $fecha_actual = date("d/m/Y"); $sql = "SELECT\r\ntab_solprestamo.spr_id,\r\ntab_fondo.fon_cod,\r\ntab_unidad.uni_codigo,\r\ntab_series.ser_codigo,\r\ntab_expediente.exp_codigo,\r\ntab_archivo.fil_codigo,\r\ntab_solprestamo.spr_fecha,\r\ntab_solprestamo.uni_id,\r\n(SELECT usu_nombres || ' ' || usu_apellidos FROM tab_usuario WHERE usu_id = tab_solprestamo.usu_id AND usu_estado = '1') AS usu_solicitante,\r\ntab_solprestamo.spr_solicitante,\r\ntab_solprestamo.spr_email,\r\ntab_solprestamo.spr_tel,\r\ntab_solprestamo.spr_fecent,\r\ntab_solprestamo.spr_fecren,\r\n(SELECT usu_nombres || ' ' || usu_apellidos FROM tab_usuario WHERE usu_id = tab_solprestamo.usua_id AND usu_estado = '1') AS usu_autoriza,\r\n(SELECT usu_nombres || ' ' || usu_apellidos FROM tab_usuario WHERE usu_id = tab_solprestamo.usur_id AND usu_estado = '1') AS usu_registrado,\r\ntab_solprestamo.spr_fecdev,\r\ntab_solprestamo.spr_obs,\r\ntab_solprestamo.spr_estado,\r\ntab_docprestamo.fil_id,\r\ntab_docprestamo.dpr_orden,\r\ntab_docprestamo.dpr_obs,\r\ntab_archivo.fil_titulo,\r\ntab_archivo.fil_proc,\r\ntab_archivo.fil_tomovol,\r\ntab_archivo.fil_ori,\r\ntab_archivo.fil_cop,\r\ntab_archivo.fil_fot,\r\ntab_archivo.fil_sala,\r\ntab_archivo.fil_estante,\r\ntab_archivo.fil_cuerpo,\r\ntab_archivo.fil_balda,\r\ntab_archivo.fil_nrocaj,\r\ntab_archivo.fil_obs,\r\ntab_expisadg.exp_fecha_exi,\r\ntab_expisadg.exp_fecha_exf,\r\ntab_sopfisico.sof_codigo,\r\ntab_unidad.uni_descripcion,\r\ntab_expisadg.exp_titulo,\r\ntab_series.ser_id,\r\ntab_expediente.exp_id\r\nFROM\r\ntab_solprestamo\r\nINNER JOIN tab_docprestamo ON tab_solprestamo.spr_id = tab_docprestamo.spr_id\r\nINNER JOIN tab_archivo ON tab_archivo.fil_id = tab_docprestamo.fil_id\r\nINNER JOIN tab_exparchivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\nINNER JOIN tab_expediente ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\nINNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\nINNER JOIN tab_series ON tab_series.ser_id = tab_expediente.ser_id\r\nINNER JOIN tab_unidad ON tab_unidad.uni_id = tab_series.uni_id\r\nINNER JOIN tab_fondo ON tab_fondo.fon_id = tab_unidad.fon_id\r\nINNER JOIN tab_sopfisico ON tab_sopfisico.sof_id = tab_archivo.sof_id\r\nWHERE\r\ntab_series.ser_id = {$filtro_series} {$where} ORDER BY tab_expediente.exp_id"; //echo ($sql); die (); $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Archivos'); $pdf->SetSubject('Reporte de Archivos'); // aumentado $pdf->SetKeywords('Castellon, TEAM DIGITAL'); // 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->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(5, 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); //set some language-dependent strings $pdf->setLanguageArray($l); $pdf->SetFont('helvetica', '', 8); // add a page $pdf->AddPage(); // $pdf->SetXY(110, 200); $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/><br/><br/>"; $cadena .= '<table width="760" border="0" >'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 30px;font-weight: bold;">'; $cadena .= 'REPORTE DE ARCHIVOS REGISTRADOS POR FUNCIONARIO'; $cadena .= '</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr><td align="left">Fecha de Elaboracion: ' . $fecha_actual . '</td></tr>'; if (count($result) > 0) { $cadena .= '<tr><td align="left"> Funcionario: ' . $result[0]->usu_nombre . ' </td></tr>'; $cadena .= '<tr><td align="left"> Unidad: ' . $result[0]->uni_descripcion . ' <br/></td></tr>'; $cadena .= '</table>'; $cadena .= '<br/>'; } $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr align="center" bgcolor="#CCCCCC">'; $cadena .= '<td width="20"><span style="font-size: 10px;font-weight: bold;">Nro</span></td>'; $cadena .= '<td width="110"><span style="font-size: 10px;font-weight: bold;">Nombre</span></td>'; $cadena .= '<td width="110"><span style="font-size: 10px;font-weight: bold;">Descripción</span></td>'; $cadena .= '<td width="80"><span style="font-size: 10px;font-weight: bold;">Característica</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;font-weight: bold;">NUR</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;font-weight: bold;">N Ejemplar</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;font-weight: bold;">Tomo/ Volumen</span></td>'; $cadena .= '<td width="100"><span style="font-size: 10px;font-weight: bold;">Tramite</span></td>'; $cadena .= '<td width="100"><span style="font-size: 10px;font-weight: bold;">Cuerpo</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;font-weight: bold;">Sop. Físico</span></td>'; $cadena .= '</tr>'; $numero = 1; $aux = 0; foreach ($result as $fila) { $exp_id = $fila->exp_id; if ($exp_id != $aux) { $cadena .= '<tr><td colspan="10" width="760"><span style="font-size: 10px;">' . $fila->expediente . '</span></td></tr>'; $aux = $exp_id; } $cadena .= '<tr>'; $cadena .= '<td width="20"><span style="font-size: 10px;">' . $numero . '</span></td>'; $cadena .= '<td width="110"><span style="font-size: 10px;">' . $fila->fil_nomoriginal . '</span></td>'; $cadena .= '<td width="110"><span style="font-size: 10px;">' . $fila->fil_descripcion . '</span></td>'; $cadena .= '<td width="80"><span style="font-size: 10px;">' . $fila->fil_caracteristica . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;">' . $fila->fil_nur . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;">' . $fila->fil_nroejem . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;">' . $fila->fil_tomovol . '</span></td>'; $cadena .= '<td width="100"><span style="font-size: 10px;">' . $fila->tra_descripcion . '</span></td>'; $cadena .= '<td width="100"><span style="font-size: 10px;">' . $fila->cue_descripcion . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 10px;">' . $fila->sof_nombre . '</span></td>'; $cadena .= '</tr >'; $numero++; } $cadena .= '</table>'; //echo ($cadena); $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_expediente.pdf', 'I'); }
function exportar() { // $zip = new zipArchive2(); // //$zip->addFile($path, $codigo); // $dir = getcwd() . "/img/"; // $dirs = getcwd() . "/uploads/"; // $zip->addDir('paver'); // $zip->addFile($dir.'1Z0-0511.pdf', 'paver/1Z0-0511.pdf'); // $pathSave = $dirs . "algo.zip"; // $zip->saveZip($pathSave); // $zip->downloadZip($pathSave); $fil = new Tab_archivo(); $exp = new Tab_expediente(); $fil_zip = ''; $fil->setRequest2Object($_REQUEST); $msg = 'Hubo un error al exportar los archivos intentelo de nuevo.'; /////$cid = @ftp_connect (PATH_FTPHOST); try { if (isset($_REQUEST) && strlen($_REQUEST['fil_ids']) > 0) { $fil_ids = substr($_REQUEST['fil_ids'], 0, -1); //selección de los expedientes para conformar las carpetas $sql = "SELECT DISTINCT\r\n te.exp_id,\r\n te.exp_nombre,\r\n te.exp_codigo\r\n FROM\r\n tab_expediente AS te\r\n Inner Join tab_exparchivo AS tea ON tea.exp_id = te.exp_id\r\n WHERE\r\n tea.fil_id IN({$fil_ids}) AND\r\n tea.exa_estado = '1' \r\n ORDER BY 1"; $rows = $exp->dbSelectBySQL($sql); if (count($rows) > 0) { // $dir = getcwd() . "\upload\\"; //realpath("/"); $dir = getcwd() . "/uploads/"; //realpath("/"); //$fil_origen = "Nuevo.zip"; $fil_destino = "Export_" . date("Ymd_His") . "_" . $_SESSION['USU_ID'] . ".zip"; //$ftp_destino = ftp_pwd($cid); //copy($dir.$fil_origen, $dir.$fil_destino ); //print_r(ftp_site($cid, "cp archivo.txt $fil_destino")); // archivo a copiar/subir //ftp_get($cid, $fil_destino, $fil_origen, FTP_BINARY); //ftp_put($cid, $fil_destino, $fil_origen, FTP_BINARY); //ftp_put($cid, $dir.$fil_destino, $fil_destino, FTP_BINARY); //echo $fil_destino."--".$fil_origen; // $dir_array = array(); // $zip = new ZipArchive(); $zip = new zipArchive2(); $fil_zip = $dir . $fil_destino; // $res = $zip->open($fil_zip, ZipArchive::CREATE); // if ($res === TRUE) { // $i = 0; $dir_destinosw = ''; foreach ($rows as $exp) { //creamos la carpeta $dir_destino = substr(addslashes($exp->exp_nombre), 0, 30) . "_" . $exp->exp_codigo; //$dir_array[$i++] = $dir_destino; //@ftp_mkdir($cid, $dir_destino); //$msg = $dir_destino; // if ($zip->addEmptyDir($dir_destino)) { if ($dir_destino == !$dir_destinosw) { $zip->addDir($dir_destino); } $sql_fil = "SELECT DISTINCT\r\n ta.fil_id,\r\n ta.fil_nomcifrado,\r\n ta.fil_nomoriginal,\r\n ta.fil_extension, \r\n tab.archivo_bytea\r\n FROM\r\n tab_archivo AS ta\r\n INNER JOIN tab_archivo_digital tab ON ta.fil_id = tab.fil_id\r\n Inner Join tab_exparchivo AS tea ON tea.fil_id = ta.fil_id\r\n WHERE\r\n ta.fil_id IN ({$fil_ids}) AND\r\n tea.exp_id = '{$exp->exp_id}' AND\r\n ta.fil_estado = '1' "; //echo($sql_fil." ... ");$i++;if($i==3) die(" fin"); $r_files = $fil->dbSelectBySQLArchive($sql_fil); if (count($r_files) > 0) { foreach ($r_files as $file) { $fil_origen = $file->fil_nomcifrado; $fil_destino = $file->fil_nomoriginal; // $zip->addFromString($dir_destino . '/' . $fil_destino . "." . $file->fil_extension); $dirAr = getcwd() . '/img/' . $fil_destino . "." . $file->fil_extension; $zip->addFile($dirAr, $dir_destino . "/" . $fil_destino . "." . $file->fil_extension); } $msg = "ok"; } else { $msg .= "<br>No se encontraron archivos"; } // } else { // $msg.="<br>NO CREO EL DIRECTORIO " . $dir_destino; // } $dir_destinosw = $dir_destino; } $zip->saveZip($fil_zip); // $zip->close(); // $msg = 'OK'; // } else { // $msg.="<br>No se pudo abrir el archivo zip"; // } } else { $msg .= "<br>No existen expedientes relacionados al(los) archivo(s)"; } } else { $msg .= "<br>No existen archivos a exportar"; } } catch (Exception $e) { // @ftp_close ( $cid ); } $msg = 'OK'; $arr = array('res' => $msg, 'archivo' => $fil_zip); echo json_encode($arr); //echo $msg; }
function verRpteDoc() { $filtro_expediente = $_REQUEST["exp_id"]; $filtro_serie = $_REQUEST["ser_id"]; $where = ""; //PARA LA ORDENACION SOLO SE ESCOJE UNA OPCION $order_by = ""; $order_by .= " ORDER BY tab_archivo.fil_codigo, tab_archivo.fil_titulo ASC "; //PARA LOS FILTROS if ($filtro_expediente != '') { $where .= " AND tab_expediente.exp_id = '{$filtro_expediente}' "; } $sqlh = "SELECT\r\n fonp.fon_descripcion as fondes,\r\n tab_fondo.fon_descripcion,\r\n sec.uni_descripcion AS seccion,\r\n\t\ttab_fondo.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_unidad.uni_descripcion,\r\n tab_unidad.uni_codigo,\r\n tab_rol.rol_titulo,\r\n tab_rol.rol_cod,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n (SELECT COUNT (DISTINCT arc.fil_nrocaj)\r\n FROM tab_archivo as arc INNER JOIN\r\n tab_exparchivo AS exa ON arc.fil_id = exa.fil_id\r\n WHERE exa.exp_id = tab_expediente.exp_id) AS totcja,\r\n (SELECT COUNT (arc.fil_id) FROM tab_archivo as arc INNER JOIN\r\n tab_exparchivo AS exa ON arc.fil_id = exa.fil_id\r\n WHERE exa.exp_id = tab_expediente.exp_id) AS totpzs,\r\n (SELECT (COUNT (DISTINCT arc.fil_nrocaj))* 0.32\r\n FROM tab_archivo as arc INNER JOIN\r\n tab_exparchivo AS exa ON arc.fil_id = exa.fil_id\r\n WHERE exa.exp_id = tab_expediente.exp_id) AS totml,\r\n (SELECT MIN (isad.exp_fecha_exi)\r\n FROM tab_expediente as exp INNER JOIN\r\n tab_expisadg AS isad ON exp.exp_id = isad.exp_id INNER JOIN\r\n tab_expusuario AS use ON exp.exp_id = use.exp_id\r\n WHERE exp.ser_id = tab_series.ser_id AND use.usu_id = tab_usuario.usu_id AND use.eus_estado = 1) AS fechaini,\r\n (SELECT MAX (isad.exp_fecha_exf)\r\n FROM tab_expediente as exp INNER JOIN\r\n tab_expisadg AS isad ON exp.exp_id = isad.exp_id INNER JOIN\r\n tab_expusuario AS use ON exp.exp_id = use.exp_id\r\n WHERE exp.ser_id = tab_series.ser_id AND use.usu_id = tab_usuario.usu_id AND use.eus_estado = 1) AS fechafin\r\n FROM\r\n\t\t\t\t\t\t\t\ttab_expediente\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id =tab_expisadg.exp_id\r\n INNER JOIN tab_series ON tab_expediente.ser_id = tab_series.ser_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_usuario ON tab_expusuario.usu_id = tab_usuario.usu_id\r\n INNER JOIN tab_rol ON tab_usuario.rol_id = tab_rol.rol_id\r\n INNER JOIN tab_unidad ON tab_series.uni_id = tab_unidad.uni_id\r\n INNER JOIN tab_unidad AS sec ON tab_unidad.uni_par = sec.uni_id\r\n INNER JOIN tab_fondo ON sec.fon_id = tab_fondo.fon_id\r\n INNER JOIN tab_fondo as fonp ON tab_fondo.fon_par = fonp.fon_id \r\n WHERE tab_expusuario.eus_estado = 1 " . $where; $expedienteh = new Tab_expediente(); $resulth = $expedienteh->dbselectBySQL($sqlh); $cadenah = "<br/><br/><br/><br/><br/><br/><br/><br/>"; if (count($resulth) > 0) { $cadenah .= '<table width="780" border="0" cellpadding="2">'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 24px;">' . $resulth[0]->uni_descripcion . ' (' . $resulth[0]->uni_codigo . ')</span>'; $cadenah .= '</td></tr>'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 24px;">' . $resulth[0]->rol_titulo . ' (' . $resulth[0]->rol_cod . ')</span>'; $cadenah .= '</td></tr>'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 30px;font-weight: bold;text-decoration: underline;">'; $cadenah .= 'FORMULARIO DE INVENTARIO DE EXPEDIENTES'; $cadenah .= '</span>'; $cadenah .= '</td></tr>'; $cadenah .= '</table>'; $cadenah .= '<br/><br/>'; $cadenah .= '<table width="760" border="1" cellpadding="2">'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;"> FONDO:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->fondes . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">INSTRUMENTO DE CONSULTA:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">INVENTARIO DE DOCUMENTOS</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">SUB-FONDO:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->fon_descripcion . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">TOTAL DE CAJAS:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">' . $resulth[0]->totcja . '</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">SECCIÓN:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->seccion . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">TOTAL DE PIEZAS:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">' . $resulth[0]->totpzs . '</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">SUB SECCIÓN:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->uni_descripcion . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">TOTAL DE ML:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">' . $resulth[0]->totml . '</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">CÓDIGO DE REFERENCIA:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->fon_cod . DELIMITER . $resulth[0]->uni_cod . DELIMITER . $resulth[0]->tco_codigo . DELIMITER . $resulth[0]->ser_codigo . DELIMITER . $resulth[0]->exp_codigo . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">NIVEL DE DESCRIPCIÓN:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">UNIDAD DOCUMENTAL SIMPLE</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">SERIES:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 14px;">' . $resulth[0]->ser_categoria . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">FECHAS EXTREMAS:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;">' . $resulth[0]->fechaini . '-' . $resulth[0]->fechafin . '</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">EXPEDIENTE(PROYECTO):</span></td>'; $cadenah .= '<td width="350" ><span style="font-size: 14px;">' . $resulth[0]->exp_titulo . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;"></span></td>'; $cadenah .= '<td width="220"><span style="font-size: 14px;"></span></td>'; $cadenah .= '</tr>'; ///// //consulta para campos adicionales $camposc = new expcampo(); $resultdc = $camposc->obtenerSelectCamposRepDoc($filtro_serie, $filtro_expediente); $cadenah .= $resultdc; ///// $cadenah .= '</table>'; } $sql = "SELECT\r\n tab_archivo.fil_nrocaj,\r\n tab_archivo.fil_nroejem,\r\n tab_fondo.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_codigo,\r\n tab_departamento.dep_nombre,\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_expisadg.exp_fecha_exi,\r\n tab_expisadg.exp_fecha_exf,\r\n tab_archivo.fil_tomovol,\r\n tab_archivo.fil_nrofoj,\r\n (SELECT tab_sopfisico.sof_codigo\r\n FROM tab_sopfisico \r\n WHERE tab_sopfisico.sof_id = tab_archivo.sof_id ) as sof_codigo,\r\n tab_archivo.fil_mrb,\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_obs\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id =tab_expisadg.exp_id\r\n INNER JOIN tab_series ON tab_expediente.ser_id = tab_series.ser_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_usuario ON tab_expusuario.usu_id = tab_usuario.usu_id\r\n INNER JOIN tab_rol ON tab_usuario.rol_id = tab_rol.rol_id\r\n INNER JOIN tab_unidad ON tab_series.uni_id = tab_unidad.uni_id\r\n INNER JOIN tab_unidad AS sec ON tab_unidad.uni_par = sec.uni_id\r\n INNER JOIN tab_fondo ON sec.fon_id = tab_fondo.fon_id\r\n INNER JOIN tab_fondo as fonp ON tab_fondo.fon_par = fonp.fon_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_archivo_digital ON tab_archivo.fil_id = tab_archivo_digital.fil_id\r\n INNER JOIN tab_ubicacion ON tab_unidad.ubi_id = tab_ubicacion.ubi_id\r\n INNER JOIN tab_localidad ON tab_ubicacion.loc_id = tab_localidad.loc_id\r\n INNER JOIN tab_provincia ON tab_localidad.pro_id = tab_provincia.pro_id\r\n INNER JOIN tab_departamento ON tab_provincia.dep_id = tab_departamento.dep_id\r\n WHERE tab_expusuario.eus_estado = 1 " . $where . $order_by; // // //echo ($sql); die (); // $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Inventario'); $pdf->SetSubject('Reporte de Inventario'); // aumentado $pdf->SetKeywords('Castellon, TEAM DIGITAL'); // set default header data $pdf->SetHeaderData('logo2.png', 20, 'MPD', 'ADMINISTRADORA BOLIVIANA DE CARRETERAS (MPD)'); // 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->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(5, 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); //set some language-dependent strings $pdf->setLanguageArray($l); $pdf->SetFont('helvetica', '', 8); // add a page $pdf->AddPage(); // $pdf->SetXY(110, 200); $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false); $cadena = ""; $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td colspan="19" align="center" width="700"><span style="font-size: 20px;font-weight: bolder;">�?REA DE IDENTIFICACIÓN</span></td>'; $cadena .= '<td width="80" align="center"><span style="font-size: 20px;font-weight: bolder;">�?REA DE NOTAS</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="25" rowspan="2" align="center"><span style="font-size: 11px ;font-weight: bold;">N de Caja</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center"><span style="font-size: 11px ;font-weight: bold;">Total piezas/cajas</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center"><span style="font-size: 11px ;font-weight: bold;">N ejem.</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center"><span style="font-size: 11px; font-weight: bold;">ML</span></td>'; $cadena .= '<td width="60" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">N de Orden doc.</span></td>'; $cadena .= '<td width="40" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Depto.</span></td>'; $cadena .= '<td width="90" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Titulo del Documento</span></td>'; $cadena .= '<td width="70" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Sub titulo</span></td>'; $cadena .= '<td width="45" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Productor</span></td>'; $cadena .= '<td width="40" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Firma</span></td>'; $cadena .= '<td width="35" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Fecha</span></td>'; $cadena .= '<td width="125" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Tomo/Volumen</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Fojas</span></td>'; $cadena .= '<td width="30" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Soporte Físico</span></td>'; $cadena .= '<td width="30" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Conser. Doc.</span></td>'; $cadena .= '<td width="100" colspan="4" align="center"><span style="font-size: 11px ;font-weight: bold;">Ubicación Topografica</span></td>'; $cadena .= '<td width="60" rowspan="2" align="center" valign="middle"><span style="font-size: 11px ;font-weight: bold;">Observaciones</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="25" align="center"><span style="font-size: 11px ;font-weight: bold;">Sala</span></td>'; $cadena .= '<td width="25" align="center"><span style="font-size: 11px ;font-weight: bold;">Estante</span></td>'; $cadena .= '<td width="25" align="center"><span style="font-size: 11px ;font-weight: bold;">Cuerpo</span></td>'; $cadena .= '<td width="25" align="center"><span style="font-size: 11px ;font-weight: bold;">Balda</span></td>'; $cadena .= '</tr>'; $numero = 1; foreach ($result as $fila) { $cadena .= '<tr>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_nrocaj . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;"></span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_nroejem . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">0,32</span></td>'; $cadena .= '<td width="60"><span style="font-size: 11px;">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->fil_codigo . '</span></td>'; $cadena .= '<td width="40"><span style="font-size: 11px;">' . $fila->dep_nombre . '</span></td>'; $cadena .= '<td width="90"><span style="font-size: 11px;">' . $fila->fil_titulo . '</span></td>'; $cadena .= '<td width="70"><span style="font-size: 11px;">' . $fila->fil_subtitulo . '</span></td>'; $cadena .= '<td width="45"><span style="font-size: 11px;">' . $fila->fil_proc . '</span></td>'; $cadena .= '<td width="40"><span style="font-size: 11px;">' . $fila->fil_firma . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->exp_fecha_exi . ' - ' . $fila->exp_fecha_exf . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_tomovol . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_nrofoj . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 11px;">' . $fila->sof_codigo . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 11px;">' . $fila->fil_mrb . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_sala . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_estante . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_cuerpo . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 11px;">' . $fila->fil_balda . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 11px;">' . $fila->fil_obs . '</span></td>'; $cadena .= '</tr>'; $numero++; } //obtenerSelectCamposRepC $cadena .= '</table>'; $cadena = $cadenah . $cadena; $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_inventario.pdf', 'I'); }
function verRpte() { $spr_id = $_REQUEST["spr_id"]; // $where = " AND tab_usuario.usu_id = " . $_SESSION['USU_ID']; $where = ""; $where = " AND tab_solprestamo.spr_id = " . $spr_id; $order_by = ""; $order_by .= " ORDER BY dpr_orden"; $sql = "SELECT\r\n tab_solprestamo.spr_id,\r\n tab_solprestamo.spr_fecha,\r\n (SELECT uni_descripcion from tab_unidad WHERE uni_id=tab_solprestamo.uni_id) AS uni_id,\r\n (SELECT usu_nombres || ' ' || usu_apellidos from tab_usuario WHERE usu_id=tab_solprestamo.usu_id) AS usu_id,\r\n tab_solprestamo.spr_solicitante,\r\n tab_solprestamo.spr_email,\r\n tab_solprestamo.spr_tel,\r\n tab_solprestamo.spr_fecent,\r\n tab_solprestamo.spr_fecren,\r\n (SELECT usu_nombres || ' ' || usu_apellidos from tab_usuario WHERE usu_id=tab_solprestamo.usua_id) AS usua_id,\r\n (SELECT usu_nombres || ' ' || usu_apellidos from tab_usuario WHERE usu_id=tab_solprestamo.usur_id) AS usur_id,\r\n tab_solprestamo.spr_fecdev,\r\n tab_solprestamo.spr_obs,\r\n tab_solprestamo.spr_estado,\r\n tab_docprestamo.dpr_orden,\r\n tab_fondo.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_codigo,\r\n tab_archivo.fil_titulo,\r\n tab_archivo.fil_proc,\r\n tab_archivo.fil_firma,\r\n tab_archivo.fil_tomovol,\r\n tab_sopfisico.sof_nombre,\r\n tab_archivo.fil_nrofoj,\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_nrocaj,\r\n tab_docprestamo.dpr_obs\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad ON tab_fondo.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_docprestamo ON tab_archivo.fil_id = tab_docprestamo.fil_id\r\n INNER JOIN tab_solprestamo ON tab_solprestamo.spr_id = tab_docprestamo.spr_id\r\n INNER JOIN tab_sopfisico ON tab_sopfisico.sof_id = tab_archivo.sof_id\r\n WHERE\r\n tab_fondo.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_docprestamo.dpr_estado = 1 AND\r\n tab_solprestamo.spr_estado = 1 " . $where . $order_by; $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Prestamos'); $pdf->SetSubject('Reporte de Prestamos'); // aumentado $pdf->SetKeywords('Castellon, TEAM DIGITAL'); // 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->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(5, 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); //set some language-dependent strings $pdf->setLanguageArray($l); $pdf->SetFont('helvetica', '', 8); // add a page $pdf->AddPage(); // $pdf->SetXY(110, 200); $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false); $sqltop = "SELECT\r\n tab_unidad.uni_descripcion,\r\n tab_unidad.uni_codigo,\r\n tab_rol.rol_titulo,\r\n tab_rol.rol_cod\r\n FROM\r\n tab_unidad\r\n INNER JOIN tab_usuario ON tab_usuario.uni_id = tab_unidad.uni_id\r\n INNER JOIN tab_rol ON tab_usuario.rol_id = tab_rol.rol_id\r\n WHERE tab_usuario.usu_estado = 1 AND tab_usuario.usu_id = " . $_SESSION['USU_ID']; $usuario = new Tab_usuario(); $resultop = $usuario->dbselectBySQL($sqltop); $cadena = "<br/><br/><br/><br/><br/><br/><br/><br/>"; if (count($resultop) > 0) { $cadena .= '<table width="760" border="0" cellpadding="2">'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 24px;">' . $resultop[0]->uni_descripcion . ' (' . $resultop[0]->uni_codigo . ')</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 24px;">' . $resultop[0]->rol_titulo . ' (' . $resultop[0]->rol_cod . ')</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 30px;font-weight: bold;text-decoration: underline;">'; $cadena .= 'FORMULARIO DE SALIDA DOCUMENTAL'; $cadena .= '</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 24px;">(Para uso de las diferentes unidades y/o áreas solicitantes)</span>'; $cadena .= '</td></tr>'; $cadena .= '</table>'; $cadena .= '<br/><br/>'; } if (count($result) > 0) { $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr>'; $cadena .= '<td width="130" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">FECHA DE SOLICITUD:</span></td>'; $cadena .= '<td width="130"><span style="font-size: 14px;">' . $result[0]->spr_fecha . '</span></td>'; $cadena .= '<td width="130" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">Ubicado:</span></td>'; $cadena .= '<td width="130"><span style="font-size: 14px;">' . $result[0]->spr_fecha . '</span></td>'; $cadena .= '<td width="130" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">Nro. DE PRÉSTAMO:</span></td>'; $cadena .= '<td width="110"><span style="font-size: 14px;">' . 'no hay query' . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">GCIA/UNIDAD/ÁREA:</span></td>'; $cadena .= '<td width="130"><span style="font-size: 14px;">' . $result[0]->uni_id . '</span></td>'; $cadena .= '<td width="130" bgcolor="#CCCCCC"><span style="font-size: 14px;font-weight: bold;">SOLICITADO POR:</span></td>'; $cadena .= '<td colspan="3"><span style="font-size: 14px;">' . 'no hay query' . '</span></td>'; $cadena .= '</tr>'; $cadena .= '</table>'; } $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="30" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">N</span></td>'; $cadena .= '<td width="70" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Código de Referencia</span></td>'; $cadena .= '<td width="120" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Documento Solicitado</span></td>'; $cadena .= '<td width="70" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Productor</span></td>'; $cadena .= '<td width="60" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Firma</span></td>'; $cadena .= '<td width="60" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Fechas Extremas</span></td>'; $cadena .= '<td width="35" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Tomo/Vol.</span></td>'; $cadena .= '<td width="35" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Sop. Fis.</span></td>'; $cadena .= '<td width="35" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">N Fojas</span></td>'; $cadena .= '<td width="175" colspan="5" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Localización Topográfica</span></td>'; $cadena .= '<td width="70" rowspan="2" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Observaciones</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="35" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Sala</span></td>'; $cadena .= '<td width="35" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Estante</span></td>'; $cadena .= '<td width="35" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Cuerpo</span></td>'; $cadena .= '<td width="35" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Balda</span></td>'; $cadena .= '<td width="35" align="center" valign="middle"><span style="font-size: 11px;font-weight: bold;">Caja</span></td>'; $cadena .= '</tr>'; foreach ($result as $fila) { $cadena .= '<tr>'; $cadena .= '<td width="30"><span style="font-size: 11px;">' . $fila->dpr_orden . '</span></td>'; $cadena .= '<td width="70"><span style="font-size: 11px;">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->fil_codigo . '</span></td>'; $cadena .= '<td width="120"><span style="font-size: 11px;">' . $fila->fil_titulo . '</span></td>'; $cadena .= '<td width="70"><span style="font-size: 11px;">' . $fila->fil_proc . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 11px;">' . $fila->fil_firma . '</span></td>'; $cadena .= '<td width="60"><span style="font-size: 11px;">' . 'no hay query' . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_tomovol . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->sof_nombre . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_nrofoj . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_sala . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_estante . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_cuerpo . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_balda . '</span></td>'; $cadena .= '<td width="35"><span style="font-size: 11px;">' . $fila->fil_nrocaj . '</span></td>'; $cadena .= '<td width="70"><span style="font-size: 11px;">' . $fila->dpr_obs . '</span></td>'; $cadena .= '</tr>'; } $cadena .= '</table>'; if (count($result) > 0) { $cadena .= '<br/>'; $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr>'; $cadena .= '<td width="130" height="50"><span style="font-size: 14px;font-weight: bold;">Nombre Completo del Solicitante:</span></td>'; $cadena .= '<td width="500" height="50"><span style="font-size: 14px;">' . $result[0]->spr_solicitante . '</span></td>'; $cadena .= '<td width="130" height="50" align="center"><span style="font-size: 14px;">Firma</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130"><span style="font-size: 14px;font-weight: bold;">Documento Retirado del Archivo:</span></td>'; $cadena .= '<td colspan="2"><span style="font-size: 14px;">' . 'no hay query' . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130"><span style="font-size: 14px;font-weight: bold;">Fecha Entrega Doc.:</span></td>'; $cadena .= '<td colspan="2"><span style="font-size: 14px;">' . $result[0]->spr_fecha . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130" height="50"><span style="font-size: 14px;font-weight: bold;">Nombre Completo del que Autoriza:</span></td>'; $cadena .= '<td width="500" height="50"><span style="font-size: 14px;">' . $result[0]->usua_id . '</span></td>'; $cadena .= '<td width="130" height="50" align="center"><span style="font-size: 14px;">Firma</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130" height="50"><span style="font-size: 14px;font-weight: bold;">Archivista Responsable:</span></td>'; $cadena .= '<td width="500" height="50"><span style="font-size: 14px;">' . $result[0]->usur_id . '</span></td>'; $cadena .= '<td width="130" height="50" align="center"><span style="font-size: 14px;">Firma</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bordercolor="#FFFFFF">'; $cadena .= '<td colspan="3"><span style="font-size: 14px">Llenado unicamente por el personal de archivo</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130"><span style="font-size: 14px;font-weight: bold;">Fecha de Devolución:</span></td>'; $cadena .= '<td colspan="2"><span style="font-size: 14px;">' . $result[0]->spr_fecdev . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="130"><span style="font-size: 14px;font-weight: bold;">Observaciones:</span></td>'; $cadena .= '<td colspan="2"><span style="font-size: 14px;">' . $result[0]->spr_obs . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bordercolor="#FFFFFF">'; $cadena .= '<td colspan="3"><span style="font-size: 14px"><strong>Nota:</strong> A través de este formulario cada funcionario se responsabiliza por el cuidado o cualquier deterioro del documento.</span></td>'; $cadena .= '</tr>'; $cadena .= '</table>'; } //echo ($cadena); $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_prestamo.pdf', 'I'); }
function viewPaquetesBACK() { $ini = $_REQUEST['nro_inicial']; $fin = $_REQUEST['nro_final']; if ($fin == NULL) { $fin = $ini; } $fondo2 = new Tab_fondo(); $texp = new Tab_etiquetas(); $usuario = new usuario(); $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n tab_fondo.fon_descripcion,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n u.uni_descripcion,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_fecha_exi,\r\n (tab_expisadg.exp_fecha_exi +\r\n (SELECT tab_retensiondoc.red_prearc * INTERVAL '1 year'\r\n FROM tab_retensiondoc\r\n WHERE tab_retensiondoc.red_id = tab_series.red_id)) ::DATE AS exp_fecha_exf,\r\n tab_expediente.exp_nroejem,\r\n tab_expediente.exp_tomovol,\r\n tab_expediente.exp_nrocaj,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expediente.exp_obs\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad as u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.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 WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.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_expisadg.exp_estado = 1 AND\r\n tab_expediente.exp_id = '" . $_REQUEST['exp_id'] . "' "; $rows = $texp->dbSelectBySQL($sql); $expediente = new Tab_expediente(); $ser_id = $expediente->dbselectByField("exp_id", $_REQUEST['exp_id']); $ser_id = $ser_id[0]; $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad ON tab_fondo.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 WHERE tab_fondo.fon_estado = 1\r\n AND tab_unidad.uni_estado = 1\r\n AND tab_tipocorr.tco_estado = 1\r\n AND tab_series.ser_estado = 1\r\n AND tab_series.ser_id ='" . $ser_id->ser_id . "'"; $tabfondo = new Tab_fondo(); $cuerpo = $tabfondo->dbSelectBySQL($sql); foreach ($cuerpo as $idlistado) { $tco_codigo = $idlistado->tco_codigo; } // Include the main TCPDF library (search for installation path). //require_once('tcpdf/tcpdf_include.php'); require_once 'tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Castellon S.R.L.'); $pdf->SetTitle('Etiquetado de Cajas'); $pdf->SetSubject('Etiquetado de Cajas'); $pdf->SetKeywords('Etiquetado, Cajas, cajas, caratulas, folders'); // set default header data // $pdf->SetHeaderData('logo2.png', 25, 'ADMINISTRADORA BOLIVIANA DE CARRETERA', 'IMPRESIÓN DE CAJAS'); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING); // 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)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, 5, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', 'B', 8); // add a page $pdf->AddPage(); $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', '', 8); $st = ""; // ----------------------------------------------------------------------------- $id_exp = $_REQUEST['exp_id']; $cantMin = ""; $cantMax = ""; for ($i = $ini; $i <= $fin; $i++) { $expediente = new expediente(); foreach ($rows as $value) { if ($tco_codigo == "I") { $obteneCaja = $expediente->obtenerCajaCorrespondecia($_REQUEST['exp_id']); $cantMin = strlen($obteneCaja->minimo); $cantMax = strlen($obteneCaja->maximo); } else { $obteneCaja = $expediente->obtenerCaja($i, $_REQUEST['exp_id']); $cantMin = strlen($obteneCaja->minimo); $cantMax = strlen($obteneCaja->maximo); } $expe = new Tab_expediente(); $sqlcaja = "SELECT\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_balda,\r\n tab_archivo.fil_cuerpo\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = '" . $_REQUEST['exp_id'] . "' AND\r\n tab_expediente.exp_estado=1 AND\r\n tab_archivo.fil_nropaq='{$i}'"; $cajaresult = $expe->dbSelectBySQL($sqlcaja); foreach ($cajaresult as $rowscaja) { $sala = $rowscaja->fil_sala; $estante = $rowscaja->fil_estante; $balda = $rowscaja->fil_balda; $cuerpo = $rowscaja->fil_cuerpo; } $exptransferencia = new tab_exptransferencia(); $sql = "SELECT\r\n tab_soltransferencia.str_fecha,\r\n tab_soltransferencia.str_id\r\n FROM\r\n tab_exptransferencia\r\n INNER JOIN tab_soltransferencia ON tab_soltransferencia.str_id = tab_exptransferencia.str_id\r\n WHERE\r\n tab_exptransferencia.exp_id ={$id_exp}"; $datos = $exptransferencia->dbSelectBySQL($sql); $strfecha = ""; $strid = ""; foreach ($datos as $listr) { $strfecha = $listr->str_fecha; $strid = $listr->str_id; } $st .= '<br><br>'; $st .= '<table border="1" style="width: 100%">'; $st .= '<tr>'; $st .= '<td style="border-right:2px solid white;">'; $st .= '<img src="' . PATH_ROOT . '/web/img/escudo.png" width="50" height="50" border="0" />'; $st .= '</td><td align="right"><img src="' . PATH_ROOT . '/web/img/iso.png" width="50" height="50" border="0" />'; $st .= '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2">'; $st .= '<table border="1" style="width: 100%; text-align: center">'; $st .= '<tr>'; //$st.='<td colspan="11">'.$value->fon_cod . "-" . $value->uni_cod. '</td>'; $st .= '<th colspan="11" height="20" style="font-size:70px"><b>' . $value->fon_cod . DELIMITER . $value->uni_cod . DELIMITER . $value->tco_codigo . DELIMITER . $value->ser_codigo . DELIMITER . $value->exp_codigo . '</b></th>'; $st .= '</tr>'; if ($value->uni_par_cod) { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . $value->uni_par_cod . '</b></td>'; $st .= '</tr>'; } else { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . $value->uni_descripcion . '</b></td>'; $st .= '</tr>'; } $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:35px"><b>' . $value->ser_categoria . '</b></td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:48px"><b>' . $value->exp_titulo . '</b></td>'; $st .= '</tr>'; $pdf->SetFont('helvetica', '', 8); $st .= '<tr>'; $st .= '<td colspan="2" height="20" bgcolor="#CCCCCC" style="font-size:40px" width="232">FECHAS EXTREMAS:</td>'; $st .= '<td colspan="9" bgcolor="#CCCCCC" width="420" style="font-size:40px">CODIGOS:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2" height="20" style="font-size:45px"><b>' . $value->exp_anioi . "-" . $value->exp_aniof . '</b></td>'; $st .= '<th colspan="9" rowspan="3" style="text-align:left;font-size:45px;padding:15px">'; $sqlcodigos = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad AS u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.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 WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.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_expediente.exp_id ='" . $_REQUEST['exp_id'] . "'"; $idexp = $_REQUEST['exp_id']; $sqlarchivo = "SELECT fil_nro,fil_fot FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$idexp} AND\r\n tab_archivo.fil_nropaq = '{$i}' AND\r\n tab_expediente.exp_estado = 1 ORDER BY fil_nro"; $cod_fil_nro = $expe->dbSelectBySQL($sqlarchivo); $codigoDocument = $fondo2->dbSelectBySQL($sqlcodigos); $codigoDocument = $codigoDocument[0]; $cant1 = 0; $codigo_paquetes = $codigoDocument->fon_cod . DELIMITER . $codigoDocument->uni_cod . DELIMITER . $codigoDocument->tco_codigo . DELIMITER . $codigoDocument->ser_codigo . DELIMITER . $codigoDocument->exp_codigo; foreach ($cod_fil_nro as $filnro) { $st .= $codigo_paquetes . DELIMITER . $filnro->fil_nro; $st .= " (" . $filnro->fil_fot . ")"; $cant1 = $cant1 + $filnro->fil_fot; $st .= "<br>"; } $st .= '</th>'; $st .= '</tr>'; $cant = $cant1; $st .= '<tr>'; $st .= '<td colspan="4" height="20" bgcolor="#CCCCCC" width="232">NRO. DE PAQUETE</td>'; // $st.='<td colspan="7" bgcolor="#CCCCCC" >ML</td>'; $st .= '</tr>'; //width="420" $st .= '<tr>'; $st .= '<td height="20" colspan="4" rowspan="3" style="font-size:190px">' . $i . '</td>'; // $st.='<td colspan="7" height="20" style="font-size:70px" >0,32</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">NRO. DE PIEZAS</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">Nº DE TRANSFERENCIA</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" height="20" style="font-size:60px"><b>' . $cant . '</b></td>'; if ($strid == "") { $st .= '<td colspan="2"></td>'; } else { $st .= '<td colspan="2">' . $strid . '</td>'; } $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="4" bgcolor="#CCCCCC" height="20" width="232">UBICACIÓN TOPOGRAFICA:</td>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">FECHA DE TRANSFERENCIA DOCUMENTAL</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">ELABORADO POR:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" bgcolor="#CCCCCC">SALA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">ESTANTE</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">BALDA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">CUERPO</td>'; $st .= '<td colspan="5" rowspan="2">'; if ($strfecha != "") { $fechastr = explode("-", $strfecha); $fett = $fechastr[2] . '-' . $fechastr[1] . '-' . $fechastr[0]; $st .= $fett; } $st .= '</td>'; $st .= '<td colspan="2" rowspan="2">' . $usuario->obtenerNombre($_SESSION['USU_ID']) . '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $sala = ""; $estante = ""; $balda = ""; $cuerpo = ""; $st .= '</tr>'; /* $st.='<tr>'; $st.='<td height="20">' . $value->exp_sala . '</td>'; $st.='<td>' . $value->exp_estante . '</td>'; $st.='<td>' . $value->exp_cuerpo . '</td>'; $st.='<td>' . $value->exp_balda . '</td>'; $st.='<td colspan="5"></td>'; $st.='<td colspan="2"></td>'; $st.='</tr>'; */ $st .= '</table>'; $st .= '</td>'; $st .= '</tr>'; $st .= '</table>'; $st .= ''; //EOD; } $pdf->writeHTML($st, true, false, false, false, ''); $st = ""; } // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_paquetes.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ }
function verRpte_funcionario() { /* $tipo_clasificado = "FUNCIONARIO"; //$add_select = ""; $add_group_by = ""; if ($tipo_clasificado == "FUNCIONARIO") { //$add_select.=" ts.ser_categoria, "; $add_group_by.= " GROUP BY tu1.usu_id "; } */ $tipo_orden = $_REQUEST["tipo_orden"]; $filtro_serie = $_REQUEST["filtro_serie"]; $filtro_unidad = $_REQUEST["filtro_unidad"]; $filtro_funcionario = $_REQUEST["filtro_funcionario"]; $f_prestdesde = $_REQUEST["f_prestdesde"]; $f_presthasta = $_REQUEST["f_presthasta"]; $where = ""; // if ($_SESSION["ROL_COD"] != "ADM") { // $where .= " AND tun3.ins_id = '" . $_SESSION["INS_ID"] . "' "; // } //PARA LA ORDENACION SOLO SE ESCOJE UNA OPCION $order_by = ""; if ($tipo_orden == 'SERIE') { $order_by .= " ORDER BY llave ASC, ts.ser_categoria ASC"; } if ($tipo_orden == 'UNIDAD_ORIGEN') { $order_by .= " ORDER BY llave ASC, tun1.uni_codigo ASC"; } if ($tipo_orden == 'FUNC_ORIGEN') { $order_by .= " ORDER BY llave ASC, tu1.usu_apellidos ASC, tu1.usu_nombres ASC"; } if ($tipo_orden == 'NOMBRE_EXPEDIENTE') { $order_by .= " ORDER BY llave ASC, te.exp_nombre ASC"; } if ($tipo_orden == 'CODIGO_REFERENCIA') { $order_by .= " ORDER BY llave ASC, te.exp_codigo ASC"; } if ($tipo_orden == 'FECHA_TRANS') { $order_by .= " ORDER BY llave ASC, ttr.trn_fecha_crea ASC"; } //PARA LOS FILTROS if ($filtro_serie != '') { $where .= " AND te.ser_id = '{$filtro_serie}' "; } if ($filtro_unidad != '') { $where .= " AND tu1.uni_id = '{$filtro_unidad}' "; } if ($filtro_funcionario != '') { $where .= " AND tu1.usu_id = '{$filtro_funcionario}' "; } if ($f_prestdesde != '' && $f_presthasta != '') { $where .= " AND DATE(ttr.trn_fecha_crea) BETWEEN '{$f_prestdesde}' AND '{$f_presthasta}' "; } //para la fecha de la cabezera $fecha_actual = date("d/m/Y"); $sql = "SELECT DISTINCT\r\n te.exp_nombre,\r\n te.exp_codigo,\r\n te.ser_id,\r\n ts.ser_categoria,\r\n ttr.trn_fecha_crea AS fecha_transferencia,\r\n tu1.usu_id AS llave,\r\n tu1.usu_nombres AS usunom_ori,\r\n tu1.usu_apellidos AS usuape_ori,\r\n tu2.usu_nombres AS usunom_dest,\r\n tu2.usu_apellidos AS usuape_dest,\r\n tu2.usu_id,\r\n tun1.uni_codigo AS cod_ori,\r\n tun1.uni_descripcion AS uni_ori,\r\n tun1.uni_id,\r\n ttr.trn_descripcion,\r\n tun2.uni_codigo,\r\n tun2.uni_descripcion AS uni_dest,\r\n tun2.uni_id,\r\n IF(ttr.trn_estado = '1','PENDIENTE A RECEPCIONAR','RECEPCIONADO') AS observaciones\r\n FROM\r\n tab_expediente AS te\r\n Inner Join tab_series AS ts ON ts.ser_id = te.ser_id\r\n Inner Join tab_transferencia AS ttr ON ttr.exp_id = te.exp_id\r\n Inner Join tab_usuario AS tu1 ON ttr.trn_usuario_orig = tu1.usu_id\r\n Inner Join tab_usuario AS tu2 ON tu2.usu_id = ttr.trn_usuario_des\r\n Inner Join tab_unidad AS tun1 ON tu1.uni_id = tun1.uni_id\r\n Inner Join tab_unidad AS tun2 ON tun2.uni_id = tu2.uni_id\r\n Inner Join tab_expusuario AS teu ON teu.exp_id = te.exp_id\r\n Inner Join tab_usuario AS tu3 ON tu3.usu_id = teu.usu_id\r\n Inner Join tab_unidad AS tun3 ON tu3.uni_id = tun3.uni_id\r\n WHERE\r\n te.exp_estado = '1' AND ttr.trn_confirmado = '0'" . $where . $order_by; //echo ($sql); die (); $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $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 Transferencia'); $pdf->SetSubject('Reporte de Transferencia'); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // aumentado $pdf->SetKeywords('Castellon, TEAM DIGITAL'); // 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', '', 8); // add a page $pdf->AddPage(); $cadena = "<br/><br/><br/>"; $cadena .= '<table width="780" border="0" >'; // $cadena .= '<tr><td>MINISTERIO DE PLANIFICACION DEL DESARROLO </td></tr>'; // $inst = $_SESSION["INS_ID"]; // $institucion = new Tab_institucion(); // $institucion = $institucion->dbselectById($inst); // // $cadena .= '<tr><td>' . $institucion->ins_nombre . '<br/></td></tr>'; $cadena .= '<tr><td align="center">'; $cadena .= '<span style="font-size: 30px;font-weight: bold;">'; $cadena .= 'TRANSFERENCIAS ENTRE CUSTODIOS'; $cadena .= '</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr><td align="left">Fecha de Elaboración:' . $fecha_actual . '</td></tr>'; $cadena .= '<tr><td align="left">Fecha de Transferencia:Del ' . $f_prestdesde . ' al ' . $f_presthasta . '</td></tr>'; $cadena .= '<tr><td align="left"> Nivel de Descripción: Funcionario <br/></td></tr>'; $cadena .= '</table>'; $cadena .= '<table width="780" border="1">'; $cadena .= '<tr>'; $cadena .= '<td width="10"><div align="center"><strong>N°</strong></div></td>'; $cadena .= '<td width="80"><div align="center"><strong>Código de Referencia</strong></div></td>'; $cadena .= '<td width="90"><div align="center"><strong>Serie</strong></div></td>'; $cadena .= '<td width="120"><div align="center"><strong>Título</strong></div></td>'; $cadena .= '<td width="80"><div align="center"><strong>Fecha de Transferencia</strong></div></td>'; $cadena .= '<td width="200"><table width="170" border="1">'; $cadena .= '<tr>'; $cadena .= '<td width="200"><div align="center"><strong>DESTINO</strong></div></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="100"><div align="center"><strong>Unidad</strong></div></td>'; $cadena .= '<td width="100"><div align="center"><strong>Funcionario</strong></div></td>'; $cadena .= '</tr>'; $cadena .= '</table></td>'; $cadena .= '<td width="95"><div align="center"><strong>Descripción</strong></div></td>'; $cadena .= '<td width="105"><div align="center"><strong>Observaciones</strong></div></td>'; $cadena .= '</tr>'; //$cadena .= '<tr>'; //$cadena .= '<td width="720"><strong>Funcionario:</strong></td>'; //$cadena .= '</tr>'; $numero = 1; $aux = ""; foreach ($result as $fila) { $usu_id = $fila->llave; if ($usu_id != $aux) { $cadena .= '<tr>'; $cadena .= '<td width="780"><strong>Funcionario: ' . $fila->usunom_ori . ' ' . $fila->usuape_ori . ' - ' . $fila->cod_ori . '</strong></td>'; $cadena .= '</tr>'; $aux = $usu_id; $numero = 1; } $cadena .= '<tr>'; $cadena .= '<td width="10"><div align="center">' . $numero . '</div></td>'; $cadena .= '<td width="80">' . $fila->exp_codigo . '</td>'; $cadena .= '<td width="90">' . $fila->ser_categoria . '</td>'; $cadena .= '<td width="120">' . $fila->exp_nombre . '</td>'; $cadena .= '<td width="80"><div align="center">' . $fila->fecha_transferencia . '</div></td>'; $cadena .= '<td width="100">' . $fila->uni_dest . '</td>'; $cadena .= '<td width="100">' . $fila->usunom_dest . ' ' . $fila->usuape_dest . '</td>'; $cadena .= '<td width="95">' . $fila->trn_descripcion . '</td>'; $cadena .= '<td width="105">' . $fila->observaciones . '</td>'; $cadena .= '</tr>'; $numero++; } $cadena .= '</table>'; $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_prestamo.pdf', 'I'); }
function verRpte_serie2() { // $filtro_series = $_REQUEST["filtro_series"]; if (isset($_REQUEST["exp_id2"])) { $filtro_expedientes = $_REQUEST["exp_id2"]; } else { $filtro_expedientes = ""; } $where = ""; $where .= " AND tab_usuario.usu_id=" . $_SESSION["USU_ID"]; $order_by = ""; // //PARA LOS FILTROS // if ($filtro_series != '') { // $where.=" AND tab_series.ser_id = '$filtro_series' "; // } if ($filtro_expedientes != '') { $where .= " AND tab_expediente.exp_id = '{$filtro_expedientes}' "; } $sqlh = "SELECT\r\n fonp.fon_descripcion as fondes,\r\n tab_fondo.fon_descripcion,\r\n tab_unidad.uni_descripcion,\r\n tab_unidad.uni_codigo,\r\n tab_rol.rol_titulo,\r\n tab_rol.rol_cod,\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_series.ser_categoria\r\n \r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_fondo as fonp ON tab_fondo.fon_par = fonp.fon_id\r\n INNER JOIN tab_unidad ON tab_fondo.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_usu_serie ON tab_series.ser_id = tab_usu_serie.ser_id\r\n INNER JOIN tab_usuario ON tab_usuario.usu_id = tab_usu_serie.usu_id\r\n INNER JOIN tab_rol ON tab_usuario.rol_id = tab_rol.rol_id\r\n INNER JOIN tab_expusuario ON tab_expusuario.usu_id = tab_usuario.usu_id\r\n INNER JOIN tab_expediente ON tab_expediente.ser_id = tab_series.ser_id\r\n WHERE tab_expusuario.eus_estado = 1 " . $where; $expedienteh = new Tab_expediente(); $resulth = $expedienteh->dbselectBySQL($sqlh); $cadenah = "<br/><br/><br/><br/><br/><br/><br/><br/>"; if (count($resulth) > 0) { $cadenah .= '<table width="780" border="0" cellpadding="2">'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 24px;">' . $resulth[0]->uni_descripcion . ' (' . $resulth[0]->uni_codigo . ')</span>'; $cadenah .= '</td></tr>'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 24px;">' . $resulth[0]->rol_titulo . ' (' . $resulth[0]->rol_cod . ')</span>'; $cadenah .= '</td></tr>'; $cadenah .= '<tr><td align="center">'; $cadenah .= '<span style="font-size: 30px;font-weight: bold;text-decoration: underline;">'; $cadenah .= 'FORMULARIO DE INVENTARIO DE DOCUMENTOS'; $cadenah .= '</span>'; $cadenah .= '</td></tr>'; $cadenah .= '</table>'; $cadenah .= '<br/><br/>'; $cadenah .= '<table width="760" border="1" cellpadding="2">'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;"> FONDO:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 22px;">' . $resulth[0]->fondes . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">INSTRUMENTO DE CONSULTA:</span></td>'; $cadenah .= '<td width="220"><span style="font-size: 22px;">INVENTARIO DE EXPEDIENTES</span></td>'; $cadenah .= '</tr>'; $cadenah .= '<tr>'; $cadenah .= '<td width="100" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SUB-FONDO:</span></td>'; $cadenah .= '<td width="350"><span style="font-size: 22px;">' . $resulth[0]->fon_descripcion . '</span></td>'; $cadenah .= '<td width="90" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SECCIÓN:</span></td>'; $cadenah .= '<td width="220" ><span style="font-size: 22px;">' . $resulth[0]->uni_descripcion . '</span></td>'; $cadenah .= '</tr>'; $cadenah .= '</table>'; } $sql = "SELECT\r\n tab_expediente.exp_id,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_nroejem,\r\n tab_fondo.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_expisadg.exp_titulo,\r\n tab_expisadg.exp_fecha_exi,\r\n tab_expisadg.exp_fecha_exf,\r\n tab_expediente.exp_tomovol,\r\n (SELECT tab_sopfisico.sof_codigo\r\n FROM tab_sopfisico \r\n WHERE tab_sopfisico.sof_id = tab_expediente.sof_id ) as sof_codigo,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expediente.exp_obs,\r\n tab_series.ser_categoria,\r\n tab_series.ser_id\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad ON tab_fondo.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 INNER JOIN tab_usuario ON tab_usuario.usu_id = tab_expusuario.usu_id\r\n WHERE tab_expusuario.eus_estado = 1 " . $where . $order_by; // // //echo ($sql); die (); // $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Inventario'); $pdf->SetSubject('Reporte de Inventario'); // aumentado $pdf->SetKeywords('Castellon, TEAM DIGITAL'); // set default header data $pdf->SetHeaderData('logo2.png', 20, 'MPD', 'ADMINISTRADORA BOLIVIANA DE CARRETERAS (MPD)'); // 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->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(5, 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); //set some language-dependent strings $pdf->setLanguageArray($l); $pdf->SetFont('helvetica', '', 8); // add a page $pdf->AddPage(); // $pdf->SetXY(110, 200); $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false); $cadena = ""; $cadena .= '<table width="760" border="1" cellpadding="2">'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td colspan="14" align="center" width="650"><span style="font-size: 22px;font-weight: bolder;">ÁREA DE IDENTIFICACIÓN</span></td>'; $cadena .= '<td width="110" align="center"><span style="font-size: 22px;font-weight: bolder;">ÁREA DE NOTAS</span></td>'; // $camposh = new expcampo; // $resultdh = $camposh->obtenerSelectCamposRepH($filtro_series); // // $cadena .= $resultdh; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Unidad de Instalación</span></td>'; $cadena .= '<td width="100" colspan="3" align="center"><span style="font-size: 22px ;font-weight: bold;">Volumen</span></td>'; $cadena .= '<td width="30" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">N de Orden doc.</span></td>'; $cadena .= '<td width="50" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Código de Expediente</span></td>'; $cadena .= '<td width="240" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Nombre de Expediente</span></td>'; $cadena .= '<td width="30" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Fecha</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Tomo/Volumen</span></td>'; $cadena .= '<td width="25" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Soporte Físico</span></td>'; $cadena .= '<td width="120" colspan="4" align="center"><span style="font-size: 22px ;font-weight: bold;">Ubicación Topografica</span></td>'; $cadena .= '<td width="110" rowspan="2" align="center" valign="middle"><span style="font-size: 22px ;font-weight: bold;">Observaciones</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="30" align="center" valign="middle"><span style="font-size: 22px; font-weight: bold;">N de Caja</span></td>'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Total piezas/cajas</span></td>'; $cadena .= '<td width="35" align="center"><span style="font-size: 22px ;font-weight: bold;">N ejem.</span></td>'; $cadena .= '<td width="35" align="center"><span style="font-size: 22px; font-weight: bold;">ML</span></td>'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Sala</span></td>'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Estante</span></td>'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Cuerpo</span></td>'; $cadena .= '<td width="30" align="center"><span style="font-size: 22px ;font-weight: bold;">Balda</span></td>'; $cadena .= '</tr>'; $aux = ""; $numero = 1; foreach ($result as $fila) { $ser_id = $fila->ser_id; if ($ser_id != $aux) { $cadena .= '<tr>'; $cadena .= '<td width="760"><strong>Serie:' . $fila->ser_categoria . ' - ' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . '</strong></td>'; $cadena .= '</tr>'; $numero = 1; $aux = $ser_id; } $cadena .= '<tr>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_nrocaj . '</span></td>'; $cadena .= '<td width="20"><span style="font-size: 22px;"></span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_nroejem . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">0,32</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $numero . '</span></td>'; $cadena .= '<td width="50"><span style="font-size: 22px;">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . '</span></td>'; $cadena .= '<td width="260"><span style="font-size: 22px;">' . $fila->exp_titulo . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_fecha_exi . ' - ' . $fila->exp_fecha_exf . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 22px;">' . $fila->exp_tomovol . '</span></td>'; $cadena .= '<td width="25"><span style="font-size: 22px;">' . $fila->sof_codigo . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_sala . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_estante . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_cuerpo . '</span></td>'; $cadena .= '<td width="30"><span style="font-size: 22px;">' . $fila->exp_balda . '</span></td>'; $cadena .= '<td width="110"><span style="font-size: 22px;">' . $fila->exp_obs . '</span></td>'; ///// //consulta para campos adicionales // $camposc = new expcampo; // $resultdc = $camposc->obtenerSelectCamposRepC($filtro_series, $fila->exp_id); // $cadena .= $resultdc; ///// $cadena .= '</tr>'; $numero++; } //obtenerSelectCamposRepC $cadena .= '</table>'; $cadena = $cadenah . $cadena; $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_inventario.pdf', 'I'); }
function obtenerSucId($exp_id) { $tab_expediente = new Tab_expediente(); $sql = "select suc_id from tab_expcontenedor where exp_id={$exp_id} AND exc_estado = 1 "; $expfon = $tab_expediente->dbSelectBySQL($sql); $suc_id = 0; if (count($expfon) > 0) { foreach ($expfon as $expfon2) { $suc_id = $expfon2->suc_id; } } return $suc_id; }
function verRpte() { $where = ""; $filtro_seccion = $_POST['filtro_seccion']; $tiporeporte = $_POST['tiporeporte']; $nrocajas = $_POST['nro_cajas']; $usuario = new Tab_usuario(); $where .= " AND tab_unidad.uni_id = {$filtro_seccion}"; if ($tiporeporte == 1) { require_once 'tcpdf/config/lang/eng.php'; require_once 'tcpdf/tcpdf.php'; $this->usuario = new usuario(); // create new PDF document $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->setFontSubsetting(FALSE); $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID'])); $pdf->SetTitle('Reporte de Inventario'); $pdf->SetSubject('Reporte de Inventario'); $pdf->SetKeywords('Castellon, SAD'); // set default header data $pdf->SetHeaderData('logo2.png', 20, 'MPD', ""); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(5, 30, 10); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->setPrintFooter(false); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, 15); //set some language-dependent strings $pdf->setLanguageArray($l); $pdf->SetFont('helvetica', '', 9); // add a page $pdf->AddPage(); $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false); } else { if ($tiporeporte == 2) { header("Content-type: application/vnd.ms-excel; name='excel'"); header("Content-Disposition: filename=inventario_sec.xls"); header("Pragma: no-cache"); header("Expires: 0"); } else { if ($tiporeporte == 3) { } } } // Count data $sql = "SELECT\r\n e.exp_id,\r\n (SELECT \r\n count(tab_archivo.fil_nroejem) as cont\r\n FROM\r\n tab_expediente\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 WHERE tab_expediente.exp_id = e.exp_id) AS contador,\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_descripcion,\r\n tab_unidad.uni_cod,\r\n tab_unidad.uni_id,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_id,\r\n tab_series.ser_par,\r\n tab_series.ser_codigo,\r\n e.exp_codigo,\r\n tab_expisadg.exp_titulo,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_fecha_exi,\r\n tab_expisadg.exp_id,\r\n tab_series.ser_id,\r\n tab_unidad.uni_par,\r\n tab_unidad.uni_id,\r\n tab_fondo.fon_descripcion,\r\n tab_series.ser_categoria\r\n FROM\r\n tab_expediente e\r\n INNER JOIN tab_series ON e.ser_id = tab_series.ser_id\r\n INNER JOIN tab_expisadg ON e.exp_id = tab_expisadg.exp_id\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\r\n tab_fondo.fon_estado = 1 AND\r\n tab_unidad.uni_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n e.exp_estado = 1 AND\r\n tab_expisadg.exp_estado = 1 AND\r\n tab_unidad.uni_id = '{$filtro_seccion}'\r\n ORDER BY\r\n e.exp_id::int ASC"; $expediente = new Tab_expediente(); $result = $expediente->dbselectBySQL($sql); $piezas = 0; if (count($result) > 0) { foreach ($result as $row) { if ($row->contador == 0) { $piezas = $piezas + 1; } else { $piezas = $piezas + $row->contador; } } } // Header data $sqlh = "SELECT\r\n e.exp_id,\r\n (SELECT fon_descripcion from tab_fondo WHERE fon_id=f.fon_par) as fon_par,\r\n f.fon_descripcion, \r\n f.fon_cod,\r\n (SELECT uni_descripcion from tab_unidad WHERE uni_id=u.uni_par) as uni_padre,\r\n u.uni_descripcion,\r\n u.uni_cod,\r\n u.uni_id,\r\n u.uni_par,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_id,\r\n tab_series.ser_par,\r\n tab_series.ser_codigo,\r\n e.exp_codigo,\r\n tab_expisadg.exp_titulo,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_fecha_exi,\r\n tab_expisadg.exp_id,\r\n tab_series.ser_id,\r\n u.uni_par,\r\n u.uni_id,\r\n tab_series.ser_categoria\r\n FROM\r\n tab_expediente e\r\n INNER JOIN tab_series ON e.ser_id = tab_series.ser_id\r\n INNER JOIN tab_expisadg ON e.exp_id = tab_expisadg.exp_id\r\n INNER JOIN tab_unidad u ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_fondo f ON f.fon_id = u.fon_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n WHERE\r\n f.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n e.exp_estado = 1 AND\r\n tab_expisadg.exp_estado = 1 AND\r\n u.uni_id = '{$filtro_seccion}'\r\n ORDER BY\r\n e.exp_id ASC"; $exp_titulo = ""; $expedienteh = new Tab_expediente(); $resulth = $expedienteh->dbselectBySQL($sqlh); $cadena = ""; if (count($resulth) > 0) { // Header $cadena .= '<table width="100%" cellpadding="2" border="1" style="border-collapse: collapse; " >'; $cadena .= '<tr><td align="center" colspan="12" >'; $cadena .= '<span style="font-family: helvetica; font-size: 20px;font-weight: bold;text-decoration: underline;">'; $cadena .= 'FORMULARIO DE INVENTARIO POR SECCIONES'; $cadena .= '</span>'; $cadena .= '</td></tr>'; $cadena .= '<tr>'; $cadena .= '<td width="5%" colspan="2" bgcolor="#CCCCCC"><span style="font-family: helvetica; font-size: 16px;font-weight: bold; text-align:justify;"> FONDO:</span></td>'; $cadena .= '<td width="50%" colspan="4"><span style="font-family: helvetica; font-size: 16px; text-align:justify;">' . $resulth[0]->fon_par . '</span></td>'; $cadena .= '<td width="5%" colspan="3" bgcolor="#CCCCCC"><span style="font-family: helvetica; font-size: 16px;font-weight: bold; text-align:justify;">INSTRUMENTO DE CONSULTA:</span></td>'; $cadena .= '<td width="40%" colspan="3"><span style="font-family: helvetica; font-size: 16px; text-align:justify;">INVENTARIO DE DOCUMENTOS POR SECCIONES</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="5%" colspan="2" bgcolor="#CCCCCC"><span style="font-family: helvetica; font-size: 16px;font-weight: bold; text-align:justify;">SUB-FONDO:</span></td>'; $cadena .= '<td width="50%" colspan="4"><span style="font-family: helvetica; font-size: 16px; text-align:justify;">' . $resulth[0]->fon_descripcion . '</span></td>'; $cadena .= '<td width="5%" colspan="3" bgcolor="#CCCCCC"><span style="font-family: helvetica; font-size: 16px;font-weight: bold; text-align:justify;">TOTAL DE CAJAS:</span></td>'; $cadena .= '<td width="40%" colspan="3"><span style="font-family: helvetica; font-size: 16px; text-align:justify;">' . $nrocajas . '</span></td>'; $cadena .= '</tr>'; $unidad = new unidad(); $cadena .= '<tr>'; $cadena .= '<td width="5%" colspan="2" bgcolor="#CCCCCC"><span style="font-family: helvetica; font-size: 16px;font-weight: bold; text-align:justify;">SECCIÓN:</span></td>'; $cadena .= '<td width="50%" colspan="4"><span style="font-family: helvetica; font-size:16px;">' . $unidad->obtenerPadre($resulth[0]->uni_par, $resulth[0]->uni_descripcion) . '</span></td>'; $cadena .= '<td width="5%" colspan="3" bgcolor="#CCCCCC"><span style="font-size: 16px;font-weight: bold; text-align:justify;">TOTAL DE PIEZAS:</span></td>'; $cadena .= '<td width="40%" colspan="3"><span style="font-size: 16px;">' . $piezas . '</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr>'; $cadena .= '<td width="5%" colspan="2" bgcolor="#CCCCCC"><span style="font-size: 16px;font-weight: bold; text-align:justify;">SUB SECCIÓN:</span></td>'; $cadena .= '<td width="50%" colspan="4"><span style="font-size: 16px;">' . $unidad->obtenerPadres($resulth[0]->uni_par, $resulth[0]->uni_descripcion) . '</span></td>'; $cadena .= '<td width="5%" colspan="3" bgcolor="#CCCCCC"><span style="font-size: 16px;font-weight: bold; text-align:justify;"></span></td>'; $cadena .= '<td width="40%" colspan="3"><span style="font-size: 16px;"></span></td>'; $cadena .= '</tr>'; // Body - Header $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="95%" align="center" colspan="11"><span style="font-family: helvetica; font-size: 11px;font-weight: bold;">ÁREA DE IDENTIFICACIÓN</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px;font-weight: bold;">ÁREA DE NOTAS</span></td>'; $cadena .= '</tr>'; $cadena .= '<tr bgcolor="#CCCCCC">'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Archivo</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Código</span></td>'; $cadena .= '<td width="60%" align="center"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Titulo/Subtitulo</span></td>'; $cadena .= '<td width="5%" align="center"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">T/V</span></td>'; $cadena .= '<td width="5%" align="center"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Fechas Extremas</span></td>'; $cadena .= '<td width="3%" align="center"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Caja</span></td>'; $cadena .= '<td width="3%" align="center"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold;">Sala</span></td>'; $cadena .= '<td width="3%" align="center"><span style="font-family: helvetica; font-size: 9px ;font-weight: bold;">Estante</span></td>'; $cadena .= '<td width="3%" align="center"><span style="font-family: helvetica; font-size: 9px ;font-weight: bold;">Cuerpo</span></td>'; $cadena .= '<td width="3%" align="center"><span style="font-family: helvetica; font-size: 9px ;font-weight: bold;">Balda</span></td>'; $cadena .= '<td width="5%" align="center"><span style="font-family: helvetica; font-size: 9px ;font-weight: bold;">Soporte Fisico</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 9px ;font-weight: bold; height: auto; ">Observaciones</span></td>'; $cadena .= '</tr>'; // Body - Data $sql = "SELECT\r\n tab_unidad.uni_id,\r\n tab_unidad.uni_descripcion,\r\n tab_series.ser_id,\r\n tab_series.ser_categoria\r\n FROM\r\n tab_unidad\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n WHERE tab_unidad.uni_id = {$filtro_seccion}\r\n ORDER BY\r\n tab_series.ser_orden, ser_codigo "; $expedienteh = new Tab_expediente(); $result = $expedienteh->dbselectBySQL($sql); foreach ($result as $res) { // Serie // Expedientes sin documentos // Search exps $select = "SELECT\r\n tab_expediente.exp_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 tab_expisadg.exp_mesi,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_mesf,\r\n tab_expisadg.exp_aniof,\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_expediente.exp_tomovol,\r\n tab_expediente.sof_id,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expediente.exp_obs\r\n 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 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_expisadg.exp_estado = 1 AND \r\n tab_expusuario.eus_estado = 1 AND \r\n tab_series.ser_id = '{$res->ser_id}'\r\n ORDER BY tab_unidad.uni_cod, \r\n tab_series.ser_id, \r\n tab_expediente.exp_codigo::int "; $ser_categoria = ""; $exp_titulo = ""; $sopfisico = new sopfisico(); $rows2 = $expedienteh->dbSelectBySQL($select); if (count($rows2) > 0) { // Expedientes // Data body foreach ($rows2 as $row) { if ($row->ser_categoria != $ser_categoria) { // Validate // Aqui // Expedientes // Search docs $select = "SELECT\r\n tab_expediente.exp_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 tab_expisadg.exp_mesi,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_mesf,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_aniof, \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_expediente.exp_tomovol,\r\n tab_expediente.sof_id,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda\r\n 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 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_expisadg.exp_estado = 1 AND \r\n tab_expusuario.eus_estado = 1 AND \r\n tab_expediente.exp_id = '{$row->exp_id}'\r\n ORDER BY tab_unidad.uni_id, \r\n tab_series.ser_id, \r\n tab_expediente.exp_codigo::int "; $sopfisico = new sopfisico(); $rows4 = $expedienteh->dbSelectBySQL($select); if (count($rows4) > 0) { // SERIE $cadena .= '<tr bgcolor="#969696">'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;"></span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold; text-align:left;">' . $row->fon_cod . DELIMITER . $row->uni_cod . DELIMITER . $row->tco_codigo . DELIMITER . $row->ser_codigo . DELIMITER . '</span></td>'; $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align:left;">' . $row->ser_categoria . '</span></td>'; $cadena .= '<td width="5%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="5%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="3%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="3%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="3%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="3%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="3%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="5%"><span style="font-family: helvetica; font-size: 11px; text-align:center;"></span></td>'; $cadena .= '<td width="5%" height="auto"><span style="font-family: helvetica; font-size: 7px; text-align:left; "></span></td>'; $cadena .= '</tr>'; $ser_categoria = $row->ser_categoria; } } // Aqui // Documentos // Search docs $select = "SELECT\r\n tab_expediente.exp_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 tab_expisadg.exp_mesi,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_mesf,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_aniof, \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_expediente.exp_tomovol,\r\n tab_expediente.sof_id,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expusuario.usu_id\r\n 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 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_expisadg.exp_estado = 1 AND \r\n tab_expusuario.eus_estado = 1 AND \r\n tab_expediente.exp_id = '{$row->exp_id}'\r\n ORDER BY tab_unidad.uni_id, \r\n tab_series.ser_id, \r\n tab_expediente.exp_codigo::int "; $exp_titulo = ""; $sopfisico = new sopfisico(); $usuario = new usuario(); $rows3 = $expedienteh->dbSelectBySQL($select); if (count($rows3) > 0) { // Data body foreach ($rows3 as $row) { // EXPEDIENTE if ($row->exp_titulo != $exp_titulo) { $cadena .= '<tr bgcolor="#DDDDDD">'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $usuario->getRol($row->usu_id) . '</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold; text-align: left;">' . $row->fon_cod . DELIMITER . $row->uni_cod . DELIMITER . $row->tco_codigo . DELIMITER . $row->ser_codigo . DELIMITER . $row->exp_codigo . '</span></td>'; $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align: left;">' . $row->exp_titulo . '</span></td>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_tomovol . '</span></td>'; if ($row->exp_aniof) { if ($row->exp_aniof != " ") { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_anioi . ' - ' . $row->exp_aniof . '</span></td>'; } else { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_anioi . '</span></td>'; } } else { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_anioi . '</span></td>'; } $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_nrocaj . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_sala . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_estante . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_cuerpo . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row->exp_balda . '</span></td>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $sopfisico->obtenerNombre($row->sof_id) . '</span></td>'; $cadena .= '<td width="5%" height="auto" align="left" valign="top"><span style="font-family: helvetica; font-size: 7px; text-align: left; height: auto; ">' . $row->exp_obs . '</span></td>'; $cadena .= '</tr>'; $exp_titulo = $row->exp_titulo; // Documento // Aqui // Documentos // Search docs $select = "SELECT\r\n tab_expediente.exp_id,\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 tab_expisadg.exp_mesi,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_mesf,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_aniof, \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_expediente.exp_tomovol,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expusuario.usu_id,\r\n tab_cuerpos.cue_codigo,\r\n tab_archivo.fil_codigo,\r\n tab_archivo.fil_nro,\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 tab_archivo.sof_id,\r\n tab_archivo.sof_id,\r\n tab_archivo.fil_anio,\r\n tab_archivo.fil_aniof,\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\r\n 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_expisadg.exp_estado = 1 AND \r\n tab_archivo.fil_estado = 1 AND\r\n tab_exparchivo.exa_estado = 1 AND\r\n tab_expediente.exp_id = '{$row->exp_id}'\r\n ORDER BY tab_unidad.uni_id, \r\n tab_series.ser_id, \r\n tab_expediente.exp_codigo::int,\r\n tab_archivo.fil_nro::int "; $sopfisico = new sopfisico(); $rows6 = $expedienteh->dbSelectBySQL($select); if (count($rows6) > 0) { foreach ($rows6 as $row6d) { // Documentos $cadena .= '<tr>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $usuario->getRol($row6d->usu_id) . '</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold; text-align: left;">' . $row6d->fon_cod . DELIMITER . $row6d->uni_cod . DELIMITER . $row6d->tco_codigo . DELIMITER . $row6d->ser_codigo . DELIMITER . $row6d->exp_codigo . DELIMITER . $row6d->fil_nro . '</span></td>'; if ($row6d->fil_subtitulo) { $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align: left;">' . $row6d->fil_titulo . '-' . $row6d->fil_subtitulo . '</span></td>'; } else { $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align: left;">' . $row6d->fil_titulo . '</span></td>'; } $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_tomovol . '</span></td>'; if ($row6d->fil_aniof) { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;;">' . $row6d->fil_anio . ' - ' . $row6d->fil_aniof . '</span></td>'; } else { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;;">' . $row6d->fil_anio . '</span></td>'; } $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_nrocaj . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_sala . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_estante . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_cuerpo . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_balda . '</span></td>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $sopfisico->obtenerNombre($row6d->sof_id) . '</span></td>'; $cadena .= '<td width="5%" height="auto" align="left" valign="top"><span style="font-family: helvetica; font-size: 7px; text-align: left; height: auto; ">' . $row6d->fil_obs . '</span></td>'; $cadena .= '</tr>'; } } $exp_titulo = $row->exp_titulo; } else { // Documento // Aqui // Documentos // Search docs $select = "SELECT\r\n tab_expediente.exp_id,\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 tab_expisadg.exp_mesi,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_mesf,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_aniof, \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_expediente.exp_tomovol,\r\n tab_expediente.exp_nrocaj,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expusuario.usu_id,\r\n tab_cuerpos.cue_codigo,\r\n tab_archivo.fil_codigo,\r\n tab_archivo.fil_nro,\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 tab_archivo.sof_id,\r\n tab_archivo.fil_anio,\r\n tab_archivo.fil_aniof,\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\r\n 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_expisadg.exp_estado = 1 AND \r\n tab_archivo.fil_estado = 1 AND\r\n tab_exparchivo.exa_estado = 1 AND\r\n tab_expediente.exp_id = '{$row->exp_id}'\r\n ORDER BY tab_unidad.uni_id, \r\n tab_series.ser_id, \r\n tab_expediente.exp_codigo::int, \r\n tab_archivo.fil_nro::int "; $sopfisico = new sopfisico(); $rows6 = $expedienteh->dbSelectBySQL($select); if (count($rows6) > 0) { foreach ($rows6 as $row6d) { // Documentos $cadena .= '<tr>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $usuario->getRol($row6d->usu_id) . '</span></td>'; $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px ;font-weight: bold; text-align: left;">' . $row6d->fon_cod . DELIMITER . $row6d->uni_cod . DELIMITER . $row6d->tco_codigo . DELIMITER . $row6d->ser_codigo . DELIMITER . $row6d->exp_codigo . DELIMITER . $row6d->fil_nro . '</span></td>'; if ($row6d->fil_subtitulo) { $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align: left;">' . $row6d->fil_titulo . '-' . $row6d->fil_subtitulo . '</span></td>'; } else { $cadena .= '<td width="60%"><span style="font-family: helvetica; font-size: 11px; text-align: left;">' . $row6d->fil_titulo . '</span></td>'; } $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_tomovol . '</span></td>'; if ($row6d->fil_aniof) { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_anio . ' - ' . $row6d->fil_aniof . '</span></td>'; } else { $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_anio . '</span></td>'; } $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_nrocaj . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_sala . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_estante . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_cuerpo . '</span></td>'; $cadena .= '<td width="3%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $row6d->fil_balda . '</span></td>'; $cadena .= '<td width="5%" align="center" valign="top"><span style="font-family: helvetica; font-size: 11px; text-align: center;">' . $sopfisico->obtenerNombre($row6d->sof_id) . '</span></td>'; $cadena .= '<td width="5%" height="auto" align="left" valign="top"><span style="font-family: helvetica; font-size: 7px; text-align: left; height: auto; ">' . $row6d->fil_obs . '</span></td>'; $cadena .= '</tr>'; } } $exp_titulo = $row->exp_titulo; } } // end for } } // end for } } // End foreach $cadenaLogo = ''; $cadena .= '</table>'; if ($tiporeporte == 1) { $pdf->writeHTML($cadena, true, false, false, false, ''); //Close and output PDF document $pdf->Output('reporte_inventario.pdf', 'I'); } else { if ($tiporeporte == 2) { echo $cadena; } else { if ($tiporeporte == 3) { $cadenaLogo .= '<tr'; $cadenaLogo .= '<td width="760" align="left"><img src="' . PATH_DOMAIN . '/web/img/logo2.png" width="80" height="100"></td>'; $cadenaLogo .= '</tr>'; $cadena = $cadenaLogo . $cadena; echo $cadena; } } } } }
function save() { $this->archivo = new tab_archivo(); $this->archivo->setRequest2Object($_REQUEST); $ser_id = $_REQUEST["ser_id"]; $exp_id = $_REQUEST["exp_id"]; $tra_id = $_REQUEST["tra_id"]; $cue_id = $_REQUEST["cue_id"]; // file $this->archivo->setFil_id(''); // Generation code if ($_REQUEST['exp_corr'] == 'AUTO') { $sqlmax = "select MAX(tab_archivo.fil_codigo) as maximo from tab_archivo"; $max = $this->archivo->dbSelectBySQL($sqlmax); foreach ($max as $cant) { $valmax = $cant->maximo; } if ($valmax == "") { $valmax = 0; } $this->archivo->setFil_codigo($valmax + 1); $maxFil = new Tab_expediente(); $sql2 = "SELECT\r\n MAX(tab_archivo.fil_nro) AS maxnro\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$exp_id} AND\r\n tab_expediente.exp_estado = 1"; $cant_max = $maxFil->dbSelectBySQL($sql2); foreach ($cant_max as $lismax) { $max3 = $lismax->maxnro; } if ($max3 == "") { $max3 = 0; } $max3 = $max3 + 1; $this->archivo->setFil_nro($max3); } else { $this->archivo->setFil_codigo($_REQUEST['fil_nro']); $this->archivo->setFil_nro($_REQUEST['fil_nro']); } if ($_REQUEST['fil_titulo2']) { $this->archivo->setFil_titulo(strtoupper($_REQUEST['fil_titulo'] . " Nro. " . $_REQUEST['fil_titulo2'])); } else { $this->archivo->setFil_titulo(strtoupper($_REQUEST['fil_titulo'])); } $this->archivo->setFil_subtitulo(strtoupper($_REQUEST['fil_subtitulo'])); $this->archivo->setFil_fecha($_REQUEST['fil_fecha']); $this->archivo->setFil_proc(strtoupper($_REQUEST['fil_proc'])); $this->archivo->setFil_firma(strtoupper($_REQUEST['fil_firma'])); $this->archivo->setFil_cargo(strtoupper($_REQUEST['fil_cargo'])); $this->archivo->setSof_id($_REQUEST['sof_id']); $this->archivo->setFil_nrofoj($_REQUEST['fil_nrofoj']); $this->archivo->setFil_tomovol($_REQUEST['fil_tomovol']); $this->archivo->setFil_nroejem(strtoupper($_REQUEST['fil_nroejem'])); $this->archivo->setFil_nrocaj(strtoupper($_REQUEST['fil_nrocaj'])); $this->archivo->setFil_sala(strtoupper($_REQUEST['fil_sala'])); $this->archivo->setFil_estante(strtoupper($_REQUEST['fil_estante'])); $this->archivo->setFil_cuerpo(strtoupper($_REQUEST['fil_cuerpo'])); $this->archivo->setFil_balda(strtoupper($_REQUEST['fil_balda'])); $this->archivo->setFil_tipoarch($_REQUEST['fil_tipoarch']); if ($_REQUEST['fil_mrb']) { $this->archivo->setFil_mrb($_REQUEST['fil_mrb']); } $this->archivo->setFil_mes($_REQUEST['fil_mes']); $this->archivo->setFil_anio($_REQUEST['fil_anio']); $this->archivo->setFil_mesf($_REQUEST['fil_mesf']); $this->archivo->setFil_aniof($_REQUEST['fil_aniof']); $this->archivo->setIdi_id($_REQUEST['idi_id']); $this->archivo->setFil_confidencialidad($_REQUEST['fil_confidencialidad']); $this->archivo->setFil_obs(strtoupper($_REQUEST['fil_obs'])); $this->archivo->setFil_estado('1'); if ($_REQUEST['fil_ori']) { $this->archivo->setFil_ori($_REQUEST['fil_ori']); } else { $this->archivo->setFil_ori(0); } if ($_REQUEST['fil_cop']) { $this->archivo->setFil_cop($_REQUEST['fil_cop']); } else { $this->archivo->setFil_cop(0); } if ($_REQUEST['fil_fot']) { $this->archivo->setFil_fot($_REQUEST['fil_fot']); } else { $this->archivo->setFil_fot(0); } $this->archivo->setFil_alccon(strtoupper($_REQUEST['fil_alccon'])); if ($_REQUEST['fil_nropaq']) { $this->archivo->setFil_nropaq(strtoupper($_REQUEST['fil_nropaq'])); } else { $this->archivo->setFil_nropaq('0'); } $this->archivo->setFil_cantpaq(strtoupper(trim($_REQUEST['fil_cantpaq']))); $this->archivo->setFil_cantcaj(strtoupper(trim($_REQUEST['fil_cantcaj']))); $fil_id = $this->archivo->insert2(); // update code $this->archivo2 = new tab_archivo(); $this->archivo2->setFil_id($fil_id); $this->archivo2->setFil_codigo($fil_id); $this->archivo2->setFil_estado('1'); $this->archivo2->update(); // Tab_doccorr $doccorr = new Tab_doccorr(); $doccorr->setFil_id($fil_id); if ($_REQUEST['fil_nur']) { $doccorr->setFil_nur($_REQUEST['fil_nur']); if ($_REQUEST['fil_nur_s']) { $doccorr->setFil_nur_s(strtoupper($_REQUEST['fil_nur_s'])); } if ($_REQUEST['fil_cite']) { $doccorr->setFil_cite(strtoupper($_REQUEST['fil_cite'])); } if ($_REQUEST['fil_asunto']) { $doccorr->setFil_asunto(strtoupper($_REQUEST['fil_asunto'])); } if ($_REQUEST['fil_sintesis']) { $doccorr->setFil_sintesis(strtoupper($_REQUEST['fil_sintesis'])); } $doccorr->setDco_estado(1); $dco_id = $doccorr->insert(); if ($_REQUEST['tiponur'] == 'ORI' || $_REQUEST['tiponur'] == '') { // Registra en el SIACO tabla archivados $this->archivados = new tab_archivados(); $this->archivados->setRequest2Object($_REQUEST); $this->archivados->setId_archivado("0"); $this->archivados->setCodigo($_REQUEST['fil_nur']); $this->archivados->setFecha(date("Y-m-d")); $this->archivados->setPersona($_SESSION['USU_LOGIN']); $this->archivados->setLugar($_REQUEST['exp_id'] . '-' . $_REQUEST['exp_nombre']); $this->archivados->setObservaciones("SAD"); $this->archivados->setCopia("NO"); $this->archivados->insert(); // Update seguimiento $this->seguimientos = new Tab_seguimientos(); $sql = "SELECT seguimientos.id_seguimiento\r\n FROM seguimientos\r\n WHERE codigo = '" . $_REQUEST['fil_nur'] . "'\r\n ORDER BY id_seguimiento DESC "; $rows = $this->seguimientos->dbSelectBySQL($sql); $row = $rows[0]; $this->seguimientos->setId_seguimiento($row->id_seguimiento); $this->seguimientos->setEstado(100); $this->seguimientos->update(); } else { // Registra en el SIACO tabla archivados_digitales $this->archivados_digitales = new tab_archivados_digitales(); $this->archivados_digitales->setRequest2Object($_REQUEST); $this->archivados_digitales->setId_archivado("0"); $this->archivados_digitales->setCodigo($_REQUEST['fil_nur']); $this->archivados_digitales->setFecha(date("Y-m-d")); $this->archivados_digitales->setPersona($_SESSION['USU_LOGIN']); $this->archivados->setLugar($_REQUEST['exp_id'] . '-' . $_REQUEST['exp_nombre']); $this->archivados_digitales->setObservaciones("SAD"); $this->archivados_digitales->setCopia("SI"); $this->archivados_digitales->insert(); // Update seguimiento $this->seguimientos = new Tab_seguimientos(); $sql = "SELECT seguimientos.id_seguimiento\r\n FROM seguimientos\r\n WHERE codigo = '" . $_REQUEST['fil_nur'] . "'\r\n ORDER BY id_seguimiento DESC "; $rows = $this->seguimientos->dbSelectBySQL($sql); $row = $rows[0]; $this->seguimientos->setId_seguimiento($row->id_seguimiento); $this->seguimientos->setEstado(51); $this->seguimientos->update(); } } // $usu_id = 0; // // // expusuario // $this->expusuario = new Tab_expusuario (); // $sql = "SELECT * // FROM tab_expusuario // WHERE eus_estado = 1 // and exp_id='" . $exp_id . "' "; // $rows_eus = $this->expusuario->dbselectBySQL($sql); // if (count($rows_eus) >= 1) { // $usu_id = $rows_eus [0]->getUsu_id(); // } // exparchivo $this->exparchivo = new tab_exparchivo(); $this->exparchivo->setExa_id(''); $this->exparchivo->setFil_id($fil_id); $this->exparchivo->setExp_id($exp_id); $this->exparchivo->setTra_id($tra_id); $this->exparchivo->setCue_id($cue_id); $this->exparchivo->setExa_condicion('1'); $this->exparchivo->setExa_estado(1); $this->exparchivo->insert(); // Keywords if (!empty($_REQUEST['fil_descripcion'])) { $this->palclave = new tab_palclave(); $pac_nombre = trim($_REQUEST['fil_descripcion']); $array = explode(SEPARATOR_SEARCH, $pac_nombre); for ($j = 0; $j < count($array); $j++) { $sql = "select pac_id from tab_palclave where pac_estado = 1 AND fil_id='{$fil_id}' AND pac_nombre='" . $array[$j] . "'"; $row = $this->palclave->dbSelectBySQL($sql); if (count($row) == 0) { $this->palclave->setFil_id($fil_id); $this->palclave->setPac_nombre(strtoupper(trim($array[$j]))); $this->palclave->setPac_formulario('Documento'); $this->palclave->setPac_estado(1); $this->palclave->insert(); } } } $msm_guardado_archivo = 1; if ($_FILES["archivo"]["error"] == 4) { } else { // Digital file $archivo_digital = new tab_archivo_digital(); $archivo_type = $_FILES["archivo"]["type"]; $archivo = $_FILES["archivo"]["tmp_name"]; $archivo_size = $_FILES["archivo"]["size"]; $archivo_name = $_FILES["archivo"]["name"]; $nombre = basename($_FILES["archivo"]["name"]); $nombreFichero = $_FILES["archivo"]["name"]; $archivo_name_array = explode(".", $archivo_name); $archivo_ext = array_pop($archivo_name_array); $archivo_cifrado = md5($archivo_name); $sis_tammax = 0; // Data Parameters $sis_tipcarga = 2; $nombreDirectorio = ""; $tsistema = new tab_sistema(); $sql = "SELECT *\r\n FROM tab_sistema"; $rows2 = $tsistema->dbselectBySQL($sql); if (count($rows2) >= 1) { $sis_tipcarga = $rows2[0]->sis_tipcarga; $sis_tammax = $rows2[0]->sis_tammax; $nombreDirectorio = $rows2[0]->sis_ruta; } // Verify size if ($archivo_size > $sis_tammax) { $errores["archivo"] = "El tamanio del fichero supera el limite permitido ({$sis_tammax} Mbytes)!"; $error = true; } else { if ($sis_tipcarga == 2) { // SERVER FILE $error = false; $copiarFichero = false; if (is_uploaded_file($_FILES['archivo']['tmp_name'])) { //$nombreDirectorio = "img/"; $nombreFichero = $_FILES['archivo']['name']; $copiarFichero = true; $nombreCompleto = $nombreDirectorio . $nombreFichero; if (is_file($nombreCompleto)) { $idUnico = time(); $nombreFichero = $idUnico . "-" . $nombreFichero; } } else { if ($_FILES['archivo']['error'] == UPLOAD_ERR_FORM_SIZE) { // $maxsize = $_REQUEST['MAX_FILE_SIZE']; $errores["archivo"] = "El tamanio del fichero supera el limite permitido ({$sis_tammax} bytes)!"; $error = true; } else { if ($_FILES['archivo']['name'] == "") { $nombreFichero = ''; } else { $errores["archivo"] = "No se ha podido subir el fichero!"; $msm_guardado_archivo = 0; $error = true; } } } if ($error == false) { $link = $archivo_digital->connect(); pg_query($link, "begin"); $sql = "INSERT INTO tab_archivo_digital(fil_id,\r\n fil_nomoriginal,\r\n fil_nomcifrado,\r\n fil_tipo,\r\n fil_tamano,\r\n fil_extension,\r\n nombre,\r\n mime,\r\n size,\r\n archivo,\r\n fil_estado)\r\n VALUES ({$fil_id},\r\n '{$nombreFichero}',\r\n '{$archivo_cifrado}',\r\n '{$archivo_type}',\r\n '{$archivo_size}' ,\r\n '{$archivo_ext}' ,\r\n '{$nombre}',\r\n '{$archivo_type}',\r\n {$archivo_size},\r\n '{$nombreFichero}',\r\n 1)"; pg_query($link, $sql) or die(pg_last_error($link)); pg_query($link, "commit"); if ($copiarFichero) { move_uploaded_file($_FILES['archivo']['tmp_name'], $nombreDirectorio . $nombreFichero); } $msm_guardado_archivo = 1; } } else { // BD $link = $archivo_digital->connect(); $fp = fopen($archivo, "rb"); $contenido = fread($fp, filesize($archivo)); fclose($fp); pg_query($link, "begin"); $oid = pg_lo_create($link); $sql = "INSERT INTO tab_archivo_digital(fil_id,\r\n fil_nomoriginal,\r\n fil_nomcifrado,\r\n fil_tipo,\r\n fil_tamano,\r\n fil_extension,\r\n nombre,\r\n archivo_oid,\r\n mime,\r\n size,\r\n archivo)\r\n VALUES ({$fil_id},\r\n '{$archivo_name}',\r\n '{$archivo_cifrado}',\r\n '{$archivo_type}',\r\n '{$archivo_size}',\r\n '{$archivo_ext}',\r\n '{$nombre}',\r\n {$oid},\r\n '{$archivo_type}',\r\n {$archivo_size},\r\n '{$nombreFichero}')"; pg_query($link, $sql) or die(pg_last_error($link)); $blob = pg_lo_open($link, $oid, "w"); pg_lo_write($blob, $contenido); pg_lo_close($blob); pg_query($link, "commit"); $msm_guardado_archivo = 1; } } } $msm = "SE GUARDO CORRECTAMENTE EL EXPEDIENTE!"; $this->registry->template->msm = $msm; // Forwarding if ($_REQUEST['accion'] == 'guardarsinsalir') { $msm_guardado_archivo = 1; Header("Location: " . PATH_DOMAIN . "/archivo/view/" . $exp_id . "/" . $fil_id . "/" . $msm_guardado_archivo . "/"); // } else if ($_REQUEST ['accion'] == 'guardarnuevo') { // $_SESSION['SER_ID'] = $_REQUEST['ser_id']; // $this->add(); } else { if ($_REQUEST['accion'] == 'guardar') { header("location:" . PATH_DOMAIN . "/archivo/viewTree/" . $exp_id . "/" . $msm_guardado_archivo . "/{$cue_id}/"); } else { header("location:" . PATH_DOMAIN . "/archivo/viewTree/" . $exp_id . "/" . $msm_guardado_archivo . "/{$cue_id}/"); } } // if ($_REQUEST ['accion'] == 'guardarsinsalir') { // $msm_guardado_archivo = 1; // Header("Location: " . PATH_DOMAIN . "/archivo/view/" . $exp_id . "/" . $fil_id . "/". $msm_guardado_archivo . "/"); // // }else if ($_REQUEST ['accion'] == 'cargarnuevo') { // header("location:" . PATH_DOMAIN . "/archivo/viewTree/" . $exp_id . "/" . $msm_guardado_archivo . "/$cue_id/"); // //$this->add2(); // } else { // header("location:" . PATH_DOMAIN . "/archivo/viewTree/" . $exp_id . "/" . $msm_guardado_archivo . "/$cue_id/"); // } }