function index()
 {
     $unidad = new unidad();
     $this->registry->template->uni_id = $unidad->obtenerSelectPorSerie();
     $this->registry->template->ser_id = "";
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_EVENT = "verRpte";
     $this->registry->template->GRID_SW = "true";
     $this->registry->template->PATH_J = "jquery-1.4.1";
     $this->menu = new menu();
     $liMenu = $this->menu->imprimirMenu("rpteMarbetesSecciones", $_SESSION['USU_ID']);
     $this->registry->template->men_titulo = $liMenu;
     $this->registry->template->show('headerG');
     $this->registry->template->show('tab_rpteMarbetesSecciones.tpl');
     $this->registry->template->show('footer');
 }
 function view()
 {
     if (!VAR3) {
         die("Error del sistema 404");
     }
     $codigo = "";
     $codigop = "";
     $serie = new series();
     $this->usuario = new usuario();
     $adm = $this->usuario->esAdm();
     $this->series = new tab_series();
     $this->series->setRequest2Object($_REQUEST);
     $row = $this->series->dbselectByField("ser_id", VAR3);
     $row = $row[0];
     // Find state
     $departamento = new departamento();
     //$dep_id = $departamento->obtenerIdDeptoCodigoSerie($row->ser_codigo);
     $this->registry->template->dep_id = $departamento->obtenerSelect($row->dep_id);
     //$departamento->obtenerSelect($dep_id);
     // Find unity
     $unidad = new unidad();
     $this->registry->template->uni_id = $unidad->listUnidad($row->uni_id);
     //$unidad->obtenerSelect($uni_id);
     $fondo = new fondo();
     $this->registry->template->fon_id = $fondo->obtenerSelectFondosbySeccion($row->uni_id);
     $this->registry->template->adm = $adm;
     $this->registry->template->ser_id = $row->ser_id;
     $this->registry->template->ser_par = $serie->obtenerSelectSeriesDefault($row->ser_par);
     $this->registry->template->ser_categoria = utf8_encode($row->ser_categoria);
     $this->registry->template->ser_tipo = $row->ser_tipo;
     $this->registry->template->ser_contador = $row->ser_contador;
     $this->registry->template->fon_cod = $fondo->getCod($row->uni_id);
     $this->registry->template->uni_cod = $unidad->getCodigo($row->uni_id);
     $tipo_corr = new tipocorr();
     $this->registry->template->tco_codigo = $tipo_corr->getCodigoById($row->tco_id);
     $retensiondoc = new retensiondoc();
     $this->registry->template->tco_id = $tipo_corr->obtenerSelect($row->tco_id);
     $this->registry->template->red_id = $retensiondoc->obtenerSelect($row->red_id);
     $this->registry->template->delimiter = DELIMITER;
     $this->registry->template->ser_orden = $row->ser_orden;
     $this->registry->template->ser_codigo = $row->ser_codigo;
     if ($row->ser_corr == 'AUTO') {
         $this->registry->template->ser_corr = "<OPTION selected>AUTO</OPTION><OPTION>MANUAL</OPTION>";
     } else {
         $this->registry->template->ser_corr = "<OPTION>AUTO</OPTION><OPTION selected>MANUAL</OPTION>";
     }
     $this->registry->template->ser_exp = $row->ser_exp;
     $this->registry->template->ser_nivel = $row->ser_nivel;
     $this->registry->template->serclon_id = "";
     $tramiteSerie = new tramite();
     $tramites = $tramiteSerie->obtenerTramitesSerie(VAR3);
     $tramiteTr = "";
     $i = 0;
     if ($tramites != "") {
         foreach ($tramites as $tramite) {
             $tramiteTr .= "<tr><td><input type='checkbox' name='tramite[{$i}]' value='" . $tramite->tra_id . "' {$tramite->checked}></td><td>" . $tramite->tra_descripcion . "</td></tr>\n";
             $i++;
         }
     } else {
         $tramiteTr = "<tr><td colspan='2'>No existen tramites</td></tr>";
     }
     $this->registry->template->LISTA_TRAMITES = $tramiteTr;
     $this->registry->template->LISTA_TRAMITES_SELECT = '';
     //$tramiteLi;
     $this->registry->template->titulo = "Editar ";
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_EVENT = "update";
     $this->registry->template->GRID_SW = "true";
     $this->registry->template->PATH_J = "jquery-1.4.1";
     $this->menu = new menu();
     $this->liMenu = $this->menu->imprimirMenu(VAR1, $_SESSION['USU_ID']);
     $this->registry->template->men_titulo = $this->liMenu;
     $this->registry->template->show('headerG');
     $this->registry->template->show('serie/tab_series.tpl');
     $this->registry->template->show('footer');
 }
示例#3
0
    <label>Tipo Unidad</label>
    <label class='form-control' id='txt_id_tipo_unidad'>...</label>
    <p class='help-block'><a href='#modal_id_tipo_unidad' data-toggle='modal'>Seleccionar</a></p>
    <input type='hidden' name='id_tipo_unidad' id='id_tipo_unidad' value=''/>
</div>

<div class='control-group'>
    <p></p>
    <button type='button' class='btn btn-primary' onclick='save()'>Guardar</button>
    <button type='reset' class='btn'>Limpiar</button>
</div>
</form>
<hr/>
<?php 
include_once 'nucleo/unidad.php';
$obj = new unidad();
$objs = $obj->listDB();
include_once 'nucleo/tipo_unidad.php';
?>
<div class='contenedor-tabla'>
    <table id='tb' class='display' cellspacing='0' width='100%'>
        <thead>
            <tr>
                <th>Id</th><th>Tipo Unidad</th><th>Placa</th>
                <th>OPC</th>
            </tr>
        </thead>
        <tbody>
            <?php 
if (is_array($objs)) {
    foreach ($objs as $o) {
<?php

include '../ReglasNegocio/bodega.php';
include '../ReglasNegocio/unidad.php';
include "../ReglasNegocio/asociado.php";
$asociado = new asociado();
$folio = $asociado->GetMayor() + 1;
$unidad = new unidad();
$bodega = new bodega();
$boton = "verifica()";
$boton2 = "verifica2()";
?>
<script LANGUAGE="JavaScript">

function verifica()
{
	if (document.miform.NInventario.value.length==0)
   {
		alert("Debe ingresar un Numero de Inventario");
		document.miform.MInventario.focus();
      	return 0;
	}
	if(document.miform.NombreI.value.length==0){
		alert("Debe ingresar un Nombre de Inventario");
		document.miform.NombreI.focus();
      	return 0;
	}
	if(document.miform.periodo.value.length==0){
		alert("Debe ingresar un Periodo, si es indefinido ingrese '-1'");
		document.miform.periodo.focus();
      	return 0;
 function verifyFields($id)
 {
     $unidad = new unidad();
     //el ingreso es normal
     $sql = "SELECT *\r\n                FROM tab_usuario\r\n                WHERE usu_id='" . $id . "'";
     $row = $unidad->dbselectBySQL($sql);
     if (count($row)) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 function verRpteExcel()
 {
     $id = VAR3;
     $where = "";
     $tab_extransferencia = new tab_exptransferencia();
     $result = $tab_extransferencia->dbSelectBySQL("select* from tab_exptransferencia where str_id={$id}");
     $cantidad = count($result);
     $valor3 = "";
     $t = 1;
     foreach ($result as $row) {
         $valor3 .= "tab_expediente.exp_id={$row->exp_id}";
         if ($t < $cantidad) {
             $valor3 .= " or ";
         }
         $t++;
     }
     $where .= " AND {$valor3} ";
     $sql = "SELECT\r\n            f.fon_codigo,\r\n            f.fon_cod,\r\n            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n            tab_expediente.exp_codigo AS codigo,\r\n            (NULLIF(tab_expediente.exp_codigo,'')::int) as cantidad,\r\n            tab_soltransferencia.str_id,\r\n            tab_soltransferencia.str_fecha,\r\n            tab_soltransferencia.uni_id,\r\n            tab_soltransferencia.unid_id,\r\n            tab_soltransferencia.str_nrocajas,\r\n            tab_soltransferencia.str_totpzas,\r\n            tab_soltransferencia.str_totml,\r\n            tab_soltransferencia.str_nroreg,\r\n            tab_soltransferencia.str_fecini,\r\n            tab_soltransferencia.str_fecfin,\r\n            tab_soltransferencia.str_estado,\r\n            tab_soltransferencia.usu_id,\r\n            tab_soltransferencia.usud_id,\r\n            tab_soltransferencia.str_direccion,\r\n            tab_soltransferencia.str_telefono,\r\n            tab_expisadg.exp_fecha_exi,\r\n            tab_expisadg.exp_fecha_exf,\r\n            tab_expisadg.exp_anioi,\r\n            tab_expisadg.exp_aniof,\r\n            tab_expisadg.exp_titulo,\r\n            tab_series.ser_codigo,\r\n            tab_unidad.uni_codigo,\r\n            tab_unidad.uni_id,\r\n            tab_unidad.uni_par,\r\n            tab_unidad.uni_cod,\r\n            tab_unidad.uni_descripcion,\r\n            f.fon_cod,\r\n            tab_series.ser_categoria,\r\n            tab_expisadg.exp_titulo,\r\n            tab_expediente.exp_obs,\r\n            tab_series.ser_id,\r\n            tab_series.ser_par,\r\n            tab_expediente.exp_id\r\n            FROM\r\n            tab_unidad\r\n            INNER JOIN tab_fondo as f ON tab_unidad.fon_id = f.fon_id\r\n            INNER JOIN tab_series ON tab_series.uni_id = tab_unidad.uni_id\r\n            INNER JOIN tab_expediente ON tab_expediente.ser_id = tab_series.ser_id\r\n            INNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\n            INNER JOIN tab_exptransferencia ON tab_expediente.exp_id = tab_exptransferencia.exp_id\r\n            INNER JOIN tab_soltransferencia ON tab_soltransferencia.str_id = tab_exptransferencia.str_id\r\n            INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n            WHERE\r\n            tab_soltransferencia.str_estado = 2 AND\r\n            tab_expediente.exp_estado = 1 {$where} order by tab_expediente.exp_id ";
     $usua = new usuario();
     $subfondo = new fondo();
     $seccion = new unidad();
     $expedientes = new expediente();
     $archivo = new tab_archivo();
     $archivo2 = new tab_archivo();
     $query = $archivo->dbSelectBySQL($sql);
     $query2 = $archivo2->dbSelectBySQL($sql);
     foreach ($query2 as $ids) {
         $usu_id = $ids->usu_id;
         $uni_id = $ids->uni_id;
         $uni_par = $ids->uni_par;
         $uni_cod = $ids->uni_cod;
         $str_telefono = $ids->str_telefono;
         $str_id = $ids->str_id;
         $str_fecha = $ids->str_fecha;
         $str_direccion = $ids->str_direccion;
         $uni_descripcion = $ids->uni_descripcion;
     }
     $usuarioOrigen = $usua->obtenerNombre($usu_id);
     $usuarioDestino = $usua->obtenerNombre($usu_id);
     $fond = $subfondo->obtenerfon($usu_id);
     $ob_seccion = $seccion->obtenerSeccion($uni_id);
     $cadena = "";
     $cadena = "<br/><br/><br/><br/><br/><br/><br/>";
     $cadena .= '<table width="740" border="1">';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="10" align="center" ><b>';
     $cadena .= 'FORMULARIO DE RELACION DE TRANSFERENCIAS</b><br /></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="9" align="right" style=border:none ><b>';
     $cadena .= 'Nº de transferencia:</b></td><td align="center">' . $str_id . '</td>';
     $cadena .= '</tr>';
     //    $cadena.='<tr>';
     //  $cadena.='<td colspan="10" align="right" ><b>';
     //  $cadena.='<b>Nº de transferencia:</b> '.$str_id.'</td>';
     //  $cadena.='</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="5"><blockquote>';
     $cadena .= '<b>Subfondo:</b> ' . $fond . '<br />';
     $cadena .= '<b>Secci&oacute;n:</b> ';
     $explode = explode(".", $uni_cod);
     $contado = count($explode);
     $codigo = "";
     for ($t = 0; $t < $contado - 1; $t++) {
         $codigo .= $explode[$t];
         if ($t < $contado - 2) {
             $codigo .= ".";
         }
     }
     $codigo2 = $codigo;
     if (strlen($codigo) == 1) {
         $codigo = $codigo . ".0";
     } else {
         $estraer_codigo = explode(".", $codigo);
         $codigo = $estraer_codigo[0] . ".0";
     }
     $tab_unidad = new Tab_unidad();
     $unidad = new unidad();
     $sqlUni2 = "SELECT\r\n                    tab_unidad.uni_descripcion\r\n                    FROM\r\n                    tab_unidad\r\n                    WHERE\r\n                    tab_unidad.uni_cod = '{$codigo}'";
     $codigoss = explode(".", $codigo2);
     $cantcodigo2 = count($codigoss);
     if ($cantcodigo2 == 1) {
         $codigo2 = "{$codigo2}.1";
     }
     $sqlUni1 = "SELECT\r\n                    tab_unidad.uni_descripcion\r\n                    FROM\r\n                    tab_unidad\r\n                    WHERE\r\n                    tab_unidad.uni_cod = '{$codigo2}'";
     $resultadott = $tab_unidad->dbSelectBySQL($sqlUni2);
     $resultadott1 = $tab_unidad->dbSelectBySQL($sqlUni1);
     $ca1 = "";
     foreach ($resultadott1 as $rowss2) {
         $ca1 = $rowss2->uni_descripcion;
     }
     foreach ($resultadott as $rowss) {
         $ca = $rowss->uni_descripcion;
     }
     $variable = $ca;
     $excluirparent = explode("(", $variable);
     if ($excluirparent[1] == "") {
         $ca = $ca;
     } else {
         $excluirultimoparent = $excluirparent[1] . "x";
         $imprimir_descripcion = explode(")", $excluirultimoparent);
         $ca = $imprimir_descripcion[0];
     }
     $ca = $unidad->obtenerPadre($uni_par, $uni_descripcion);
     $cadena .= $ca;
     $cadena .= '<br><b>Subsecci&oacute;n:</b> ';
     $cadena .= $ca1;
     $cadena .= '</blockquote></td>';
     //$cadena.='<td colspan="5"  ><blockquote><b>Unidad:</b> '.$uni_descripcion;
     $cadena .= '<td colspan="5"  ><blockquote>';
     $cadena .= '<br /><b>Tel&eacute;fono:</b> ' . $str_telefono . '</blockquote></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td width="20" rowspan="2" align="center" bgcolor="#CCCCCC"><strong>Nº</strong></td>';
     $cadena .= '<td width="105" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Serie</strong></td>';
     $cadena .= '<td width="120" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Subserie</strong></td>';
     $cadena .= '<td width="125" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>T&iacute;tulo del Expediente</strong></td>';
     $cadena .= '<td width="80" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>C&oacute;digo de Referencia</strong></td>';
     $cadena .= '<td colspan="2" width="130" style="text-align:center" bgcolor="#CCCCCC"><strong>Fechas extremas</strong></td>';
     $cadena .= '<td width="30" rowspan="2" bgcolor="#CCCCCC" style="font-size:25px"><strong >NºDoc.</strong></td>';
     $cadena .= '<td width="30" rowspan="2" bgcolor="#CCCCCC"><strong>Cajas</strong></td>';
     $cadena .= '<td width="100" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><p><strong>Observ.</strong></p></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td width="65" style="text-align:center" bgcolor="#CCCCCC"><strong>Inicio</strong></td>';
     $cadena .= '<td width="65" style="text-align:center" bgcolor="#CCCCCC"><strong>Final</strong></td>';
     $cadena .= '</tr>';
     $sum = 0;
     $i = 1;
     $cant = 0;
     foreach ($query as $row) {
         $tabserie = new tab_series();
         if ($row->exp_fecha_exi == "") {
             $fei = "";
         } else {
             $fechainicial = explode("-", $row->exp_fecha_exi);
             $fei = $fechainicial[2] . "/" . $fechainicial[1] . "/" . $fechainicial[0];
         }
         if ($row->exp_fecha_exf == "") {
             $fef = "";
         } else {
             $fechafinal = explode("-", $row->exp_fecha_exf);
             $fef = $fechafinal[2] . "/" . $fechafinal[1] . "/" . $fechafinal[0];
         }
         $lugar = "";
         $cadena .= '<tr>';
         $cadena .= '<td align="center">' . $i . '</td>';
         $cadena .= '<td style="font-size:22px">';
         $tab_serie = new Tab_series();
         $lugar2 = "";
         if ($row->ser_par != -1) {
             $rowsdb = $tab_serie->dbselectByField("ser_id", $row->ser_par);
             foreach ($rowsdb as $fila) {
                 $ser_par = $fila->ser_par;
                 $ser_categoria = $fila->ser_categoria;
             }
             if ($ser_par != -1) {
                 $cadena .= $ser_categoria;
             } else {
                 $cadena .= $row->ser_categoria;
                 $lugar = $row->ser_categoria;
             }
         } else {
             $cadena .= $row->ser_categoria;
             $lugar2 = $row->ser_categoria;
         }
         $cadena .= '</td>';
         $cadena .= '<td style="font-size:22px">';
         if ($lugar2 != $row->ser_categoria && $row->ser_categoria != $lugar) {
             $cadena .= $row->ser_categoria;
         }
         $expsum = $expedientes->cantidadExpedientes($row->exp_id);
         //     $cajas=$expedientes->cantidadCajas($row->exp_id);
         $cant = $cant + $expsum;
         //     $sum=$sum+$cajas;
         $cadena .= '</td>';
         $cadena .= '<td align="left" style="font-size:22px">' . htmlentities($row->exp_titulo, ENT_COMPAT, 'utf-8') . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $row->codigo . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $row->exp_anioi . '</td>';
         $cadena .= '<td align="center"  style="font-size:22px">' . $row->exp_aniof . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $expsum . '</td>';
         $cadena .= '<td align="center"></td>';
         $cadena .= '<td style="font-size:22px">' . $row->exp_obs . '</td>';
         $cadena .= '</tr>';
         $i++;
     }
     $cadena .= '<tr>';
     $cadena .= '<td colspan="6" align="right" >TOTAL</td>';
     $cadena .= '<td align="center"></td>';
     $cadena .= '<td align="center">' . $cant . '</td>';
     $cadena .= '<td></td>';
     $cadena .= '<td>&nbsp;</td>';
     $cadena .= '</tr>';
     $cadena .= '</table>';
     $fecha = explode("-", $str_fecha);
     $anio = $fecha[0];
     $mes = $fecha[1];
     $dia = $fecha[2];
     switch ($mes) {
         case 1:
             $mes = "Enero";
             break;
         case 2:
             $mes = "Enero";
             break;
         case 3:
             $mes = "Enero";
             break;
         case 4:
             $mes = "Enero";
             break;
         case 5:
             $mes = "Enero";
             break;
         case 6:
             $mes = "Enero";
             break;
         case 7:
             $mes = "Enero";
             break;
         case 8:
             $mes = "Enero";
             break;
         case 9:
             $mes = "Enero";
             break;
         case 10:
             $mes = "Enero";
             break;
         case 11:
             $mes = "Enero";
             break;
         case 12:
             $mes = "Enero";
             break;
     }
     $cadena .= '<b>Lugar y fecha de la transferencia:</b> ' . $str_direccion . '  ' . $dia . ' de ' . $mes . ' de ' . $anio;
     $cadena .= '<br/>';
     require_once 'tcpdf/config/lang/eng.php';
     require_once 'tcpdf/tcpdf.php';
     $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setFontSubsetting(FALSE);
     $pdf->SetAuthor("Castellon");
     $pdf->SetTitle('Reporte de Transferencia');
     $pdf->SetSubject('Reporte de Transferencia');
     //        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, 14);
     //        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     $pdf->SetFont('helvetica', '', 10);
     // 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);
     $cadena2 = "";
     $cadena2 .= "<br/><br/><br/><br/>";
     $cadena2 .= '<table width="740" border="0">';
     $cadena2 .= '<tr>';
     $cadena2 .= '<td width="100" height="65" ></td><td width="160" align="center" >';
     $cadena2 .= '<h4 style="border-top:1px solid black">Archivista Remitente<br>' . $usuarioOrigen . '</h4>';
     $cadena2 .= '</td><td width="100"></td>';
     $cadena2 .= '<td width="100" ></td><td width="150" align="center">';
     $cadena2 .= '<h4 style="border-top:1px solid black">Archivista de Recepci&oacute;n<br>' . $usuarioDestino . '</h4></td>';
     $cadena2 .= '<td width="100"></td></tr>';
     $cadena2 .= '<tr>';
     $cadena2 .= '<td width="100" height="65" ></td><td width="160" align="center" >';
     $cadena2 .= '<h4 style="border-top:1px solid black">Autoridad<br>Unidad Remitente</h4>';
     $cadena2 .= '</td><td width="100"></td>';
     $cadena2 .= '<td width="100" ></td><td width="150" align="center">';
     $cadena2 .= '<h4 style="border-top:1px solid black">SGE / DOC<br></h4></td>';
     $cadena2 .= '<td width="100"></td></tr>';
     $cadena2 .= '</table>';
     $cadena = $cadena . $cadena2;
     $pdf->writeHTML($cadena, true, false, false, false, '');
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     //   $pdf->Output('reporte_transferencia.pdf', 'D');
     $pdf->Output('reporte_transferencia.pdf', 'I');
     Header("Location: " . PATH_DOMAIN . "/soltransferencia/");
 }
 function viewCaratulas2()
 {
     $id_valor = $_REQUEST['exp_id'];
     $cantidad = $_REQUEST['cantidad_ejem'];
     $texp = new Tab_etiquetas();
     $usuario = new usuario();
     $sql = "SELECT\r\n                tab_fondo.fon_cod,\r\n                u.uni_id,\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_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                tab_sopfisico.sof_codigo,\r\n                tab_expisadg.exp_volsop,\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_notas,\r\n                tab_series.ser_par\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                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                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                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 = '" . $id_valor . "' ";
     $sql2 = "SELECT\r\n                tab_fondo.fon_cod,\r\n                u.uni_id,\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_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                tab_expisadg.exp_volsop,\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_notas,\r\n                tab_series.ser_par\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 ='" . $id_valor . "' ";
     $foncod = "";
     $rows = $texp->dbSelectBySQL($sql);
     //$rows = $rows[0];
     foreach ($rows as $cs) {
         $foncod = $cs->fon_cod;
     }
     if ($foncod == "") {
         $rows = $texp->dbSelectBySQL($sql2);
         $rows = $rows[0];
     } else {
         $rows = $rows[0];
     }
     // 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('UNIDAD DE TECNOLOG�?A, INFORMACION Y COMUNICACION');
     $pdf->SetSubject('Etiquetado de Caratulas');
     $pdf->SetKeywords('Etiquetado, Caratulas, cajas, caratulas, folders');
     // set default header data
     $pdf->SetHeaderData('logo2.png', 25, '');
     //$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(15, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(0);
     $pdf->AddPage();
     // 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
     $st = "";
     for ($i = 1; $i <= $cantidad; $i++) {
         //$st.='<table border="0"><tr><td align="center" style="font-size:65px"><b>CARATULA</b></td></tr></table>';
         // -----------------------------------------------------------------------------
         $st .= '<table width="640" border="1" style="font-family:Tahoma, Geneva, sans-serif;font-size:50px">';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35" ><b>CODIGO DE REFERENCIA:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:65px">' . $rows->fon_cod . DELIMITER . $rows->uni_cod . DELIMITER . $rows->tco_codigo . DELIMITER . $rows->ser_codigo . DELIMITER . $rows->exp_codigo . '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35" ><b>SUBFONDO:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:50px">' . $rows->fon_descripcion . '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35" ><b>SECCION:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:40px">';
         $unidad = new unidad();
         $uni_descripcion = $unidad->obtenerPadre($rows->uni_id);
         $st .= $uni_descripcion;
         $st .= '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35"><b>SUBSECCION:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:40px">';
         if ($uni_descripcion != $rows->uni_descripcion) {
             $st .= $rows->uni_descripcion;
         }
         if ($rows->exp_mesi == "") {
             $fechaInicial = $rows->exp_anioi;
         } else {
             $fechaInicial = $rows->exp_mesi . " " . $rows->exp_anioi;
         }
         if ($rows->exp_mesf == "") {
             $fechaFinal = $rows->exp_aniof;
         } else {
             $fechaFinal = $rows->exp_mesf . " " . $rows->exp_aniof;
         }
         $st .= '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35"><b>SERIE / SUBSERIE:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:40px">';
         $tab_serie = new Tab_series();
         if ($rows->ser_par != -1) {
             $rowsdb = $tab_serie->dbselectByField("ser_id", $rows->ser_par);
             if ($rowsdb[0]->ser_par != -1) {
                 $st .= $rowsdb[0]->ser_categoria;
                 $st .= " / ";
             }
         }
         $st .= $rows->ser_categoria;
         $st .= '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35"><b>TITULO DEL EXPEDIENTE:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="130" align="center" style="font-size:55px">' . $rows->exp_titulo . '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35" ><b>NRO. DE VOLUMEN/TOMO:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="45" align="center" style="font-size:45px">' . $rows->exp_tomovol . '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35"><br><b>FECHAS EXTREMAS:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="40" align="center" style="font-size:60px">' . $fechaInicial . '   -   ' . $fechaFinal . '</td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" bgcolor="#CCCCCC" height="35"><br><b>OBSERVACIONES:</b></td>';
         $st .= '</tr>';
         $st .= '<tr>';
         $st .= '<td colspan="4" height="62" align="center" style="font-size:45px">' . $rows->exp_obs . '</td>';
         $st .= '</tr>';
         $st .= '</table><br>';
     }
     $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);
     $pdf->SetFont('helvetica', '', 8);
     $pst = $st;
     // -----------------------------------------------------------------------------
     $pdf->writeHTML($pst, true, false, false, false, '');
     //Close and output PDF document
     $pdf->Output('example_048.pdf', 'I');
     //============================================================+
     // END OF FILE
     //============================================================+
 }
示例#8
0
        }
    }
    if (isset($_GET["tr"])) {
        $sql_where .= " AND r.id_trayecto = '" . $_GET["tr"] . "'";
    }
    if (isset($_GET["fac"])) {
        $sql_where .= " AND r.facturado = '" . $_GET["fac"] . "'";
    }
    if (isset($_GET["nfac"])) {
        if ($_GET["nfac"] !== "") {
            $sql_where .= " AND r.numero_facturacion = '" . $_GET["nfac"] . "'";
        }
    }
}
if (isset($_GET["fi"])) {
    $objunidad = new unidad();
    $uns = null;
    if (isset($_GET["tu"])) {
        if ($_GET["tu"] !== "0") {
            $uns = $objunidad->searchDB($_GET["tu"], "id_tipo_unidad");
        } else {
            $uns = $objunidad->listDB();
        }
    } else {
        $uns = $objunidad->listDB();
    }
    if (is_array($uns)) {
        foreach ($uns as $u) {
            echo "<tr>";
            echo "<td>" . $u["placa"] . "</td>";
            $objtu = new tipo_unidad();
        </thead>
        <tbody>
            <?php 
if (is_array($objs)) {
    foreach ($objs as $o) {
        ?>
                    <tr>
                        <td><?php 
        echo $o['id'];
        ?>
</td>
                        <td><?php 
        $objconfiguracion_vehiculo = new configuracion_vehiculo();
        $objconfiguracion_vehiculo->setVar('id', $o['id_configuracion_vehiculo']);
        $objconfiguracion_vehiculo->getDB();
        $objunidad = new unidad();
        $objunidad->setId($objconfiguracion_vehiculo->getIdUnidad());
        $objunidad->getDB();
        echo $objunidad->getPlaca();
        ?>
</td>
                        <td><?php 
        $objacople = new acople();
        $objacople->setVar('id', $o['id_acople']);
        $objacople->getDB();
        echo $objacople->getVar($gl_acoples_configuracion_id_acople);
        ?>
</td>
                        <td>
                            <a href='#' onclick='sel(<?php 
        echo $o['id'];
示例#10
0
<?php

require_once "model/unidadModel.php";
$u = new unidad();
$u->delete_unidad();
    }
    if (isset($_GET["fac"])) {
        $sql_where .= " AND r.facturado = '" . $_GET["fac"] . "'";
    }
    if (isset($_GET["nfac"])) {
        if ($_GET["nfac"] !== "") {
            $sql_where .= " AND r.numero_facturacion = '" . $_GET["nfac"] . "'";
        }
    }
}
$col1 = 0;
$col2 = 0;
$col3 = 0;
$col4 = 0;
if (isset($_GET["fi"])) {
    $objunidad = new unidad();
    $uns = null;
    $pesos = $objunidad->consulta_arreglo("Select sum(r.peso_neto) as kil from registro r, configuracion_vehiculo cv, unidad u where r.id_configuracion_vehiculo = cv.id AND u.id = cv.id_unidad " . $sql_where);
    $total_mes = round(floatval($pesos["kil"]), 2);
    if (isset($_GET["tu"])) {
        if ($_GET["tu"] !== "0") {
            $uns = $objunidad->searchDB($_GET["tu"], "id_tipo_unidad");
        } else {
            $uns = $objunidad->listDB();
        }
    } else {
        $uns = $objunidad->listDB();
    }
    if (is_array($uns)) {
        foreach ($uns as $u) {
            echo "<tr>";
示例#12
0
<?php

include "../ReglasNegocio/unidad.php";
include "../ReglasNegocio/departamento.php";
include "../ReglasNegocio/direccion.php";
$departamento = new departamento();
$unidad = new unidad();
$direccion = new direccion();
$editar = $_GET["editar"];
$boton = "verifica()";
if (!empty($editar)) {
    $id_unidad = $unidad->Select($editar);
    $row = mysql_fetch_array($id_unidad);
    $id_departamento = $row['ID_DEPARTAMENTO'];
    $nombre_unidad = $row['NOMBRE_UNIDAD'];
    //echo $id_departamento;
    $boton = "VerificaUpdate()";
}
?>
        
        
<script LANGUAGE="JavaScript">

function verifica()
{
	if (document.form.unidad.value.length==0)
   {
		alert("Debe ingresar un Nombre");
      return 0;
	}
	else if (document.form.departamento.value==0)
<?php

require_once '../nucleo/configuracion_vehiculo.php';
$objconfiguracion_vehiculo = new configuracion_vehiculo();
require_once '../nucleo/unidad.php';
$objunidad = new unidad();
require_once '../nucleo/acople.php';
if (isset($_POST['op'])) {
    switch ($_POST['op']) {
        case 'add':
            $objconfiguracion_vehiculo->setVar('id', $_POST['id']);
            $objconfiguracion_vehiculo->setVar('id_unidad', $_POST['id_unidad']);
            echo json_encode($objconfiguracion_vehiculo->insertDB());
            break;
        case 'mod':
            $objconfiguracion_vehiculo->setVar('id', $_POST['id']);
            $objconfiguracion_vehiculo->setVar('id_unidad', $_POST['id_unidad']);
            $objconfiguracion_vehiculo->setVar('fecha', $_POST['fecha']);
            echo json_encode($objconfiguracion_vehiculo->updateDB());
            break;
        case 'del':
            $objconfiguracion_vehiculo->setVar('id', $_POST['id']);
            echo json_encode($objconfiguracion_vehiculo->deleteDB());
            break;
        case 'get':
            $res = $objconfiguracion_vehiculo->searchDB($_POST['id'], 'id', 1);
            if (is_array($res)) {
                $res[0]['id_unidad'] = $objunidad->searchDB($res[0]['id_unidad'], 'id', 1);
                $res[0]['id_unidad'] = $res[0]['id_unidad'][0];
                $r1 = $objunidad->consulta_arreglo("Select * from tipo_unidad where id = '" . $res[0]["id_unidad"]["id_tipo_unidad"] . "'");
                $res[0]['tipo'] = $r1;
<?php

include "../AccesoDatos/Controller.php";
include "../ReglasNegocio/unidad.php";
$unidad = $_POST["unidad"];
$id_departamento = $_POST["departamento"];
$hd_variable = $_POST["hd_variable"];
$id_variable = $_POST["id_variable"];
//echo $hd_variable."<br>";
//echo "id_depto= ". $id_variable."<br>";
//echo "id_direccion= ". $id_direccion."<br>";
//echo "nombre_depto= ". $departamento."<br>";
$address = new unidad();
if (empty($unidad)) {
    header("Location: paso.php?c=w");
} elseif ($hd_variable == "ingresar") {
    $value = $address->Select2($unidad);
    //echo $direccion;
    if (empty($value)) {
        $value = $address->Add($id_departamento, $unidad);
    }
    header("Location: paso.php?c=w");
    //echo "insercion";
} elseif ($hd_variable == "editar") {
    $value = $address->Update($id_variable, $id_departamento, $unidad);
    header("Location: paso.php?c=w");
    //echo "edicion";
}
示例#15
0
                        <td><?php 
        echo $o['fecha'];
        ?>
</td>
                        <td><?php 
        $objturno = new turno();
        $objturno->setId($o["id_turno"]);
        $objturno->getDB();
        echo $objturno->getNombre();
        ?>
</td>
                        <td><?php 
        $objcfg = new configuracion_vehiculo();
        $objcfg->setId($o["id_configuracion_vehiculo"]);
        $objcfg->getDB();
        $objuni = new unidad();
        $objuni->setId($objcfg->getIdUnidad());
        $objuni->getDB();
        $objtipo_unidad = new tipo_unidad();
        $objtipo_unidad->setId($objuni->getIdTipoUnidad());
        $objtipo_unidad->getDB();
        echo $objtipo_unidad->getNombre();
        ?>
</td>
                        <td><?php 
        echo $objuni->getPlaca();
        ?>
</td>
                        <td><?php 
        $acos = $objuni->consulta_matriz("Select a.placa,ta.nombre from acoples_configuracion ac, acople a, tipo_acople ta where ac.id_configuracion_vehiculo = '" . $o["id_configuracion_vehiculo"] . "' AND ac.id_acople = a.id AND a.id_tipo_acople = ta.id");
        $strcnfg = "";
示例#16
0
<?php

require_once "model/unidadModel.php";
$u = new unidad();
$datos = $u->add_unidad();
require_once "view/menutp.phtml";
require_once "view/addunidad.phtml";
 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&Oacute;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&Oacute;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;">&Aacute;REA DE IDENTIFICACI&Oacute;N</span></td>';
         $cadena .= '<td width="5%" align="left"><span style="font-family: helvetica; font-size: 11px;font-weight: bold;">&Aacute;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&oacute;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 verRpteExcel()
 {
     header("Content-type: application/vnd.ms-excel; name='excel'");
     header("Content-Disposition: filename=transferencia_expedientes.xls");
     header("Pragma: no-cache");
     header("Expires: 0");
     $id = VAR3;
     $where = "";
     $tab_extransferencia = new tab_exptransferencia();
     $result = $tab_extransferencia->dbSelectBySQL("select* from tab_exptransferencia where str_id={$id}");
     $cantidad = count($result);
     $valor3 = "";
     $t = 1;
     foreach ($result as $row) {
         $valor3 .= "tab_expediente.exp_id={$row->exp_id}";
         if ($t < $cantidad) {
             $valor3 .= " or ";
         }
         $t++;
     }
     $where .= " AND {$valor3} ";
     $sql = "SELECT\r\n            f.fon_codigo,\r\n            f.fon_cod,\r\n            (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n            tab_expediente.exp_codigo AS codigo,\r\n            (NULLIF(tab_expediente.exp_codigo,'')::int) as cantidad,\r\n            tab_soltransferencia.str_id,\r\n            tab_soltransferencia.str_fecha,\r\n            tab_soltransferencia.uni_id,\r\n            tab_soltransferencia.unid_id,\r\n            tab_soltransferencia.str_nrocajas,\r\n            tab_soltransferencia.str_totpzas,\r\n            tab_soltransferencia.str_totml,\r\n            tab_soltransferencia.str_nroreg,\r\n            tab_soltransferencia.str_fecini,\r\n            tab_soltransferencia.str_fecfin,\r\n            tab_soltransferencia.str_estado,\r\n            tab_soltransferencia.usu_id,\r\n            tab_soltransferencia.usud_id,\r\n            tab_soltransferencia.str_direccion,\r\n            tab_soltransferencia.str_telefono,\r\n            tab_expisadg.exp_fecha_exi,\r\n            tab_expisadg.exp_fecha_exf,\r\n            tab_expisadg.exp_anioi,\r\n            tab_expisadg.exp_aniof,\r\n            tab_expisadg.exp_titulo,\r\n            tab_series.ser_codigo,\r\n            tab_unidad.uni_codigo,\r\n            tab_unidad.uni_id,\r\n            tab_unidad.uni_par,\r\n            tab_unidad.uni_cod,\r\n            tab_unidad.uni_descripcion,\r\n            f.fon_cod,\r\n            tab_series.ser_categoria,\r\n            tab_expisadg.exp_titulo,\r\n            tab_expediente.exp_obs,\r\n            tab_series.ser_id,\r\n            tab_series.ser_par,\r\n            tab_expediente.exp_id\r\n            FROM\r\n            tab_unidad\r\n            INNER JOIN tab_fondo as f ON tab_unidad.fon_id = f.fon_id\r\n            INNER JOIN tab_series ON tab_series.uni_id = tab_unidad.uni_id\r\n            INNER JOIN tab_expediente ON tab_expediente.ser_id = tab_series.ser_id\r\n            INNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\n            INNER JOIN tab_exptransferencia ON tab_expediente.exp_id = tab_exptransferencia.exp_id\r\n            INNER JOIN tab_soltransferencia ON tab_soltransferencia.str_id = tab_exptransferencia.str_id\r\n            INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n            WHERE\r\n            tab_soltransferencia.str_estado = 2 \r\n            AND tab_expediente.exp_estado = 1 \r\n            {$where} \r\n            ORDER BY f.fon_cod,\r\n            tab_unidad.uni_cod,\r\n            tab_series.ser_orden, \r\n            tab_series.ser_codigo, \r\n            tab_expediente.exp_codigo::int ";
     $usua = new usuario();
     $subfondo = new fondo();
     $seccion = new unidad();
     $expedientes = new expediente();
     $archivo = new tab_archivo();
     $archivo2 = new tab_archivo();
     $query = $archivo->dbSelectBySQL($sql);
     $query2 = $archivo2->dbSelectBySQL($sql);
     $usu_id = "";
     $usud_id = "";
     $uni_id = "";
     foreach ($query2 as $ids) {
         $usu_id = $ids->usu_id;
         $usud_id = $ids->usud_id;
         $uni_id = $ids->uni_id;
         $uni_par = $ids->uni_par;
         $uni_cod = $ids->uni_cod;
         $str_telefono = $ids->str_telefono;
         $str_id = $ids->str_id;
         $str_fecha = $ids->str_fecha;
         $str_direccion = $ids->str_direccion;
         $uni_descripcion = $ids->uni_descripcion;
     }
     $usuarioOrigen = $usua->obtenerNombre($usu_id);
     $usuarioDestino = $usua->obtenerNombre($usud_id);
     $fond = $subfondo->obtenerfon($usu_id);
     $ob_seccion = $seccion->obtenerSeccion($uni_id);
     $cadena = "";
     $cadena .= '<table width="740" border="1">';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="10" align="center" ><b>';
     $cadena .= 'FORMULARIO DE RELACION DE TRANSFERENCIAS</b><br /></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="9" align="right" style=border:none ><b>';
     $cadena .= 'Nro. de transferencia:</b></td><td align="center">' . $str_id . '</td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="5">';
     $cadena .= '<b>Subfondo:</b> ' . $fond . '<br />';
     $cadena .= '<b>Secci&oacute;n:</b> ';
     $explode = explode(".", $uni_cod);
     $contado = count($explode);
     $codigo = "";
     for ($t = 0; $t < $contado - 1; $t++) {
         $codigo .= $explode[$t];
         if ($t < $contado - 2) {
             $codigo .= ".";
         }
     }
     $codigo2 = $codigo;
     if (strlen($codigo) == 1) {
         $codigo = $codigo . ".0";
     } else {
         $estraer_codigo = explode(".", $codigo);
         $codigo = $estraer_codigo[0] . ".0";
     }
     $tab_unidad = new Tab_unidad();
     $unidad = new unidad();
     $sqlUni2 = "SELECT\r\n                    tab_unidad.uni_descripcion\r\n                    FROM\r\n                    tab_unidad\r\n                    WHERE\r\n                    tab_unidad.uni_cod = '{$codigo}'";
     $codigoss = explode(".", $codigo2);
     $cantcodigo2 = count($codigoss);
     if ($cantcodigo2 == 1) {
         $codigo2 = "{$codigo2}.1";
     }
     $sqlUni1 = "SELECT\r\n                    tab_unidad.uni_descripcion\r\n                    FROM\r\n                    tab_unidad\r\n                    WHERE\r\n                    tab_unidad.uni_cod = '{$codigo2}'";
     $resultadott = $tab_unidad->dbSelectBySQL($sqlUni2);
     $resultadott1 = $tab_unidad->dbSelectBySQL($sqlUni1);
     $ca1 = "";
     foreach ($resultadott1 as $rowss2) {
         $ca1 = $rowss2->uni_descripcion;
     }
     foreach ($resultadott as $rowss) {
         $ca = $rowss->uni_descripcion;
     }
     $variable = $ca;
     $excluirparent = explode("(", $variable);
     if ($excluirparent[1] == "") {
         $ca = $ca;
     } else {
         $excluirultimoparent = $excluirparent[1] . "x";
         $imprimir_descripcion = explode(")", $excluirultimoparent);
         $ca = $imprimir_descripcion[0];
     }
     $ca = $unidad->obtenerPadre($uni_par, $uni_descripcion);
     $cadena .= $ca;
     $cadena .= '<br><b>Subsecci&oacute;n:</b> ';
     $cadena .= $ca1;
     $cadena .= '</td>';
     $cadena .= '<td colspan="5"  >';
     $cadena .= '<br /><b>Tel&eacute;fono:</b> ' . $str_telefono . '</td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td width="20" rowspan="2" align="center" bgcolor="#CCCCCC"><strong>Nro.</strong></td>';
     $cadena .= '<td width="125" colspan="2" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Serie/Subserie</strong></td>';
     $cadena .= '<td width="225" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>T&iacute;tulo del Expediente</strong></td>';
     $cadena .= '<td width="90" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>C&oacute;digo de Referencia</strong></td>';
     $cadena .= '<td width="100" colspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Fechas extremas</strong></td>';
     $cadena .= '<td width="40" rowspan="2" bgcolor="#CCCCCC" style="font-size:25px"><strong >Nro.Doc.</strong></td>';
     $cadena .= '<td width="40" rowspan="2" bgcolor="#CCCCCC"><strong>Cajas</strong></td>';
     $cadena .= '<td width="100" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><p><strong>Obs.</strong></p></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr>';
     $cadena .= '<td width="50" style="text-align:center" bgcolor="#CCCCCC"><strong>Inicio</strong></td>';
     $cadena .= '<td width="50" style="text-align:center" bgcolor="#CCCCCC"><strong>Final</strong></td>';
     $cadena .= '</tr>';
     $sum = 0;
     $i = 1;
     $cant = 0;
     foreach ($query as $row) {
         $tabserie = new tab_series();
         if ($row->exp_fecha_exi == "") {
             $fei = "";
         } else {
             $fechainicial = explode("-", $row->exp_fecha_exi);
             $fei = $fechainicial[2] . "/" . $fechainicial[1] . "/" . $fechainicial[0];
         }
         if ($row->exp_fecha_exf == "") {
             $fef = "";
         } else {
             $fechafinal = explode("-", $row->exp_fecha_exf);
             $fef = $fechafinal[2] . "/" . $fechafinal[1] . "/" . $fechafinal[0];
         }
         $cadena .= '<tr>';
         $cadena .= '<td align="center">' . $i . '</td>';
         $cadena .= '<td colspan="2" style="font-size:22px">';
         $cadena .= $row->ser_categoria;
         $expsum = $expedientes->cantidadExpedientes($row->exp_id);
         $cant = $cant + $expsum;
         $cadena .= '</td>';
         $cadena .= '<td align="left" style="font-size:22px">' . htmlentities($row->exp_titulo, ENT_COMPAT, 'utf-8') . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $row->codigo . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $row->exp_anioi . '</td>';
         $cadena .= '<td align="center"  style="font-size:22px">' . $row->exp_aniof . '</td>';
         $cadena .= '<td align="center" style="font-size:22px">' . $expsum . '</td>';
         $cadena .= '<td align="center"></td>';
         $cadena .= '<td style="font-size:22px">' . $row->exp_obs . '</td>';
         $cadena .= '</tr>';
         $i++;
     }
     $cadena .= '<tr>';
     $cadena .= '<td colspan="6" align="right" >TOTAL</td>';
     $cadena .= '<td align="center"></td>';
     $cadena .= '<td align="center">' . $cant . '</td>';
     $cadena .= '<td></td>';
     $cadena .= '<td>&nbsp;</td>';
     $cadena .= '</tr>';
     $cadena .= '</table>';
     $fecha = explode("-", $str_fecha);
     $anio = $fecha[0];
     $mes = $fecha[1];
     $dia = $fecha[2];
     switch ($mes) {
         case 1:
             $mes = "Enero";
             break;
         case 2:
             $mes = "Febrero";
             break;
         case 3:
             $mes = "Marzo";
             break;
         case 4:
             $mes = "Abril";
             break;
         case 5:
             $mes = "Mayo";
             break;
         case 6:
             $mes = "Junio";
             break;
         case 7:
             $mes = "Julio";
             break;
         case 8:
             $mes = "Agosto";
             break;
         case 9:
             $mes = "Septiembre";
             break;
         case 10:
             $mes = "Octubre";
             break;
         case 11:
             $mes = "Noviembre";
             break;
         case 12:
             $mes = "Diciembre";
             break;
     }
     $cadena .= '<b>Lugar y fecha de la transferencia:</b> ' . $str_direccion . '  ' . $dia . ' de ' . $mes . ' de ' . $anio;
     $cadena2 = "";
     $cadena2 .= '<table width="740" border="0">';
     $cadena2 .= '<tr>';
     $cadena2 .= '<td width="100" height="65" ></td><td width="160" align="center" >';
     $cadena2 .= '<h4 style="border-top:1px solid black">Archivista Remitente<br>' . $usuarioOrigen . '</h4>';
     $cadena2 .= '</td><td width="100"></td>';
     $cadena2 .= '<td width="100" ></td><td width="150" align="center">';
     $cadena2 .= '<h4 style="border-top:1px solid black">Archivista de Recepci&oacute;n<br>' . $usuarioDestino . '</h4></td>';
     $cadena2 .= '<td width="100"></td></tr>';
     $cadena2 .= '<tr>';
     $cadena2 .= '<td width="100" height="65" ></td><td width="160" align="center" >';
     $cadena2 .= '<h4 style="border-top:1px solid black">Autoridad<br>Unidad Remitente</h4>';
     $cadena2 .= '</td><td width="100"></td>';
     $cadena2 .= '<td width="100" ></td><td width="150" align="center">';
     $cadena2 .= '<h4 style="border-top:1px solid black">SGE / DOC<br></h4></td>';
     $cadena2 .= '<td width="100"></td></tr>';
     $cadena2 .= '</table>';
     $cadena = $cadena . $cadena2;
     echo $cadena;
 }
 public function create2()
 {
     $obj = new unidad();
     $obj->insert2($_POST);
 }
 public function delete()
 {
     $obj = new unidad();
     $p = $obj->delete($_GET['id']);
     if ($p[0]) {
         header('Location: index.php?controller=unidad');
     } else {
         $data = array();
         $view = new View();
         $data['msg'] = $p[1];
         $data['url'] = 'index.php?controller=unidad';
         $view->setData($data);
         $view->setTemplate('../view/_Error_App.php');
         $view->setLayout('../template/Layout.php');
         $view->render();
     }
 }
 function loadAjaxCkeck()
 {
     $unidad = new unidad();
     $usu_id = $_REQUEST['Usu_id'];
     $uni_id = $_REQUEST['Uni_id'];
     $lista = $unidad->obtenerCheck($uni_id, $usu_id);
     echo $lista;
 }
 public function editarUni_nombre()
 {
     $obj = new unidad();
     $p = $obj->actualizar_unidad_nombre($_POST);
 }
示例#23
0
<?php

require_once '../nucleo/unidad.php';
$objunidad = new unidad();
require_once '../nucleo/tipo_unidad.php';
$objtipo_unidad = new tipo_unidad();
if (isset($_POST['op'])) {
    switch ($_POST['op']) {
        case 'add':
            $objunidad->setVar('id', $_POST['id']);
            $objunidad->setVar('id_tipo_unidad', $_POST['id_tipo_unidad']);
            $objunidad->setVar('placa', $_POST['placa']);
            echo json_encode($objunidad->insertDB());
            break;
        case 'mod':
            $objunidad->setVar('id', $_POST['id']);
            $objunidad->setVar('id_tipo_unidad', $_POST['id_tipo_unidad']);
            $objunidad->setVar('placa', $_POST['placa']);
            echo json_encode($objunidad->updateDB());
            break;
        case 'del':
            $objunidad->setVar('id', $_POST['id']);
            echo json_encode($objunidad->deleteDB());
            break;
        case 'get':
            $res = $objunidad->searchDB($_POST['id'], 'id', 1);
            if (is_array($res)) {
                $res[0]['id_tipo_unidad'] = $objtipo_unidad->searchDB($res[0]['id_tipo_unidad'], 'id', 1);
                $res[0]['id_tipo_unidad'] = $res[0]['id_tipo_unidad'][0];
                echo json_encode($res[0]);
            } else {
示例#24
0
<?php

require_once "model/unidadModel.php";
$u = new unidad();
$datos = $u->get_unidad();
require_once "view/menutp.phtml";
require_once "view/verunidad.phtml";
 function verRpte()
 {
     // Header
     $filtro_series = $_REQUEST["filtro_series"];
     if (!$filtro_series) {
         $filtro_expediente = VAR3;
     } else {
         $filtro_expediente = 0;
     }
     $filtro_serie = 0;
     $where = "";
     //PARA LA ORDENACION SOLO SE ESCOJE UNA OPCION
     $order_by = "";
     $order_by .= " ORDER BY  tab_archivo.fil_nro 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,tab_unidad.uni_par,tab_unidad.uni_id,\r\n                ( SELECT sec.uni_descripcion\r\n                FROM tab_unidad AS sec \r\n                WHERE  sec.uni_id = tab_unidad.uni_par) AS seccion,\r\n\t\ttab_fondo.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_unidad.uni_par,\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                tab_expisadg.exp_anioi,\r\n                tab_expisadg.exp_aniof,\r\n                tab_expisadg.exp_mesi,\r\n                tab_expisadg.exp_mesf,\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 and arc.fil_estado=1) 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 and arc.fil_estado=1) AS totpzs,\r\n                      (SELECT SUM (NULLIF(arc.fil_nroejem,'')::int) 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 and arc.fil_estado=1) AS totalpiezas,\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\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_fondo ON tab_unidad.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/>";
     $exp_titulo = "";
     if (count($resulth) > 0) {
         $cadenah .= '<table width="980" 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="980" border="1" cellpadding="2">';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">FONDO:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size: 22px;">' . $resulth[0]->fondes . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">INSTRUMENTO DE CONSULTA:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">INVENTARIO DE DOCUMENTOS</span></td>';
         $cadenah .= '</tr>';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SUB-FONDO:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size: 22px;">' . $resulth[0]->fon_descripcion . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">TOTAL DE CAJAS:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">' . $resulth[0]->totcja . '</span></td>';
         $cadenah .= '</tr>';
         $unidad = new unidad();
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SECCI&Oacute;N:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size:22px;">' . $unidad->obtenerPadre($resulth[0]->uni_par, $resulth[0]->uni_descripcion) . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">TOTAL DE PIEZAS:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">' . $resulth[0]->totalpiezas . '</span></td>';
         $cadenah .= '</tr>';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SUB SECCI&Oacute;N:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size: 22px;">' . $unidad->obtenerPadres($resulth[0]->uni_par, $resulth[0]->uni_descripcion) . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">TOTAL DE ML:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">' . $resulth[0]->totml . '</span></td>';
         $cadenah .= '</tr>';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">C&Oacute;DIGO DE REFERENCIA:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size: 22px;">' . $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="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">NIVEL DE DESCRIPCI&Oacute;N:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">UNIDAD DOCUMENTAL SIMPLE</span></td>';
         $cadenah .= '</tr>';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">SERIES:</span></td>';
         $cadenah .= '<td width="390"><span style="font-size: 22px;">' . $resulth[0]->ser_categoria . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">FECHAS EXTREMAS:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">' . $resulth[0]->exp_mesi . ' ' . $resulth[0]->exp_anioi;
         if (trim($resulth[0]->exp_aniof) != "") {
             $cadenah .= ' - ' . $resulth[0]->exp_mesf . ' ' . $resulth[0]->exp_aniof;
         }
         $cadenah .= '</span></td>';
         $cadenah .= '</tr>';
         $cadenah .= '<tr>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">EXPEDIENTE(PROYECTO):</span></td>';
         $cadenah .= '<td width="390" ><span style="font-size: 22px;">' . htmlentities($resulth[0]->exp_titulo, ENT_IGNORE, 'utf-8') . '</span></td>';
         $cadenah .= '<td width="150" bgcolor="#CCCCCC"><span style="font-size: 22px;font-weight: bold;">TOTAL REGISTROS:</span></td>';
         $cadenah .= '<td width="290"><span style="font-size: 22px;">' . $resulth[0]->totpzs . '</span></td>';
         $cadenah .= '</tr>';
         $exp_titulo = $resulth[0]->exp_titulo;
         //consulta para campos adicionales
         $camposc = new expcampo();
         $resultdc = $camposc->obtenerSelectCamposRepDoc($filtro_serie, $filtro_expediente);
         $cadenah .= $resultdc;
         $cadenah .= '</table>';
     }
     // Tcpdf
     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, 'LEGAL', 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', $exp_titulo);
     // 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', '', 9);
     // add a page
     $pdf->AddPage();
     //        $pdf->SetXY(110, 200);
     $pdf->Image(PATH_ROOT . '/web/img/iso.png', '330', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false);
     //
     // Body
     $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_cuerpos.cue_codigo,\r\n            tab_archivo.fil_codigo,\r\n            tab_archivo.fil_nro,\r\n            tab_expediente.exp_lugar,\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            tab_archivo.fil_mes,\r\n            tab_archivo.fil_anio,\r\n            tab_archivo.fil_mesf,\r\n            tab_archivo.fil_aniof,\r\n            tab_tramite.tra_descripcion\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_unidad ON tab_series.uni_id = tab_unidad.uni_id\r\n            INNER JOIN tab_fondo ON tab_unidad.fon_id = tab_fondo.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_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            INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n            INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_exparchivo.tra_id\r\n            WHERE tab_expusuario.eus_estado = 1 AND tab_archivo.fil_estado=1" . $where . $order_by;
     $expediente = new Tab_expediente();
     $result = $expediente->dbselectBySQL($sql);
     $cadena = "";
     $cadena .= '<table width="980" border="1" cellpadding="2">';
     $cadena .= '<tr bgcolor="#CCCCCC">';
     $cadena .= '<td colspan="19" align="center" width="860"><span style="font-size: 13px;font-weight: bolder;">&Aacute;REA DE IDENTIFICACI&Oacute;N</span></td>';
     $cadena .= '<td width="120" align="center"><span style="font-size: 13px;font-weight: bolder;">&Aacute;REA DE NOTAS</span></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr bgcolor="#CCCCCC">';
     $cadena .= '<td width="35"  rowspan="2" align="center"><span style="font-size: 13px ;font-weight: bold;">N de Caja</span></td>';
     $cadena .= '<td width="35" rowspan="2" align="center"><span style="font-size: 13px ;font-weight: bold;">Total piezas/cajas</span></td>';
     $cadena .= '<td width="35" rowspan="2" align="center"><span style="font-size: 13px ;font-weight: bold;">N ejem.</span></td>';
     $cadena .= '<td width="35" rowspan="2" align="center"><span style="font-size: 13px; font-weight: bold;">ML</span></td>';
     $cadena .= '<td width="70" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">N de Orden doc.</span></td>';
     $cadena .= '<td width="50" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Depto.</span></td>';
     $cadena .= '<td width="100" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Titulo del Documento</span></td>';
     $cadena .= '<td width="80" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Sub titulo</span></td>';
     $cadena .= '<td width="55" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Productor</span></td>';
     $cadena .= '<td width="50" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Firma</span></td>';
     $cadena .= '<td width="45" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Fecha</span></td>';
     $cadena .= '<td width="45" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Tomo/Volumen</span></td>';
     $cadena .= '<td width="35" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Fojas</span></td>';
     $cadena .= '<td width="40" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Soporte F&iacute;sico</span></td>';
     $cadena .= '<td width="40" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Conser. Doc.</span></td>';
     $cadena .= '<td width="110" colspan="4" align="center"><span style="font-size: 13px ;font-weight: bold;">Ubicaci&oacute;n Topografica</span></td>';
     $cadena .= '<td width="120" rowspan="2" align="center" valign="middle"><span style="font-size: 13px ;font-weight: bold;">Observaciones</span></td>';
     $cadena .= '</tr>';
     $cadena .= '<tr bgcolor="#CCCCCC">';
     $cadena .= '<td width="27" align="center"><span style="font-size: 13px ;font-weight: bold;">Sala</span></td>';
     $cadena .= '<td width="27" align="center"><span style="font-size: 13px ;font-weight: bold;">Estante</span></td>';
     $cadena .= '<td width="28" align="center"><span style="font-size: 13px ;font-weight: bold;">Cuerpo</span></td>';
     $cadena .= '<td width="28" align="center"><span style="font-size: 13px ;font-weight: bold;">Balda</span></td>';
     $cadena .= '</tr>';
     $numero = 1;
     $tra_descripciona = "";
     $tra_descripcionn = "";
     foreach ($result as $fila) {
         // New
         $tra_descripcionn = $fila->tra_descripcion;
         if ($tra_descripcionn != $tra_descripciona) {
             $cadena .= '<tr>';
             $cadena .= '<td width="290" colspan="20"><span style="font-size: 13px;">' . htmlentities($fila->tra_descripcion, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '</tr>';
             //
             $cadena .= '<tr>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;">' . $fila->fil_nrocaj . '</span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;"></span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;">' . $fila->fil_nroejem . '</span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;"></span></td>';
             $cadena .= '<td  width="70"><span style="font-size: 17px;">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->fil_nro . '</span></td>';
             $cadena .= '<td width="50"><span style="font-size: 17px;">' . $fila->exp_lugar . '</span></td>';
             $cadena .= '<td width="100"><span style="font-size: 17px;">' . htmlentities($fila->fil_titulo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="80"><span style="font-size: 17px;">' . htmlentities($fila->fil_subtitulo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="55"><span style="font-size: 17px;">' . htmlentities($fila->fil_proc, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="50"><span style="font-size: 17px;">' . htmlentities($fila->fil_firma, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="45"><span style="font-size: 17px;">' . $fila->fil_mes . ' ' . $fila->fil_anio . ' - ' . $fila->fil_mesf . ' ' . $fila->fil_aniof . '</span></td>';
             $cadena .= '<td width="45"><span style="font-size: 17px;">' . htmlentities($fila->fil_tomovol, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="35"><span style="font-size: 17px;">' . htmlentities($fila->fil_nrofoj, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="40"><span style="font-size: 17px;">' . htmlentities($fila->sof_codigo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="40"><span style="font-size: 17px;">' . htmlentities($fila->fil_mrb, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="27"><span style="font-size: 17px;">' . htmlentities($fila->fil_sala, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="27"><span style="font-size: 17px;">' . htmlentities($fila->fil_estante, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="28"><span style="font-size: 17px;">' . htmlentities($fila->fil_cuerpo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="28"><span style="font-size: 17px;">' . htmlentities($fila->fil_balda, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="120"><span style="font-size: 17px;">' . htmlentities($fila->fil_obs, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '</tr>';
         } else {
             $cadena .= '<tr>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;">' . htmlentities($fila->fil_nrocaj, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;"></span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;">' . htmlentities($fila->fil_nroejem, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td  width="35"><span style="font-size: 17px;"></span></td>';
             $cadena .= '<td  width="70"><span style="font-size: 17px;">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->fil_nro . '</span></td>';
             $cadena .= '<td width="50"><span style="font-size: 17px;">' . htmlentities($fila->exp_lugar, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="100"><span style="font-size: 17px;">' . htmlentities($fila->fil_titulo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="80"><span style="font-size: 17px;">' . htmlentities($fila->fil_subtitulo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="55"><span style="font-size: 17px;">' . htmlentities($fila->fil_proc, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="50"><span style="font-size: 17px;">' . htmlentities($fila->fil_firma, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="45"><span style="font-size: 17px;">' . $fila->fil_mes . ' ' . $fila->fil_anio;
             if (trim($fila->fil_aniof) != "" && trim($fila->fil_mesf) != "") {
                 $cadena .= ' - ' . $fila->fil_mesf . ' ' . $fila->fil_aniof;
             }
             $cadena .= '</span></td>';
             $cadena .= '<td width="45"><span style="font-size: 17px;">' . htmlentities($fila->fil_tomovol, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="35"><span style="font-size: 17px;">' . htmlentities($fila->fil_nrofoj, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="40"><span style="font-size: 17px;">' . htmlentities($fila->sof_codigo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="40"><span style="font-size: 17px;">' . htmlentities($fila->fil_mrb, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="27"><span style="font-size: 17px;">' . htmlentities($fila->fil_sala, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="27"><span style="font-size: 17px;">' . htmlentities($fila->fil_estante, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="28"><span style="font-size: 17px;">' . htmlentities($fila->fil_cuerpo, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="28"><span style="font-size: 17px;">' . htmlentities($fila->fil_balda, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '<td width="120"><span style="font-size: 17px;">' . htmlentities($fila->fil_obs, ENT_IGNORE, 'utf-8') . '</span></td>';
             $cadena .= '</tr>';
         }
         $numero++;
         $tra_descripciona = $fila->tra_descripcion;
     }
     //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 view()
 {
     if (!VAR3) {
         die("Error del sistema 404");
     }
     $this->unidad = new tab_unidad();
     if (VAR3 == null) {
         header("Location: " . PATH_DOMAIN . "/unidad/");
     }
     $row = $this->unidad->dbselectByField("uni_id", VAR3);
     if (count($row) == 0) {
         header("Location: " . PATH_DOMAIN . "/unidad/");
     }
     $row = $row[0];
     $this->registry->template->titulo = "EDITAR SECCI&Oacute;N: {$row->uni_descripcion}";
     $this->registry->template->uni_id = $row->uni_id;
     if ($row->uni_par > 0) {
         $unidad = new unidad();
         $uni_par = $unidad->obtenerSelectUnidades($row->uni_par);
         $this->registry->template->uni_par = $uni_par;
     } else {
         $unidad = new unidad();
         $this->registry->template->uni_par = $unidad->obtenerSelectUnidades();
     }
     $localidad = new localidad();
     $this->registry->template->loc_id = $localidad->obtenerSelectLocalidades($row->loc_id);
     $this->registry->template->uni_cod = $row->uni_cod;
     $this->registry->template->uni_descripcion = utf8_encode($row->uni_descripcion);
     $this->registry->template->uni_dir = $row->uni_dir;
     $this->registry->template->uni_tel = $row->uni_tel;
     $this->menu = new menu();
     $liMenu = $this->menu->imprimirMenu(VAR1, $_SESSION['USU_ID']);
     $this->registry->template->men_titulo = $liMenu;
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_WEB = PATH_WEB;
     $this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
     $this->registry->template->PATH_EVENT = "update";
     $this->registry->template->GRID_SW = "true";
     $this->registry->template->PATH_J = "jquery-1.4.1";
     $this->registry->template->show('header');
     $this->registry->template->show('unidad/tab_unidad.tpl');
     $this->registry->template->show('footer');
 }
 function VerRTransferencia()
 {
     $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 = "";
     $tab_extransferencia = new tab_exptransferencia();
     $result = $tab_extransferencia->dbSelectBySQL("select DISTINCT(exp_id) from tab_exptransferencia");
     $cantidad = count($result);
     $valor3 = "";
     $t = 1;
     foreach ($result as $row) {
         $valor3 .= "tab_expediente.exp_id={$row->exp_id}";
         if ($t < $cantidad) {
             $valor3 .= " or ";
         }
         $t++;
     }
     $where .= " AND {$valor3} ";
     if ($filtro_serie != "") {
         $where .= " AND tab_series.ser_id=" . $filtro_serie;
     }
     if ($filtro_unidad != "") {
         $where .= " AND tab_soltransferencia.uni_id=" . $filtro_unidad;
     }
     if ($filtro_funcionario != "") {
         $where .= " AND tab_soltransferencia.usu_id=" . $filtro_funcionario;
     }
     $sql = "SELECT\r\ntab_fondo.fon_codigo,\r\ntab_expediente.exp_codigo,\r\ntab_soltransferencia.str_id,\r\ntab_soltransferencia.str_fecha,\r\ntab_soltransferencia.uni_id,\r\ntab_soltransferencia.unid_id,\r\ntab_soltransferencia.str_nrocajas,\r\ntab_soltransferencia.str_totpzas,\r\ntab_soltransferencia.str_totml,\r\ntab_soltransferencia.str_nroreg,\r\ntab_soltransferencia.str_fecini,\r\ntab_soltransferencia.str_fecfin,\r\ntab_soltransferencia.str_estado,\r\ntab_soltransferencia.usu_id,\r\ntab_soltransferencia.usud_id,\r\ntab_soltransferencia.str_direccion,\r\ntab_soltransferencia.str_telefono,\r\ntab_expisadg.exp_fecha_exi,\r\ntab_expisadg.exp_fecha_exf,\r\ntab_series.ser_codigo,\r\ntab_unidad.uni_codigo,\r\ntab_fondo.fon_cod,\r\ntab_series.ser_categoria,\r\ntab_expisadg.exp_titulo,\r\ntab_expediente.exp_obs,\r\ntab_series.ser_id,\r\ntab_series.ser_par,\r\ntab_expediente.exp_id\r\nFROM\r\ntab_unidad\r\nINNER JOIN tab_fondo ON tab_unidad.fon_id = tab_fondo.fon_id\r\nINNER JOIN tab_series ON tab_series.uni_id = tab_unidad.uni_id\r\nINNER JOIN tab_expediente ON tab_expediente.ser_id = tab_series.ser_id\r\nINNER JOIN tab_expisadg ON tab_expisadg.exp_id = tab_expediente.exp_id\r\nINNER JOIN tab_exptransferencia ON tab_expediente.exp_id = tab_exptransferencia.exp_id\r\nINNER JOIN tab_soltransferencia ON tab_soltransferencia.str_id = tab_exptransferencia.str_id\r\nWHERE\r\ntab_soltransferencia.str_estado = 2 AND\r\ntab_expediente.exp_estado = 1 " . $where . " ORDER BY tab_soltransferencia.str_id";
     $usua = new usuario();
     $subfondo = new fondo();
     $seccion = new unidad();
     $expedientes = new expediente();
     $archivo = new tab_archivo();
     $archivo2 = new tab_archivo();
     $query = $archivo->dbSelectBySQL($sql);
     $query2 = $archivo2->dbSelectBySQL($sql);
     $query2 = $query2[0];
     $usuarioOrigen = $usua->obtenerNombre($query2->usu_id);
     $usuarioDestino = $usua->obtenerNombre($query2->usud_id);
     $fond = $subfondo->obtenerfon($query2->usu_id);
     $cadena = "";
     $cadena = "<br/><br/><br/><br/><br/><br/><br/>";
     $cadena .= '<b>Cuadro 8. Formulario Normalizado de Transferencias</b>';
     $cadena .= '<br/><br/>';
     $cadena .= '<table width="740" border="1">';
     $cadena .= '<tr>';
     $cadena .= '<td colspan="10" align="center"><b>ADMINISTRADORA BOLIVIANA DE CARRETERAS</b><br />';
     $cadena .= 'Formulario de Relacion de Transferencias<br /></td>';
     $cadena .= '</tr></table>';
     $i = 1;
     foreach ($query as $row) {
         $tabserie = new tab_series();
         $cadena .= '<table border="1" width="740"><tr>';
         $cadena .= '<td colspan="5"><blockquote>';
         $cadena .= '<b>Subfondo:</b> ' . $fond . '<br />';
         $cadena .= '<b>Secci&oacute;n:</b> ';
         $ob_seccion = $seccion->obtenerSeccion($row->usu_id);
         if ($ob_seccion->tab_sec == "") {
             $cadena .= $ob_seccion->uni_descripcion . '<br />';
         } else {
             $cadena .= $ob_seccion->tab_sec . '<br />';
         }
         $cadena .= '<b>Subsecci&oacute;n:</b> ';
         if ($ob_seccion->tab_sec != "") {
             $cadena .= $ob_seccion->uni_descripcion;
         }
         $cadena .= '</blockquote></td>';
         $cadena .= '<td colspan="5"  ><blockquote><b>Nº de transferencia:</b> ' . $row->str_id;
         $cadena .= '<br /><b>Direcci&oacute;n  y Tel&eacute;fono:</b> ' . $row->str_direccion . ' ' . $row->str_telefono . '</blockquote></td>';
         $cadena .= '</tr>';
         $cadena .= '<tr>';
         $cadena .= '<td width="20" rowspan="2" align="center"><strong>Nº</strong></td>';
         $cadena .= '<td width="140" rowspan="2"><strong>Serie</strong></td>';
         $cadena .= '<td width="120" rowspan="2"><strong>Subserie</strong></td>';
         $cadena .= '<td width="80" rowspan="2"><strong>C&oacute;digo de Referencia</strong></td>';
         $cadena .= '<td colspan="2" width="130"><strong>Fechas extremas</strong></td>';
         $cadena .= '<td width="30" rowspan="2"><strong>Nº Piezas Docum.</strong></td>';
         $cadena .= '<td width="30" rowspan="2"><strong>Cajas</strong></td>';
         $cadena .= '<td width="30" rowspan="2"><strong>M.L.</strong></td>';
         $cadena .= '<td width="160" rowspan="2"><p><strong>Observ.</strong></p></td>';
         $cadena .= '</tr>';
         $cadena .= '<tr>';
         $cadena .= '<td width="65"><strong>Inicio</strong></td>';
         $cadena .= '<td width="65"><strong>Final</strong></td>';
         $cadena .= '</tr>';
         $sum = 0;
         $sum2 = 0;
         if ($row->exp_fecha_exi == "") {
             $fei = "";
         } else {
             $fechainicial = explode("-", $row->exp_fecha_exi);
             $fei = $fechainicial[2] . "/" . $fechainicial[1] . "/" . $fechainicial[0];
         }
         if ($row->exp_fecha_exf == "") {
             $fef = "";
         } else {
             $fechafinal = explode("-", $row->exp_fecha_exf);
             $fef = $fechafinal[2] . "/" . $fechafinal[1] . "/" . $fechafinal[0];
         }
         if ($row->ser_par == "") {
             $ser_id = 0;
         } else {
             $ser_id = $row->ser_par;
         }
         $obtenerSubserie = $tabserie->dbselectByField("ser_id", $ser_id);
         $u = 0;
         foreach ($obtenerSubserie as $ver) {
             $u++;
             $cte = $ver->ser_categoria;
         }
         $cadena .= '<tr>';
         $cadena .= '<td align="center">' . $i . '</td>';
         $cadena .= '<td>';
         if ($u == 0) {
             $cadena .= $row->ser_categoria;
         } else {
             $cadena .= $cte;
         }
         $cadena .= '</td>';
         $cadena .= '<td>';
         if ($u != 0) {
             $cadena .= $row->ser_categoria;
         }
         $sum = $sum + $expedientes->cantidadExpedientes($row->exp_id);
         $sum2 = $sum2 + $row->str_nrocajas;
         $cadena .= '</td>';
         $cadena .= '<td align="center">' . $row->fon_codigo . DELIMITER . $row->uni_codigo . DELIMITER . $row->ser_codigo . DELIMITER . $row->exp_codigo . '</td>';
         $cadena .= '<td align="center">' . $fei . '</td>';
         $cadena .= '<td align="center">' . $fef . '</td>';
         $cadena .= '<td align="center">' . $expedientes->cantidadExpedientes($row->exp_id) . '</td>';
         $cadena .= '<td align="center">' . $row->str_nrocajas . '</td>';
         $cadena .= '<td align="center">' . $row->str_totml . '</td>';
         $cadena .= '<td>' . $row->exp_obs . '</td>';
         $cadena .= '</tr>';
         $i++;
         $cadena .= '</table><br><br>';
     }
     require_once 'tcpdf/config/lang/eng.php';
     require_once 'tcpdf/tcpdf.php';
     $pdf = new TCPDF('L', PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setFontSubsetting(FALSE);
     $pdf->SetAuthor("Castellon");
     $pdf->SetTitle('Reporte de Transferencia');
     $pdf->SetSubject('Reporte de Transferencia');
     //        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, 14);
     //        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     $pdf->SetFont('helvetica', '', 10);
     // 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;
     $pdf->writeHTML($cadena, true, false, false, false, '');
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     //   $pdf->Output('reporte_transferencia.pdf', 'D');
     $pdf->Output('reporte_transferencia.pdf', 'I');
 }