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
     //============================================================+
 }