コード例 #1
0
 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/");
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 function rpteBuscar()
 {
     $archivo = new archivo();
     $tarchivo = new tab_archivo();
     $tarchivo->setRequest2Object($_REQUEST);
     $where = "";
     //        if (isset($_REQUEST ['fon_id'])) {
     //            $where .= " AND tab_fondo.fon_id='$_REQUEST ['fon_id']' ";
     //        }
     //        if (isset($_REQUEST ['uni_id'])) {
     //            $where .= " AND tab_unidad.uni_id='$_REQUEST ['uni_id']' ";
     //        }
     //        if (isset($_REQUEST ['ser_id'])) {
     //            $where .= " AND tab_series.ser_id='$ser_id' ";
     //        }
     //        if (!is_null($_REQUEST ['tra_id'])) {
     //            $where .= " AND tab_tramite.tra_id='$tra_id' ";
     //        }
     //        if (!is_null($_REQUEST ['cue_id'])) {
     //            $where .= " AND tab_cuerpos.cue_id='$cue_id' ";
     //        }
     //        if (!is_null($_REQUEST ['exp_titulo'])) {
     //            $where .= " AND tab_expisadg.exp_titulo='$exp_titulo' ";
     //        }
     //        if (!is_null($_REQUEST ['exf_fecha_exi'])) {
     //            $where .= " AND tab_expisadg.exp_fecha_exi='$exf_fecha_exi' ";
     //        }
     //        if (!is_null($_REQUEST ['exf_fecha_exf'])) {
     //            $where .= " AND tab_expisadg.exf_fecha_exf='$exf_fecha_exi' ";
     //        }
     $usu_id = $_SESSION['USU_ID'];
     $select = "SELECT\r\n                tab_archivo.fil_id,\r\n                (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) AS fon_codigo,\r\n                tab_unidad.uni_descripcion,\r\n                tab_series.ser_categoria,\r\n                tab_expisadg.exp_titulo,\r\n                f.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_tipocorr.tco_codigo,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_id,\r\n                tab_expediente.exp_codigo,\r\n                tab_cuerpos.cue_codigo,\r\n                tab_archivo.fil_codigo,\r\n                tab_cuerpos.cue_descripcion,\r\n                tab_archivo.fil_titulo,\r\n                tab_archivo.fil_proc,\r\n                tab_archivo.fil_firma,\r\n                tab_archivo.fil_cargo,\r\n                tab_archivo.fil_nrofoj,\r\n                tab_archivo.fil_tomovol,\r\n                tab_archivo.fil_nroejem,\r\n                tab_archivo.fil_nrocaj,\r\n                tab_archivo.fil_sala,\r\n                tab_archivo.fil_estante,\r\n                tab_archivo.fil_cuerpo,\r\n                tab_archivo.fil_balda,\r\n                tab_archivo.fil_tipoarch,\r\n                tab_archivo.fil_mrb,\r\n                tab_archivo.fil_ori,\r\n                tab_archivo.fil_cop,\r\n                tab_archivo.fil_fot,\r\n                (CASE tab_exparchivo.exa_condicion \r\n                                    WHEN '1' THEN 'DISPONIBLE' \r\n                                    WHEN '2' THEN 'PRESTADO' END) AS disponibilidad,\r\n                (SELECT fil_nomoriginal FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_nomoriginal,\r\n                (SELECT fil_extension FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_extension,\r\n                (SELECT fil_tamano/1048576 FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_tamano,\r\n                (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur,                \r\n                (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto,                \r\n                tab_archivo.fil_obs";
     $from = "FROM\r\n                tab_fondo as f\r\n                INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n                INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n                INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n                INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n                INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n                WHERE\r\n                f.fon_estado = 1 AND\r\n                tab_unidad.uni_estado = 1 AND\r\n                tab_tipocorr.tco_estado = 1 AND\r\n                tab_series.ser_estado = 1 AND\r\n                tab_expediente.exp_estado = 1 AND\r\n                tab_archivo.fil_estado = 1 AND\r\n                tab_exparchivo.exa_estado = 1 AND\r\n                tab_expusuario.eus_estado = 1 AND\r\n                tab_expusuario.usu_id='{$usu_id}' ";
     //        if (isset($_REQUEST ['fon_id'])) {
     //            $where .= " AND tab_fondo.fon_id='$fon_id' ";
     //        }
     //        if (isset($_REQUEST ['uni_id'])) {
     //            $where .= " AND tab_unidad.uni_id='$uni_id' ";
     //        }
     //        if (isset($_REQUEST ['ser_id'])) {
     //            $where .= " AND tab_series.ser_id='$ser_id' ";
     //        }
     //        if (!is_null($_REQUEST ['tra_id'])) {
     //            $where .= " AND tab_tramite.tra_id='$tra_id' ";
     //        }
     //        if (!is_null($_REQUEST ['cue_id'])) {
     //            $where .= " AND tab_cuerpos.cue_id='$cue_id' ";
     //        }
     //        if (!is_null($_REQUEST ['exp_titulo'])) {
     //            $where .= " AND tab_expisadg.exp_titulo='$exp_titulo' ";
     //        }
     //        if (!is_null($_REQUEST ['exf_fecha_exi'])) {
     //            $where .= " AND tab_expisadg.exp_fecha_exi='$exf_fecha_exi' ";
     //        }
     //        if (!is_null($_REQUEST ['exf_fecha_exf'])) {
     //            $where .= " AND tab_expisadg.exf_fecha_exf='$exf_fecha_exi' ";
     //        }
     //        $fil_nur
     //        $fil_nur
     //        $fil_titulo
     //        $fil_descripcion
     $sql = "{$select} {$from} {$where} ";
     $result = $tarchivo->dbSelectBySQL($sql);
     $this->usuario = new usuario();
     // PDF
     // Landscape
     require_once 'tcpdf/config/lang/eng.php';
     require_once 'tcpdf/tcpdf.php';
     $pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setFontSubsetting(FALSE);
     $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID']));
     $pdf->SetTitle('Reporte de Buscar Archivo ');
     $pdf->SetSubject('Reporte de Buscar Archivo ');
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //        aumentado
     $pdf->SetKeywords('Castellon, SISTEMA DE PASAJES Y VIÁTICOS');
     // set default header data
     $pdf->SetHeaderData('logo2.png', 20, 'MPD', 'Administradora Boliviana de Carreteras');
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     //
     $pdf->SetMargins(10, 30, 10);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     //        $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, 15);
     //        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->SetFont('helvetica', '', 6);
     // add a page
     $pdf->AddPage();
     // Report
     $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false);
     $cadena = "<br/><br/><br/><br/><br/><br/>";
     $cadena .= '<table width="780" border="0" >';
     $cadena .= '<tr><td align="center">';
     $cadena .= '<span style="font-size: 30px;font-weight: bold;">';
     $cadena .= 'Reporte de B&uacute;squeda de Documentos';
     $cadena .= '</span>';
     $cadena .= '</td></tr>';
     foreach ($result as $fila) {
         $cadena .= '<tr><td align="left">C&oacute;digo: ' . "" . '</td></tr>';
         $cadena .= '<tr><td align="left">Secci&oacute;n Remitente: ' . "" . '</td></tr>';
         $cadena .= '<tr><td align="left">Direcci&oacute;n y Tel&eacute;fono: ' . "" . '</td></tr>';
         $cadena .= '</table>';
         break;
     }
     // Header
     $cadena .= '<table width="700" border="1">';
     $cadena .= '<tr>';
     $cadena .= '<td width="20"><div align="center"><strong>Nro.</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Fondo</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Secci&oacute;n</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Serie</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Expediente</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Tipo Doc.</strong></div></td>';
     $cadena .= '<td width="80"><div align="center"><strong>Cod.Doc.</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Titulo</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Proc.</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Firma</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Cargo</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Nro.Foj.</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Nro.Caja</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Sala</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Estante</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Cuerpo</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Balda</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Tipo</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Estado</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Nro.Ori</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Nro.Cop</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Nro.Fot</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>NUR/NURI</strong></div></td>';
     $cadena .= '<td width="30"><div align="center"><strong>Asunto/Ref.</strong></div></td>';
     $cadena .= '<td width="40"><div align="center"><strong>Disponibilidad</strong></div></td>';
     $cadena .= '<td width="50"><div align="center"><strong>Doc.Digital</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Tama&ntilde;o</strong></div></td>';
     $cadena .= '<td width="20"><div align="center"><strong>Obs.</strong></div></td>';
     $cadena .= '</tr>';
     $numero = 1;
     foreach ($result as $fila) {
         $cadena .= '<tr>';
         $cadena .= '<td width="20"><div align="center">' . $numero . '</div></td>';
         $cadena .= '<td width="20">' . $fila->fon_codigo . '</td>';
         $cadena .= '<td width="50">' . $fila->uni_descripcion . '</td>';
         $cadena .= '<td width="50">' . $fila->ser_categoria . '</td>';
         $cadena .= '<td width="50">' . $fila->exp_titulo . '</td>';
         $cadena .= '<td width="50">' . $fila->cue_descripcion . '</td>';
         $cadena .= '<td width="80">' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . DELIMITER . $fila->cue_codigo . DELIMITER . $fila->fil_codigo . '</td>';
         $cadena .= '<td width="50">' . $fila->fil_titulo . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_proc . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_firma . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_cargo . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_nrofoj . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_nrocaj . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_sala . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_estante . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_cuerpo . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_balda . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_tipoarch . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_mrb . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_ori . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_cop . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_fot . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_nur . '</td>';
         $cadena .= '<td width="30">' . $fila->fil_asunto . '</td>';
         $cadena .= '<td width="40">' . $fila->disponibilidad . '</td>';
         $cadena .= '<td width="50">' . $fila->fil_nomoriginal . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_tamano . '</td>';
         $cadena .= '<td width="20">' . $fila->fil_obs . '</td>';
         $cadena .= '</tr>';
         $numero++;
     }
     $cadena .= '</table>';
     $pdf->writeHTML($cadena, true, false, false, false, '');
     // -----------------------------------------------------------------------------
     //Close and output PDF document
     $pdf->Output('reporte_buscar_archivo.pdf', 'I');
 }
コード例 #4
0
 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');
 }
コード例 #5
0
 function buscar2($busquedaArray)
 {
     $valor = "";
     $id_listar = "";
     if (isset($_SESSION['id_lista'])) {
         $id_listar = $_SESSION['id_lista'];
     }
     $page = $busquedaArray['page'];
     $rp = $busquedaArray['rp'];
     $sortname = $busquedaArray['sortname'];
     $sortorder = $busquedaArray['sortorder'];
     //
     //        $fon_id = $busquedaArray['fon_id'];
     // Search
     $archivo = new archivo();
     $tarchivo = new tab_archivo();
     $tarchivo->setRequest2Object($_REQUEST);
     $page = $_REQUEST['page'];
     $rp = $_REQUEST['rp'];
     $sortname = $_REQUEST['sortname'];
     $sortorder = $_REQUEST['sortorder'];
     if (!$sortname) {
         $sortname = 'fil_id';
     }
     if (!$sortorder) {
         $sortorder = 'desc';
     }
     $sort = "ORDER BY {$sortname} {$sortorder}";
     if (!$page) {
         $page = 1;
     }
     if (!$rp) {
         $rp = 15;
     }
     $start = ($page - 1) * $rp;
     $limit = "LIMIT {$rp} OFFSET {$start} ";
     $query = $_REQUEST['query'];
     $qtype = $_REQUEST['qtype'];
     $where = "";
     if ($query) {
         if ($qtype == 'fil_id') {
             $where = " WHERE {$qtype} = '{$query}' ";
         } else {
             $where = " WHERE {$qtype} LIKE '%{$query}%' ";
         }
         $sql = "SELECT *\r\n                    FROM tab_rol\r\n                    {$where} AND\r\n                    rol_estado = 1 {$sort} {$limit} ";
     } else {
         $sql = "SELECT *\r\n                    FROM tab_rol\r\n                    WHERE rol_estado = 1 {$sort} {$limit} ";
     }
     $usu_id = $_SESSION['USU_ID'];
     $select = "SELECT\r\n                tab_archivo.fil_id,\r\n                (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) AS fon_codigo,\r\n                tab_unidad.uni_descripcion,\r\n                tab_series.ser_categoria,\r\n                tab_expisadg.exp_titulo,\r\n                f.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_tipocorr.tco_codigo,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_id,\r\n                tab_expediente.exp_codigo,\r\n                tab_cuerpos.cue_codigo,\r\n                tab_archivo.fil_codigo,\r\n                tab_cuerpos.cue_descripcion,\r\n                tab_archivo.fil_titulo,\r\n                tab_archivo.fil_subtitulo,\r\n                tab_archivo.fil_proc,\r\n                tab_archivo.fil_firma,\r\n                tab_archivo.fil_cargo,\r\n                tab_archivo.fil_nrofoj,\r\n                tab_archivo.fil_tomovol,\r\n                tab_archivo.fil_nroejem,\r\n                tab_archivo.fil_nrocaj,\r\n                tab_archivo.fil_sala,\r\n                tab_archivo.fil_estante,\r\n                tab_archivo.fil_cuerpo,\r\n                tab_archivo.fil_balda,\r\n                tab_archivo.fil_tipoarch,\r\n                tab_archivo.fil_mrb,\r\n                tab_archivo.fil_ori,\r\n                tab_archivo.fil_cop,\r\n                tab_archivo.fil_fot,\r\n                (CASE tab_exparchivo.exa_condicion\r\n                                    WHEN '1' THEN 'DISPONIBLE'\r\n                                    WHEN '2' THEN 'PRESTADO' END) AS disponibilidad,\r\n                (SELECT fil_nomoriginal FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_nomoriginal,\r\n                (SELECT fil_extension FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_extension,\r\n                (SELECT fil_tamano/1048576 FROM tab_archivo_digital WHERE tab_archivo_digital.fil_id=tab_archivo.fil_id AND tab_archivo_digital.fil_estado = '1' ) AS fil_tamano,\r\n                (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur,\r\n                (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto,\r\n                tab_archivo.fil_obs";
     $from = "FROM\r\n                tab_fondo as f\r\n                INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                INNER JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n                INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n                INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n                INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n                INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n                WHERE\r\n                f.fon_estado = 1 AND\r\n                tab_unidad.uni_estado = 1 AND\r\n                tab_tipocorr.tco_estado = 1 AND\r\n                tab_series.ser_estado = 1 AND\r\n                tab_expediente.exp_estado = 1 AND\r\n                tab_archivo.fil_estado = 1 AND\r\n                tab_exparchivo.exa_estado = 1 AND\r\n                tab_expusuario.eus_estado = 1 AND\r\n                tab_expusuario.usu_id='{$usu_id}'";
     $where = "";
     //        if (strlen($fon_id)> 0 && $fon_id!='null') {
     //            $where .= " AND tab_fondo.fon_id='$fon_id' ";
     //        }
     // Search addwords
     if ($id_listar != "") {
         $explode = explode(",", $id_listar);
         $cantidad = count($explode);
         for ($i = 0; $i < $cantidad; $i++) {
             $valor .= "tab_archivo.fil_id=" . $explode[$i];
             if ($i < $cantidad - 1) {
                 $valor .= " or ";
             }
         }
         $where .= " AND {$valor} ";
     }
     $sql = "{$select} {$from} {$where} {$sort} {$limit}";
     $result = $tarchivo->dbSelectBySQL($sql);
     //print $sql;
     $sql_c = "SELECT COUNT(tab_archivo.fil_id) {$from} {$where} ";
     $total = $tarchivo->countBySQL($sql_c);
     $exp = new expediente();
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     header("Content-type: text/x-json");
     $json = "";
     $json .= "{\n";
     $json .= "page: {$page},\n";
     $json .= "total: {$total},\n";
     $json .= "rows: [";
     $rc = false;
     $i = 0;
     $j = 1;
     foreach ($result as $un) {
         if ($rc) {
             $json .= ",";
         }
         $json .= "\n{";
         $json .= "id:'" . $un->fil_id . "',";
         //$json .= "cell:['" . $un->fil_id . "'";
         $json .= "cell:[";
         $json .= "'<input id=\"chkid_" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"fil_chk" . $j . "\" type=\"checkbox\" value=\"" . $un->fil_id . "\" checked=\"checked\" />'";
         if ($un->fil_confidencialidad == 3) {
             $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFileP icon\" />'";
         } else {
             //$json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'";
             $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-{$un->fil_extension}.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'";
             ///web/lib/32/document-". $una->fil_extension .".png'
         }
         if ($un->fil_confidencialidad == 3) {
             $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewP icon\" />'";
         } else {
             //$json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\" />'";
             $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"view icon\" />'";
             ///web/lib/32/document-". $una->fil_extension .".png'
         }
         $json .= ",'" . $un->fil_id . "'";
         $json .= ",'" . addslashes($un->fon_codigo) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->uni_descripcion)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->ser_categoria)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->exp_titulo)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->cue_descripcion)) . "'";
         $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo . DELIMITER . $un->exp_codigo . DELIMITER . $un->cue_codigo . DELIMITER . $un->fil_codigo) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_titulo)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_proc)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_firma)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_cargo)) . "'";
         $json .= ",'" . addslashes($un->fil_nrofoj) . "'";
         $json .= ",'" . addslashes($un->fil_nrocaj) . "'";
         $json .= ",'" . addslashes($un->fil_sala) . "'";
         $json .= ",'" . addslashes($un->fil_estante) . "'";
         $json .= ",'" . addslashes($un->fil_cuerpo) . "'";
         $json .= ",'" . addslashes($un->fil_balda) . "'";
         $json .= ",'" . addslashes($un->fil_tipoarch) . "'";
         $json .= ",'" . addslashes($un->fil_mrb) . "'";
         $json .= ",'" . addslashes($un->fil_ori) . "'";
         $json .= ",'" . addslashes($un->fil_cop) . "'";
         $json .= ",'" . addslashes($un->fil_fot) . "'";
         $json .= ",'" . addslashes($un->fil_nur) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_asunto)) . "'";
         $json .= ",'" . addslashes($un->disponibilidad) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_nomoriginal)) . "'";
         $json .= ",'" . addslashes($un->fil_tamano) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_obs)) . "'";
         $json .= "]}";
         $rc = true;
         $i++;
         $j++;
     }
     $json .= "]\n";
     $json .= "}";
     echo $json;
 }
コード例 #6
0
 function loadDoc()
 {
     // Search
     $usuario = new usuario();
     $tarchivo = new tab_archivo();
     $tarchivo->setRequest2Object($_REQUEST);
     // Hasta aqui
     $valor = "";
     $id_listar = "";
     if (isset($_SESSION['id_lista'])) {
         $id_listar = $_SESSION['id_lista'];
     }
     $page = $_REQUEST['page'];
     $rp = $_REQUEST['rp'];
     $sortname = $_REQUEST['sortname'];
     $sortorder = $_REQUEST['sortorder'];
     if (!$sortname) {
         $sortname = " f.fon_cod,\r\n                        tab_unidad.uni_cod,\r\n                        tab_series.ser_orden,\r\n                        tab_series.ser_codigo,\r\n                        tab_expediente.exp_codigo::int,\r\n                        tab_archivo.fil_nro::int  ";
     } else {
         $sortname = $sortname;
     }
     if (!$sortorder) {
         $sortorder = 'desc';
     }
     $sort = "ORDER BY {$sortname} {$sortorder}";
     if (!$page) {
         $page = 1;
     }
     if (!$rp) {
         $rp = 20;
     }
     $start = ($page - 1) * $rp;
     $limit = "LIMIT {$rp} OFFSET {$start} ";
     $query = $_REQUEST['query'];
     $qtype = $_REQUEST['qtype'];
     $where = "";
     if ($query) {
         if ($qtype) {
         }
     }
     $whereUsuario = "";
     $usu_id = $_SESSION['USU_ID'];
     if ($_SESSION['ROL_COD'] != 'AA') {
         $whereUsuario = " AND tab_expusuario.usu_id=" . $_SESSION['USU_ID'] . "";
     }
     // Search docs
     $select = "SELECT\r\n                tab_expediente.exp_id,\r\n                tab_archivo.fil_id,\r\n                f.fon_codigo,\r\n                f.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_tipocorr.tco_codigo,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_codigo,\r\n                tab_archivo.fil_nro,\r\n                tab_unidad.uni_descripcion,\r\n                tab_series.ser_categoria,\r\n                tab_expisadg.exp_titulo,\r\n                tab_cuerpos.cue_descripcion,\r\n                tab_archivo.fil_confidencialidad,\r\n                tab_archivo.fil_titulo,\r\n                tab_archivo.fil_subtitulo,\r\n                tab_archivo.fil_proc,\r\n                tab_archivo.fil_firma,\r\n                tab_archivo.fil_cargo,\r\n                tab_archivo.fil_nrofoj,\r\n                tab_archivo.fil_tomovol,\r\n                tab_archivo.fil_nroejem,\r\n                tab_archivo.fil_nrocaj,\r\n                tab_archivo.fil_sala,\r\n                tab_archivo.fil_estante,\r\n                tab_archivo.fil_cuerpo,\r\n                tab_archivo.fil_balda,\r\n                tab_archivo.fil_tipoarch,\r\n                tab_archivo.fil_mrb,\r\n                tab_archivo.fil_ori,\r\n                tab_archivo.fil_cop,\r\n                tab_archivo.fil_fot,\r\n                (SELECT fil_nur FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_nur,\r\n                (SELECT fil_asunto FROM tab_doccorr WHERE tab_doccorr.fil_id=tab_archivo.fil_id AND tab_doccorr.dco_estado = '1' ) AS fil_asunto,\r\n                tab_archivo.fil_obs,\r\n                tab_expusuario.usu_id";
     $from = "FROM\r\n                tab_fondo as f\r\n                INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                LEFT JOIN tab_exparchivo ON tab_expediente.exp_id = tab_exparchivo.exp_id\r\n                INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n                INNER JOIN tab_cuerpos ON tab_cuerpos.cue_id = tab_exparchivo.cue_id\r\n                INNER JOIN tab_tramitecuerpos ON tab_cuerpos.cue_id = tab_tramitecuerpos.cue_id\r\n                INNER JOIN tab_tramite ON tab_tramite.tra_id = tab_tramitecuerpos.tra_id\r\n                WHERE\r\n                f.fon_estado = 1 AND\r\n                tab_unidad.uni_estado = 1 AND\r\n                tab_tipocorr.tco_estado = 1 AND\r\n                tab_series.ser_estado = 1 AND\r\n                tab_expediente.exp_estado = 1 AND\r\n                tab_archivo.fil_estado = 1 AND\r\n                tab_exparchivo.exa_estado = 1 AND\r\n                tab_expusuario.eus_estado = 1\r\n                {$whereUsuario} ";
     $where = "";
     // Search addwords
     if ($id_listar != "") {
         $explode = explode(",", $id_listar);
         $cantidad = count($explode);
         if ($cantidad > 0) {
             $valor .= "tab_archivo.fil_id=0 OR ";
             for ($i = 0; $i < $cantidad; $i++) {
                 $valor .= "tab_archivo.fil_id=" . $explode[$i];
                 if ($i < $cantidad - 1) {
                     $valor .= " or ";
                 }
             }
         }
         $where .= " AND {$valor} ";
     }
     // MODIFICADO
     //$sort = "ORDER BY tab_expediente.exp_id, tab_cuerpos.cue_id, tab_archivo.fil_nro ";
     //$sort = "ORDER BY tab_series.ser_orden, tab_expediente.exp_codigo::int, tab_archivo.fil_nro::int ";
     $sql = "{$select} {$from} {$where} {$sort} {$limit}";
     $result = $tarchivo->dbSelectBySQL($sql);
     //print $sql;
     $sql_c = "SELECT COUNT(tab_archivo.fil_id) {$from} {$where} ";
     $total = $tarchivo->countBySQL($sql_c);
     $exp = new expediente();
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     header("Content-type: text/x-json");
     $json = "";
     $json .= "{\n";
     $json .= "page: {$page},\n";
     $json .= "total: {$total},\n";
     $json .= "rows: [";
     $rc = false;
     $i = 0;
     $j = 1;
     $exp_titulo = "";
     foreach ($result as $un) {
         // Documento
         if ($rc) {
             $json .= ",";
         }
         $json .= "\n{";
         $json .= "id:'" . $un->fil_id . "',";
         $json .= "cell:[";
         $json .= "'<input id=\"chkid_" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"fil_chk" . $j . "\" type=\"checkbox\" value=\"" . $un->fil_id . "\" checked=\"checked\" />'";
         //            $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-$un->fil_extension.png\" file=\"$un->fil_id\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\"  />'";
         $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/document-.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"viewFile icon\"  />'";
         $json .= ",'<img src=\"" . PATH_DOMAIN . "/web/lib/32/b_view.png\" file=\"{$un->fil_id}\" valueId=\"" . $un->fil_id . "\" restric=\"" . $un->fil_confidencialidad . "\" class=\"view icon\" />'";
         $json .= ",'" . $un->fil_id . "'";
         $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo . DELIMITER . $un->exp_codigo . DELIMITER . $un->fil_nro) . "'";
         $json .= ",'" . addslashes($usuario->getRol($un->usu_id)) . "'";
         $json .= ",'" . addslashes($un->fon_codigo) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->uni_descripcion)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->ser_categoria)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->exp_titulo)) . "'";
         //$json .= ",'" . addslashes(utf8_decode($un->cue_descripcion)) . "'";
         if ($un->fil_subtitulo) {
             $json .= ",'" . addslashes(utf8_decode($un->fil_titulo . " - " . $un->fil_subtitulo)) . "'";
         } else {
             $json .= ",'" . addslashes(utf8_decode($un->fil_titulo)) . "'";
         }
         $json .= ",'" . addslashes($un->fil_tomovol) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_proc)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_firma)) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_cargo)) . "'";
         $json .= ",'" . addslashes($un->fil_nrofoj) . "'";
         $json .= ",'" . addslashes($un->fil_nrocaj) . "'";
         $json .= ",'" . addslashes($un->fil_sala) . "'";
         $json .= ",'" . addslashes($un->fil_estante) . "'";
         $json .= ",'" . addslashes($un->fil_cuerpo) . "'";
         $json .= ",'" . addslashes($un->fil_balda) . "'";
         $json .= ",'" . addslashes($un->fil_tipoarch) . "'";
         $json .= ",'" . addslashes($un->fil_mrb) . "'";
         $json .= ",'" . addslashes($un->fil_ori) . "'";
         $json .= ",'" . addslashes($un->fil_cop) . "'";
         $json .= ",'" . addslashes($un->fil_fot) . "'";
         //palabras clave
         $palclave = new palclave();
         $fil_palclave = $palclave->listaPCFile($un->fil_id);
         $json .= ",'" . addslashes($fil_palclave) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_obs)) . "'";
         // SIACO
         $json .= ",'" . addslashes($un->fil_nur) . "'";
         $json .= ",'" . addslashes(utf8_decode($un->fil_asunto)) . "'";
         $json .= "]}";
         $rc = true;
         $i++;
         $j++;
     }
     $json .= "]\n";
     $json .= "}";
     echo $json;
 }
コード例 #7
0
 function printFichaSearchExpediente()
 {
     $exp_id = VAR3;
     $dov_id = VAR4;
     $where = "";
     //        if ($_SESSION['ROL_COD'] != 'AA') {
     //            $where = " AND tab_expusuario.usu_id=" . $_SESSION['USU_ID'] . "";
     //        }
     $tarchivo = new tab_archivo();
     $select = "SELECT\r\n                (SELECT fon_codigo from tab_fondo WHERE fon_id=f.fon_par) AS fon_codigo,\r\n                tab_unidad.uni_descripcion,\r\n                tab_series.ser_categoria,\r\n                tab_expisadg.exp_titulo,\r\n                f.fon_cod,\r\n                tab_unidad.uni_cod,\r\n                tab_tipocorr.tco_codigo,\r\n                tab_series.ser_id,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_id,\r\n                tab_expediente.exp_codigo,\r\n                tab_expisadg.exp_fecha_exi,\r\n                tab_expisadg.exp_fecha_exf,\r\n                tab_expisadg.exp_nivdes,\r\n                tab_expisadg.exp_volsop,\r\n                tab_expisadg.exp_nomprod,\r\n                tab_expisadg.exp_hisins,\r\n                tab_expisadg.exp_hisarc,\r\n                tab_expisadg.exp_foring,\r\n                tab_expisadg.exp_alccon,\r\n                tab_expisadg.exp_vaseel,\r\n                tab_expisadg.exp_nueing,\r\n                tab_expisadg.exp_org,\r\n                tab_expisadg.exp_conacc,\r\n                tab_expisadg.exp_conrep,\r\n                tab_expisadg.exp_lengua,\r\n                tab_expisadg.exp_carfis,\r\n                tab_expisadg.exp_insdes,\r\n                tab_expisadg.exp_exloor,\r\n                tab_expisadg.exp_exloco,\r\n                tab_expisadg.exp_underel,\r\n                tab_expisadg.exp_notpub,\r\n                tab_expisadg.exp_notas,\r\n                tab_expisadg.exp_notarc,\r\n                tab_expisadg.exp_regnor,\r\n                tab_expisadg.exp_fecdes,\r\n                tab_expisadg.exp_estado,\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_expediente.sof_id,\r\n                tab_expediente.exp_nrofoj,\r\n                tab_expediente.exp_tomovol,\r\n                tab_expediente.exp_nroejem,\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                tab_expediente.exp_estado,\r\n                tab_expisadg.idi_id,\r\n                tab_expediente.exp_ori,\r\n                tab_expediente.exp_cop,\r\n                tab_expediente.exp_fot,\r\n                tab_expediente.exp_lugar";
     $from = "FROM\r\n                tab_fondo AS f\r\n                INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id\r\n                INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n                INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n                INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n                INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n                INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n                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_expusuario.eus_estado = 1 AND\r\n                tab_expediente.exp_id = '{$exp_id}'\r\n                {$where} ";
     $sql = "{$select} {$from} ";
     $result = $tarchivo->dbSelectBySQL($sql);
     //print $sql;
     $this->usuario = new usuario();
     // PDF
     // Landscape
     require_once 'tcpdf/config/lang/eng.php';
     require_once 'tcpdf/tcpdf.php';
     $pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setFontSubsetting(FALSE);
     $pdf->SetAuthor($this->usuario->obtenerNombre($_SESSION['USU_ID']));
     $pdf->SetTitle('Reporte Ficha del Expediente');
     $pdf->SetSubject('Reporte Ficha del Expediente');
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //        aumentado
     $pdf->SetKeywords('Castellon, SISTEMA DE PASAJES Y VIÁTICOS');
     // set default header data
     $pdf->SetHeaderData('logo2.png', 20, 'MPD', 'Administradora Boliviana de Carreteras');
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     //
     $pdf->SetMargins(10, 30, 10);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     //        $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, 15);
     //        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     // Report
     $pdf->Image(PATH_ROOT . '/web/img/iso.png', '255', '8', 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 1, false, false, false);
     $cadena = "<br/><br/><br/><br/><br/><br/>";
     $cadena .= '<table width="580" border="0" >';
     $cadena .= '<tr><td align="center">';
     $cadena .= '<span style="font-size: 30px;font-weight: bold;">';
     $cadena .= 'Reporte Ficha del Expediente';
     $cadena .= '</span>';
     $cadena .= '</td></tr>';
     foreach ($result as $fila) {
         $cadena .= '<tr><td align="left"><b>1. AREA DE INDENTIFICACI&Oacute;N</b></td></tr>';
         $cadena .= '<tr><td align="left"><b>Id: </b>' . $fila->exp_id . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>C&oacute;digo: </b>' . $fila->fon_cod . DELIMITER . $fila->uni_cod . DELIMITER . $fila->tco_codigo . DELIMITER . $fila->ser_codigo . DELIMITER . $fila->exp_codigo . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>Fondo:</b> ' . $fila->fon_codigo . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>Secci&oacute;n:</b> ' . $fila->uni_descripcion . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>Serie:</b> ' . $fila->ser_categoria . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>T&iacute;tulo:</b> <b>' . $fila->exp_titulo . '</b></td></tr>';
         if ($fila->exp_mesi) {
             if ($fila->exp_anioi) {
                 $cadena .= '<tr><td align="left"><b>Fecha Inicial:</b> ' . $fila->exp_mesi . "/" . $fila->exp_anioi . '</td></tr>';
             } else {
                 $cadena .= '<tr><td align="left"><b>Fecha Inicial:</b> ' . $fila->exp_mesi . '</td></tr>';
             }
         } else {
             if ($fila->exp_anioi) {
                 $cadena .= '<tr><td align="left"><b>Fecha Inicial:</b> ' . $fila->fil_anioi . '</td></tr>';
             }
         }
         if ($fila->exp_mesf) {
             if ($fila->exp_aniof) {
                 $cadena .= '<tr><td align="left"><b>Fecha Final:</b> ' . $fila->exp_mesf . "/" . $fila->exp_aniof . '</td></tr>';
             } else {
                 $cadena .= '<tr><td align="left"><b>Fecha Final:</b> ' . $fila->exp_mesf . '</td></tr>';
             }
         } else {
             if ($fila->exp_aniof) {
                 $cadena .= '<tr><td align="left"><b>Fecha Final:</b> ' . $fila->exp_aniof . '</td></tr>';
             }
         }
         //            $cadena .= '<tr><td align="left"><b>Fecha Inicial:</b> ' . $fila->exp_mesi . "/" . $fila->exp_anioi . '</td></tr>';
         //            $cadena .= '<tr><td align="left"><b>Fecha Final:</b> ' . $fila->exp_mesf . "/" . $fila->exp_aniof . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>Ubicaci&oacute;n Geogr&aacute;fica:</b> ' . $fila->exp_lugar . '</td></tr>';
         $cadena .= '<tr><td align="left"><b>Volumen y soporte de la Unidad de Descripci&oacute;n:</b> ' . $fila->exp_volsop . '</td></tr>';
         // Include dynamic fields
         $expcampo = new expcampo();
         $filcampo = $expcampo->obtenerSelectCamposShow($fila->ser_id, $fila->exp_id);
         if ($filcampo) {
             $cadena .= '<br/>';
             $cadena .= '<tr><td align="left"><b>Datos adicionales en la identificaci&oacute;n:</b> ' . "" . '</td></tr>';
             $cadena .= $filcampo;
         }
         $cadena .= '<br/><tr><td align="left"><b>2. AREA DE CONTEXTO</b></td></tr>';
         if ($fila->exp_nomprod) {
             $cadena .= '<tr><td align="left"><b>Nombre del o de los Productores:</b> ' . $fila->exp_nomprod . '</td></tr>';
         }
         if ($fila->exp_hisins) {
             $cadena .= '<tr><td align="left"><b>Historia Institucional/Rese&ntilde;a biogr&aacute;fica:</b> ' . $fila->exp_hisins . '</td></tr>';
         }
         if ($fila->exp_hisarc) {
             $cadena .= '<tr><td align="left"><b>Historia Archiv&iacute;stica:</b> ' . $fila->exp_hisarc . '</td></tr>';
         }
         if ($fila->exp_foring) {
             $cadena .= '<tr><td align="left"><b>Forma de ingreso:</b> ' . $fila->exp_foring . '</td></tr>';
         }
         $cadena .= '<br/><tr><td align="left"><b>3. AREA DE CONTENIDO Y ESTRUCTURA</b></td></tr>';
         if ($fila->exp_alccon) {
             $cadena .= '<tr><td align="left"><b>Alcance y contenido:</b> ' . $fila->exp_alccon . '</td></tr>';
         }
         if ($fila->exp_vaseel) {
             $cadena .= '<tr><td align="left"><b>Valoraci&oacute;n, selecci&oacute;n y eliminaci&oacute;n:</b> ' . $fila->exp_vaseel . '</td></tr>';
         }
         if ($fila->exp_nueing) {
             $cadena .= '<tr><td align="left"><b>Nuevos Ingresos:</b> ' . $fila->exp_nueing . '</td></tr>';
         }
         if ($fila->exp_org) {
             $cadena .= '<tr><td align="left"><b>Organizaci&oacute;n:</b> ' . $fila->exp_org . '</td></tr>';
         }
         $idioma = new idioma();
         $cadena .= '<br/><tr><td align="left"><b>4. AREA DE CONDICIONES DE ACCESO Y USO</b></td></tr>';
         if ($fila->exp_conacc) {
             $cadena .= '<tr><td align="left"><b>Condiciones de Acceso:</b> ' . $fila->exp_conacc . '</td></tr>';
         }
         if ($fila->exp_conrep) {
             $cadena .= '<tr><td align="left"><b>Condiciones de Reproducci&oacute;n:</b> ' . $fila->exp_conrep . '</td></tr>';
         }
         if ($fila->idi_id) {
             $cadena .= '<tr><td align="left"><b>Lengua/Escritura de la documentaci&oacute;n:</b> ' . $idioma->obtenerIdioma($fila->idi_id) . '</td></tr>';
         }
         if ($fila->exp_carfis) {
             $cadena .= '<tr><td align="left"><b>Carater&iacute;sticas f&iacute;sicas o requisitos t&eacute;cnicos:</b> ' . $fila->exp_carfis . '</td></tr>';
         }
         if ($fila->exp_insdes) {
             $cadena .= '<tr><td align="left"><b>Instrumentos de descripci&oacute;n:</b> ' . $fila->exp_insdes . '</td></tr>';
         }
         $cadena .= '<br/><tr><td align="left"><b>5. AREA DE DOCUMENTACI&Oacute;N ASOCIADA</b></td></tr>';
         if ($fila->exp_exloor) {
             $cadena .= '<tr><td align="left"><b>Existencia y localizaci&oacute;n de originales:</b> ' . $fila->exp_exloor . '</td></tr>';
         }
         if ($fila->exp_exloco) {
             $cadena .= '<tr><td align="left"><b>Existencia y localizaci&oacute;n de copias:</b> ' . $fila->exp_exloco . '</td></tr>';
         }
         if ($fila->exp_underel) {
             $cadena .= '<tr><td align="left"><b>Unidades de descripci&oacute;n relacionadas:</b> ' . $fila->exp_underel . '</td></tr>';
         }
         if ($fila->exp_notpub) {
             $cadena .= '<tr><td align="left"><b>Notas de publicaci&oacute;n:</b> ' . $fila->exp_notpub . '</td></tr>';
         }
         $cadena .= '<br/><tr><td align="left"><b>6. AREA DE NOTAS</b></td></tr>';
         if ($fila->exp_notas) {
             $cadena .= '<tr><td align="left"><b>Notas:</b> ' . $fila->exp_notas . '</td></tr>';
         }
         $cadena .= '<br/><tr><td align="left"><b>7. AREA DE CONTROL DE LA DESCRIPCI&Oacute;N</b></td></tr>';
         if ($fila->exp_notarc) {
             $cadena .= '<tr><td align="left"><b>Notas del archivero:</b> ' . $fila->exp_notarc . '</td></tr>';
         }
         if ($fila->exp_regnor) {
             $cadena .= '<tr><td align="left"><b>Reglas o Normas:</b> ' . $fila->exp_regnor . '</td></tr>';
         }
         if ($fila->exp_fecdes) {
             $cadena .= '<tr><td align="left"><b>Fecha de la descripci&oacute;n:</b> ' . $fila->exp_fecdes . '</td></tr>';
         }
         $sop_fisico = new tab_sopfisico();
         $nombresopf = $sop_fisico->dbselectByField("sof_id", $fila->sof_id);
         $nombresopf = $nombresopf[0];
         $cadena .= '<br/><tr><td align="left"><b>8. PRESENTACI&Oacute;N DEL EXPEDIENTE</b></td></tr>';
         if ($nombresopf->sof_nombre) {
             $cadena .= '<tr><td align="left"><b>Soporte F&iacute;sico:</b> ' . $nombresopf->sof_nombre . '</td></tr>';
         }
         if ($fila->exp_nrofoj) {
             $cadena .= '<tr><td align="left"><b>Nro. de Fojas:</b> ' . $fila->exp_nrofoj . '</td></tr>';
         }
         if ($fila->exp_tomovol) {
             $cadena .= '<tr><td align="left"><b>Tomos (Vols):</b> ' . $fila->exp_tomovol . '</td></tr>';
         }
         if ($fila->exp_nroejem) {
             $cadena .= '<tr><td align="left"><b>Nro. Ejemplares:</b> ' . $fila->exp_nroejem . '</td></tr>';
         }
         if ($fila->exp_ori) {
             $cadena .= '<tr><td align="left"><b>Originales:</b> ' . $fila->exp_ori . '</td></tr>';
         }
         if ($fila->exp_cop) {
             $cadena .= '<tr><td align="left"><b>Copias:</b> ' . $fila->exp_cop . '</td></tr>';
         }
         if ($fila->exp_fot) {
             $cadena .= '<tr><td align="left"><b>Duplicados:</b> ' . $fila->exp_fot . '</td></tr>';
         }
         if ($fila->exp_nrocaj) {
             $cadena .= '<tr><td align="left"><b>Nro. de Caja:</b> ' . $fila->exp_nrocaj . '</td></tr>';
         }
         if ($fila->exp_sala) {
             $cadena .= '<tr><td align="left"><b>Sala:</b> ' . $fila->exp_sala . '</td></tr>';
         }
         if ($fila->exp_estante) {
             $cadena .= '<tr><td align="left"><b>Estante:</b> ' . $fila->exp_estante . '</td></tr>';
         }
         if ($fila->exp_cuerpo) {
             $cadena .= '<tr><td align="left"><b>Cuerpo:</b> ' . $fila->exp_cuerpo . '</td></tr>';
         }
         if ($fila->exp_balda) {
             $cadena .= '<tr><td align="left"><b>Balda:</b> ' . $fila->exp_balda . '</td></tr>';
         }
         if ($fila->exp_obs) {
             $cadena .= '<tr><td align="left"><b>Observaciones:</b> ' . $fila->exp_obs . '</td></tr>';
         }
         // Key words
         $palclave = new palclave();
         $cadena .= '<tr><td align="left"><b>Palabras claves:</b> ' . $palclave->listaPCFile2($fila->exp_id) . '</td></tr>';
     }
     $cadena .= '</table>';
     //$cadena .= '</table>';
     $pdf->writeHTML($cadena, true, false, false, false, '');
     // Close and output PDF document
     $pdf->Output('ficha_expediente.pdf', 'I');
 }
コード例 #8
0
 function verRpte()
 {
     // Include the main TCPDF library (search for installation path).
     require_once 'tcpdf/tcpdf.php';
     // create new PDF document
     //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf = new TCPDF('P', PDF_UNIT, 'LETTER', true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Castellon S.R.L.');
     $pdf->SetTitle('Marbetes de documentos y expedientes');
     $pdf->SetSubject('Marbetes de documentos y expedientes');
     $pdf->SetKeywords('Marbetes, documentos y expedientes');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default header data
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 027', PDF_HEADER_STRING);
     // set header and footer fonts
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     //$pdf->SetMargins(PDF_MARGIN_LEFT, 7, PDF_MARGIN_RIGHT);
     //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     //$pdf->SetMargins(5, 7, 5);
     $pdf->SetMargins(6, 7, 6);
     // Margin Header
     //        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     //        $pdf->SetHeaderMargin(10);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE);
     //$pdf->SetAutoPageBreak(FALSE);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     if (@file_exists(dirname(__FILE__) . 'tcpdf/lang/eng.php')) {
         require_once dirname(__FILE__) . 'tcpdf/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // ---------------------------------------------------------
     // set a barcode on the page footer
     //$pdf->setBarcode(date('Y-m-d H:i:s'));
     // set font
     // add a page
     $pdf->AddPage();
     //$pdf->SetFont('helvetica', '', 10);
     $pdf->SetFont('helvetica', 'U', 18);
     // create columns content
     //$pdf->Ln(6);
     $pdf->Ln(6);
     $style1 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'L', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $style2 = array('position' => '', 'align' => '', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => 'R', 'border' => true, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'font' => 'helvetica', 'fontsize' => 8);
     // Tipo de reporte
     $tiporeporte = $_REQUEST['tiporeporte'];
     // Filtro seccion
     $uni_id = $_REQUEST['uni_id'];
     $ser_id = $_REQUEST['ser_id'];
     // Nuevo c&oacute;digo
     $where = "";
     // Resultset
     $result = null;
     $kl = 0;
     $v2[$kl] = 0;
     $doxexp[$kl] = 0;
     $de[$kl] = 0;
     $n = 0;
     $where = "";
     if ($ser_id) {
         $where .= " AND tab_series.ser_id = '{$ser_id}' ";
     }
     if ($_SESSION["ROL_COD"] != 'AA') {
         $where .= " AND tab_expusuario.usu_id= '" . $_SESSION["USU_ID"] . "'";
     }
     // ************
     // Series
     // ************
     if ($uni_id != "") {
         // Expedientes
         $sql_marbete = "SELECT\r\n                tab_expediente.exp_id,\r\n                tab_series.ser_orden,\r\n                tab_series.ser_codigo,\r\n                tab_expediente.exp_codigo,\r\n                tab_expisadg.exp_titulo,\r\n                tab_expediente.exp_nrocaj\r\n                FROM\r\n                tab_usuario\r\n                INNER JOIN tab_expusuario ON tab_usuario.usu_id = tab_expusuario.usu_id\r\n                INNER JOIN tab_expediente ON tab_expusuario.exp_id = tab_expediente.exp_id\r\n                INNER JOIN tab_expfondo ON tab_expediente.exp_id = tab_expfondo.exp_id\r\n                INNER JOIN tab_series ON tab_expediente.ser_id = tab_series.ser_id                \r\n                INNER JOIN tab_expisadg ON tab_expediente.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 tab_fondo.fon_estado = 1\r\n                AND tab_unidad.uni_estado = 1\r\n                AND tab_series.ser_estado = 1\r\n                AND tab_tipocorr.tco_estado = 1\r\n                AND tab_expediente.exp_estado = 1\r\n                AND tab_expisadg.exp_estado = 1\r\n                AND tab_expfondo.exf_estado = 1\r\n                AND tab_expusuario.eus_estado = 1\r\n                AND tab_unidad.uni_id = '{$uni_id}'\r\n                {$where}\r\n                ORDER BY \r\n                tab_fondo.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 ";
         // INNER JOIN tab_usu_serie ON tab_series.ser_id = tab_usu_serie.ser_id
         $tab_usuario = new Tab_usuario();
         $rows_expedientes = $tab_usuario->dbSelectBySQL($sql_marbete);
         $kl = 0;
         $tarchivo = new tab_archivo();
         foreach ($rows_expedientes as $rows) {
             $x = new Tab_archivo();
             $sqlcantidad = "SELECT\r\n                            COUNT(tab_archivo.fil_id) as cantidad\r\n                            FROM\r\n                            tab_exparchivo\r\n                            INNER JOIN tab_archivo ON tab_exparchivo.fil_id = tab_archivo.fil_id\r\n                            WHERE\r\n                            tab_exparchivo.exp_id = '" . $rows->exp_id . "'\r\n                            AND tab_exparchivo.exa_estado = 1 ";
             $cantidad_documentos = $x->dbSelectBySQL($sqlcantidad);
             $ct = $cantidad_documentos[0]->cantidad;
             if ($ct == 0) {
                 // Series
                 $sqlsoloexpedientes = "SELECT\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                            tab_expediente.exp_nroejem,\r\n                            tab_expediente.exp_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                            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_id={$rows->exp_id}\r\n                            ORDER BY \r\n                            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 ";
                 $tab_fondo = new Tab_fondo();
                 $rows_marb = $tab_fondo->dbSelectBySQL($sqlsoloexpedientes);
                 $result = $tab_fondo->dbSelectBySQL($sqlsoloexpedientes);
                 foreach ($rows_marb as $list) {
                     $m = $list->exp_nroejem;
                     for ($n = 1; $n <= $m; $n++) {
                         $v2[$kl] = $list->codigo;
                         $doxexp[$kl] = 'E' . $list->exp_id;
                         $de[$kl] = 'e';
                         $kl++;
                     }
                 }
             } else {
                 // Documentos
                 $sqldocumentos = "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) ||'.'|| f.fon_codigo ||'.'||tab_unidad.uni_cod ||'.'|| tab_tipocorr.tco_codigo ||'.'||tab_series.ser_codigo||'.'||\r\n                            tab_expediente.exp_codigo as codigoexp,                            \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||'.'||tab_archivo.fil_nro as codigo,\r\n                            tab_archivo.fil_nroejem,\r\n                            tab_archivo.fil_id,\r\n                            (NULLIF(tab_archivo.fil_codigo,'')::int) as correlativo\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_archivo.fil_estado = 1 AND\r\n                            tab_exparchivo.exa_estado = 1 AND\r\n                            tab_expusuario.eus_estado = 1 AND\r\n                            tab_expediente.exp_id ='{$rows->exp_id}' \r\n                            ORDER BY \r\n                            f.fon_cod,\r\n                            tab_unidad.uni_cod,\r\n                            tab_series.ser_orden, \r\n                            tab_series.ser_codigo, \r\n                            tab_expediente.exp_codigo::int, \r\n                            tab_archivo.fil_nro::int ";
                 $result_documentos = $tarchivo->dbSelectBySQL($sqldocumentos);
                 $result = $tarchivo->dbSelectBySQL($sqldocumentos);
                 $exp_id = 0;
                 foreach ($result_documentos as $list2) {
                     if ($exp_id != $list2->exp_id) {
                         // Exp
                         $v2[$kl] = $list2->codigoexp;
                         $doxexp[$kl] = 'E' . $list2->exp_id;
                         $de[$kl] = 'e';
                         $kl++;
                         // Doc
                         $m = $list2->fil_nroejem;
                         for ($n = 1; $n <= $m; $n++) {
                             $v2[$kl] = $list2->codigo;
                             $doxexp[$kl] = $list2->fil_id;
                             $de[$kl] = 'd';
                             $kl++;
                         }
                         $exp_id = $list2->exp_id;
                     } else {
                         $m = $list2->fil_nroejem;
                         for ($n = 1; $n <= $m; $n++) {
                             $v2[$kl] = $list2->codigo;
                             $doxexp[$kl] = $list2->fil_id;
                             $de[$kl] = 'd';
                             $kl++;
                         }
                         $exp_id = $list2->exp_id;
                     }
                 }
             }
         }
         // end row expedientes
         //            if ($kl < 1) {
         //                echo "Esta Serie no tiene Marbetes";
         //                exit();
         //            }
     }
     //        else {
     //            $sqlnoexpedientes = "SELECT
     //                        (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||'.'||
     //                        tab_expediente.exp_codigo AS codigo,
     //                        tab_expediente.exp_nroejem,
     //                        tab_expediente.exp_id
     //                        FROM
     //                        tab_fondo AS f
     //                        INNER JOIN tab_unidad ON f.fon_id = tab_unidad.fon_id
     //                        INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id
     //                        INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id
     //                        INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id
     //                        WHERE
     //                        f.fon_estado = 1 AND
     //                        tab_unidad.uni_estado = 1 AND
     //                        tab_tipocorr.tco_estado = 1 AND
     //                        tab_series.ser_estado = 1 AND
     //                        tab_expediente.exp_id=$exp_id";
     //            $tab_fondo = new Tab_fondo();
     //            $rows_marb = $tab_fondo->dbSelectBySQL($sqlnoexpedientes);
     //            $result = $tab_fondo->dbSelectBySQL($sqlnoexpedientes);
     //        }
     $t = 1;
     $numero = 0;
     $j = 1;
     // **********************
     // Todos los documentos
     // **********************
     $cantidad_ejem = 0;
     $cantidad_ejem2 = $kl;
     $n = $kl;
     if ($cantidad_ejem == 1) {
         $j = 1;
         $tip = 1;
         $cantidad_ejem2 = 1;
     } else {
         $j = 1;
         $tip = 2;
     }
     $l = 0;
     $codigoizquierda = "";
     while ($j <= $n) {
         //                $codigo = $v[$l];
         //                $fil_ids = $vdoc[$l];
         //
         $codigo = $v2[$l];
         $fil_ids = $doxexp[$l];
         $tipode = $de[$l];
         $l++;
         $pdf->SetFillColor(255, 255, 255);
         $pdf->SetTextColor(58, 35, 9);
         $tipo = "";
         $izq = 0;
         $lugar = 0;
         if ($j % 2 == 1) {
             $izq = 104;
             $lugar = 0;
         } else {
             $izq = 100;
             //
             $lugar = 1;
         }
         if ($fil_ids) {
             // Grid Code Document
             if ($j == $cantidad_ejem2) {
                 if ($j % 2 == 1) {
                     //                    if ($tipode=='e'){
                     //                        $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     //                    }else{
                     //                        $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     //                    }
                     //
                     for ($k = 1; $k <= 2; $k++) {
                         if ($k == 1) {
                             if ($tipode == 'e') {
                                 // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
                                 // write the first column
                                 $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                             } else {
                                 // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
                                 $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                             }
                         } else {
                             $pdf->MultiCell(100, 0, '', 0, 'J', 1, 1, '', '', true, 0, false, true, 0);
                         }
                     }
                 } else {
                     if ($tipode == 'e') {
                         $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     } else {
                         $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                     }
                 }
             } else {
                 if ($tipode == 'e') {
                     $pdf->MultiCell($izq, 0, $codigo, 1, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                 } else {
                     $pdf->MultiCell($izq, 0, $codigo, 0, 'J', 1, $lugar, '', '', true, 0, false, true, 0);
                 }
             }
         }
         // Bar Code
         if ($j % 2 == 0) {
             for ($i = 1; $i <= $tip; $i++) {
                 if ($i % 2 == 1) {
                     $tipo = "";
                     $style = $style1;
                     $pdf->write1DBarcode(str_pad($codigoizquierda, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                 } else {
                     $tipo = "N";
                     $style = $style2;
                     $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style, $tipo);
                 }
             }
             //*************************
             // New line for new bar code
             //*************************
             $pdf->Ln(12);
             //                        // Count lines
             //                        if (j!=14){
             //                            $pdf->Ln(11);
             //                        }else{
             //                            $pdf->Ln(20);
             //                        }
         } else {
             if ($j == $cantidad_ejem2) {
                 $pdf->write1DBarcode(str_pad($fil_ids, 7, "0", STR_PAD_LEFT), 'C39', '', '', '', 18, 0.61, $style1, "");
             }
         }
         $j++;
         if ($j > 14) {
             //$pdf->SetMargins(PDF_MARGIN_LEFT, 14, PDF_MARGIN_RIGHT);
             //$pdf->SetMargins(5, 14, 5);
             $pdf->SetMargins(6, 14, 6);
         }
         $t++;
         $codigoizquierda = $fil_ids;
     }
     //end foreach
     $pdf->Output('listado_marbetes.pdf', 'I');
 }