function obtenerMaximo($field) { $maximo = new tab_exptransferencia(); $max = $maximo->dbSelectBySQL("SELECT* from tab_exptransferencia\r\n where {$field} = (select max({$field}) from tab_exptransferencia)"); $u = 0; foreach ($max as $uuu) { $u++; } if ($u > 0) { $mx = $max[0]; $id = $mx->etr_orden; } else { $id = 1; } return $id; }
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ó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ó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é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ítulo del Expediente</strong></td>'; $cadena .= '<td width="80" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Có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> </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ón<br>' . $usuarioDestino . '</h4></td>'; $cadena2 .= '<td width="100"></td></tr>'; $cadena2 .= '<tr>'; $cadena2 .= '<td width="100" height="65" ></td><td width="160" align="center" >'; $cadena2 .= '<h4 style="border-top:1px solid black">Autoridad<br>Unidad Remitente</h4>'; $cadena2 .= '</td><td width="100"></td>'; $cadena2 .= '<td width="100" ></td><td width="150" align="center">'; $cadena2 .= '<h4 style="border-top:1px solid black">SGE / DOC<br></h4></td>'; $cadena2 .= '<td width="100"></td></tr>'; $cadena2 .= '</table>'; $cadena = $cadena . $cadena2; $pdf->writeHTML($cadena, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document // $pdf->Output('reporte_transferencia.pdf', 'D'); $pdf->Output('reporte_transferencia.pdf', 'I'); Header("Location: " . PATH_DOMAIN . "/soltransferencia/"); }
function viewPaquetesBACK() { $ini = $_REQUEST['nro_inicial']; $fin = $_REQUEST['nro_final']; if ($fin == NULL) { $fin = $ini; } $fondo2 = new Tab_fondo(); $texp = new Tab_etiquetas(); $usuario = new usuario(); $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n tab_fondo.fon_descripcion,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n u.uni_descripcion,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n tab_expisadg.exp_anioi,\r\n tab_expisadg.exp_aniof,\r\n tab_expisadg.exp_fecha_exi,\r\n (tab_expisadg.exp_fecha_exi +\r\n (SELECT tab_retensiondoc.red_prearc * INTERVAL '1 year'\r\n FROM tab_retensiondoc\r\n WHERE tab_retensiondoc.red_id = tab_series.red_id)) ::DATE AS exp_fecha_exf,\r\n tab_expediente.exp_nroejem,\r\n tab_expediente.exp_tomovol,\r\n tab_expediente.exp_nrocaj,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre,\r\n tab_expediente.exp_sala,\r\n tab_expediente.exp_estante,\r\n tab_expediente.exp_cuerpo,\r\n tab_expediente.exp_balda,\r\n tab_expediente.exp_obs\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad as u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_expisadg.exp_estado = 1 AND\r\n tab_expediente.exp_id = '" . $_REQUEST['exp_id'] . "' "; $rows = $texp->dbSelectBySQL($sql); $expediente = new Tab_expediente(); $ser_id = $expediente->dbselectByField("exp_id", $_REQUEST['exp_id']); $ser_id = $ser_id[0]; $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad ON tab_fondo.fon_id = tab_unidad.fon_id\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n WHERE tab_fondo.fon_estado = 1\r\n AND tab_unidad.uni_estado = 1\r\n AND tab_tipocorr.tco_estado = 1\r\n AND tab_series.ser_estado = 1\r\n AND tab_series.ser_id ='" . $ser_id->ser_id . "'"; $tabfondo = new Tab_fondo(); $cuerpo = $tabfondo->dbSelectBySQL($sql); foreach ($cuerpo as $idlistado) { $tco_codigo = $idlistado->tco_codigo; } // Include the main TCPDF library (search for installation path). //require_once('tcpdf/tcpdf_include.php'); require_once 'tcpdf/tcpdf.php'; // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Castellon S.R.L.'); $pdf->SetTitle('Etiquetado de Cajas'); $pdf->SetSubject('Etiquetado de Cajas'); $pdf->SetKeywords('Etiquetado, Cajas, cajas, caratulas, folders'); // set default header data // $pdf->SetHeaderData('logo2.png', 25, 'ADMINISTRADORA BOLIVIANA DE CARRETERA', 'IMPRESIÓN DE CAJAS'); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 048', PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, 5, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) { require_once dirname(__FILE__) . '/lang/eng.php'; $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', 'B', 8); // add a page $pdf->AddPage(); $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('helvetica', '', 8); $st = ""; // ----------------------------------------------------------------------------- $id_exp = $_REQUEST['exp_id']; $cantMin = ""; $cantMax = ""; for ($i = $ini; $i <= $fin; $i++) { $expediente = new expediente(); foreach ($rows as $value) { if ($tco_codigo == "I") { $obteneCaja = $expediente->obtenerCajaCorrespondecia($_REQUEST['exp_id']); $cantMin = strlen($obteneCaja->minimo); $cantMax = strlen($obteneCaja->maximo); } else { $obteneCaja = $expediente->obtenerCaja($i, $_REQUEST['exp_id']); $cantMin = strlen($obteneCaja->minimo); $cantMax = strlen($obteneCaja->maximo); } $expe = new Tab_expediente(); $sqlcaja = "SELECT\r\n tab_archivo.fil_sala,\r\n tab_archivo.fil_estante,\r\n tab_archivo.fil_balda,\r\n tab_archivo.fil_cuerpo\r\n FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = '" . $_REQUEST['exp_id'] . "' AND\r\n tab_expediente.exp_estado=1 AND\r\n tab_archivo.fil_nropaq='{$i}'"; $cajaresult = $expe->dbSelectBySQL($sqlcaja); foreach ($cajaresult as $rowscaja) { $sala = $rowscaja->fil_sala; $estante = $rowscaja->fil_estante; $balda = $rowscaja->fil_balda; $cuerpo = $rowscaja->fil_cuerpo; } $exptransferencia = new tab_exptransferencia(); $sql = "SELECT\r\n tab_soltransferencia.str_fecha,\r\n tab_soltransferencia.str_id\r\n FROM\r\n tab_exptransferencia\r\n INNER JOIN tab_soltransferencia ON tab_soltransferencia.str_id = tab_exptransferencia.str_id\r\n WHERE\r\n tab_exptransferencia.exp_id ={$id_exp}"; $datos = $exptransferencia->dbSelectBySQL($sql); $strfecha = ""; $strid = ""; foreach ($datos as $listr) { $strfecha = $listr->str_fecha; $strid = $listr->str_id; } $st .= '<br><br>'; $st .= '<table border="1" style="width: 100%">'; $st .= '<tr>'; $st .= '<td style="border-right:2px solid white;">'; $st .= '<img src="' . PATH_ROOT . '/web/img/escudo.png" width="50" height="50" border="0" />'; $st .= '</td><td align="right"><img src="' . PATH_ROOT . '/web/img/iso.png" width="50" height="50" border="0" />'; $st .= '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2">'; $st .= '<table border="1" style="width: 100%; text-align: center">'; $st .= '<tr>'; //$st.='<td colspan="11">'.$value->fon_cod . "-" . $value->uni_cod. '</td>'; $st .= '<th colspan="11" height="20" style="font-size:70px"><b>' . $value->fon_cod . DELIMITER . $value->uni_cod . DELIMITER . $value->tco_codigo . DELIMITER . $value->ser_codigo . DELIMITER . $value->exp_codigo . '</b></th>'; $st .= '</tr>'; if ($value->uni_par_cod) { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . $value->uni_par_cod . '</b></td>'; $st .= '</tr>'; } else { $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:30px"><b>' . $value->uni_descripcion . '</b></td>'; $st .= '</tr>'; } $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:35px"><b>' . $value->ser_categoria . '</b></td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="11" height="20" style="font-size:48px"><b>' . $value->exp_titulo . '</b></td>'; $st .= '</tr>'; $pdf->SetFont('helvetica', '', 8); $st .= '<tr>'; $st .= '<td colspan="2" height="20" bgcolor="#CCCCCC" style="font-size:40px" width="232">FECHAS EXTREMAS:</td>'; $st .= '<td colspan="9" bgcolor="#CCCCCC" width="420" style="font-size:40px">CODIGOS:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="2" height="20" style="font-size:45px"><b>' . $value->exp_anioi . "-" . $value->exp_aniof . '</b></td>'; $st .= '<th colspan="9" rowspan="3" style="text-align:left;font-size:45px;padding:15px">'; $sqlcodigos = "SELECT\r\n tab_fondo.fon_cod,\r\n u.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n (SELECT uni_descripcion from tab_unidad WHERE tab_unidad.uni_id=u.uni_par) AS uni_par_cod,\r\n u.uni_codigo,\r\n (SELECT sof_nombre FROM tab_sopfisico WHERE sof_id=tab_expediente.sof_id AND tab_sopfisico.sof_estado = '1' ) AS sof_nombre\r\n FROM\r\n tab_fondo\r\n INNER JOIN tab_unidad AS u ON tab_fondo.fon_id = u.fon_id\r\n INNER JOIN tab_series ON u.uni_id = tab_series.uni_id\r\n INNER JOIN tab_tipocorr ON tab_tipocorr.tco_id = tab_series.tco_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n WHERE\r\n tab_fondo.fon_estado = 1 AND\r\n u.uni_estado = 1 AND\r\n tab_tipocorr.tco_estado = 1 AND\r\n tab_series.ser_estado = 1 AND\r\n tab_expediente.exp_estado = 1 AND\r\n tab_expediente.exp_id ='" . $_REQUEST['exp_id'] . "'"; $idexp = $_REQUEST['exp_id']; $sqlarchivo = "SELECT fil_nro,fil_fot FROM\r\n tab_expediente\r\n INNER JOIN tab_exparchivo ON tab_exparchivo.exp_id = tab_expediente.exp_id\r\n INNER JOIN tab_archivo ON tab_archivo.fil_id = tab_exparchivo.fil_id\r\n WHERE\r\n tab_expediente.exp_id = {$idexp} AND\r\n tab_archivo.fil_nropaq = '{$i}' AND\r\n tab_expediente.exp_estado = 1 ORDER BY fil_nro"; $cod_fil_nro = $expe->dbSelectBySQL($sqlarchivo); $codigoDocument = $fondo2->dbSelectBySQL($sqlcodigos); $codigoDocument = $codigoDocument[0]; $cant1 = 0; $codigo_paquetes = $codigoDocument->fon_cod . DELIMITER . $codigoDocument->uni_cod . DELIMITER . $codigoDocument->tco_codigo . DELIMITER . $codigoDocument->ser_codigo . DELIMITER . $codigoDocument->exp_codigo; foreach ($cod_fil_nro as $filnro) { $st .= $codigo_paquetes . DELIMITER . $filnro->fil_nro; $st .= " (" . $filnro->fil_fot . ")"; $cant1 = $cant1 + $filnro->fil_fot; $st .= "<br>"; } $st .= '</th>'; $st .= '</tr>'; $cant = $cant1; $st .= '<tr>'; $st .= '<td colspan="4" height="20" bgcolor="#CCCCCC" width="232">NRO. DE PAQUETE</td>'; // $st.='<td colspan="7" bgcolor="#CCCCCC" >ML</td>'; $st .= '</tr>'; //width="420" $st .= '<tr>'; $st .= '<td height="20" colspan="4" rowspan="3" style="font-size:190px">' . $i . '</td>'; // $st.='<td colspan="7" height="20" style="font-size:70px" >0,32</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">NRO. DE PIEZAS</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">Nº DE TRANSFERENCIA</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="5" height="20" style="font-size:60px"><b>' . $cant . '</b></td>'; if ($strid == "") { $st .= '<td colspan="2"></td>'; } else { $st .= '<td colspan="2">' . $strid . '</td>'; } $st .= '</tr>'; $st .= '<tr>'; $st .= '<td colspan="4" bgcolor="#CCCCCC" height="20" width="232">UBICACIÓN TOPOGRAFICA:</td>'; $st .= '<td colspan="5" bgcolor="#CCCCCC" height="20" width="218">FECHA DE TRANSFERENCIA DOCUMENTAL</td>'; $st .= '<td colspan="2" bgcolor="#CCCCCC" width="201">ELABORADO POR:</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" bgcolor="#CCCCCC">SALA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">ESTANTE</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">BALDA</td>'; $st .= '<td height="20" bgcolor="#CCCCCC">CUERPO</td>'; $st .= '<td colspan="5" rowspan="2">'; if ($strfecha != "") { $fechastr = explode("-", $strfecha); $fett = $fechastr[2] . '-' . $fechastr[1] . '-' . $fechastr[0]; $st .= $fett; } $st .= '</td>'; $st .= '<td colspan="2" rowspan="2">' . $usuario->obtenerNombre($_SESSION['USU_ID']) . '</td>'; $st .= '</tr>'; $st .= '<tr>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $st .= '<td height="20" style="font-size:35px"></td>'; $sala = ""; $estante = ""; $balda = ""; $cuerpo = ""; $st .= '</tr>'; /* $st.='<tr>'; $st.='<td height="20">' . $value->exp_sala . '</td>'; $st.='<td>' . $value->exp_estante . '</td>'; $st.='<td>' . $value->exp_cuerpo . '</td>'; $st.='<td>' . $value->exp_balda . '</td>'; $st.='<td colspan="5"></td>'; $st.='<td colspan="2"></td>'; $st.='</tr>'; */ $st .= '</table>'; $st .= '</td>'; $st .= '</tr>'; $st .= '</table>'; $st .= ''; //EOD; } $pdf->writeHTML($st, true, false, false, false, ''); $st = ""; } // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('reporte_paquetes.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ }
function 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ó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ón:</b> '; $cadena .= $ca1; $cadena .= '</td>'; $cadena .= '<td colspan="5" >'; $cadena .= '<br /><b>Telé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ítulo del Expediente</strong></td>'; $cadena .= '<td width="90" rowspan="2" style="text-align:center" bgcolor="#CCCCCC"><strong>Có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> </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ó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; }
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ó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ó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ón y Telé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ó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'); }
function loadExp() { $id_trans = VAR3; $usuario = $_SESSION['USU_ID']; $this->series = new series(); $this->expediente = new tab_expediente(); $this->expediente->setRequest2Object($_REQUEST); $this->usuario = new usuario(); $page = $_REQUEST['page']; $rp = $_REQUEST['rp']; $sortname = $_REQUEST['sortname']; $sortorder = $_REQUEST['sortorder']; if (!$sortname) { $sortname = ' tab_fondo.fon_cod, tab_unidad.uni_cod, tab_series.ser_orden, tab_series.ser_codigo, tab_expediente.exp_codigo::int '; } 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 = utf8_encode($_REQUEST['query']); $qtype = $_REQUEST['qtype']; $where = ""; if ($query != "") { if ($qtype == 'exp_id') { $where .= " and tab_expediente.exp_id LIKE '{$query}' "; } elseif ($qtype == 'ser_categoria') { if ($query == 'TODOS') { $where .= ""; } else { $where .= " and tab_series.ser_categoria LIKE '%{$query}%' "; } } elseif ($qtype == 'custodio') { $nomArray = explode(" ", $query); foreach ($nomArray as $nom) { $where .= " and (tab_usuario.usu_nombres LIKE '%{$nom}%' OR tab_usuario.usu_apellidos LIKE '%{$nom}%') "; } } else { if ($query == 'TODOS') { $where .= ""; } else { $where .= " and {$qtype} LIKE '%{$query}%' "; } } } $tab_expusuario = new tab_expusuario(); $tab_extransferencia = new tab_exptransferencia(); $result = $tab_extransferencia->dbSelectBySQL("select* from tab_exptransferencia where str_id={$id_trans}"); $cantidad = count($result); $valor3 = ""; $t = 1; foreach ($result as $row) { $nuevo = $tab_expusuario->dbSelectBySQL("select* from tab_expusuario where exp_id=" . $row->exp_id . " and usu_id={$usuario} and eus_estado=2"); foreach ($nuevo as $list) { $valor3 .= "tab_expusuario.eus_id=" . $list->eus_id . ""; if ($t < $cantidad) { $valor3 .= " or "; } $t++; } } $where .= " AND {$valor3} "; if ($_SESSION["ROL_COD"] != 'AA') { $where .= " AND tab_expusuario.usu_id ='" . $_SESSION['USU_ID'] . "' "; } $sql = "SELECT\r\n tab_fondo.fon_cod,\r\n tab_unidad.uni_cod,\r\n tab_tipocorr.tco_codigo,\r\n tab_series.ser_codigo,\r\n tab_expediente.exp_codigo,\r\n tab_unidad.uni_id,\r\n tab_series.ser_id,\r\n tab_expediente.exp_id,\r\n tab_series.ser_categoria,\r\n tab_expisadg.exp_titulo,\r\n tab_expisadg.exp_fecha_exi,\r\n (tab_expisadg.exp_fecha_exi + \r\n (SELECT tab_retensiondoc.red_prearc * INTERVAL '1 year' \r\n FROM tab_retensiondoc \r\n WHERE tab_retensiondoc.red_id = tab_series.red_id)) ::DATE AS exp_fecha_exf,\r\n tab_usuario.usu_nombres,\r\n tab_usuario.usu_apellidos,\r\n tab_expfondo.exf_estado\r\n FROM\r\n tab_unidad\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expfondo ON tab_expediente.exp_id = tab_expfondo.exp_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_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 INNER JOIN tab_usuario ON tab_usuario.usu_id = tab_expusuario.usu_id\r\n WHERE \r\n tab_series.ser_estado = 1\r\n AND tab_expediente.exp_estado = 1\r\n AND tab_usuario.usu_estado = 1\r\n AND tab_expfondo.exf_estado = 1 \r\n AND tab_expusuario.eus_estado = 2\r\n {$where} \r\n {$sort} \r\n {$limit}"; // tab_expusuario.usu_id = " . $_SESSION['USU_ID'] . " $expediente = new expediente(); $result = $this->expediente->dbselectBySQL($sql); $total = $this->expediente->countBySQL("SELECT COUNT(tab_fondo.fon_cod)\r\n FROM\r\n tab_unidad\r\n INNER JOIN tab_series ON tab_unidad.uni_id = tab_series.uni_id\r\n INNER JOIN tab_expediente ON tab_series.ser_id = tab_expediente.ser_id\r\n INNER JOIN tab_expfondo ON tab_expediente.exp_id = tab_expfondo.exp_id\r\n INNER JOIN tab_expusuario ON tab_expediente.exp_id = tab_expusuario.exp_id\r\n INNER JOIN tab_expisadg ON tab_expediente.exp_id = tab_expisadg.exp_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 INNER JOIN tab_usuario ON tab_usuario.usu_id = tab_expusuario.usu_id\r\n WHERE \r\n tab_series.ser_estado = 1\r\n AND tab_expediente.exp_estado = 1\r\n AND tab_usuario.usu_estado = 1\r\n AND tab_expfondo.exf_estado = 1 \r\n AND tab_expusuario.eus_estado = 2\r\n {$where}"); 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; $si = 0; foreach ($result as $un) { $chk = "<input id=\"chk_" . $un->exp_id . "\" restric=\"" . $un->exp_id . "\" class=\"fil_chk" . $j . "\" checked=\"checked\" type=\"checkbox\" value=\"" . $un->exp_id . "\" />"; if ($rc) { $json .= ","; } $json .= "\n{"; $json .= "id:'" . $un->exp_id . "',"; $json .= "cell:['" . $un->exp_id . "'"; $json .= ",'" . $chk . "'"; $json .= ",'" . addslashes($un->fon_cod . DELIMITER . $un->uni_cod . DELIMITER . $un->tco_codigo . DELIMITER . $un->ser_codigo . DELIMITER . $un->exp_codigo) . "'"; $json .= ",'" . addslashes($un->ser_categoria) . "'"; $json .= ",'" . addslashes($un->exp_titulo) . "'"; $json .= ",'" . addslashes($un->exp_fecha_exi) . "'"; $json .= ",'" . addslashes($un->exp_fecha_exf) . "'"; $json .= ",'" . addslashes($expediente->obtenerCustodios($un->exp_id)) . "'"; $json .= "]}"; $rc = true; $i++; $j++; } $json .= "]\n"; $json .= "}"; echo $json; }