function showPdf($idReg = "") { global $db; // Oficina $sesIdOficina = $_SESSION[sesIdOficina]; $oficina = getValueTable("oficina", "OFICINA", "id_oficina", $sesIdOficina); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', false, 'ISO-8859-1', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 009'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', 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, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // $pdf->SetFooterMargin(3); $pdf->setPageOrientation('P', '', 1); //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 //$pdf->setLanguageArray($l); // set some language dependent data: $lg = array(); $lg['a_meta_charset'] = 'ISO-8859-1'; $lg['a_meta_dir'] = 'ltr'; $lg['a_meta_language'] = 'en'; $lg['w_page'] = 'page'; //set some language-dependent strings $pdf->setLanguageArray($lg); // ------------------------------- // CONSULTA DE DATOS // ------------------------------- $sql = "select * from INVENTARIO where id_inventario='{$idReg}'"; $db->query($sql); while ($db->next_record()) { $entSal = $db->f('ent_sal'); $eir = $db->f(eir); //$idCliente = $db->f('id_cliente'); //$cliente = getValueTable("cliente","CLIENTE","id_cliente",$idCliente); $cliente = $db->f('consig'); $idConte = $db->f('id_contenedor'); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); if (preg_match("/(\\w{4})(\\d{7})/", $conte, $parts)) { $conteL = $parts[1]; $conteN = $parts[2]; } $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq); $bkg = $db->f('bkg'); $clase = $db->f('clase'); $clase = "CLASE: {$clase} "; $damage = $db->f('damage'); $sello = $db->f('sello'); $nota = $db->f('nota'); //$idTrans = $db->f('id_transporte'); //$transp = getValueTable("transporte","TRANSPORTE","id_transporte",$idTrans); $transp = $db->f('transportista'); $conteP1 = substr($conte, 0, 4); $conteP2 = substr($conte, 4, 10); if (preg_match("/(\\d+)(\\d)\$/", $conteP2, $parts)) { $conteP2 = $parts[1] . "-" . $parts[2]; } $idNav = $db->f('id_naviera'); $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav); $placas = $db->f('placas'); // $idOperador = $db->f('id_operador'); //$operador = getValueTable("operador","OPERADOR","id_operador",$idOperador); $operador = $db->f('operador'); $capFec = $db->f('cap_fec'); if ($entSal == "E") { $entSalTx = "INVENTARIO"; } if ($entSal == "S") { $entSalTx = "SALIDA"; } $tipoMani = $db->f('tipo_mani'); $noRecibo = $db->f('recibo'); if ($tipoMani == "D") { $tipoManiTx = "MANIOBRA DE DESCARGA"; } if ($tipoMani == "C") { $tipoManiTx = "MANIOBRA DE CARGA"; } $maniCosto = $db->f('mani_costo'); $montoLetra = traducirCifra($maniCosto); $capIdUsr = $db->f('cap_id_usr'); $capFec = $db->f('cap_fec'); $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr); } // ------------------------------ // DAÑOS // ------------------------------ $sql = "select * from REL_NOME "; $sql .= "where id_inventario='{$idReg}' "; $dano = ""; $db->query($sql); while ($db->next_record()) { $idRelNome = $db->f(id_rel_nome); $idNome = $db->f(id_nome); $idUbica = $db->f(id_ubicacion); $idDime = $db->f(id_dimension); $nome = getValueTable("nombre", "NOMENCLATURA", "id_nome", $idNome); $nomeCode = getValueTable("codigo", "NOMENCLATURA", "id_nome", $idNome); $ubica = getValueTable("ubicacion", "UBICACION", "id_ubicacion", $idUbica); $dimen = getValueTable("dimension", "DIMENSION", "id_dimension", $idDime); $dano .= "{$nome} ({$nomeCode}) : {$ubica} : {$dimen}\n"; } $dano = nl2br($dano); // --------------------------------------------------------- // DATOS DEL RECIBO // --------------------------------------------------------- if ($noRecibo > 0) { $datoRecibo = "\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>FECHA</b></td>\n <td><b>No.R.I.E.</b></td> \n <td></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$capFec}</td> \n <td>{$idReg}</td>\n <td></td>\n <td>{$conteL}{$conteN}</td>\n <td>{$equipo}</td>\n </tr> \n <tr>\n <td><b>CONCEPTO</b></td> \n <td><b>TRANSPORTISTA</b></td> \n <td><b>OPERADOR</b></td>\n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td>{$tipoManiTx}</td> \n <td>{$transp}</td>\n <td>{$operador}</td> \n <td colspan=\"2\">{$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>MANIOBRA \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>SUBTOTAL \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>IVA \$</b></td>\n <td align=\"left\">{$maniIva}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td colspan=\"3\" align=\"left\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n </tr>\n </table> \n "; } // ------------------------------------------------------------------- $pdf->AddPage(); // Logo $pdf->setJPEGQuality(100); $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false); //$pdf->Image('../images/nome.jpg', 15, 140, 185, 96,'','','',false); // set cell padding //$pdf->setCellPaddings(1, 1, 1, 1); // set cell margins //$pdf->setCellMargins(1, 1, 1, 1); // Encabezado $pdf->SetFillColor(197, 197, 197); if ($sesIdOficina == 1) { $txt = "ALMARTCON, S.A. DE C.V.\n\"El Trébol\""; $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true); $txt = "Direccion, Guatemala \nTels.: 505-2350-0976 Cel. 505-8635-0708"; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true); } /* elseif( $sesIdOficina==3 ){ $txt = "TRANSPORTES MALEJA, S.A. DE C.V.\n\"El Pino\""; $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true); $txt="Carretera Querétaro San Luis Potosí Km.28\nCol.Buenavista Santa Rosa Jauregui\nQueretaro, QRO."; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true); } */ $pdf->SetFont('helvetica', '', 12); $tbl = <<<EOD <table cellspacing="0" cellpadding="3" border="1" align="center"> <tr bgcolor="#cacaca"> <th>FOLIO</th> </tr> <tr> \t \t<td><font color="red">{$entSal} {$eir}</font></td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); $txt = "RECIBO DE INTERCAMBIO DE EQUIPO (R.I.E)"; $pdf->SetFont('helvetica', 'B', 12); $pdf->MultiCell(100, 4, $txt, 0, 'C', 0, 0, 60, 37, true); $pdf->SetFont('helvetica', '', 8); $tbl = <<<EOD <br><br><br> <table cellspacing="0" cellpadding="3" border="1" align="center"> <tr> <th><b>CLIENTE</b></th> <th><b>MARCA</b></th> <th><b>NUMERO</b></th> <th><b>CARACTERISTICAS FISICAS</b></th> </tr> <tr> \t \t<td>{$cliente}</td> \t<td>{$conteL}</td> \t<td>{$conteN}</td> \t<td>{$equipo} / {$damage} </td> \t </tr> <tr bgcolor="#cacaca"> \t<th colspan="4"><b>{$entSalTx}</b></th> </tr> <tr> \t<td><b>ENTREGADO POR :</b></td> \t<td><b>FECHA Y HORA</b></td> <td><b>BOOKING</b></td> \t<td><b>ESTADO FISICO</b></td> \t </tr> <tr> \t<td>{$naviera}</td> \t<td>{$capFec}</td> <td>{$bkg}</td> \t<td>{$clase}</td> \t </tr> <tr> \t<td><b>TRANSPORTISTA</b></td> <td><b>OPERADOR</b></td> <td><b>PLACAS</b></td> \t<td><b>SELLO</b></td> \t \t </tr>\t <tr> \t<td>{$transp}</td> <td>{$operador}</td> <td>{$placas}</td> <td>{$sello}</td> </tr> <tr> \t<td colspan="2"><b>OBSERVACIONES</b></td> \t <td colspan="2"><b>DANOS</b></td> </tr> <tr> <td colspan="2">{$nota}</td> \t<td colspan="2">{$dano}</td> </tr> <tr> <td colspan="4"><i>Capturo: {$capUsr}<br>Fecha captura: {$capFec} </i></td> </tr> </table> <br><br><br> {$datoRecibo} EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); $noRecibo > 0 ? $corY = 180 : ($corY = 105); $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 15, $corY, true); $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(30, 10, $txt, 1, 'C', 0, 0, 55, $corY, true); $txt = "AUTO. DE REPARACION\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 85, $corY, true); $txt = "POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40, 10, $txt, 1, 'C', 0, 0, 125, $corY, true); $txt = "POR DEPOSITO\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(35, 10, $txt, 1, 'C', 0, 0, 165, $corY, true); //Close and output PDF document $pdf->Output('example_eir.pdf', 'I'); }
function showPdf($idReg = "") { global $db; // Oficina $sesIdOficina = $_SESSION[sesIdOficina]; $oficina = getValueTable("oficina", "OFICINA", "id_oficina", $sesIdOficina); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', false, 'ISO-8859-1', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 009'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', 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, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // $pdf->SetFooterMargin(3); $pdf->setPageOrientation('P', '', 1); //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 //$pdf->setLanguageArray($l); // set some language dependent data: $lg = array(); $lg['a_meta_charset'] = 'ISO-8859-1'; $lg['a_meta_dir'] = 'ltr'; $lg['a_meta_language'] = 'en'; $lg['w_page'] = 'page'; //set some language-dependent strings $pdf->setLanguageArray($lg); // ------------------------------- // CONSULTA DE DATOS // ------------------------------- $sql = "select * from PENSION where id_pension='{$idReg}'"; $db->query($sql); while ($db->next_record()) { $noRecibo = $db->f(id_pension); $entFec = $db->f(ent_fec); $salFec = $db->f(sal_fec); $idConte = $db->f(id_contenedor); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq); $concepto = $db->f(concepto); $operador = $db->f(operador); $placas = $db->f(placas); $monto = $db->f(monto); $montoLetra = traducirCifra($monto); $idOficina = $db->f(id_oficina); $transporte = $db->f(transporte); $metPago = $db->f(met_pago); } // --------------------------------------------------------- // DATOS DEL RECIBO // --------------------------------------------------------- $datoRecibo = "\n\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES TMA</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>ENTRADA</b></td>\n <td><b>SALIDA</b></td> \n <td><b>TRANSPORTE</b></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$entFec}</td> \n <td>{$salFec}</td>\n <td>{$transporte}</td>\n <td>{$conte}</td>\n <td>{$equipo}</td>\n </tr> \n <tr> \n <td colspan=\"2\"><b>OPERADOR</b></td> \n <td><b>PLACAS</b></td> \n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td colspan=\"2\">{$operador}</td>\n <td>{$placas}</td> \n <td colspan=\"2\">{$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>{$concepto} \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>SUBTOTAL \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n </table>\n </td>\n </tr>\n <tr>\n <td colspan=\"3\" align=\"center\">\n RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100<br> \n <b>Metodo de pago :</b> {$metPago}<br>\n ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>\n EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO<br>\n PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.<br>\n Solicitarla al correo: facturacionpatios@demo.com.mx<br>\n </td>\n </tr>\n </table> \n\n <br><br><br><br><br><br>\n <center>---------------------------------- RECIBO PARA VIGILANCIA ---------------------------------- </center> \n <br><br><br><br><br>\n\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>ENTRADA</b></td>\n <td><b>SALIDA</b></td> \n <td><b>TRANSPORTE</b></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$entFec}</td> \n <td>{$salFec}</td>\n <td>{$transporte}</td>\n <td>{$conte}</td>\n <td>{$equipo}</td>\n </tr> \n <tr> \n <td colspan=\"2\"><b>OPERADOR</b></td> \n <td><b>PLACAS</b></td> \n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td colspan=\"2\">{$operador}</td>\n <td>{$placas}</td> \n <td colspan=\"2\">{$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>{$concepto} \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>SUBTOTAL \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"right\">{$monto}</td>\n </tr> \n </table>\n </td>\n </tr>\n <tr>\n <td colspan=\"3\" align=\"center\">\n RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 <br>\n <b>Metodo de pago :</b> {$metPago}<br>\n ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>\n EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO<br>\n PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.<br>\n Solicitarla al correo: facturacionpatios@demo.com.mx<br>\n </td>\n </tr>\n </table> \n\n "; // ------------------------------------------------------------------- $pdf->AddPage(); // Logo $pdf->setJPEGQuality(100); $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false); //$pdf->Image('../images/nome.jpg', 15, 140, 185, 96,'','','',false); // set cell padding //$pdf->setCellPaddings(1, 1, 1, 1); // set cell margins //$pdf->setCellMargins(1, 1, 1, 1); // Encabezado $pdf->SetFillColor(197, 197, 197); if ($idOficina == 1) { $txt = "ALMARTCON S.A. DE C.V.\n\"El Trébol\""; $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true); $txt = "Direccion, Guatemala \\Tel. 505-2350-0976 Cel. 505-8635-0708"; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true); } /* elseif( $idOficina==2 ){ $txt = "ALMARTCON S.A DE C.V.\n\"El Arbol\""; $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true); $txt="Av. Refinería Azcapotzalco S/N \nEsq. Ferrocarriles Nacionales.\nMéxico D.F."; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true); } elseif( $idOficina==3 ){ $txt = "TRANSPORTES MALEJA S.A DE C.V.\n\"El Pino\""; $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true); $txt="Carretera Querétaro San Luis Potosí Km.28\nCol.Buenavista Santa Rosa Jauregui\nQueretaro, QRO."; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true); } */ $pdf->SetFont('helvetica', '', 12); //$tbl = <<<EOD EOD; //$pdf->writeHTML($tbl, true, false, false, false, ''); $txt = "RECIBO"; $pdf->SetFont('helvetica', 'B', 12); $pdf->MultiCell(100, 4, $txt, 0, 'C', 0, 0, 60, 37, true); $pdf->SetFont('helvetica', '', 8); $tbl = <<<EOD <br><br><br> {$datoRecibo} EOD; //$tbl = "$datoRecibo"; $pdf->writeHTML($tbl, true, false, false, false, ''); $txt = "EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO\n PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.\n Solicitarla al correo: facturacionpatios@demo.com.mx"; $noRecibo > 0 ? $corY = 200 : ($corY = 125); //$pdf->MultiCell(185, 4,$txt, 1, 'C',0, 0, 16, 109,true); /* ($noRecibo>0)?$corY=180:$corY=105; $txt="POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40,10,$txt, 1, 'C',0, 0, 15, $corY,true); $txt="POR DEPOSITO\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(30, 10,$txt, 1, 'C',0, 0, 55, $corY,true); $txt="AUTO. DE REPARACION\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40, 10,$txt, 1, 'C',0, 0, 85, $corY,true); $txt="POR TRANSPORTISTA\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40, 10,$txt, 1, 'C',0, 0, 125, $corY,true); $txt="POR DEPOSITO\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(35, 10,$txt, 1, 'C',0, 0, 165, $corY,true); */ //Close and output PDF document $pdf->Output('reciboPension.pdf', 'I'); }
function showPdf($idReg = "") { global $db; // Oficina //$sesIdOficina = $_SESSION[sesIdOficina]; //$oficina = getValueTable("oficina","OFICINA","id_oficina",$sesIdOficina); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', false, 'ISO-8859-1', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 009'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', 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, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // $pdf->SetFooterMargin(3); $pdf->setPageOrientation('P', '', 1); //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 //$pdf->setLanguageArray($l); // set some language dependent data: $lg = array(); $lg['a_meta_charset'] = 'ISO-8859-1'; $lg['a_meta_dir'] = 'ltr'; $lg['a_meta_language'] = 'es'; $lg['w_page'] = 'page'; //set some language-dependent strings $pdf->setLanguageArray($lg); // ------------------------------- // CONSULTA DE DATOS // ------------------------------- $sql = "select * from SALIDA where id_salida='{$idReg}'"; $db->query($sql); while ($db->next_record()) { $docu = $db->f(doc_tipo); $docuRef = $db->f(doc_ref); $docTipo = $db->f(doc_tipo); //$entSal= $db->f('ent_sal'); $idSal = $idReg; $eir = $db->f(eir); $idOficina = $db->f(id_oficina); //$idCliente = $db->f('id_cliente'); //$cliente = getValueTable("cliente","CLIENTE","id_cliente",$idCliente); $cliente = $db->f('consig'); $idConte = $db->f('id_contenedor'); $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte); if (preg_match("/(\\w{4})(\\d{7})/", $conte, $parts)) { $conteL = $parts[1]; $conteN = $parts[2]; } $maniStPago = $db->f(mani_st_pago); if ($maniStPago == "M") { $pagaManiobras = "MERCHANT"; } elseif ($maniStPago == "C") { $pagaManiobras = "CARRIER"; } $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq); $bkg = $db->f('bkg'); $clase = $db->f('clase'); $clase = "CLASE: {$clase} "; $damage = $db->f('damage'); $sello = $db->f('sello'); $nota = $db->f('nota'); //$idTrans = $db->f('id_transporte'); //$transp = getValueTable("transporte","TRANSPORTE","id_transporte",$idTrans); $transp = $db->f('transportista'); $conteP1 = substr($conte, 0, 4); $conteP2 = substr($conte, 4, 10); if (preg_match("/(\\d+)(\\d)\$/", $conteP2, $parts)) { $conteP2 = $parts[1] . "-" . $parts[2]; } $idNav = $db->f('id_naviera'); $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav); $placas = $db->f('placas'); // $idOperador = $db->f('id_operador'); //$operador = getValueTable("operador","OPERADOR","id_operador",$idOperador); $operador = $db->f('operador'); $capFec = $db->f('cap_fec'); $entSalTx = "SALIDA"; $tipoMani = $db->f('tipo_mani'); $noRecibo = $db->f('recibo'); if ($tipoMani == "D") { $tipoManiTx = "MANIOBRA DE DESCARGA"; } if ($tipoMani == "C") { $tipoManiTx = "MANIOBRA DE CARGA"; } $maniCosto = $db->f('mani_costo'); $repaCosto = $db->f('repa_costo'); $sumaCpto = $maniCosto + $repaCosto; $montoLetra = traducirCifra($sumaCpto); $capIdUsr = $db->f('cap_id_usr'); $capFec = $db->f('cap_fec'); $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr); $modFec = $db->f('mod_fec'); $consig = $db->f('consig'); } // ------------------------------ // DAÑOS // ------------------------------ $sql = "select * from REL_NOME_SAL_PLUS "; $sql .= "where id_salida='{$idSal}' "; $dano = ""; $db->query($sql); while ($db->next_record()) { $idRelNome = $db->f(id_rel_nome); $idNome = $db->f(id_nome); $idUbica = $db->f(id_ubicacion); $idDime = $db->f(id_dimension); $nome = getValueTable("nombre", "NOMENCLATURA", "id_nome", $idNome); $nomeCode = getValueTable("codigo", "NOMENCLATURA", "id_nome", $idNome); $ubica = getValueTable("ubicacion", "UBICACION", "id_ubicacion", $idUbica); $dimen = getValueTable("dimension", "DIMENSION", "id_dimension", $idDime); $dano .= "{$nome} ({$nomeCode}) : {$ubica} : {$dimen}\n"; } $dano = nl2br($dano); // --------------------------------------------------------- // DATOS DEL RECIBO // --------------------------------------------------------- if ($noRecibo > 0) { $subTotal = $maniCosto + $repaCosto; $total = $subTotal; $subTotal = number_format($subTotal, 2); $total = number_format($total, 2); $datoRecibo = "\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES OPEMANTRA</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>FECHA</b></td>\n <td><b>No.R.I.E.</b></td> \n <td></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$capFec}</td> \n <td>{$idReg}</td>\n <td></td>\n <td>{$conteL}{$conteN}</td>\n <td>{$equipo}</td>\n </tr> \n <tr>\n <td><b>CONCEPTO</b></td> \n <td><b>TRANSPORTISTA</b></td> \n <td><b>OPERADOR</b></td>\n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td>{$tipoManiTx}</td> \n <td>{$transp}</td>\n <td>{$operador}</td> \n <td colspan=\"2\">{$docu} {$docuRef} / {$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>MANIOBRA \$</b></td>\n <td align=\"right\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>REPARACIONES \$</b></td>\n <td align=\"right\">{$repaCosto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"right\">{$total}</td>\n </tr>\n </table>\n </td>\n </tr>\n "; if ($docTipo == "EFECTIVO") { $datoRecibo .= "\n <tr> \n <td colspan=\"3\" align=\"right\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n </tr>\n "; } $datoRecibo .= "</table>"; } // ------------------------------------------------------------------- $pdf->AddPage(); // Logo $pdf->setJPEGQuality(100); $pdf->Image('../images/logo.jpg', 13, 4, 60, 30, '', '', '', false); //$pdf->Image('../images/nome.jpg', 15, 145, 185, 120,'','','',false); // set cell padding $pdf->setCellPaddings(1, 1, 1, 1); // set cell margins $pdf->setCellMargins(1, 1, 1, 1); // Encabezado $pdf->SetFillColor(197, 197, 197); // Trebol $pdf->SetFont('helvetica', '', 14); $pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true); //$txt="Av. "; $pdf->SetFont('helvetica', '', 7); $pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true); $pdf->SetFont('helvetica', '', 12); $tbl = <<<EOD <table cellspacing="0" cellpadding="3" border="0" align="center"> <tr bgcolor="#cacaca"> <th>FOLIO</th> </tr> <tr> \t \t<td><font color="red">S {$eir}</font></td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); $txt = "RECIBO DE INTERCAMBIO DE EQUIPO (R.I.E)"; $pdf->SetFont('helvetica', 'B', 12); $pdf->MultiCell(100, 4, $txt, 0, 'C', 0, 0, 60, 37, true); $pdf->SetFont('helvetica', '', 8); $tbl = <<<EOD <br><br><br> <table cellspacing="0" cellpadding="3" border="0" align="center"> <tr> <th><b>CONTENEDOR</b></th> <th><b>CARACTERISTICAS FISICAS</b></th> <td><b>CLIENTE</b></td> <td><b>PAGA MANIOBRAS</b></td> </tr> <tr> \t<td>{$conteL}{$conteN}</td> \t<td>{$equipo} / {$damage} </td> \t<td>{$consig}</td> <td>{$pagaManiobras}</td> </tr> <tr bgcolor="#cacaca"> \t<th colspan="4"><b>{$entSalTx}</b></th> </tr> <tr> \t<td><b>NAVIERA</b></td> \t<td><b>FECHA Y HORA</b></td> <td><b>BOOKING / BL</b></td> \t<td><b>ESTADO FISICO</b></td> \t </tr> <tr> \t<td>{$naviera}</td> \t<td>{$capFec}</td> <td>{$bkg}</td> \t<td>{$clase}</td> \t </tr> <tr> \t<td><b>TRANSPORTISTA</b></td> <td><b>OPERADOR</b></td> <td><b>PLACAS</b></td> \t<td><b>SELLO</b></td> \t \t </tr>\t <tr> \t<td>{$transp}</td> <td>{$operador}</td> <td>{$placas}</td> <td>{$sello}</td> </tr> <tr > \t<td colspan="2"><b>OBSERVACIONES</b></td> \t <td colspan="2"><b>DANOS</b></td> </tr> <tr > <td colspan="2">{$nota}</td> \t<td colspan="2">{$dano}</td> </tr> <tr> <td><b>OPERADOR<br><br><br>Nombre y Firma</b></td> <td><b>INSPECTOR<br><br><br>Nombre y Firma</b></td> <td colspan="2">EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS.</td> </tr> <tr bgcolor="#cacaca"> <td colspan="4"><i>Capturo: {$capUsr}<br>Fecha captura: {$modFec} </i></td> </tr> </table> <br><br><br> <!-- {$datoRecibo} --> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); /* ($noRecibo>0)?$corY=180:$corY=125; $txt="OPERADOR\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(40,10,$txt, 0, 'C',0, 0, 15, $corY,true); $txt="INSPECTOR\n\n\nNOMBRE Y FIRMA"; $pdf->MultiCell(30, 10,$txt, 0, 'C',0, 0, 55, $corY,true); $txt="EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS. Solicitarla al correo: factu@demo.com.mx"; $pdf->MultiCell(105, 10,$txt, 0, 'L',0, 0, 95, $corY,true); $txt="EMISION DE FACTURA DENTRO DE LOS 5 DIAS POSTERIORES A LA REALIZACIÓN DE SU SERVICIO PASADO ESTE TIEMPO NO HABRÁ EMISIÓN DE FACTURAS. Solicitarla al correo: facturacionpatios@demo.com.mx"; */ //($noRecibo>0)?$corY=200:$corY=125; //$pdf->MultiCell(185, 10,$txt, 1, 'C',0, 0, 15, 200,true); //Close and output PDF document $pdf->Output('eirSalida.pdf', 'I'); }
function facturarform($idFactura) { global $db, $hoy, $tmIdUsuario, $facturado; $pdf = new FPDF(); // Manda datos al FPDF. $pdf->Open(); $pdf->SetMargins(20, 20, 20); $pdf->AddPage(); $cont = 0; $row = 100; // inicio de renglon para los conceptos. // Moneda $moneda = getValueTable("moneda", "FT_TMA", "id_factura", $idFactura); $idCliente = getValueTable("id_cliente", "FT_TMA", "id_factura", $idFactura); //actualizar flg_proforma para indicar que ya se puede mandar a imprimir la factura $sql = "update FT_TMA set flg_proforma='1' where id_factura='{$idFactura}'"; $db->query($sql); // Datos del cliente $sql = "select * from FT_CLIENTE where id_cliente='{$idCliente}'"; $db->query($sql); while ($db->next_record()) { $cliente = $db->f(cliente); $tel = $db->f(tel); $rfc = $db->f(rfc); $calle = $db->f(calle); $noExt = $db->f(no_ext); $noInt = $db->f(no_int); $colonia = $db->f(colonia); $cp = $db->f(cp); $ciudad = $db->f(ciudad); $edo = $db->f(edo); } // Encabezado $pdf->Image('../images/msc.jpg', 8, 16, 13); $pdf->Image('../images/rfc2.jpg', 5, 235, 25); $pdf->Image('../images/mscblackF.jpg', 25, 80, 150); $pdf->SetFont('Arial', 'B', 15); //$pdf->Text(65,20,"RECIBASE"); $pdf->SetFont('Arial', 'B', 11); $pdf->Text(25, 23, "MEDITERRANEAN SHIPPING COMPANY MÉXICO, S.A. DE C.V."); $pdf->SetFont('Arial', 'B', 9); $pdf->Text(153, 23, "AS AGENTS ONLY"); $pdf->SetFont('Arial', 'B', 6); //DIRECCION OFICINA MATRIZ $pdf->Text(5, 30, "OFICINA MATRIZ"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(2, 32, "AV. BENJAMIN FRANKLIN No 204"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(2, 34, "PISO 1 COL ESCANDON C.P. 11800"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(1, 36, "DELEG. MIGUEL HIDALGO, MEXICO DF"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(9, 38, "TEL50917070"); //DIRECCION OFICINA ALTAMIRA $pdf->SetFont('Arial', 'B', 6); $pdf->Text(35, 29, "SUC. ALTAMIRA"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(35, 31, "AV. RIO TMESI KM0+700"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(30, 33, "EDIF. TORRE MULTIMODAL DESP. 306"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(32, 35, "C.P. 69600 PUERTO INDUSTRIAL"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(38, 37, "ALTAMIRA, TAMPS."); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(37, 39, "TEL: 01 833 260-3200"); //DIRECCION OFICINA GUADALAJARA $pdf->SetFont('Arial', 'B', 6); $pdf->Text(62, 30, "SUC. GUADALAJARA"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(65, 32, "RUBEN DARIO No 217"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(60, 34, "COL.CIRCUNVALACION VALLARTA"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(62, 36, "C.P. 44680 GUADALAJARA JAL."); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(66, 38, "TEL: 01 33 3630-4460"); //DIRECCION OFICINA MANZANILLO $pdf->SetFont('Arial', 'B', 6); $pdf->Text(92, 30, "SUC. MANZANILLO"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(90, 32, "CALLE 20 DE NOVIEMBRE No 11"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(92, 34, "COL.BUROCRATA C.P.28250"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(96, 36, "MANZANILLO, COL."); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(95, 38, "TEL: 01 314 332-3055"); //DIRECCION OFICINA MAZATLAN $pdf->SetFont('Arial', 'B', 6); $pdf->Text(122, 29, "SUC. MANZATLAN"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(118, 31, "AV. EMILIO BARRAGAN No 63 DESP. 102"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(123, 33, "EDIF. CENTRO MARITIMO"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(123, 35, "CO. CENTRO C.P. 82000"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(125, 37, "MAZATLAN SINALOA"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(125, 39, "TEL. 01 569 985-0844"); //DIRECCION OFICINA VERACRUZ $pdf->SetFont('Arial', 'B', 6); $pdf->Text(152, 29, "SUC. VERACRUZ"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(153, 31, "AV. 5 DE MAYO No 961"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(152, 33, "DEPTO 2 ENTRE JUAREZ"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(153, 35, "Y EMPARAM COL. CENTRO"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(152, 37, "C.P. 91700 VERACRUZ VER"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(152, 39, "TEL. 01 229 931-0416"); //DIRECCION OFICINA MONTERREY $pdf->SetFont('Arial', 'B', 6); $pdf->Text(182, 29, "SUC. MONTERREY"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(183, 31, "AV. ZARAGOZA No 1000"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(182, 33, "DESP. 1010 COL. CENTRO"); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(182, 35, "C.P. 54000 MONTERREY N.L."); $pdf->SetFont('Arial', 'B', 4); $pdf->Text(184, 37, "TEL. 01 83 5345-1010"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.2); $pdf->Line(5, 40, 140, 40); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(10, 43, "CLIENTE : "); $pdf->SetFont('Arial', 'B', 10); // Cliente $pdf->Text(24, 43, $cliente); $pdf->Text(24, 49, $calle); if (!empty($cp)) { $cpT = "C.P. {$cp}"; } else { $cpT = ""; } $dir = "{$noExt} {$noInt} {$colonia} {$cpT}"; $pdf->SetFont('Arial', 'B', 6); $pdf->Text(10, 50, "DIRECCION : "); $pdf->SetFont('Arial', 'B', 10); $pdf->Text(24, 52, $dir); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(10, 58, "TEL : "); $pdf->Text(60, 58, "R.F.C."); $pdf->SetFont('Arial', 'B', 10); $pdf->Text(24, 58, $tel); $pdf->Text(70, 58, $rfc); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(10, 61, "CIUDAD : "); $pdf->SetFont('Arial', 'B', 10); $pdf->Text(24, 61, $ciudad); $pdf->Text(60, 64, $edo); //LINEA HORIZONTAL $pdf->SetLineWidth(0.2); $pdf->Line(156, 57, 193, 57); $pdf->SetLineWidth(0.2); $pdf->Line(5, 64, 140, 64); //LINEA VERTICAL $pdf->SetLineWidth(0.2); $pdf->Line(5, 40, 5, 64); $pdf->SetLineWidth(0.2); //$pdf->Line(140,40,140,64); $pdf->Line(140, 40, 140, 64); //VERTICAL FECHA $pdf->SetLineWidth(0.2); $pdf->Line(156, 57, 156, 70); $pdf->SetLineWidth(0.2); $pdf->Line(193, 57, 193, 70); $pdf->SetLineWidth(0.2); $pdf->Line(165, 57, 165, 70); $pdf->SetLineWidth(0.2); $pdf->Line(180, 57, 180, 70); //LINEA HORIZONTAL $pdf->SetLineWidth(0.2); $pdf->Line(156, 62, 193, 62); $pdf->SetLineWidth(0.2); $pdf->Line(156, 70, 193, 70); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(158, 60, "DIA"); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(170, 60, "MES"); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(183, 60, "AÑO"); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(163, 45, "PRO-FORMA"); $pdf->SetFont('Arial', '', 12); $pdf->Text(168, 52, "{$idFactura}"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.2); $pdf->Line(3, 84, 205.5, 84); $pdf->SetLineWidth(0.2); $pdf->Line(3, 90, 205.5, 90); $pdf->SetLineWidth(0.2); $pdf->Line(3, 235, 205, 235); $pdf->SetLineWidth(0.2); $pdf->Line(45, 283, 190, 283); $pdf->SetLineWidth(0.2); $pdf->Line(20, 295, 190, 295); $pdf->SetFont('Arial', '', 6); $pdf->Text(4, 88, "CANT."); $pdf->SetFont('Arial', '', 6); $pdf->Text(60, 88, "DESCRIPCIÓN"); $pdf->SetFont('Arial', '', 6); $pdf->Text(140, 88, "P. UNITARIO"); $pdf->SetFont('Arial', '', 6); $pdf->Text(180, 88, "P. UNITARIO"); //LINEA VERTICAL $pdf->SetLineWidth(0.2); $pdf->Line(3, 84, 3, 235); $pdf->SetLineWidth(0.2); $pdf->Line(205.5, 84, 205.5, 235); $pdf->SetLineWidth(0.2); $pdf->Line(13, 84, 13, 235); $pdf->SetLineWidth(0.2); $pdf->Line(123, 84, 123, 235); $pdf->SetLineWidth(0.2); $pdf->Line(168, 84, 168, 235); $pdf->SetLineWidth(0.2); $pdf->Line(20, 283, 20, 295); $pdf->SetLineWidth(0.2); $pdf->Line(190, 283, 190, 295); //$pdf->Image('../images/rfc2.JPG',8,16,13); $pdf->SetFont('Arial', 'B', 6); $pdf->Text(21, 283, "IMPORTE CON LETRA"); //Selecciona la fecha emitida $fecha = getValueTable("femitida", "FT_TMA", "id_factura", $idFactura); //MESES //Poner formato de Fecha de Captura $ano = substr($fecha, 0, 4); $mes = substr($fecha, 5, 2); $dia = substr($fecha, 8, 2); $mesC = date("F", mktime(0, 0, 0, $mes, $dia, $ano)); if ($mesC == "January") { $mc = "ENERO"; } if ($mesC == "February") { $mc = "FEBRERO"; } if ($mesC == "March") { $mc = "MARZO"; } if ($mesC == "April") { $mc = "ABRIL"; } if ($mesC == "May") { $mc = "MAYO"; } if ($mesC == "June") { $mc = "JUNIO"; } if ($mesC == "July") { $mc = "JULIO"; } if ($mesC == "August") { $mc = "AGOSTO"; } if ($mesC == "September") { $mc = "SEP"; } if ($mesC == "October") { $mc = "OCT"; } if ($mesC == "November") { $mc = "NOV"; } if ($mesC == "December") { $mc = "DIC"; } //$fecha_final=$dia."/".$mc."/".$ano; //$pdf->Text(162,44,$fecha_final); // Fecha $pdf->Text(160, 67, $dia); $pdf->Text(168, 67, $mc); $pdf->Text(184, 67, $ano); /*$pdf->Text(24,67,"HONDURAS"); $pdf->Text(66,67,"HONDURAS"); $pdf->Text(120,67,$rfc);*/ //Imprimir Conceptos $sql = "select id_fac_rel from FT_REL_CONCEPTO_PRO where id_factura='{$idFactura}'"; $db->query($sql); while ($db->next_record()) { $idFacRel = $db->f(id_fac_rel); } unset($totalG); if (empty($idFacRel)) { $sql = "select * from FT_REL_CONCEPTO where id_factura='{$idFactura}'"; } else { $sql = "select * from FT_REL_CONCEPTO_PRO where id_factura='{$idFactura}'"; } $db->query($sql); while ($db->next_record()) { $idConcepto = $db->f(id_concepto); $conceptoConta = getValueTable("concepto", "FT_CONCEPTO", "id_concepto", $idConcepto); $conceptoImp = $db->f(concepto_imp); $cantidad = $db->f(cantidad); $precioU = $db->f(preciou); $iva = $db->f(iva); $importeT = $db->f(importe); $descpT = $db->f(descp); //$long= strlen($importeT); //$importeU= $importeT; //$longU= strlen($importeU); //Imprimir los conceptos //Cantidad $pdf->Text(4, $row, $cantidad); //IDENTIFICAMOS QUE CONCEPTO MANDAMOS A IMPRESION if (empty($conceptoImp)) { $concepto = $conceptoConta; } else { $concepto = $conceptoImp; } //Concepto $pdf->SetFont('Courier', 'B', 10); $pdf->Text(15, $row, $concepto); $concepto = ""; $precioU = number_format($precioU, 2); $longU = strlen($precioU); //Importe Unitario switch ($longU) { case "4": //$precioU= number_format($precioU,2); $pdf->Text(136, $row, $precioU); //0.00 break; case "5": //$precioU=number_format($precioU,2); $pdf->Text(134.8, $row, $precioU); //136.9 ; 00.00 break; case "6": //$precioU=number_format($precioU,2); $pdf->Text(133.7, $row, $precioU); //134.7 : 000.00 break; case "7": //$precioU=number_format($precioU,2); $pdf->Text(130.5, $row, $precioU); //130.5 ; 0000.00 break; case "8": //$precioU=number_format($precioU,2); $pdf->Text(131.9, $row, $precioU); //128.4 ; 0,000.00 break; case "9": //$precioU=number_format($precioU,2); $pdf->Text(130.9, $row, $precioU); //128.4 ; 00,000.00 break; case "10": //$precioU=number_format($precioU,2); $pdf->Text(129.5, $row, $precioU); //128.4 ; 000,000.00 break; case "12": //$precioU=number_format($precioU,2); $pdf->Text(127.7, $row, $precioU); //128.4 ; 0,000,000.00 break; } $totalG = $totalG + $importeT; //$importeT=number_format($importeT,2); $long = strlen($importeT); //Importe Total switch ($long) { case "4": //$importeT=number_format($importeT,2); $pdf->Text(182.0, $row, $importeT); //184 break; case "5": //$importeT=number_format($importeT,2); $pdf->Text(180.9, $row, $importeT); //181.9 break; case "6": //$importeT=number_format($importeT,2); $pdf->Text(179.7, $row, $importeT); //179.7 break; case "7": //$importeT=number_format($importeT,2); $pdf->Text(175.5, $row, $importeT); //175.5 break; case "8": //$importeT=number_format($importeT,2); $pdf->Text(178.0, $row, $importeT); //173.4 break; case "9": //$importeT=number_format($importeT,2); $pdf->Text(176.9, $row, $importeT); //173.4 break; case "10": //$importeT=number_format($importeT,2); $pdf->Text(175.9, $row, $importeT); //173.4 break; case "12": //$importeT=number_format($importeT,2); $pdf->Text(173.9, $row, $importeT); //173.4 break; } /*$descp = getValueTable("descp","FT_TMA","id_factura",$idFactura); if (!empty($descp)) { //Descripcion $descpT=$descp; }*/ if (!empty($descpT)) { $descp = $descpT; } else { $descp = getValueTable("descp", "FT_TMA", "id_factura", $idFactura); } $cadena = substr($direccion, 0, 67); $cadena2 = substr($direccion, 67); $lenght = strlen($cadena); if (!$lenght == 67) { $pdf->Text(28, 54, $cadena); } else { $pdf->Text(28, 54, $cadena); $pdf->Text(28, 57, $cadena2); } /* $cadenax = substr($descp,0,67); $cadena2x = substr($descp,67); $lenght = strlen($cadenax); if(!$lenght == 67){ $pdf->SetFont('Courier','B',8); $pdf->Text(20,$row+3,$cadenax); }else{ $pdf->SetFont('Courier','B',8); $pdf->Text(20,$row+3,$cadenax); $pdf->Text(20,$row+6,$cadena2x); } */ $caddes = strlen($descp); $inid = 0; $find = 60; //$posd=175; //$pos=0; $row += 3; while ($caddes > 0) { $datad[] = substr($descp, $inid, $find); $inid = $inid + 60; $find = $find; $caddes = $caddes - 60; //$pdf->Text(90,$s,$description); //$s=$s+3; foreach ($datad as $line) { $pdf->SetFont('Courier', 'B', 8); $pdf->Text(20, $row, $line); $row = $row + 3; unset($datad); } } /*if(!empty($descpT)){ $arrT= explode("|",$descpT); $row+=3; foreach ($arrT as $tx){ $pdf->Text(30,$row,$tx); $row+=3; } $row+=2; } else { $row+=4; }*/ //} //CALCULAR EL IVA Y EL SUBTOTAL MANUALMENTE. //$totalG=$totalG+$importeT; $tlIva = $tlIva + $iva; } /* //VER IMPRESOS LOS CONTENEDORES CAPTURADOS. $sql="select f.id_msc_bl_conte as id_msc_bl_conte, f.id_bl_conte as id_bl_conte "; $sql.="from FT_TMA_BL_CONTE f, BL_CONTE b, EXPO e "; $sql.="where f.id_bl_conte=b.id_bl_conte and b.id_bl=e.Id_expo and f.id_factura='$idFactura' order by e.Bl "; $db->query($sql); while( $db->next_record() ){ $idFBlConte= $db->f(id_msc_bl_conte); $idBlConte= $db->f(id_bl_conte); $idBl= getValueTable("id_bl","BL_CONTE","id_bl_conte",$idBlConte); $idConte= getValueTable("id_contenedor","BL_CONTE","id_bl_conte",$idBlConte); $idTipo= getValueTable("id_equipo","CONTENEDOR","id_contenedor",$idConte); $bl = getValueTable("Bl","EXPO","Id_expo",$idBl); $conte = getValueTable("numero","CONTENEDOR","Id_contenedor",$idConte); $tipo = getValueTable("equipo","EQUIPO","Id_equipo",$idTipo); $blConteTipo.="[".$bl."/".$conte."-".$tipo."]"; } $descp=$blConteTipo; $caddes = strlen($descp); $inid=0; $find=60; //$posd=175; //$pos=0; $row+=4; while ($caddes > 0) { $datad[]=substr($descp,$inid,$find); $inid=$inid+60; $find=$find; $caddes=$caddes-60; //$pdf->Text(90,$s,$description); //$s=$s+3; foreach ( $datad as $line ) { $pdf->SetFont('Courier','B',8); $pdf->Text(20,$row,$line); $row=$row+3; unset($datad); } } //LEYENDA OBLIGATORIA EN LA FACTURA $pdf->SetFont('Courier','B',10); $pdf->Text(15,232,"EL PAGO DE ESTA FACTURA SE HACE EN UNA SOLA EXHIBICION"); //VER No CARACTERES Y SEPARAR LA CADENA DE 90 EN 90 PARA DESCRIPTION /* $descp = getValueTable("descp","FT_TMA","id_factura",$idFactura); $caddes = strlen($descp); $inid=0; $find=90; //$posd=175; //$pos=0; $row+=3; while ($caddes > 0) { $datad[]=substr($descp,$inid,$find); $inid=$inid+90; $find=$find; $caddes=$caddes-90; //$pdf->Text(90,$s,$description); //$s=$s+3; foreach ( $datad as $line ) { $pdf->Text(13,$row,$line); $row=$row+2; unset($datad); } }*/ //Total,Iva,Subtotal //$totalG=number_format($totalG,2); $totalT = $totalG + $tlIva; //$totalT=number_format($totalT,2); /*$totalT= getValueTable("total","FT_TMA","id_factura",$idFactura); $totalG= getValueTable("subtotal","FT_TMA","id_factura",$idFactura); $tlIva= getValueTable("iva","FT_TMA","id_factura",$idFactura);*/ $totalT2 = str_replace(",", "", $totalT); if (preg_match("/^(\\d+)\\.{0,2}/", $totalT2, $part)) { $importeInt = $part[1]; } $importeLetra = traducirCifra($importeInt); //( ereg( "\.([0-9]+)", $totalT2, $regs ) )?$centavos=$regs[1]:$centavos="00"; if (preg_match("/\\.([0-9]+)/", $totalT2, $regs)) { $centavos = $regs[1]; } else { $centavos = "00"; } //( ereg( "\.([0-9]+{2})", $totalT2, $regs ) )?$centavos=$regs[1]:$centavos="00"; $nameMoneda = getValueTable("moneda", "INFO", "id_info", 1); $nameMoneda = strtoupper($nameMoneda); if ($moneda == "2") { $txtImporte = "{$importeLetra} {$nameMoneda} {$centavos}/100 M.N."; } elseif ($moneda == "1") { $txtImporte = "{$importeLetra} DOLARES {$centavos}/100 CTS"; } $pdf->SetFont('Arial', 'B', 10); //Imprimir Total $longSub = strlen($totalG); //$pdf->Text(170,215,$longSub); $rowImp = 245; switch ($longSub) { case "1": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(183, $rowImp, $totalG); break; case "2": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(186, $rowImp, $totalG); break; case "3": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(183, $rowImp, $totalG); break; case "4": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(183, $rowImp, $totalG); //179.9 break; case "5": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(175.9, $rowImp, $totalG); break; case "6": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(181.7, $rowImp, $totalG); //181.7 break; case "7": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(182.5, $rowImp, $totalG); //177.5 break; case "8": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalG = number_format($totalG, 2); $pdf->Text(175.4, $rowImp, $totalG); break; case "9": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalT = number_format($totalT, 2); $pdf->Text(171.4, $rowImp, $totalG); break; case "10": $pdf->Text(155, $rowImp, "SUBTOTAL:"); $totalT = number_format($totalT, 2); $pdf->Text(170.4, $rowImp, $totalG); break; } // Imprimir Iva $longIva = strlen($tlIva); $rowImpX = 255; switch ($longIva) { case "1": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(184, $rowImpX, $tlIva); break; case "2": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(185, $rowImpX, $tlIva); break; case "3": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(186, $rowImpX, $tlIva); break; case "4": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(186, $rowImpX, $tlIva); break; case "5": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(183.9, $rowImpX, $tlIva); break; case "6": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(185.7, $rowImpX, $tlIva); break; case "7": $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(177.5, $rowImpX, $tlIva); break; case "8": $tlIva = number_format($tlIva, 2); $pdf->Text(175.4, $rowImpX, $tlIva); break; case "9": //$pdf->Text(155,$row,"TOTAL : "); $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(171.4, $rowImpX, $tlIva); break; case "10": //$pdf->Text(155,$row,"TOTAL : "); $pdf->Text(155, $rowImpX, "IVA:"); $tlIva = number_format($tlIva, 2); $pdf->Text(170.4, $rowImpX, $tlIva); break; } //Imprimir Total $longT = strlen($totalT); $rowImpY = 265; switch ($longT) { case "1": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(183, $rowImpY, $totalT); break; case "2": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(183, $rowImpY, $totalT); break; case "3": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(183, $rowImpY, $totalT); break; case "4": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(183, $rowImpY, $totalT); //183 break; case "5": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(183.9, $rowImpY, $totalT); //180.9 break; case "6": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(181.7, $rowImpY, $totalT); //178.7 break; case "7": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(177.5, $rowImpY, $totalT); //174.5 break; case "8": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(175.4, $rowImpY, $totalT); //172.4 break; case "9": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(171.4, $rowImpY, $totalT); //171.4 break; case "10": $pdf->Text(155, $rowImpY, "TOTAL : "); $totalT = number_format($totalT2, 2); $pdf->Text(171.4, $rowImpY, $totalT); //170.4 break; } $pdf->SetFont('Arial', 'B', 10); $pdf->Text(25, 290, $txtImporte); //LEYENDA OBLIGATORIA EN LA FACTURA $pdf->SetFont('Courier', 'B', 10); $pdf->Text(15, 232, "EL PAGO DE ESTA FACTURA SE HACE EN UNA SOLA EXHIBICION"); //------------------------------------------ //SACAMOS LA INFORMACION DE LOS CONTENEDORES //------------------------------------------ $numContes = 0; $sql = "select f.id_msc_bl_conte as id_msc_bl_conte, f.id_bl_conte as id_bl_conte "; $sql .= "from FT_TMA_BL_CONTE f, BL_CONTE b, EXPO e "; $sql .= "where f.id_bl_conte=b.id_bl_conte and b.id_bl=e.Id_expo and f.id_factura='{$idFactura}' order by e.Bl "; $db->query($sql); while ($db->next_record()) { //NUMERO DE CONTENEDORES PARA IMPRIMIR $numContes = $numContes + 1; $idFBlConte = $db->f(id_msc_bl_conte); $idBlConte = $db->f(id_bl_conte); $idBl = getValueTable("id_bl", "BL_CONTE", "id_bl_conte", $idBlConte); $idConte = getValueTable("id_contenedor", "BL_CONTE", "id_bl_conte", $idBlConte); $idTipo = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte); $bl = getValueTable("Bl", "EXPO", "Id_expo", $idBl); $conte = getValueTable("numero", "CONTENEDOR", "Id_contenedor", $idConte); $tipo = getValueTable("equipo", "EQUIPO", "Id_equipo", $idTipo); $blConteTipo .= "[" . $bl . "|" . $conte . "|" . $tipo . "]"; $blsS = $blsS . "," . $bl; $conteS = $conteS . "," . $conte; } $numContesLine = $numContes / 4; $numLine = $row + $numContesLine; //---------------------------------------------------- //PREGUNTAMOS SI NO SE REQUIERE UN ARCHIVO ANEXO ENTRA //---------------------------------------------------- //$anexo=1; if ($anexo == 0) { if ($numLine <= 220) { //$descp=$blConteTipo; $descp = "Bls: {$blsS} // Conte: {$conteS}"; $caddes = strlen($descp); $inid = 0; $find = 72; //$posd=175; //$pos=0; $row += 3; $rowPdf2 = 10; $flgPdf2 = 0; while ($caddes > 0) { if ($flgPdf2 == 0) { $datad[] = substr($descp, $inid, $find); $inid = $inid + 72; $find = $find; $caddes = $caddes - 72; } } if (!empty($datad)) { foreach ($datad as $line) { $pdf->SetFont('Courier', 'B', 7); $pdf->Text(15, $row, $line); $row = $row + 3; unset($datad); } } } else { //---------------------------- //CONTENEDORES EN LA HOJA No 2 //---------------------------- // ENCABEZADO $pdf->SetFont('Courier', 'B', 12); $row = $row + 10; $pdf->Text(15, $row, "{$numContes} CONTENEDORES SEGUN RELACION ANEXA"); $pdf->AddPage(); $pdf->Image('../images/msc.jpg', 8, 1, 15); $pdf->Image('../images/mscblackF.jpg', 25, 80, 150); $pdf->SetFont('Courier', 'B', 10); $pdf->Text(75, 12, "ANEXO DE CONTENEDORES"); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(35, 7, "MEDITERRANEAN SHIPPING COMPANY MEXICO, S.A. DE C.V."); $numFactura = getValueTable("folio", "FT_TMA", "id_factura", $idFactura); $pdf->SetFont('Arial', 'B', 9); $pdf->Text(165, 12, "FACTURA : {$numFactura}"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 17, 205, 17); $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 205, 2); $pdf->SetLineWidth(0.5); $pdf->Line(5, 295, 205, 295); //LINEA VERTICAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 5, 295); $pdf->SetLineWidth(0.5); $pdf->Line(205.5, 2, 205.5, 295); $numeroAnexos = $numeroAnexos - 1; //----------------------------- $rowPdf2 = 20; //MANDAMOS A IMPRESION LOS NUMEROS DE CONTENEDORES EN EL PDF2 //$descp=$blConteTipo; $desc = "Bls : {$blsS} // Conte: {$conteS}"; $caddes = strlen($descp); $inid = 0; $find = 126; //$posd=175; //$pos=0; $row += 4; //$rowPdf2=10; //$flgPdf2=0; while ($caddes > 0) { $datad[] = substr($descp, $inid, $find); $inid = $inid + 126; $find = $find; $caddes = $caddes - 126; $linePdf2 = $linePdf2 + 1; } //AGREGAR LAS HOJAS QUE SEAN NECESARIAS PARA IMPRIMIR TODOS LOS CONTENEDORES if (!empty($datad)) { foreach ($datad as $line) { $conta = $conta + 1; $contaLine = $contaLine + 1; $pdf->SetFont('Courier', 'B', 7); $pdf->Text(5, $rowPdf2, $contaLine); $pdf->Text(10, $rowPdf2, $line); $rowPdf2 = $rowPdf2 + 3; unset($datad); if ($conta == 92) { $conta = ""; // ENCABEZADO $pdf->AddPage(); $pdf->Image('../images/msc.jpg', 8, 1, 15); $pdf->Image('../images/mscblackF.jpg', 25, 80, 150); $pdf->SetFont('Courier', 'B', 10); $pdf->Text(75, 12, "ANEXO DE CONTENEDORES"); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(35, 7, "MEDITERRANEAN SHIPPING COMPANY MEXICO, S.A. DE C.V."); $pdf->SetFont('Arial', 'B', 9); $pdf->Text(165, 12, "FACTURA : {$numFactura}"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 17, 205, 17); $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 205, 2); $pdf->SetLineWidth(0.5); $pdf->Line(5, 295, 205, 295); //LINEA VERTICAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 5, 295); $pdf->SetLineWidth(0.5); $pdf->Line(205.5, 2, 205.5, 295); $rowPdf2 = 20; } } } } } else { //---------------------------- //CONTENEDORES EN LA HOJA No 2 //---------------------------- // ENCABEZADO $pdf->SetFont('Courier', 'B', 12); $row = $row + 10; $pdf->Text(15, $row, "{$numContes} CONTENEDORES SEGUN RELACION ANEXA"); $pdf->AddPage(); $pdf->Image('../images/msc.jpg', 8, 1, 15); $pdf->Image('../images/mscblackF.jpg', 25, 80, 150); $pdf->SetFont('Courier', 'B', 10); $pdf->Text(75, 12, "ANEXO DE CONTENEDORES"); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(35, 7, "MEDITERRANEAN SHIPPING COMPANY MEXICO, S.A. DE C.V."); $numFactura = getValueTable("folio", "FT_TMA", "id_factura", $idFactura); $pdf->SetFont('Arial', 'B', 9); $pdf->Text(165, 12, "FACTURA : {$numFactura}"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 17, 205, 17); $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 205, 2); $pdf->SetLineWidth(0.5); $pdf->Line(5, 295, 205, 295); //LINEA VERTICAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 5, 295); $pdf->SetLineWidth(0.5); $pdf->Line(205.5, 2, 205.5, 295); $numeroAnexos = $numeroAnexos - 1; //----------------------------- $rowPdf2 = 20; //MANDAMOS A IMPRESION LOS NUMEROS DE CONTENEDORES EN EL PDF2 $descp = $blConteTipo; $caddes = strlen($descp); $inid = 0; $find = 126; //$posd=175; //$pos=0; $row += 4; //$rowPdf2=10; //$flgPdf2=0; while ($caddes > 0) { $datad[] = substr($descp, $inid, $find); $inid = $inid + 126; $find = $find; $caddes = $caddes - 126; $linePdf2 = $linePdf2 + 1; } //AGREGAR LAS HOJAS QUE SEAN NECESARIAS PARA IMPRIMIR TODOS LOS CONTENEDORES foreach ($datad as $line) { $conta = $conta + 1; $contaLine = $contaLine + 1; $pdf->SetFont('Courier', 'B', 7); $pdf->Text(5, $rowPdf2, $contaLine); $pdf->Text(10, $rowPdf2, $line); $rowPdf2 = $rowPdf2 + 3; unset($datad); if ($conta == 92) { $conta = ""; // ENCABEZADO $pdf->AddPage(); $pdf->Image('../images/msc.jpg', 8, 1, 15); $pdf->Image('../images/mscblackF.jpg', 25, 80, 150); $pdf->SetFont('Courier', 'B', 10); $pdf->Text(75, 12, "ANEXO DE CONTENEDORES"); $pdf->SetFont('Arial', 'B', 12); $pdf->Text(35, 7, "MEDITERRANEAN SHIPPING COMPANY MEXICO, S.A. DE C.V."); $pdf->SetFont('Arial', 'B', 9); $pdf->Text(165, 12, "FACTURA : {$numFactura}"); //LINEA HORIZONTAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 17, 205, 17); $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 205, 2); $pdf->SetLineWidth(0.5); $pdf->Line(5, 295, 205, 295); //LINEA VERTICAL $pdf->SetLineWidth(0.5); $pdf->Line(5, 2, 5, 295); $pdf->SetLineWidth(0.5); $pdf->Line(205.5, 2, 205.5, 295); $rowPdf2 = 20; } } } $pdf->Output(); }