AuthUser(); require_once(DOC_ROOT.'/tcpdf/config/lang/eng.php'); require_once(DOC_ROOT.'/tcpdf/tcpdf.php'); $envioId = intval($_GET['id']); $envio->setEnvioId($envioId); $info = $envio->Info(); $sucursal->setSucursalId($info['sucursalId']); $info['nomSuc'] = urldecode($sucursal->GetNameById()); $infS = $sucursal->Info(); $dir = ''; if($infS['calle']) $dir .= $infS['calle']; if($infS['noExt']) $dir .= '. No. Ext. '.$infS['noExt']; if($infS['noInt']) $dir .= '. No. Int. '.$infS['noInt']; if($infS['colonia']) $dir .= '. Col. '.$infS['colonia']; if($infS['ciudad']) $dir .= ','.$infS['ciudad']; if($infS['municipio']) $dir .= ', '.$infS['municipio']; if($infS['estado']) $dir .= ', '.$infS['estado']; $info['direccion'] = utf8_encode($dir); $usuario->setSucursalId($info['sucursalId']); $usuario->setTipo('gerente'); $usuarioId = $usuario->GetUserBySucAndType(); $usuario->setUsuarioId($usuarioId); $info['gteDest'] = $usuario->GetFullNameById(); $envio->setEnvioId($envioId); $info['noCajas'] = $envio->GetTotalCajas(); $total = $envio->GetValorTotal(); $info['total'] = number_format($total,2); // 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(''); $pdf->SetTitle(''); $pdf->SetSubject(''); $pdf->SetKeywords(''); // set default header data $pdf->SetHeaderData('', '', 'Talones de Embarque', ''); // 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); //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); // --------------------------------------------------------- // add a page $pdf->AddPage(); $pdf->SetFont('helvetica', '', 9); // ----------------------------------------------------------------------------- for($k=1; $k<=$info['noCajas']; $k++){ $tbl .= '
 
 Novomoda
 Remitente  CEDIS
 Gte. Abel PĂ©rez
 Dir. Av. Tulipanes, Col. Centro, Oaxaca, Oaxaca.
 Tel. 01-982-123-456
 No. de Envio: '.$envioId.'
 Destinatario  Suc: '.$info['nomSuc'].'
 Gte: '.utf8_encode($info['gteDest']).'
 Dir. '.urldecode($info['direccion']).'
 Tel. '.$infS['telefono'].'
 Conteo de Cajas  Caja '.$k.' de '.$info['noCajas'].'
 Contenido  Ropa en General
 Valor  '.$info['total'].'




'; } $pdf->writeHTML($tbl, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('example_048.pdf', 'I'); ?>