示例#1
1
function createPDF($text)
{
    if (!isset($GLOBALS["pdf_font"])) {
        $GLOBALS["pdf_font"] = 'Arial';
        $GLOBALS["pdf_fontsize"] = 12;
    }
    $pdf = new FPDF();
    $pdf->SetCreator("PHPlist version " . VERSION);
    $pdf->Open();
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont($GLOBALS["pdf_font"], $GLOBALS["pdf_fontstyle"], $GLOBALS["pdf_fontsize"]);
    $pdf->Write((int) $GLOBALS["pdf_fontsize"] / 2, $text);
    $fname = tempnam($GLOBALS["tmpdir"], "pdf");
    $pdf->Output($fname, false);
    return $fname;
}
示例#2
0
function generate_pdf($prenote)
{
    require_once 'fpdf17/fpdf.php';
    $pdf = new FPDF();
    $length = count($prenote->product);
    $pdf->Open();
    $pdf->AddPage('P', array(50, 49 + $length * 8));
    $pdf->SetFont('Arial', '', 9);
    $pdf->Image($prenote->folio . '.png', 3, 2, 35, 15, 'PNG');
    $pdf->Text(7, 20, $prenote->folio);
    $pdf->Text(5, 24, $prenote->clientName);
    $pdf->Text(5, 26, '------------------------------');
    $product = $prenote->product;
    $c = 0;
    for ($i = 0; $i < $length; $i++) {
        $pdf->Text(5, 29 + $c, utf8_decode($product[$i]->Description));
        $pdf->Text(5, 33 + $c, $product[$i]->scanCode);
        $pdf->Text(20, 33 + $c, $product[$i]->Quantity);
        $precio_cantidad = $product[$i]->Quantity * $product[$i]->Price;
        $pdf->Text(28, 33 + $c, '$' . $precio_cantidad);
        $c += 8;
    }
    $c -= 8;
    $pdf->Text(5, 35 + $c, '------------------------------');
    $pdf->Text(25, 38 + $c, $prenote->narticles);
    $pdf->Text(5, 38 + $c, '$' . $prenote->total);
    $pdf->Text(5, 42 + $c, $prenote->id_employee);
    $pdf->Text(10, 42 + $c, $prenote->employeeName);
    $pdf->Text(5, 46 + $c, $prenote->store_id);
    $pdf->Text(10, 46 + $c, $prenote->store_name);
    $pdf->Text(5, 50 + $c, $prenote->cotizationNumber);
    $pdf->Text(5, 54 + $c, $prenote->date);
    $pdf->Output($prenote->folio . '.pdf', 'F');
}
示例#3
0
 function class_pdf_maker($orientation = 'P', $unit = 'in', $format = 'letter')
 {
     parent::FPDF($orientation, $unit, $format);
     parent::SetMargins(0, 0);
     parent::Open();
     parent::AddPage();
     parent::SetAutoPageBreak(FALSE);
 }
示例#4
0
 function Open($file)
 {
     if (FPDF_VERSION < '1.53') {
         $this->Error('Version 1.53 or above is required by this extension');
     }
     $this->f = fopen($file, 'wb');
     if (!$this->f) {
         $this->Error('Unable to create output file: ' . $file);
     }
     parent::Open();
     $this->_putheader();
 }
 public function Open($file = 'doc.pdf')
 {
     if (FPDF_VERSION < '1.7') {
         $this->Error('Version 1.7 or above is required by this extension');
     }
     $this->file = fopen($file, 'wb');
     if (!$this->file) {
         $this->Error("Unable to create output file: {$file}");
     }
     parent::Open();
     $this->_putheader();
 }
 /**
  * Constructor method
  * @param  $orientation Page orientation
  * @param  $format Page format
  * @author Pablo Dall'Oglio
  */
 public function __construct($orientation = 'P', $format = 'a4')
 {
     parent::__construct($orientation, 'pt', $format);
     $this->setLocale();
     parent::SetAutoPageBreak(true);
     parent::SetMargins(0, 0, 0);
     parent::SetCreator('Adianti Studio PDF Designer');
     // parent::SetTitle('Letter');
     // parent::SetKeywords('www.xyz.com.br');
     parent::SetFillColor(255, 255, 255);
     parent::Open();
     parent::AliasNbPages();
     parent::SetX(20);
     $this->replaces = array();
     $this->href = '';
     $this->anchors = array();
     $this->orientation = $orientation;
     $this->format = $format;
     parent::SetFont('Arial', '', 10 * 1.3);
 }
示例#7
0
function UsersTrafficPeriodPDF()
{
    //require('chart.php');
    require 'lib/fpdf.php';
    global $SAMSConf;
    global $DATE;
    $DB = new SAMSDB();
    $sdate = $DATE->sdate();
    $edate = $DATE->edate();
    $bdate = $DATE->BeginDate();
    $eddate = $DATE->EndDate();
    $size = "";
    if (isset($_GET["size"])) {
        $size = $_GET["size"];
    }
    require "reportsclass.php";
    $dateselect = new DATESELECT($DATE->sdate(), $DATE->edate());
    $lang = "./lang/lang.{$SAMSConf->LANG}";
    require $lang;
    define('FPDF_FONTPATH', 'lib/font/');
    require 'lib/fpdf.php';
    $pdfFile = new FPDF();
    $pdfFile->Open();
    $pdfFile->AddFont('Nimbus', '', 'Nimbus.php');
    $pdfFile->SetAuthor("SQUID Account Management System");
    $pdfFile->SetCreator("Created by SAMS2");
    $pdfFile->SetTitle("SAMS2 users statistic");
    //      UsersTrafficPeriodPDF();
    $pdfFile->AddPage();
    $pdfFile->SetFont('Nimbus', '', 15);
    //$pdfFile->SetFont('SUSESerif-Roman','',16);
    $pdfFile->SetXY(50, 15);
    echo " {$usersbuttom_2_traffic_UsersTrafficPeriod_1}<BR>{$usersbuttom_2_traffic_UsersTrafficPeriod_2}<br>";
    $pdfFile->Write(0, " {$usersbuttom_2_traffic_UsersTrafficPeriod_1}<BR>{$usersbuttom_2_traffic_UsersTrafficPeriod_2}");
    $pdfFile->Output();
}
示例#8
0
 public function get_toIDs_handler()
 {
     $dbc = $this->connection;
     $dbc->selectDB($this->config->get('OP_DB'));
     $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
     define('FPDF_FONTPATH', 'font/');
     include dirname(__FILE__) . '/../src/fpdf/fpdf.php';
     $pdf = new FPDF('P', 'mm', 'Letter');
     //start new instance of PDF
     $pdf->Open();
     //open new PDF Document
     $count = 0;
     $x = 0;
     $y = 0;
     $date = date("m/d/Y");
     $infoP = $dbc->prepare_statement("SELECT ItemQtty,total,regPrice,p.card_no,description,department,\n            CASE WHEN p.card_no=0 THEN o.lastName ELSE c.LastName END as name,\n            CASE WHEN p.card_no=0 THEN o.firstName ELSE c.FirstName END as fname,\n            CASE WHEN o.phone is NULL THEN m.phone ELSE o.phone END as phone,\n            discounttype,quantity,\n            p.mixMatch AS vendorName\n            FROM {$TRANS}PendingSpecialOrder AS p\n            LEFT JOIN custdata AS c ON p.card_no=c.CardNo AND personNum=p.voided\n            LEFT JOIN meminfo AS m ON c.CardNo=m.card_no\n            LEFT JOIN {$TRANS}SpecialOrders AS o ON o.specialOrderID=p.order_id\n            WHERE trans_id=? AND p.order_id=?");
     $flagP = $dbc->prepare_statement("UPDATE {$TRANS}PendingSpecialOrder SET charflag='P'\n            WHERE trans_id=? AND order_id=?");
     $idP = $dbc->prepare_statement("SELECT trans_id FROM {$TRANS}PendingSpecialOrder WHERE\n            trans_id > 0 AND order_id=? ORDER BY trans_id");
     $signage = new \COREPOS\Fannie\API\item\FannieSignage(array());
     foreach ($this->toIDs as $toid) {
         if ($count % 4 == 0) {
             $pdf->AddPage();
             $pdf->SetDrawColor(0, 0, 0);
             $pdf->Line(108, 0, 108, 279);
             $pdf->Line(0, 135, 215, 135);
         }
         $x = $count % 2 == 0 ? 5 : 115;
         $y = $count / 2 % 2 == 0 ? 10 : 145;
         $pdf->SetXY($x, $y);
         $tmp = explode(":", $toid);
         $tid = $tmp[0];
         $oid = $tmp[1];
         $r = $dbc->exec_statement($infoP, array($tid, $oid));
         $w = $dbc->fetch_row($r);
         // flag item as "printed"
         $r2 = $dbc->exec_statement($flagP, array($tid, $oid));
         $r3 = $dbc->exec_statement($idP, array($oid));
         $o_count = 0;
         $rel_id = 1;
         while ($w3 = $dbc->fetch_row($r3)) {
             $o_count++;
             if ($w3['trans_id'] == $tid) {
                 $rel_id = $o_count;
             }
         }
         $pdf->SetFont('Arial', '', '12');
         $pdf->Text($x + 85, $y, "{$rel_id} / {$o_count}");
         $pdf->SetFont('Arial', 'B', '24');
         $pdf->Cell(100, 10, $w['name'], 0, 1, 'C');
         $pdf->SetFont('Arial', '', '12');
         $pdf->SetX($x);
         $pdf->Cell(100, 8, $w['fname'], 0, 1, 'C');
         $pdf->SetX($x);
         if ($w['card_no'] != 0) {
             $pdf->Cell(100, 8, "Owner #" . $w['card_no'], 0, 1, 'C');
             $pdf->SetX($x);
         }
         $pdf->SetFont('Arial', '', '16');
         $pdf->Cell(100, 9, $w['description'], 0, 1, 'C');
         $pdf->SetX($x);
         $pdf->Cell(100, 9, "Cases: " . $w['ItemQtty'] . ' - ' . $w['quantity'], 0, 1, 'C');
         $pdf->SetX($x);
         $pdf->SetFont('Arial', 'B', '16');
         $pdf->Cell(100, 9, sprintf("Total: \$%.2f", $w['total']), 0, 1, 'C');
         $pdf->SetFont('Arial', '', '12');
         $pdf->SetX($x);
         if ($w['discounttype'] == 1 || $w['discounttype'] == 2) {
             $pdf->Cell(100, 9, 'Sale Price', 0, 1, 'C');
             $pdf->SetX($x);
         } elseif ($w['regPrice'] - $w['total'] > 0) {
             $percent = round(100 * (($w['regPrice'] - $w['total']) / $w['regPrice']));
             $pdf->Cell(100, 9, sprintf("Owner Savings: \$%.2f (%d%%)", $w['regPrice'] - $w['total'], $percent), 0, 1, 'C');
             $pdf->SetX($x);
         }
         $pdf->Cell(100, 6, "Tag Date: " . $date, 0, 1, 'C');
         $pdf->SetX($x);
         $pdf->Cell(50, 6, "Dept #" . $w['department'], 0, 0, 'R');
         $pdf->SetFont('Arial', 'B', '12');
         $pdf->SetX($x + 50);
         $pdf->Cell(50, 6, $w['vendorName'], 0, 1, 'L');
         $pdf->SetFont('Arial', '', '12');
         $pdf->SetX($x);
         $pdf->Cell(100, 6, "Ph: " . $w['phone'], 0, 1, 'C');
         $pdf->SetXY($x, $y + 85);
         $pdf->Cell(160, 10, "Notes: _________________________________");
         $pdf->SetX($x);
         $upc = "454" . str_pad($oid, 6, '0', STR_PAD_LEFT) . str_pad($tid, 2, '0', STR_PAD_LEFT);
         $pdf = $signage->drawBarcode($upc, $pdf, $x + 30, $y + 95, array('height' => 14, 'fontsize' => 8));
         $count++;
     }
     $pdf->Output();
     return false;
 }
示例#9
0
function createPDF($text)
{
    if (!isset($GLOBALS['pdf_font'])) {
        $GLOBALS['pdf_font'] = 'Arial';
        $GLOBALS['pdf_fontsize'] = 12;
    }
    $pdf = new FPDF();
    $pdf->SetCreator('PHPlist version ' . VERSION);
    $pdf->Open();
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont($GLOBALS['pdf_font'], $GLOBALS['pdf_fontstyle'], $GLOBALS['pdf_fontsize']);
    $pdf->Write((int) $GLOBALS['pdf_fontsize'] / 2, $text);
    $fname = tempnam($GLOBALS['tmpdir'], 'pdf');
    $pdf->Output($fname, false);
    return $fname;
}
 /**
  * @Template()     *
  * @Route("/statistique-participations/", name="statistiqueparticipations")
  */
 public function statistiqueParticipationsAction(Request $request)
 {
     $em = $this->getDoctrine()->getManager();
     if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
         $user = $this->getUser();
         $id = $user->getId();
         $activites = $this->get("alb_inscriptions.alb_manager")->getActivitesAdherent($id);
         $bureau = $this->get("alb_inscriptions.alb_manager")->isBureau($id, $activites);
         if ($bureau) {
             $groupes = $this->get("alb_inscriptions.alb_manager")->getGroupesAdherent($id);
             $activitesgroupe = $em->getRepository('ALBInscriptionsBundle:Activites')->findByIdgroupes($groupes);
             foreach ($activitesgroupe as $activite) {
                 $activites[] = $activite->getId();
             }
         }
         $activites = $this->get("alb_inscriptions.alb_manager")->getListeActivites($activites);
     } else {
         $activites = $em->getRepository('ALBInscriptionsBundle:Activites')->findAll();
         $groupes = $em->getRepository('ALBInscriptionsBundle:Groupes')->findAll();
     }
     if ('POST' === $request->getMethod()) {
         $activite = $request->get('activite');
         $groupe = $request->get('groupe');
         if ($activite > 0) {
             $nomactivite = $em->getRepository('ALBInscriptionsBundle:Activites')->find($activite)->getActivite();
         } elseif ($groupe > 0) {
             $nomactivite = $em->getRepository('ALBInscriptionsBundle:groupes')->find($groupe)->getGroupe();
         } else {
             $nomactivite = 'Toutes';
         }
         $datedebut = $request->get('datedebut');
         $datefin = $request->get('datefin');
         $nb = 0;
         if ($activite > 0) {
             $participants = $this->get("alb_inscriptions.alb_manager")->getListeParticipantsActivite($activite);
         } else {
             $participants = $this->get("alb_inscriptions.alb_manager")->getListeParticipants($groupe);
         }
         $nomfichier = 'statistiques/' . $activite . '.pdf';
         $pdf = new \FPDF();
         $pdf->Open();
         $pdf->SetTopMargin(5);
         $pdf->AddPage();
         $pdf->SetFont('Arial', 'B', 14);
         $pdf->Cell(0, 5, utf8_decode('Amicale Laïque de Billère'), 0, 1, 'C');
         $pdf->ln(2);
         $pdf->SetFont('Arial', '', 12);
         $pdf->Cell(0, 5, utf8_decode('Liste des présences aux sorties ' . $nomactivite . ' entre le ' . substr($datedebut, 8, 2) . '/' . substr($datedebut, 5, 2) . '/' . substr($datedebut, 0, 4) . ' et le ' . substr($datefin, 8, 2) . '/' . substr($datefin, 5, 2) . '/' . substr($datefin, 0, 4)), 0, 1);
         $pdf->ln(2);
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetFont('Arial', 'B', 8);
         $pdf->Cell(5, 4, '', 1, 0, 'C');
         $pdf->Cell(50, 4, utf8_decode('Nom Prénom'), 1, 0, 'C');
         //$pdf->Cell(20,4,utf8_decode('Activité'),1,0,'C');
         $pdf->Cell(30, 4, utf8_decode('Nb de présence'), 1, 1, 'C');
         $pdf->SetFont('Arial', '', 8);
         $i = 0;
         $encadrement = false;
         foreach ($participants as $participant) {
             if ($participant->getAidemeneur() and !$encadrement) {
                 $pdf->Cell(55, 4, 'TOTAL', 1, 0, 'R');
                 $pdf->Cell(30, 4, $nb, 1, 1, 'C');
                 $nb = 0;
                 $encadrement = true;
                 $i = 0;
                 $pdf->SetFont('Arial', 'B', 8);
                 $pdf->Cell(85, 5, 'ENCADREMENT', 0, 1, 'C');
                 $pdf->SetFont('Arial', '', 8);
                 $pdf->Cell(5, 4, '', 1, 0, 'C');
                 $pdf->Cell(50, 4, utf8_decode('Nom Prénom'), 1, 0, 'C');
                 //$pdf->Cell(20,4,utf8_decode('Activité'),1,0,'C');
                 $pdf->Cell(30, 4, utf8_decode('Nb de présence'), 1, 1, 'C');
             }
             $i++;
             $pdf->Cell(5, 4, $i, 1, 0, 'C');
             $pdf->Cell(50, 4, utf8_decode($participant->getIdadherent()->getNom() . ' ' . $participant->getIdadherent()->getPrenom()), 1, 0, '');
             $id = $participant->getId();
             if ($activite > 0) {
                 $nbparticipation = $this->get("alb_inscriptions.alb_manager")->getNbParticipationActivite($activite, $id, $datedebut, $datefin);
             } else {
                 $nbparticipation = $this->get("alb_inscriptions.alb_manager")->getNbParticipationGroupe($groupe, $id, $datedebut, $datefin);
             }
             $pdf->Cell(30, 4, $nbparticipation, 1, 1, 'C');
             $nb = $nb + $nbparticipation;
         }
         $pdf->Cell(55, 4, 'TOTAL', 1, 0, 'R');
         $pdf->Cell(30, 4, $nb, 1, 1, 'C');
         $pdf->Output($nomfichier, 'F');
         $response = new Response();
         $response->setContent(file_get_contents($nomfichier));
         $response->headers->set('Content-Type', 'application/force-download');
         $response->headers->set('Content-disposition', 'filename=' . $nomfichier);
         return $response;
     }
     return array('activites' => $activites, 'groupes' => $groupes);
 }
示例#11
0
 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();
 }
    $navs = oci_fetch_row($querynav);
    $nav_amount = $navs[1];
    //{}{}{}{}{}{}{}{}}{}{}{}{}{}{}{}{}}}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{
    $comp = "SELECT COMPANY_NAME, TEL, EMAIL,WEBSITE, ADDRESS,FAX from Company";
    $QryCompany = oci_parse($conn, $comp);
    oci_execute($QryCompany);
    while ($Companydet = oci_fetch_row($QryCompany)) {
        $compname = $Companydet[0];
        $comptel = $Companydet[1];
        $compemail = $Companydet[2];
        $compweb = $Companydet[3];
        $compadd = $Companydet[4];
        $compfax = $Companydet[5];
    }
    //{}{}{}{}{}{}{}{}}{}{}{}{}{}{}{}{}}}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{
    $sql = "SELECT * FROM TRANS WHERE ACCOUNT_NO='{$accno}' AND CONFIRMED IS NOT NULL AND DELETED IS NULL AND REVERSED IS NULL order by trans_id, TRANS_DATE asc";
    $querytrans = oci_parse($conn, $sql);
    oci_execute($querytrans);
}
$statement = new FPDF();
$statement->Open();
$statement->AddPage('L', 'a4');
$statement->Image('../images/logo.png', 10, 8, 80);
$statement->Ln();
$statement->SetFont('Times', '', 10);
$statement->Cell(170);
$statement->Cell(170, 05, 'P.O Box: ' . $compadd, 'R');
$statement->Ln();
$statement->Cell(170);
$statement->Cell(170, 06, 'Fax    : ' . $compfax, 'R');
$statement->Ln();
示例#13
0
<?php

include "../../libraries/tcpdf/font/times.php";
//fpdf
$this->load->library('fpdf');
//fpdf
$nombre = "";
$fpdf = new FPDF();
ob_end_clean();
//inicializa pagina pdf
$fpdf->Open();
$fpdf->AddPage();
$fpdf->SetAuthor("codigoweblibre.comli.co - codigoweblibre.wordpress.com", true);
$fpdf->SetCreator("codigoweblibre.comli.co - codigoweblibre.wordpress.com", true);
//Cabecera
$fpdf->SetFont('Arial', 'B', 12);
$fpdf->SetTextColor("0", "8", "8");
//rojo
//$fpdf->Image(base_url() . 'img/User.png', 10, 10, -100);
$fpdf->SetFontSize(10);
$fpdf->Image('imagenes/banner.png', 8, 10, 192, 22, 'PNG');
$fpdf->Cell(100, 30, ' ', 0, 1, 'C');
$fpdf->Image('imagenes/bandera2.png', 8, 35, 192, 1, 'PNG');
$fpdf->Cell(0, 6, 'UNIDAD EJECUTORA DE TITULACION', 0, 1, 'C');
$fpdf->Cell(0, 6, 'DEL MINISTERIO DE OBRAS PUBLICAS, SERVICIOS Y VIVIENDA', 0, 1, 'C');
$fpdf->SetFont('Arial', 'BU', 10);
$fpdf->Cell(0, 3, '', 0, 1, 'C');
$fpdf->Cell(0, 6, 'REPORTE DE PERSONAL POR FECHA DE MODIFICACION', 0, 1, 'C');
$fpdf->Ln();
$fpdf->SetFont('Arial', 'B', 10);
$fpdf->Cell(45, 7, "Nombre ", 1);
示例#14
0
// Variaveis de Tamanho
$mesq = "5";
// Margem Esquerda (mm)
$mdir = "5";
// Margem Direita (mm)
$msup = "12";
// Margem Superior (mm)
$leti = "72";
// Largura da Etiqueta (mm)
$aeti = "27";
// Altura da Etiqueta (mm)
$ehet = "3,2";
// Espaço horizontal entre as Etiquetas (mm)
$pdf = new FPDF('P', 'mm', 'Letter');
// Cria um arquivo novo tipo carta, na
vertical . $pdf->Open();
// inicia documento
$pdf->AddPage();
// adiciona a primeira pagina
$pdf->SetMargins('5', '12,7');
// Define as margens do documento
$pdf->SetAuthor("Jonas Ferreira");
// Define o autor
$pdf->SetFont('helvetica', '', 7);
// Define a fonte
$pdf->SetDisplayMode($zoom, $layout = 'continuous');
$coluna = 0;
$linha = 0;
//MONTA A ARRAY PARA ETIQUETAS
while ($dados = mysql_fetch_array($busca)) {
    $nome = $dados["nomefantasia"];
示例#15
0
 /**
  * @return void
  * @param string $numero_processo
  */
 public function generateFolhaDespachoProcesso($numero_processo)
 {
     define("FPDF_FONTPATH", "bibliotecas/fpdf/font/");
     include "bibliotecas/fpdf/fpdf.php";
     $stmt = Controlador::getInstance()->getConnection()->connection->prepare("SELECT PC.NUMERO_PROCESSO, PC.DT_AUTUACAO AS AUTUACAO, TB_PROCESSOS_INTERESSADOS.INTERESSADO,\n                                    TB_PROCESSOS_INTERESSADOS.CNPJ_CPF as CNPJ_CPF, PA.ASSUNTO\n                                FROM TB_PROCESSOS_CADASTRO PC INNER JOIN TB_PROCESSOS_ASSUNTO PA ON PA.ID = PC.ASSUNTO\n                                    INNER JOIN TB_PROCESSOS_INTERESSADOS ON TB_PROCESSOS_INTERESSADOS.ID = PC.INTERESSADO\n                                WHERE PC.NUMERO_PROCESSO = ? LIMIT 1");
     $stmt->bindParam(1, $numero_processo, PDO::PARAM_STR);
     $stmt->execute();
     $processo = $stmt->fetch(PDO::FETCH_ASSOC);
     if (empty($processo)) {
         print 'Processo não encontrado!';
         return;
     }
     $pdf = new FPDF();
     $pdf->Open();
     $pdf->AddPage();
     $pdf->SetFont("Arial", '', 10);
     $pdf->Image("imagens/" . __LOGO_JPG__, 95, 8, 20, 20);
     $pdf->Ln(2);
     $pdf->Cell(185, 8, "Folha de Despachos", 0, 0, 'R');
     $pdf->Ln(20);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 10);
     $pdf->Cell(180, 5, utf8_decode(__CABECALHO_ORGAO__), 0, 0, 'C');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(180, 5, '', 0, 0, 'R');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(180, 5, utf8_decode("Informações do Processo"), 0, 0, 'C');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(35, 5, utf8_decode("Número do Processo:"), 0, 0, 'L');
     $pdf->SetFont("Arial", '', 9);
     $pdf->Cell(90, 5, $numero_processo, 0, 0, 'L');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(30, 5, utf8_decode("Data da Autuação:"), 0, 0, 'L');
     $pdf->SetFont("Arial", '', 9);
     $pdf->Cell(25, 5, Util::formatDate($processo['AUTUACAO']), 0, 0, 'L');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(20, 5, "Interessado:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 9);
     $pdf->Cell(160, 5, utf8_decode($processo['INTERESSADO']), 0, 0, 'L');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(15, 5, "Assunto:", 0, 0, 'L');
     $pdf->SetFont("Arial", '', 9);
     $pdf->Cell(165, 5, utf8_decode($processo['ASSUNTO']), 0, 0, 'L');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->SetFont("Arial", "B", 9);
     $pdf->Cell(180, 5, "Despachos", 0, 0, 'C');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->Cell(5, 5, '', 0, 0, 'C');
     $pdf->Cell(180, 5, '', 0, 0, 'C');
     $pdf->Cell(5, 5, '', 0, 1, 'L');
     $pdf->SetFont("Arial", '', 7);
     $pdf->Cell(5, 64, "1", 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(5, 64, "2", 1, 1, 'C');
     $pdf->SetFont("Arial", '', 7);
     $pdf->Cell(5, 64, "3", 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(5, 64, "4", 1, 1, 'C');
     $pdf->SetFont("Arial", '', 7);
     $pdf->Cell(5, 64, "5", 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(90, 64, '', 1, 0, 'C');
     $pdf->Cell(5, 64, "6", 1, 1, 'C');
     $pdf->Output("bibliotecas/fpdf", "i");
 }
 public function create5160MailingLabelFile($results, $name = "dummy_")
 {
     $name .= date("M_d_Y") . ".pdf";
     $fpdf = new FPDF();
     $fpdf->Open();
     $fpdf->AddPage();
     $fpdf->SetFont('Arial', 'B', 10);
     $fpdf->SetMargins(0, 0);
     $fpdf->SetAutoPageBreak(false);
     $x = 0;
     $y = 0;
     // create the array of the ids want to query the database for addresses
     foreach ($results as $student) {
         $st = new PSUPerson($student['spriden_id'], array('address'));
         $LabelText = sprintf("%s\n%s\n%s, %s, %s", $student['spriden_last_name'] . ", " . $student['spriden_first_name'] . " " . $student['spriden_mi'], $st->address['CA'][0]->street_line1, $st->address['CA'][0]->city, $st->address['CA'][0]->stat_code, $st->address['CA'][0]->zip);
         $this->Avery5160($x, $y, $fpdf, $LabelText);
         $y++;
         // next row
         if ($y == 10) {
             // end of page wrap to next column
             $x++;
             $y = 0;
             if ($x == 3) {
                 // end of page
                 $x = 0;
                 $y = 0;
                 $fpdf->AddPage();
             }
         }
         $st->destroy();
     }
     echo $fpdf->Output($name, $destination = 'd');
 }
示例#17
0
 private static function createPDF($text)
 {
     if (Config::get('pdf_font', false) !== false) {
         Config::setRunningConfig('pdf_font', 'Arial');
         Config::setRunningConfig('pdf_fontsize', 12);
     }
     $pdf = new FPDF();
     $pdf->SetCreator('PHPlist version ' . PHPLIST_VERSION);
     $pdf->Open();
     $pdf->AliasNbPages();
     $pdf->AddPage();
     $pdf->SetFont(Config::get('pdf_font'), Config::get('pdf_fontstyle'), Config::get('pdf_fontsize'));
     $pdf->Write((int) Config::get('pdf_fontsize') / 2, $text);
     $fname = tempnam(Config::get('tmpdir'), 'pdf');
     $pdf->Output($fname, false);
     return $fname;
 }
示例#18
0
文件: tuto1.php 项目: tavo1981/phpbar
<?php

define('FPDF_FONTPATH', '../font/');
require '../fpdf.php';
$pdf = new FPDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 16);
$pdf->Cell(40, 10, 'Hello World!');
$pdf->Output();
示例#19
0
 function genSalon()
 {
     global $options;
     # paramètres
     $mg = 5;
     // Marge de gauche =>  initial 17
     $mh = 4;
     // Marge du haut =>  initial 9
     $md = 15;
     // Marge de droite
     $mb = 9;
     // Marge du bas
     $largeur_etiquette = 42;
     // largeur_etiquette =>  initial 60
     $espace_etiquettes = 13;
     // =>  initial 7
     $nb_ligne_etiquettes = 4;
     $nb_etiquette_ligne = 5;
     // Préparation du document PDF.
     $pdf = new FPDF('L', 'mm', 'A4');
     $pdf->Open();
     $pdf->SetLeftMargin($mg);
     $pdf->SetTopMargin($mh);
     $pdf->SetAutoPageBreak(1, 0);
     $pdf->AddPage();
     // Gestion des fonts
     $pdf->AddFont('code39', '', 'IDAutomation_Code_39.php');
     $pdf->SetFont('times', '', 12);
     // Préparation des informations.
     $nom = strtoupper($this->patient->getNom());
     $prenom = strtoupper($this->patient->getPrenom());
     $date = new clDate($this->patient->getDateNaissance());
     $duree = new clDuree();
     $dateN = $date->getDate("d/m/Y");
     $dateN .= " (" . $duree->getAge($date->getTimestamp()) . ")";
     if ($this->patient->getSexe() == "F") {
         $sexe = "Féminin";
         $e = "e";
     } elseif ($this->patient->getSexe() == "M") {
         $sexe = "Masculin";
         $e = "";
     } else {
         $sexe = "Indéterminé";
         $e = "";
     }
     $date->setDate($this->patient->getDateAdmission());
     $le = $date->getDate("d/m/Y H:i");
     $led = $date->getDate("d/m/Y");
     $leh = $date->getDate("H:i");
     $ipp = $this->patient->getILP();
     $nsej = $this->patient->getNSej();
     $uf = $this->patient->getUF();
     $sexe = $this->patient->getSexe();
     if ($uf == $options->getOption('numUFexec')) {
         $loc = '(URGENCES)';
     } else {
         $loc = '(UHCD)';
     }
     $tel = $this->patient->getTel();
     $adresse = $this->patient->getAdresse();
     $cpv = $this->patient->getCodePostal() . " " . $this->patient->getVille();
     $prev = $this->patient->getPrevenir();
     $medt = $this->patient->getMedecinTraitant();
     $modet = $this->patient->getMedecinTraitant();
     $adresseur = $this->patient->getAdresseur();
     $modeadm = $this->patient->getModeAdmission();
     // Grosse étiquette
     $pdf->Cell(20, 4, "", 0, 0, L);
     // Ligne 1
     $pdf->Cell(4 * $largeur_etiquette, 5, "CENTRE HOSPITALIER DE CARPENTRAS", 0, 1, L);
     // Ligne 2
     $pdf->Cell(11, 5, "Date : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(23, 5, "{$led}", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(13, 5, "Heure : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(27, 5, "{$leh}", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(21, 5, "N° Patient : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(22, 5, "{$ipp}", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(18, 5, "N° URG : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(22, 5, "{$nsej}", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(18, 5, "N° ARCHIVE : ", 0, 1, L);
     // Ligne 3
     $pdf->Cell(11, 5, "Nom : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(63, 5, strtoupper($nom), 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(13, 5, "Nom naissance : ", 0, 1, L);
     // Ligne 4
     $pdf->Cell(16, 5, "Prénom : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(58, 5, ucfirst(strtolower($prenom)), 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(12, 5, "Sexe : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(29, 5, "{$sexe}", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(12, 5, "N° S.S : ", 0, 1, L);
     // Ligne 5
     $pdf->Cell(17, 5, "Né(e) le : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(57, 5, $dateN, 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(12, 5, "A : ", 0, 1, L);
     // Ligne 6
     $pdf->Cell(17, 4, "Adresse : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(57, 4, $adresse, 0, 1, L);
     $pdf->SetFont('times', '', 12);
     // Ligne 5
     $pdf->Cell(115, 4, "", 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(9, 4, "Tél : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(20, 4, $tel, 0, 1, L);
     $pdf->SetFont('times', '', 12);
     // Ligne 6
     $pdf->Cell(17, 4, "", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(98, 4, $cpv, 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(9, 4, "Pays : ", 0, 1, L);
     // Ligne 7
     $pdf->Cell(17, 5, "Nom du tuteur : ", 0, 1, L);
     // Ligne 8
     $pdf->Cell(37, 5, "Personne à prévenir : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(98, 5, $prev, 0, 1, L);
     $pdf->SetFont('times', '', 12);
     // Ligne 9
     $pdf->Cell(23, 5, "Adressé par : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(51, 5, $adresseur, 0, 0, L);
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(30, 5, "Médecin traitant : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(98, 5, $medt, 0, 1, L);
     $pdf->SetFont('times', '', 12);
     // Ligne 10
     $pdf->Cell(34, 5, "Mode de transport : ", 0, 0, L);
     $pdf->SetFont('times', 'B', 12);
     $pdf->Cell(98, 5, $modeadm, 0, 1, L);
     $pdf->SetFont('times', '', 12);
     // Saut
     $pdf->Cell(1, 5.8, "", 0, 1);
     $pdf->SetFont('times', '', 9);
     for ($i = 1; $i <= $nb_ligne_etiquettes; $i++) {
         // Entrée
         $pdf->Cell($largeur_etiquette, 4, "Entrée du : {$led} à {$leh}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Entrée du : {$led} à {$leh}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Entrée du : {$led} à {$leh}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Entrée du : {$led} à {$leh}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Entrée du : {$led} à {$leh}", 0, 1, L);
         // D/Nais
         $pdf->Cell($largeur_etiquette, 4, "D/nais : {$dateN}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "D/nais : {$dateN}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "D/nais : {$dateN}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "D/nais : {$dateN}", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "D/nais : {$dateN}", 0, 1, L);
         // Nom
         $pdf->Cell($largeur_etiquette - 30, 4, "Nom : ", 0, 0, L);
         $pdf->SetFont('times', 'B', 9);
         $pdf->Cell(43, 4, strtoupper($nom), 0, 0, L);
         $pdf->SetFont('times', '', 9);
         $pdf->Cell($largeur_etiquette - 30, 4, "Nom : ", 0, 0, L);
         $pdf->SetFont('times', 'B', 9);
         $pdf->Cell(43, 4, strtoupper($nom), 0, 0, L);
         $pdf->SetFont('times', '', 9);
         $pdf->Cell($largeur_etiquette - 30, 4, "Nom : ", 0, 0, L);
         $pdf->SetFont('times', 'B', 9);
         $pdf->Cell(43, 4, strtoupper($nom), 0, 0, L);
         $pdf->SetFont('times', '', 9);
         $pdf->Cell($largeur_etiquette - 30, 4, "Nom : ", 0, 0, L);
         $pdf->SetFont('times', 'B', 9);
         $pdf->Cell(43, 4, strtoupper($nom), 0, 0, L);
         $pdf->SetFont('times', '', 9);
         $pdf->Cell($largeur_etiquette - 30, 4, "Nom : ", 0, 0, L);
         $pdf->SetFont('times', 'B', 9);
         $pdf->Cell(43, 4, strtoupper($nom), 0, 1, L);
         $pdf->SetFont('times', '', 9);
         // Prénom
         $pdf->Cell($largeur_etiquette, 4, "Prénom : " . ucfirst(strtolower($prenom)), 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Prénom : " . ucfirst(strtolower($prenom)), 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Prénom : " . ucfirst(strtolower($prenom)), 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Prénom : " . ucfirst(strtolower($prenom)), 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "Prénom : " . ucfirst(strtolower($prenom)), 0, 1, L);
         // NJF
         $pdf->Cell($largeur_etiquette, 4, "NJF : ", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "NJF : ", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "NJF : ", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "NJF : ", 0, 0, L);
         $pdf->Cell($espace_etiquettes, 4, "", 0, 0, L);
         $pdf->Cell($largeur_etiquette, 4, "NJF : ", 0, 1, L);
         // N° SS
         $pdf->Cell(9, 4, "NSej : ", 0, 0, L);
         $pdf->Cell(46, 4, "{$nsej}", 0, 0, L);
         $pdf->Cell(9, 4, "NSej : ", 0, 0, L);
         $pdf->Cell(46, 4, "{$nsej}", 0, 0, L);
         $pdf->Cell(9, 4, "NSej : ", 0, 0, L);
         $pdf->Cell(46, 4, "{$nsej}", 0, 0, L);
         $pdf->Cell(9, 4, "NSej : ", 0, 0, L);
         $pdf->Cell(46, 4, "{$nsej}", 0, 0, L);
         $pdf->Cell(9, 4, "NSej : ", 0, 0, L);
         $pdf->Cell(46, 4, "{$nsej}", 0, 1, L);
         // inter _etiquettes
         $pdf->Cell(1, 11, "", 0, 1);
     }
     $pdf->Output();
 }
 /**
  * @param mixed $id The entity id
  * @Template()     *
  * @Route("/etatfinancier", name="etatfinancier")
  */
 public function etatFinancierAction()
 {
     $date = new \DateTime();
     $etatfinancier = $this->get("alb_inscriptions.alb_manager")->getEtatFinancierApplication();
     $nomfichier = 'tresorerie/EF_' . $date->format('YmdHis') . '.pdf';
     $pdf = new \FPDF();
     $pdf->Open();
     $pdf->AddPage();
     $pdf->SetFont('Arial', 'B', 20);
     $pdf->Cell(0, 8, utf8_decode('Amicale Laïque de Billère'), 0, 1, 'C');
     $pdf->ln(4);
     $pdf->SetFont('Arial', '', 16);
     $pdf->Cell(0, 8, utf8_decode('Etat financier au ' . $date->format('d/m/Y')), 0, 1);
     $pdf->ln(4);
     $pdf->SetFont('Arial', '', 8);
     $pdf->Cell(5, 4, '', 1, 0, 'C');
     $pdf->Cell(45, 4, utf8_decode('Nom'), 1, 0, 'C');
     $pdf->Cell(31, 4, utf8_decode('Prénom'), 1, 0, 'C');
     $pdf->Cell(15, 4, utf8_decode('Montant'), 1, 1, 'C');
     $i = 0;
     $total = 0;
     foreach ($etatfinancier as $etatfinancier0) {
         foreach ($etatfinancier0 as $etat) {
             if ($etat['montant'] != 0) {
                 $i++;
                 $total = $total + $etat['montant'];
                 $pdf->Cell(5, 4, $i, 1, 0, 'C');
                 $pdf->Cell(45, 4, utf8_decode($etat['nom']), 1, 0, '');
                 $pdf->Cell(31, 4, utf8_decode($etat['prenom']), 1, 0, '');
                 $pdf->Cell(15, 4, number_format($etat['montant'], 2, ',', ' '), 1, 1, 'R');
             }
         }
     }
     $pdf->ln(4);
     $pdf->SetFont('Arial', '', 9);
     $pdf->Cell(45, 6, utf8_decode('Total : '), 0, 0, 'R');
     $pdf->Cell(20, 6, number_format($total, 2, ',', ' '), 0, 1, 'R');
     $pdf->Output($nomfichier, 'F');
     $response = new Response();
     $response->setContent(file_get_contents($nomfichier));
     $response->headers->set('Content-Type', 'application/force-download');
     $response->headers->set('Content-disposition', 'filename=' . $nomfichier);
     return $response;
 }
示例#21
0
function showPdf($idReg)
{
    global $db;
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from ENTRADA where id_entrada='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $entSal = $db->f('ent_sal');
        $idCliente = $db->f('id_cliente');
        $cliente = getValueTable("cliente", "CLIENTE", "id_cliente", $idCliente);
        $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);
        $bkg = $db->f('bkg');
        $clase = $db->f('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);
        $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);
        if ($entSal == "E") {
            $entF = $db->f('fec_ent');
            $entH = $db->f('hora');
            $entM = $db->f('minuto');
        }
        if ($entSal == "S") {
            $salF = $db->f('sal_f');
            $salH = $db->f('sal_h');
            $salM = $db->f('sal_m');
        }
    }
    $pdf = new FPDF();
    $pdf->Open();
    $pdf->SetMargins(20, 20, 20);
    $pdf->AddPage();
    //$pdf->Image('../images/logoPdf.jpg',75,15,15);
    // EIR
    $pdf->SetFont('Courier', '', 8);
    $pdf->Text(20, 30, "REF. {$entSal} {$idReg}");
    // Cliente
    $pdf->Text(10, 40, "{$cliente}");
    // Conte
    $pdf->Text(60, 40, $conteP1);
    $pdf->Text(80, 40, $conteP2);
    $pdf->Text(120, 40, $equipo);
    // Entregado por
    $pdf->Text(10, 50, $naviera);
    $pdf->Text(60, 50, "{$entF} {$entH}:{$entM}");
    $pdf->Text(100, 50, "BKG. {$bkg}");
    $pdf->Text(140, 50, "{$salF} {$salH}:{$salM}");
    // Transportista
    $entSal == "E" ? $pdf->Text(10, 60, $transp) : $pdf->Text(110, 60, $transp);
    // Operador y Placas
    $entSal == "E" ? $pdf->Text(10, 70, $operador) : $pdf->Text(110, 70, $operador);
    $entSal == "E" ? $pdf->Text(50, 70, $placas) : $pdf->Text(160, 70, $placas);
    $entSal == "E" ? $pdf->Text(20, 80, "CLASE :{$clase}") : $pdf->Text(120, 80, "CLASE : {$clase}");
    $entSal == "E" ? $pdf->Text(50, 80, $damage) : $pdf->Text(160, 80, $damage);
    $pdf->Text(130, 90, "NO. DE SELLO : {$sello}");
    $nota = str_replace("\n", "\r", $nota);
    $pdf->Text(110, 270, $nota);
    //$pdf->Ln(70);
    //$pdf->MultiCell(100,190,$nota,0,'L');
    // finalizar el documento pdf
    $pdf->Output();
}
function geraCertificado($Data, $NomeAluno, $Evento, $orador, $CargaHoraria, $organizadorEvento, $caminhoServidor)
{
    //CRIA O PDF
    $pdf = new FPDF();
    $pdf->SetTitle('Certificado de ' . utf8_decode($NomeAluno));
    // ABRE O PDF PARA EDIÇÃO
    $pdf->Open();
    // ADICIONA UMA PÁGINA AO ARQUIVO
    $pdf->AddPage('L', 'A4');
    $pdf->AddFont('Century', '', 'Century.php');
    // ADICIONA IMAGEM (CABEÇALHO)
    $pdf->Image('resources/images/header.png', 0, 5);
    $pdf->SetY(67);
    $pdf->SetX(20);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetFont('Century', '', 18);
    if ($orador != "") {
        $pdf->MultiCell(220, 10, utf8_decode("Certifico para os devidos fins que {$NomeAluno} participou, como ouvinte, do evento \"{$Evento}\" apresentado por \"{$orador}\" organizado pelo(a) {$organizadorEvento}, {$Data} com carga horária de {$CargaHoraria} horas."), 0, "J", false);
    } else {
        $pdf->MultiCell(220, 10, utf8_decode("Certifico para os devidos fins que {$NomeAluno} participou, como ouvinte, do evento \"{$Evento}\" organizado pelo(a) {$organizadorEvento}, {$Data} com carga horária de {$CargaHoraria} horas."), 0, "J", false);
    }
    //ADICIONA A ASSINATURA
    $pdf->Image('resources/images/assinaturaFulano.gif', 125, 130, 43, 16);
    //NOME DO ASSINANTE
    $pdf->SetFont('Century', '', 12);
    $pdf->SetY(157);
    $pdf->SetX(73);
    $pdf->Cell(145, 0, 'Sr. Fulano da Silva', 0, 0, 'C');
    //TITULO OU FUNCAO DO ASSINANTE
    $pdf->ln(7);
    $pdf->SetX(73);
    $pdf->Cell(145, 0, utf8_decode("Título/Função de Fulano da Silva"), 0, 0, 'C');
    //ENDEREÇO DO LOCAL A DESEJAR
    $pdf->SetY(175);
    $pdf->ln(4);
    $pdf->SetX(73);
    $pdf->Cell(145, 0, utf8_decode("Avenida Meu Endereço, São Paulo - SP"), 0, 0, 'C');
    //RODAPE COM DEMAIS INFORMACOES
    $pdf->ln(7);
    $pdf->SetX(73);
    $pdf->Cell(145, 0, '(11) 5555-5555 - www.seusite.com.br', 0, 0, 'C');
    //GERA O ARQUIVO PDF COM O NOME DO ALUNO E SALVA NO SERVIDOR EM PASTA ESPECIFICA DO EVENTO
    $NomeAlunoSemAcent = remove_acentuacao($NomeAluno, true);
    $EventoSemAcent = remove_acentuacao($Evento, true);
    $pdf->Output($caminhoServidor . "/{$EventoSemAcent}/" . $NomeAlunoSemAcent . ".pdf", "F");
}
 /**
  * valida email
  * @param string $email
  */
 public function geraProcessosDetran($orgao, $resultado, $anexar, $id_empresa, $id_usuario, $id_pedido, $ordem, $res_oficio)
 {
     if ($orgao == '') {
         $orgao = 'Detran';
     }
     if ($resultado == '') {
         $resultado = 'Nada Constou';
     }
     // Variaveis de Tamanho
     $mesq = "10";
     // Margem Esquerda (mm)
     $msup = "10";
     // Margem Superior (mm) margem mínima dois pois ficou cortando)
     /*Uma dica: estes tamanhos você pode verificar com uma régua ou na própria caixa da etiqueta, seja bem preciso e sugiro que faça o teste na impressora que vai ser utilizada, pois pode acontecer de na impressão começar a subir ou descer, portanto, você deverá aumentar ou diminuir a altura da etiqueta.
      */
     $m = date(m);
     $mes = traduzMes($m);
     $anexoDAO = new AnexoDAO();
     $impressoDAO = new ImpressoDAO();
     $atividadeDAO = new AtividadeDAO();
     $res = $impressoDAO->buscaPorId(28);
     $imprimir_topo = $res->topo;
     $id_impresso = $res->id_impresso;
     $imprimir_timbre = $res->timbre;
     $imprimir_sub = $res->sub;
     $imprimir_linha = $res->linhas;
     $frase = '';
     #if($anexar!='on'){
     $pdf = new FPDF('P', 'cm', 'A4');
     //papel personalizado
     $pdf->Open();
     $pdf->SetMargins(1, 2);
     //seta as margens do documento
     $pdf->SetAuthor('Softfox 2011');
     $pdf->SetFont('times', '', 7);
     $pdf->SetDisplayMode(100, 'continuous');
     //define o nivel de zoom do documento PDF
     $coluna = 0;
     $linha = 0;
     $posicaoH = 0;
     $posicaoV = 0;
     #}
     $impressao_ordem = '';
     $linha = 0;
     $frase .= $imprimir_topo;
     $bloco = '';
     if ($res_oficio->id_pedido != '') {
         $linha_bloco = 1;
         $orgao_regiao = $res_oficio->certidao_cidade;
         $orgao_regiao .= '-' . $res_oficio->certidao_estado;
         $impressao_ordem = '#' . $res_oficio->id_pedido . '/' . $res_oficio->ordem . ' ';
         $responsavel_endereco = $res_oficio->endereco . ' ' . $res_oficio->numero . ' ' . $res_oficio->complemento;
         $data_atual = $res_oficio->cidade . ', ' . date(d) . ' de ' . $mes . ' de 20' . date(y) . '.';
         $topo = str_replace('<certidao_nome>', $res_oficio->certidao_nome, $imprimir_topo);
         $topo = str_replace('<certidao_cnpj>', $res_oficio->certidao_cnpj, $topo);
         $topo = str_replace('<certidao_cpf>', $res_oficio->certidao_cpf, $topo);
         $topo = str_replace('<orgao>', $orgao, $topo);
         $topo = str_replace("<resultado>", $resultado, $topo);
         $topo = str_replace("<orgao_regiao>", $orgao_regiao, $topo);
         $topo = str_replace('<responsavel_empresa>', $res_oficio->fantasia, $topo);
         $topo = str_replace('<responsavel_endereco>', $responsavel_endereco, $topo);
         $topo = str_replace('<responsavel_cidade>', $res_oficio->cidade, $topo);
         $topo = str_replace('<responsavel_estado>', $res_oficio->estado, $topo);
         $topo = str_replace("<data>", $data_atual, $topo);
         $topo = str_replace('<impressao_ordem>', $impressao_ordem, $topo);
         $sub = str_replace('<responsavel_empresa>', $res_oficio->fantasia, $imprimir_sub);
         $sub = str_replace('<responsavel_endereco>', $responsavel_endereco, $sub);
         $sub = str_replace('<responsavel_cidade>', $res_oficio->cidade, $sub);
         $sub = str_replace('<responsavel_estado>', $res_oficio->estado, $sub);
         $sub = str_replace('<responsavel_cep>', $res_oficio->cep, $sub);
         $sub = str_replace('<responsavel_tel>', $res_oficio->tel, $sub);
         $sub = str_replace('<responsavel_fax>', $res_oficio->fax, $sub);
         $sub = str_replace('<responsavel_email>', $res_oficio->email, $sub);
         $pdf->AddPage();
         $pdf->Image('../images/header.jpg', '0', '0', '19', '3,04', 'JPG');
         $pdf->SetFont('', 'B', 12);
         $pdf->Cell('', 2, 'NÃO EMITIMOS E NEM VENDEMOS CERTIDÕES E SIM PRAZOS E SOLUÇÕES', '', 1, 'C');
         $pdf->SetFont('', 'B', 14);
         $pdf->Cell('', 2, 'Declaração de Busca', '', 1, 'C');
         $pdf->SetFont('', '', 12);
         $pdf->Write(1, $topo, '');
         $pdf->SetFont('', '', 12);
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, '', '', 1, 'C');
         $pdf->Cell('', 1, $data_atual, '', 1, 'C');
         $pdf->Cell('', 1, $impressao_ordem, '', 1, 'R');
         $pdf->ln();
         $pdf->ln();
         $pdf->ln();
         $pdf->ln();
         $pdf->Cell('', 1, $res_oficio->fantasia, '', 1, 'C');
         $pdf->ln();
         $pdf->ln();
         $pdf->Write(0.5, $sub, '');
         $pdf->Line(1, 25, 20, 25);
         $pdf->Ln();
         $pdf->Cell('', 0.5, $rodape, '', 1, 'C');
         $rodape = $responsavel_endereco . ', ' . $res_oficio->cidade . '-' . $res_oficio->estado . ' CEP: ' . $res_oficio->cep;
         $pdf->Cell('', 0.5, $rodape, '', 1, 'C');
         $rodape = 'Tel/Fax: ' . $res_oficio->tel . '/' . $res_oficio->fax . ' E-mail:' . $res_oficio->email;
         $pdf->Cell('', 0.5, $rodape, '', 1, 'C');
         $rodape = 'www.cartoriopostal.com.br';
         $pdf->Cell('', 0.5, $rodape, '', 1, 'C');
         if ($anexar == 'on' and $res_oficio->id_servico == '16') {
             $pdf->Close();
             //imprime a saida
             $num_a = $anexoDAO->listaAnexoPedidoNome($res_oficio->id_pedido_item, 'Declaração de Busca');
             if (COUNT($num_a) == 0) {
                 $file_path = "../anexosnovos/" . date('m') . '' . date('Y') . '/';
                 #alterado => "../anexos/"
                 if (!is_dir($file_path)) {
                     mkdir($file_path, 0777);
                 }
                 #alterado
                 $arq_anexo = $file_path . 'decla_busca_' . $res_oficio->id_pedido_item . '_' . time() . '.pdf';
                 $pdf->Output($arq_anexo, 'F');
                 //imprime a saida
                 $anexo->anexo = $arq_anexo;
                 $anexo->anexo_nome = 'Declaração de Busca';
                 $anexo->id_pedido_item = $res_oficio->id_pedido_item;
                 $anexo->id_usuario = $id_usuario;
                 $anexoDAO->inserir($anexo);
                 $ativ = $atividadeDAO->inserir('209', '', $id_usuario, $res_oficio->id_pedido_item);
                 return 'Declaração anexada para ' . $impressao_ordem . '<br>';
             } else {
                 return 'Declaração não pode ser anexada para ' . $impressao_ordem . ' porque o anexo já existe<br>';
             }
         } else {
             if ($anexar == 'on' and $res_oficio->id_servico != '16') {
                 return '<b>Declaração não pode ser anexada para ' . $impressao_ordem . ' porque o serviço não é "Pesquisa Detran</b>"<br>';
             }
         }
     }
     if ($anexar != 'on') {
         return $pdf->Output();
         //imprime a saida
     } else {
         return 1;
     }
 }