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