示例#1
0
 function getPdf($image)
 {
     require JPATH_SITE . "/components/com_flexpaper/fpdf/fpdf.php";
     $filePath = JPATH_SITE . "/components/com_flexpaper/output/certificate.pdf";
     $pdf = new FPDF('L', 'mm');
     $pdf->SetLeftMargin(0);
     $pdf->SetRightMargin(0);
     $pdf->SetTopMargin(0);
     $pdf->SetAutoPageBreak(false);
     $pdf->AddPage();
     $pdf->Image($image);
     $pdf_file = $pdf->Output($filePath, 'F');
     return $pdf_file;
 }
示例#2
0
 function etichette()
 {
     $db = new db_local();
     $sqlqry = "SELECT * FROM anagrafiche WHERE (a" . date("Y") . "=1 OR a" . (date("Y") - 1) . "=1) AND idcapo=0 and email = '' AND carica != 'NS' AND tiposocio IN ('SF','SO','SS') ORDER BY cognome,nome;";
     if ($db->query($sqlqry)) {
         require_once 'lib/fpdf/fpdf.php';
         $pdf = new FPDF();
         $pdf->SetMargins(0.5, 5, 1);
         $pdf->SetAutoPageBreak(true, 3);
         $pdf->AddPage('P', 'mm', 'A4');
         //$pdf->Cell(210,5,'',1,1);
         $intVar = 1;
         //$intX = $pdf->GetX();
         $intX = 0.5;
         $intY = $pdf->GetY();
         while ($db->next_record()) {
             $pdf->SetLeftMargin($intX);
             $pdf->SetXY($intX, $intY);
             $pdf->SetFont('Arial', 'B', 10);
             $pdf->Cell(75, 6, ' ', '', 1, 'L');
             $pdf->Cell(75, 6, ' ' . $db->record['cognome'] . ' ' . $db->record['nome'], '', 1, 'L');
             $pdf->SetFont('Arial', '', 10);
             $pdf->Cell(75, 6, ' ' . $db->record['via'], '', 1, 'L');
             $pdf->SetFont('Arial', '', 8);
             /*
             $pdf->Cell(53,6,$db->record['cap'],'',1,'L');
             $pdf->Cell(10,6,' ','',0,'L');
             $pdf->Cell(53,6,$db->record['cap'].' - '.$db->record['citta'].' ('.$db->record['prov'].')','',1,'L');
             */
             $pdf->Cell(75, 6, ' ' . $db->record['cap'] . ' - ' . $db->record['citta'] . ' (' . $db->record['prov'] . ')', '', 1, 'L');
             $pdf->Cell(75, 12, ' ', '', 1, 'L');
             if ($intVar < 3) {
                 $intX = $intX + 70;
                 $intY = $pdf->GetY() - 36;
             } else {
                 $intX = 0;
                 $intY = $pdf->GetY();
                 $intVar = 0;
             }
             $intVar++;
         }
         $pdf->Output();
     }
 }
示例#3
0
 public function drawPDF()
 {
     $pdf = new \FPDF('P', 'mm', 'Letter');
     if (\COREPOS\Fannie\API\FanniePlugin::isEnabled('CoopDealsSigns')) {
         $this->font = 'Gill';
         $this->alt_font = 'GillBook';
         define('FPDF_FONTPATH', dirname(__FILE__) . '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/');
         $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
         $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
     }
     $width = 52;
     // tag width in mm
     $height = 31;
     // tag height in mm
     $left = 6;
     // left margin
     $top = 16;
     // top margin
     $pdf->SetTopMargin($top);
     //Set top margin of the page
     $pdf->SetLeftMargin($left);
     //Set left margin of the page
     $pdf->SetRightMargin($left);
     //Set the right margin of the page
     $pdf->SetAutoPageBreak(False);
     // manage page breaks yourself
     $data = $this->loadItems();
     $num = 0;
     // count tags
     $x = $left;
     $y = $top;
     foreach ($data as $item) {
         // extract & format data
         $price = $item['normal_price'];
         $desc = strtoupper(substr($item['posDescription'], 0, 25));
         $brand = ucwords(strtolower(substr($item['brand'], 0, 13)));
         $pak = $item['units'];
         $size = $item['units'] . "-" . $item['size'];
         $sku = $item['sku'];
         $ppu = $item['pricePerUnit'];
         $vendor = substr($item['vendor'], 0, 7);
         $upc = $item['upc'];
         if ($num % 32 == 0) {
             $pdf->AddPage();
             $x = $left;
             $y = $top;
         } else {
             if ($num % 4 == 0) {
                 $x = $left;
                 $y += $height;
             }
         }
         $pdf->SetFont($this->font, '', 8);
         $pdf->SetXY($x, $y);
         // try normal wordwrap
         // but squeeze into two lines if needed
         $wrapped = wordwrap($desc, 12, "\n", true);
         if (count(explode("\n", $wrapped)) > 2) {
             $wrapped = substr($desc, 0, 12);
             if ($wrapped[11] != ' ') {
                 $wrapped .= '-';
             }
             $wrapped .= "\n";
             $wrapped .= trim(substr($desc, 12));
         }
         $pdf->MultiCell($width / 2, 3, $wrapped, 0, 'L');
         $pdf->SetX($x);
         $pdf->Cell($width / 2, 3, date('n/j/y ') . $size, 0, 1, 'L');
         $pdf->SetFont($this->font, 'B', 18);
         //change font for price
         $pdf->SetX($x);
         $pdf->Cell($width / 2, 8, $price, 0, 1, 'L');
         $args = array('height' => 7, 'align' => 'L', 'fontsize' => 8, 'width' => 0.23, 'font' => $this->font);
         $b_y = $pdf->GetY();
         $pdf = $this->drawBarcode($upc, $pdf, $x, $b_y, $args);
         // move right by tag width
         $x += $width;
         $num++;
     }
     $pdf->Output('Tags4x8P.pdf', 'I');
 }
function createContentFile($mod, $statement, $uid, $bild)
{
    //Erzeugung der pdf-Galerie
    //echo "Statement in Fkt: ".$statement;
    //$statement fuer exif, desc, zeit, kat(ausser Wurzel) uebergeben
    include '../share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    switch ($mod) {
        case 'geo':
            $statement = explode(' ', $statement);
            //
            $num100 = count($statement);
            break;
        default:
            $result100 = mysql_query("{$statement}");
            @($num100 = mysql_num_rows($result100));
            break;
    }
    if ($statement !== '') {
        //echo $statement;
        //echo "gefundene Bilder: ".$num100."<BR>";
        //memory_limit dynamisch anpassen, falls der berechnete Wert groesser als der vorhandene Wert ist.
        $steps = ceil($num100 / 100);
        //echo "<font color='white'>".$steps." - </font>";
        $memory_avail = ini_get('memory_limit');
        $memory_value = $steps * 50;
        if ($memory_value > $memory_avail) {
            $memory = $memory_value . "M";
            ini_set('memory_limit', $memory);
        }
        //echo "<font color='white'>".ini_get('memory_limit')."</font>";
        $seiten = floor($num100 / 20) + 1;
        define('FPDF_FONTPATH', '../share/fpdf/font/');
        require $sr . '/bin/share/fpdf/fpdf.php';
        $pdf = new FPDF('P', 'mm', 'A4');
        $pdf->SetLeftMargin(20);
        $pdf->SetFont('Arial', '', 10);
        $aktdatum = date('d.m.Y');
        for ($seite = '0'; $seite < $seiten; $seite++) {
            $pdf->AddPage();
            $pdf->Cell(0, 5, 'pic2base-Galerie', 0, 1, 'C');
            $pdf->Cell(0, 5, 'Tipp: Mit einem Klick auf den Dateinamen erhalten Sie die vergr' . utf8_decode(ö) . 'sserte Ansicht des betreffenden Bildes.', 0, 1, 'C');
            for ($zeile = '0'; $zeile < '5'; $zeile++) {
                $y_mitte = 50 + $zeile * 48;
                for ($spalte = '0'; $spalte < '4'; $spalte++) {
                    $x_mitte = 45 + $spalte * 45;
                    //Ermittlung des QH-/Ori-Dateinamens und der Bild-Masse
                    $zaehler = $spalte + $zeile * 4 + $seite * 20;
                    if ($zaehler < $num100) {
                        //echo $zaehler;
                        switch ($mod) {
                            case 'geo':
                                switch ($bild) {
                                    case '0':
                                        $result102 = mysql_query("SELECT * FROM {$table2} WHERE pic_id = '{$statement[$zaehler]}'");
                                        $FileNameV = mysql_result($result102, 0, 'FileNameV');
                                        //$FileNameHQ = mysql_result($result102, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/thumbs/' . $FileNameV));
                                        break;
                                    case '1':
                                        $result102 = mysql_query("SELECT * FROM {$table2} WHERE pic_id = '{$statement[$zaehler]}'");
                                        $FileNameHQ = mysql_result($result102, 0, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/hq-preview/' . $FileNameHQ));
                                        break;
                                }
                                $FileName = mysql_result($result102, 0, 'FileName');
                                break;
                            default:
                                switch ($bild) {
                                    case '0':
                                        $FileNameV = mysql_result($result100, $zaehler, 'FileNameV');
                                        $FileNameHQ = mysql_result($result100, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/thumbs/' . $FileNameV));
                                        break;
                                    case '1':
                                        $FileNameHQ = mysql_result($result100, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/hq-preview/' . $FileNameHQ));
                                        break;
                                }
                                $FileName = mysql_result($result100, $zaehler, 'FileName');
                                break;
                        }
                        $breite = $parameter_v[0];
                        $hoehe = $parameter_v[1];
                        //echo $hoehe." / ";
                        if ($hoehe !== '0' and $hoehe !== "" and $hoehe !== NULL) {
                            $ratio = $breite / $hoehe;
                            if ($ratio > '1') {
                                //Breitformat
                                $Breite = 40;
                                $Hoehe = number_format($Breite / $ratio, 0, '.', ',');
                            } else {
                                //Hochformat
                                $Hoehe = 40;
                                $Breite = number_format($Hoehe * $ratio, 0, '.', ',');
                            }
                            $x0 = $x_mitte - $Breite / 2;
                            $y0 = $y_mitte - $Hoehe / 2;
                            switch ($bild) {
                                case '0':
                                    $pdf->Image($sr . '/images/vorschau/thumbs/' . $FileNameV, $x0, $y0, $Breite, $Hoehe, 'jpg');
                                    break;
                                case '1':
                                    $pdf->Image($sr . '/images/vorschau/hq-preview/' . $FileNameHQ, $x0, $y0, $Breite, $Hoehe, 'jpg');
                                    break;
                            }
                            //Ausgabe des Dateinamens:
                            $x1 = $x_mitte - 15;
                            $y1 = $y_mitte + 21;
                            $pdf->SetXY($x1, $y1);
                            $pdf->SetFont('Arial', '', 8);
                            $pdf->Cell(30, 5, $FileName, 0, 0, 'C', 5, 'http://' . $_SERVER['SERVER_NAME'] . $inst_path . '/pic2base/images/vorschau/hq-preview/' . $FileNameHQ);
                            //$pdf->Cell(30,5,$FileName,0,0,C,0,'http://www.pic2base.de');
                        } else {
                            echo "<FONT COLOR='yellow'>Ein oder mehrere Vorschaubilder stehen f&uuml;r die Thumbnail-Galerie nicht zur Verf&uuml;gung.<BR>Bitte lassen Sie von Ihrem Administrator die Datenbank-Wartung ausf&uuml;hren.</FONT>";
                        }
                    }
                }
            }
            $seiten_nr = $seite + 1;
            $pdf->SetXY(25, 270);
            $pdf->Cell(0, 6, 'Druckdatum: ' . $aktdatum . ', Seite ' . $seiten_nr . ' von ' . $seiten, 0, 1, 'C');
            $pdf->SetFont('Arial', '', 10);
        }
        $pdf->Output($p2b_path . 'pic2base/userdata/' . $uid . '/kml_files/thumb-gallery.pdf');
    }
}
示例#5
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();
 }
示例#6
0
 function __construct($products, $order, $filename, $save = false)
 {
     App::import('vendor', 'fpdf/fpdf');
     $orientation = 'P';
     $unit = 'pt';
     $format = 'A4';
     $margin = 40;
     $pdf = new FPDF($orientation, $unit, $format);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     setlocale(LC_MONETARY, 'th_TH');
     $pdf->AddPage();
     $pdf->SetTopMargin($margin);
     $pdf->SetLeftMargin($margin);
     $pdf->SetRightMargin($margin);
     $pdf->SetAutoPageBreak(true, $margin);
     $pdf->SetY($pdf->GetY() + 60);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetTextColor(0);
     $pdf->SetFillColor(255);
     $pdf->SetLineWidth(1);
     $pdf->Cell(50, 25, "Order ID: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(50, 25, $order['Order']['id'], 'T', 0, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, 'Customer Name: ', 'T', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(316, 25, $order['User']['name'], 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(100, 25, "Delivery Date: ", 'LT', 0, 'L');
     $pdf->SetFont('Arial', '');
     $pdf->Cell(416, 25, $timeHelper->format($format = 'd-m-Y', $order['Delivery']['date']), 'TR', 1, 'L');
     $pdf->SetFont('Arial', 'B', '10');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 30;
     $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Ordered", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "Number Supplied", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount per Unit", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount\n ", 'LTR', 'C');
     $pdf->SetY($pdf->GetY() - 25);
     $pdf->SetFont('Arial', '');
     $pdf->SetFillColor(238);
     $pdf->SetLineWidth(0.2);
     $pdf->SetY($pdf->GetY() + 25);
     $num = 1;
     $number_ordered = 0;
     $number_supplied = 0;
     foreach ($products as $product) {
         $pdf->Cell(30, 20, $num++, 1, 0, 'L');
         $pdf->Cell(250, 20, $product['Product']['short_description'], 1, 0, 'L');
         $pdf->Cell(48, 20, $product['LineItem']['quantity'], 1, 0, 'R');
         $number_ordered += $product['LineItem']['quantity'];
         $pdf->Cell(48, 20, $product['LineItem']['quantity_supplied'], 1, 0, 'R');
         $number_supplied += $product['LineItem']['quantity_supplied'];
         $pdf->Cell(70, 20, money_format("%i", $product['Product']['selling_price']), 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $product['LineItem']['total_price_supplied']), 1, 1, 'R');
     }
     $pdf->SetX($pdf->GetX() + 30);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(250, 20, "TOTALS", 1);
     $pdf->SetFont('Arial', '');
     $pdf->Cell(48, 20, $number_ordered, 1, 0, 'R');
     $pdf->Cell(48, 20, $number_supplied, 1, 0, 'R');
     $pdf->Cell(70, 20, "N.A.", 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $order['Order']['total_supplied']), 1, 1, 'R');
     $pdf->SetY($pdf->GetY() + 25);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Amount Paid: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Actual Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total_supplied']), 0, 1);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(80, 20, "Rebate Amount: ");
     $pdf->SetFont('Arial', '');
     $pdf->Cell(80, 20, money_format("%i", $order['Order']['total'] - $order['Order']['total_supplied']), 0, 1);
     if ($save) {
         $pdf->Output($filename, 'F');
     } else {
         $pdf->Output($filename, 'I');
     }
 }
示例#7
0
 /**
  *   Print tickets as PDF documents
  *   Tickets can be printed for an event, a single occurrence,
  *   or all tickets for a user ID.
  *
  *   @param  string  $ev_id  Event ID
  *   @param  integer $rp_id  Repeat ID
  *   @param  integer $uid    User ID
  *   @return string          PDF Document containing tickets
  */
 public static function PrintTickets($ev_id = '', $rp_id = 0, $uid = 0)
 {
     global $_CONF;
     $checkin_url = $_CONF['site_admin_url'] . '/plugins/evlist/checkin.php?tic=';
     // get the tickets, paid and unpaid. Need event id and uid.
     $tickets = self::GetTickets($ev_id, $rp_id, $uid);
     // The PDF functions in lgLib are a recent addition. Make sure that
     // the lgLib version supports PDF creation since we can't yet check
     // the lglib version during installation
     if (empty($tickets) || !function_exists('USES_lglib_class_fpdf')) {
         return "There are no tickets available to print";
     }
     USES_lglib_class_fpdf();
     USES_evlist_class_repeat();
     USES_evlist_class_tickettype();
     $ev_id = NULL;
     // create params array for qrcode, if used
     $params = array('module_size' => 5);
     $pdf = new FPDF();
     $pdf->SetLeftMargin(20);
     $pdf->AddPage();
     $tic_types = array();
     foreach ($tickets as $tic_id => $ticket) {
         if (!isset($tick_types[$ticket->tic_type])) {
             $tick_types[$ticket->tic_type] = new evTicketType($ticket->tic_type);
         }
         // If we don't already have the event info, get it and construct
         // the address string
         if ($ev_id != $ticket->ev_id) {
             $Ev = new evEvent($ticket->ev_id);
             $ev_id = $Ev->id;
             $addr = array();
             if ($Ev->Detail->street != '') {
                 $addr[] = $Ev->Detail->street;
             }
             if ($Ev->Detail->city != '') {
                 $addr[] = $Ev->Detail->city;
             }
             if ($Ev->Detail->province != '') {
                 $addr[] = $Ev->Detail->province;
             }
             if ($Ev->Detail->country != '') {
                 $addr[] = $Ev->Detail->country;
             }
             if ($Ev->Detail->postal != '') {
                 $addr[] = $Ev->Detail->postal;
             }
             $address = implode(' ', $addr);
         }
         // Get the repeat(s) for the ticket(s) to print a ticket for each
         // occurrence.
         $repeats = evRepeat::GetRepeats($ticket->ev_id, $ticket->rp_id);
         foreach ($repeats as $rp_id => $event) {
             $ev_date = $event->date_start;
             $ev_time = $event->time_start1 . ' - ' . $event->time_end1;
             if (!empty($event->time_start2)) {
                 $ev_time .= '; ' . $event->time_start1 . ' - ' . $event->time_end2;
             }
             $fee = self::formatAmount($ticket->fee);
             // Get the veritcal position of the current ticket
             // for positioning the qrcode
             $y = $pdf->GetY();
             // Title
             $pdf->SetFont('Times', 'B', 12);
             $pdf->Cell(130, 10, "{$tick_types[$ticket->tic_type]->description}: {$Ev->Detail->title}", 1, 0, 'C');
             $pdf->Ln(13);
             $pdf->SetFont('Times', '', 12);
             $pdf->SetX(-40);
             $pdf->Cell(0, 30, 'Fee: ' . $fee);
             if ($ticket->fee > 0) {
                 $pdf->Ln(5);
                 if ($ticket->paid >= $ticket->fee) {
                     $pdf->SetX(-40);
                     $pdf->Cell(0, 30, 'Paid');
                 } else {
                     $pdf->SetX(-55);
                     $due = $ticket->fee - $ticket->paid;
                     $pdf->Cell(0, 30, 'Balance Due: ' . self::formatAmount($due));
                 }
             }
             $pdf->SetX(20);
             $pdf->Cell(0, 8, "Date:", 0, 0);
             $pdf->setX(40);
             $pdf->Cell(0, 8, $ev_date, 0, 1);
             $pdf->Cell(0, 6, "Time:", 0, 0);
             $pdf->SetX(40);
             $pdf->Cell(0, 6, $ev_time, 0, 1);
             if ($Ev->Detail->location != '') {
                 $pdf->Ln(5);
                 $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $Ev->Detail->location, 0, 1);
             }
             if (!empty($address)) {
                 if ($Ev->Detail->location == '') {
                     $pdf->Ln(5);
                     $pdf->Cell(0, 2, 'Where: ', 0, 0);
                 }
                 $pdf->Ln(4);
                 $pdf->SetX(40);
                 $pdf->Cell(0, 2, $address, 0, 1);
             }
             // Footer
             $pdf->Ln(6);
             $pdf->setFont('Times', 'I', 10);
             $pdf->Cell(0, 10, $_CONF['site_name'], 0, 0);
             $pdf->Ln(6);
             $pdf->Cell(0, 10, $ticket->tic_id);
             // print qrcode if possible
             $params['data'] = $checkin_url . $tic_id . '&rp=' . $rp_id;
             $qrc_status = LGLIB_invokeService('qrcode', 'getcode', $params, $qrcode, $svc_msg);
             if ($qrc_status == PLG_RET_OK) {
                 $pdf->SetX(-40);
                 $pdf->Image($qrcode['path'], null, $y, 25);
             }
             $pdf->Ln();
             $y = $pdf->GetY();
             $pdf->Line(10, $y, 200, $y);
             $pdf->Ln();
         }
     }
     $pdf->Output();
 }
示例#8
0
文件: sbr.php 项目: amage/fl-ru-damp
 /**
  * Генерирует PDF-документ на основании XML-файла.
  *
  * @param string $file          Файл для обработки
  * @param mixed $replacements   массив для подстановки значений
  * @return FPDF сформированный документ PDF или FALSE в случае неудачи
  */
 public static function xml2pdf($file, $replacements = false)
 {
     // Новая обработка PDF
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/odt2pdf.php';
     $tpl = basename($file, ".xml") . ".odt";
     $t = new odt2pdf($tpl);
     $t->convert($replacements);
     return $t;
     /**
      * @deprecated
      */
     if (!file_exists($file)) {
         return false;
     }
     require_once dirname(__FILE__) . '/fpdf/fpdf.php';
     define('FPDF_FONTPATH', dirname(__FILE__) . '/fpdf/font/');
     if (is_array($replacements)) {
         foreach ($replacements as &$val) {
             $val = htmlspecialchars_decode($val, ENT_QUOTES);
         }
     }
     $replacements['$tab'] = '    ';
     $xml = new DOMDocument('1.0', 'windows-1251');
     $xml->load($file);
     $pdf = new FPDF();
     // Загружаем шрифты
     $pdf->AddFont('ArialMT', '', 'c9bb7ceca00657d007d343f4e34b71a8_arial.php');
     $pdf->AddFont('Arial-BoldMT', '', '9cb9fc616ba50d7ecc7b816984f2ffda_arialbd.php');
     $pdf->AddFont('TimesNewRomanPSMT', '', '5f37f1915715e014ee2254b95c0b6cab_times.php');
     $pdf->AddFont('TimesNewRomanPS-BoldMT', '', 'e07f6c05a47ebec50a80f29789c7f1f6_timesbd.php');
     /*
             Загружаем XML-документ и читаем из него основные параметры лоя итогового PDF-документа
     */
     $root = $xml->documentElement;
     $title = $root->getAttribute('title') ? iconv('windows-1251', 'utf-8', $root->getAttribute('title')) : '';
     // заголовок документа
     $author = $root->getAttribute('author');
     // автор
     $margin_left = $root->getAttribute('margin-left') ? $root->getAttribute('margin-left') : 20;
     // отступ слева
     $margin_right = $root->getAttribute('margin-right') ? $root->getAttribute('margin-right') : 20;
     // отступ справа
     $margin_top = $root->getAttribute('margin-top') ? $root->getAttribute('margin-top') : 20;
     // отступ сверху
     $font_name = $root->getAttribute('font-name') ? $root->getAttribute('font-name') : 'ArialMT';
     // дефолтный шрифт (имя)
     $font_size = (int) $root->getAttribute('font-size') ? (int) $root->getAttribute('font-size') : 10;
     // дефолтный шрифт (размер)
     $text_width = (int) $root->getAttribute('width') ? (int) $root->getAttribute('width') : 170;
     // ширина печатной области документа
     $paragraph_indent = (int) $root->getAttribute('paragraph-indent') ? (int) $root->getAttribute('paragraph-indent') : 0;
     // отступ между параграфами
     $printable = $pdf->h - $margin_top - 20;
     $pdf->SetTitle($title, true);
     $pdf->SetAuthor($author);
     $pdf->SetLeftMargin($margin_left);
     $pdf->SetRightMargin($margin_right);
     $pdf->SetTopMargin($margin_top);
     $pdf->AddPage();
     $pdf->SetFont($font_name, '', $font_size);
     $pdf->SetX($margin_left);
     $locates = array();
     // разбор XML-документа
     $xpath = new DOMXPath($xml);
     $scale = $xpath->query('/document/page/*');
     if ($scale->length) {
         $footer = $xpath->query('//footer');
         $footer = $footer->length ? $footer->item(0) : NULL;
         $no_brake = $xpath->query('//nobreak');
         $no_brake = $no_brake->length ? TRUE : FALSE;
         // если есть теги <nobreak>, то расставляем разрывы страниц руками
         if ($no_brake) {
             $pdf->SetAutoPageBreak(false);
         }
         $last_y = 0;
         $pages = array();
         foreach ($scale as $node) {
             $last_y = intval($pdf->y);
             if ($node->tagName == 'nobreak' && $node->getAttribute('start')) {
                 $max_h = $last_y;
                 $loc_offset = 0;
                 foreach ($xpath->query('//cell|locate[(following::nobreak)]') as $i => $nd) {
                     if ($nd->tagName == 'nobreak' && $node->getAttribute('end')) {
                         break;
                     }
                     $_h = $nd->getAttribute('height');
                     if ($i > 0 && !$loc_offset) {
                         $_h = 0;
                     }
                     $max_h += intval($_h);
                     $loc_offset = $nd->getAttribute('x_offset');
                 }
                 $max_h += $last_y;
                 if ($max_h > $printable) {
                     if ($footer) {
                         $pdf->SetY(-20);
                         $pdf->SetFont($font_name, '', 9);
                         $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                         $pages[] = $pdf->PageNo();
                     }
                     $pdf->AddPage();
                 }
             }
             if ($no_brake && $pdf->y > $printable) {
                 if ($footer && !in_array($pdf->PageNo(), $pages)) {
                     $pdf->SetY(-20);
                     $pdf->SetFont($font_name, '', 9);
                     $pdf->Cell(0, 10, self::prepareNodeText($footer), 0, 0, 'C');
                     $pages[] = $pdf->PageNo();
                 }
                 $pdf->AddPage();
             }
             if (!(int) $node->getAttribute('keep-pos')) {
                 $pdf->SetX($margin_left);
             }
             // сброс позиции по X-оси если <node keep-pos="0" или не задан
             if ((int) $node->getAttribute('offset-left')) {
                 $pdf->SetX((int) $node->getAttribute('offset-left') + $margin_left);
             }
             if ($node->tagName == 'text') {
                 // вывод строки
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'C';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $text = self::prepareNodeText($node, $replacements);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->Cell($width, $height, trim($text), $border, 1, $align);
             } elseif ($node->tagName == 'paragraph') {
                 // выводит многострочный текстовый блок, можно указывать тип выравнивания текста (L, J, R, C)
                 if (($show_if = $node->getAttribute('show-if')) && !$replacements[$show_if]) {
                     continue;
                 }
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') ? strtoupper($node->getAttribute('border')) : 0;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $skip_empty = (int) $node->getAttribute('skip-empty') ? (int) $node->getAttribute('skip-empty') : 0;
                 if ((int) $skip_empty) {
                     if (!trim($text)) {
                         continue;
                     }
                 }
                 $pdf->MultiCell($width, $height, $text, $border, $align);
                 if ($paragraph_indent) {
                     $pdf->Ln($paragraph_indent);
                 }
             } elseif ($node->tagName == 'ln') {
                 // перевод строки
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $pdf->Ln($height);
             } elseif ($node->tagName == 'cell') {
                 // рисует ячейку
                 if ($node->getAttribute('font-name')) {
                     $font_name = $node->getAttribute('font-name');
                 }
                 if ((int) $node->getAttribute('font-size')) {
                     $font_size = (int) $node->getAttribute('font-size');
                 }
                 $align = $node->getAttribute('align') ? strtoupper($node->getAttribute('align')) : 'J';
                 $width = (int) $node->getAttribute('width') ? (int) $node->getAttribute('width') : $text_width;
                 $height = (int) $node->getAttribute('height') ? (int) $node->getAttribute('height') : 5;
                 $border = $node->getAttribute('border') != '' ? (int) $node->getAttribute('border') : 1;
                 $keep_text_wrap = (int) $node->getAttribute('keep-text-wrap') ? (int) $node->getAttribute('keep-text-wrap') : 0;
                 $text = self::prepareNodeText($node, $replacements, $keep_text_wrap);
                 if (!($color = $node->getAttribute('color'))) {
                     $color = '000000';
                 }
                 $pdf->SetTextColor(hexdec(substr($color, 0, 2)), hexdec(substr($color, 2, 2)), hexdec(substr($color, 4, 2)));
                 $pdf->SetFont($font_name, '', $font_size);
                 $pdf->Cell($width, $height, $text, $border, 0, $align);
             } elseif ($node->tagName == 'locate') {
                 // перемещает указатель в определенную позицию в документе
                 $x = $node->getAttribute('x') ? $node->getAttribute('x') : 0;
                 $y = $node->getAttribute('y') ? $node->getAttribute('y') : 0;
                 $x_offset = (int) $node->getAttribute('x_offset') ? (int) $node->getAttribute('x_offset') : 0;
                 $y_offset = (int) $node->getAttribute('y_offset') ? (int) $node->getAttribute('y_offset') : 0;
                 if (strpos($x, '@') !== false) {
                     $x = $locates['x'][$x] + $x_offset;
                 }
                 if (strpos($y, '@') !== false) {
                     $y = $locates['y'][$y] + $y_offset;
                 }
                 if (!$x) {
                     $x = $pdf->GetX() + $x_offset;
                 }
                 if (!$y) {
                     $y = $pdf->GetY() + $y_offset;
                 }
                 $pdf->SetXY($x, $y);
             } elseif ($node->tagName == 'fix-locate') {
                 // перемещает указатель в определенную позицию в документе
                 if ($x = $node->getAttribute('x')) {
                     $locates['x'][$x] = $pdf->GetX();
                 }
                 if ($y = $node->getAttribute('y')) {
                     $locates['y'][$y] = $pdf->GetY();
                 }
             } elseif ($node->tagName == 'line') {
                 // рисует простую горизонтальную линию
                 $x = (int) $node->getAttribute('x') ? (int) $node->getAttribute('x') : $margin_left;
                 $y = (int) $node->getAttribute('y') ? (int) $node->getAttribute('y') : $margin_top;
                 $len = (int) $node->getAttribute('len') ? (int) $node->getAttribute('len') : $text_width;
                 if ($x) {
                     $pdf->setX($x);
                 }
                 if ($y) {
                     $pdf->setY($y);
                 }
                 $pdf->Cell($len, 0, '', 1);
             } elseif ($node->tagName == 'newpage') {
                 //новая страница и перевод указателя на нее
                 $pdf->AddPage();
             }
         }
     }
     return $pdf;
 }
 public function generar_pdf($id_cor, $id_direccion_gen)
 {
     $correspondencia = $this->ivss_model->core_parcial($id_cor)->result();
     $direccion_general = $this->ivss_model->ver_direccion_general_especifica($id_direccion_gen);
     foreach ($correspondencia as $cor_item) {
         $id_cor_oficio = $cor_item->id_cor;
         $num_control_oficio = $cor_item->num_control;
         $dir_origen_oficio = $cor_item->dir_origen;
         $remitente_oficio = $cor_item->remitente;
         $dir_destino_oficio = $cor_item->dir_destino;
         $asunto_oficio = $cor_item->asunto;
         $descripcion_oficio = $cor_item->descripcion;
         $fecha_crea_oficio = $cor_item->fecha_creacion;
     }
     $datos_director = $this->ivss_model->ver_dir_gen_especifica2($dir_destino_oficio)->result();
     foreach ($datos_director as $dir) {
         $nombre_director = $dir->nombre_director;
         $resolucion_director = $dir->resolucion_director;
     }
     $this->load->library('fpdf/fpdf');
     $pdf = new FPDF('P');
     $pdf->AddPage();
     $pdf->SetTitle("correspondencia", true);
     $pdf->SetFont('Arial', 'B', 16);
     $pdf->Image($this->config->base_url() . 'fronted/img/banner_institucional.png', 20, 8, 170);
     $pdf->AliasNbPages();
     $pdf->SetSubject("Sistema de correspondencia");
     $pdf->Image($this->config->base_url() . 'fronted/img/logogrande.png', 20, 25, 17);
     $pdf->SetFont('Arial', '', 9);
     $pdf->Text(68, 30, "REPUBLICA BOLIVARIANA DE VENEZUELA");
     $pdf->Text(42, 40, "MINISTERIO DEL PODER POPULAR PARA EL PROCESO SOCIAL DEL TRABAJO");
     $pdf->Text(62, 50, "INSTITUTO VENEZOLANO DE LOS SEGUROS SOCIALES");
     $pdf->SetLeftMargin(20.0);
     $pdf->SetRightMargin(20.0);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Text(20, 70, "OFICIO:");
     $pdf->SetFont('Arial', '', 12);
     $pdf->Text(44, 70, $num_control_oficio);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Text(20, 80, "PARA:");
     $pdf->SetFont('Arial', 'b', 12);
     #$pdf->Text(44,80,strtoupper(utf8_decode($nombre_director)));
     $pdf->Text(44, 80, strtoupper(utf8_decode("JACINTO PEREZ BONALDE SANCHEZ")));
     $pdf->SetFont('Arial', '', 12);
     $pdf->Text(44, 90, utf8_decode($dir_destino_oficio));
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Text(20, 100, "DE:");
     $pdf->SetFont('Arial', 'b', 12);
     $pdf->Text(44, 100, utf8_decode($remitente_oficio));
     $pdf->SetFont('Arial', '', 12);
     $pdf->Text(44, 110, utf8_decode(end(explode("-", $dir_origen_oficio))));
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Text(20, 120, "FECHA:");
     $pdf->SetFont('Arial', '', 12);
     $pdf->Text(44, 120, $fecha_crea_oficio);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Text(20, 130, "ASUNTO:");
     $pdf->SetFont('Arial', '', 12);
     $pdf->Text(44, 130, utf8_decode($asunto_oficio));
     $pdf->SetXY(10, 140);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetTopMargin(2.0);
     $pdf->SetLeftMargin(20.0);
     $pdf->SetRightMargin(20.0);
     $pdf->MultiCell(0, 7, utf8_decode($descripcion_oficio));
     $pdf->SetFont('Arial', 'b', 10);
     $pdf->Text(93, 245, "Atentamente");
     $pdf->Line(50, 264, 160, 264);
     #$pdf->Image($this->config->base_url().'fronted/img/FIRMADIGITAL.png',52,230,115);
     $pdf->SetFont('Arial', '', 10);
     $pdf->Text(75, 268, utf8_decode($remitente_oficio));
     $pdf->SetFont('Arial', '', 10);
     $pdf->Text(88, 272, utf8_decode("Director general"));
     $pdf->SetFont('Arial', '', 10);
     $pdf->Text(76, 276, utf8_decode("Según resolución:" . $resolucion_director));
     $pdf->Output('oficio_' . $num_control_oficio, 'I');
     #tabla
     /*
     $cabecera=array('Usuario', 'Total asignados', 'Ejecutados');
     $pdf->SetXY(10,30); //Seleccionamos posición
     $pdf->SetFont('Arial','B',10); //Fuente, Negrita, tamaño
      
         foreach($cabecera as $columna){
             //Parámetro con valor 2, cabecera vertical
             $pdf->Cell(50,7, utf8_decode($columna),1, 0,'L');
         }
     
     $pdf->SetXY(10,31);
     $pdf->Ln();//Salto de línea para generar otra fila
     $pdf->Ln();//Salto de línea para generar otra fila
         foreach($cabecera as $fila){
                 //Atención!! el parámetro valor 0, hace que sea horizontal
                 $pdf->Cell(50,7, utf8_decode($fila),1, 0 , '' );
             }
     */
     #llave clase.
 }
示例#10
0
/**
 * generatePDF - Génère un fichier PDF à partir des données d'évaluation d'un service
 *
 * @category : eval_ccpc_functions
 * @param array $data Données d'évaluation récupérées à partir de la fonction {@link getEvaluationCCPCFullData()}
 * @param boolean $comment TRUE si on incut les commentaire, FALSE si on ne les inclut pas
 * @param boolean $commentMSG TRUE si on incut un message concernant la CSG, FALSE si on ne l'inclut pas
 * @return array Array contenant les informations du fichier généré
 *
 * @Author Ali Bellamine
 *
 * Contenu de l'array retourné :<br>
 * 	['pdfPath'] => (string) Chemin local vers le fichier généré<br>
 * 	['pdfURI'] => (string) URI pointant vers le fichier généré
 *
 */
function generatePDF($data, $comment = FALSE, $commentMSG = FALSE)
{
    // Accès à la BDD
    global $db;
    // Array contenant les résultats
    $output = array();
    // On vérifie l'existence des données
    if (isset($data) && count($data) > 0) {
        /* 
        	Mise en cache
        */
        // Calcul du md5
        $hashdata = $data;
        $hashdata['optionsPDF'] = array('comment' => $comment, 'commentMSG' => $commentMSG);
        $hash = md5(json_encode($hashdata));
        $pdfPath = PLUGIN_PATH . 'cache/' . $hash . '.pdf';
        $pdfPathURI = ROOT . 'evaluations/ccpc/cache/' . $hash . '.pdf';
        if (is_file($pdfPath)) {
            $output['pdfPath'] = $pdfPath;
            $output['pdfURI'] = $pdfPathURI;
            return $output;
        } else {
            // On charge la librairie
            require_once PLUGIN_PATH . 'core/fpdf17/fpdf.php';
            // On charge le fichier XML
            if (is_file(PLUGIN_PATH . 'formulaire.xml')) {
                $form = simplexml_load_file(PLUGIN_PATH . 'formulaire.xml');
            }
            // Promotion
            if (count($data['service']['promotion']) > 1) {
                $promotion = false;
            } else {
                foreach ($data['service']['promotion'] as $promotionData) {
                    $promotion = $promotionData['id'];
                }
            }
            try {
                ob_end_clean();
            } catch (Exception $e) {
            }
            // On crée le PDF
            $A4Height = 842;
            $A4Width = 595;
            $titleSize = 15;
            $textSize = 11;
            $pdf = new FPDF('L', 'pt', 'A4');
            $pdf->SetTopMargin(10);
            $pdf->SetLeftMargin(15);
            $pdf->SetAutoPageBreak(TRUE, 10);
            /**
            						Page contenant le résumé des données d'évaluation
            					**/
            $pdf->AddPage();
            $pdf->SetFont('Arial', 'B', $titleSize);
            // On affiche le titre
            $pdf->SetFillColor(70, 70, 242);
            $pdf->SetTextColor(255, 255, 255);
            $pdf->SetX(floor(0.1 * $A4Height));
            $pdf->Cell(floor(0.8 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_TITLE), 'LRTB', 0, 'C', TRUE);
            // Première ligne
            $pdf->Ln(2 * $titleSize);
            $pdf->SetFont('Arial', '', $textSize);
            // On affiche les informations concernant le service
            // Récupération des données
            $textToDisplay = LANG_FORM_CCPC_FILTER_SERVICE_TITLE . ' : ' . $data['service']['FullName'] . PHP_EOL . LANG_FORM_CCPC_PDF_STAGEPERIODE . ' : ' . date('d/m/Y', $data['service']['date']['min']) . ' - ' . date('d/m/Y', $data['service']['date']['max']);
            // Nombre d'étudiants par promotion
            $nbEtudiantsService = array();
            $sql = 'SELECT p.nom promotion, COUNT( ae.userId ) nombre
												FROM `affectationexterne` ae
												INNER JOIN user u ON u.id = ae.userId
												INNER JOIN promotion p ON p.id = u.promotion
												WHERE `dateDebut` >= "' . TimestampToDatetime($data['service']['date']['min']) . '" AND `dateFin` <= "' . TimestampToDatetime($data['service']['date']['max']) . '" AND service = ' . $data['service']['id'] . '
												GROUP BY u.promotion';
            $res = $db->query($sql);
            while ($res_f = $res->fetch()) {
                $nbEtudiantsService[$res_f['promotion']] = $res_f['nombre'];
            }
            $firstLoop = true;
            if (count($nbEtudiantsService) > 0) {
                $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTPROMOTION . ' : ';
                foreach ($nbEtudiantsService as $promotionNom => $promotionNombre) {
                    if (!$firstLoop) {
                        $textToDisplay .= ', ';
                    } else {
                        $firstLoop = FALSE;
                    }
                    $textToDisplay .= $promotionNom . ' (' . $promotionNombre . ')';
                }
            }
            $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTNB . ' : ' . $data['service']['nbEvaluation'] . PHP_EOL . LANG_FORM_CCPC_PDF_EVALUATIONNB . ' : ' . $data['nb'];
            $textToDisplay = utf8_decode($textToDisplay);
            // Affichage
            $pdf->SetFillColor(231, 231, 231);
            $pdf->SetTextColor(0, 0, 0);
            $pdf->MultiCell(floor(0.35 * $A4Height), $textSize + 5, $textToDisplay, 'LRTB', 'L', TRUE);
            // On affiche les graphiques : mainGraphPDF
            // Récupération des données
            // Liste des graphiques à afficher
            $input = $form->xpath('categorie/input[@mainPDFGraph="1"]');
            $nbGraph = count($input);
            // Nombre de graphiques à intégrer
            // On génère $tempData, contenant les données utilisées pour génération du png
            foreach ($input as $select) {
                if ($select['type'] == 'select') {
                    $categorie = $select->xpath('..')[0];
                    // Catégorie du graphique
                    $tempData = array();
                    $tempData['settings'] = array('width' => 450, 'height' => 230);
                    foreach ($select->option as $option) {
                        if (isset($data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']])) {
                            $value = $data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']];
                            if (is_numeric($value)) {
                                $tempData['data'][constant((string) $option['text'])] = $value;
                            } else {
                                $tempData['data'][constant((string) $option['text'])] = 0;
                            }
                        } else {
                            $tempData['data'][constant((string) $option['text'])] = 0;
                        }
                    }
                    // On inclut l'image
                    $pdf->Image(eval_ccpc_genGraphPie($tempData), 0.4 * $A4Height, 3 * $titleSize, floor(0.4 * $A4Height), 0, 'PNG');
                    break;
                }
            }
            // On affiche l'icone des filtres : maximum 4
            $filtres = eval_ccpc_checkFilterExistence($data['service']['id'], $data['service']['date']['min'], $data['service']['date']['max'], $promotion);
            $numberOfIcons = 0;
            // Compte le nombre d'icones ajoutées
            $leftCornerX = 0.8 * $A4Height - 5;
            $leftCornerY = 3 * $titleSize - 5;
            if (is_array($filtres)) {
                foreach ($filtres as $filtre) {
                    if (isset($filtre['icone']) && strlen($filtre['icone']) > 1 && $numberOfIcons < 4) {
                        $pdf->Image($filtre['icone'], $leftCornerX, $leftCornerY, floor(0.1 * $A4Height), 0, 'PNG');
                        $numberOfIcons++;
                        if ($numberOfIcons == 1) {
                            $leftCornerX = 0.9 * $A4Height - 3;
                        } else {
                            if ($numberOfIcons == 2) {
                                $leftCornerX = 0.8 * $A4Height - 5;
                                $leftCornerY += 0.1 * $A4Height + 1;
                            } else {
                                if ($numberOfIcons == 3) {
                                    $leftCornerX = 0.9 * $A4Height - 3;
                                }
                            }
                        }
                        break;
                    }
                }
            }
            if ($numberOfIcons == 0) {
                // On ajoute l'icone neutre si aucune icone n'est présente
                $pdf->Image(PLUGIN_PATH . '/css/img/neutral.png', $leftCornerX, $leftCornerY, floor(0.1 * $A4Height), 0, 'PNG');
            }
            // Deuxième ligne
            $pdf->Ln(8 * $titleSize);
            // On affiche le radar sur 1 an de données
            $fullYearData = getEvaluationCCPCFullData($data['service']['id'], $promotion, $data['service']['date']['max'] - 31536000, $data['service']['date']['max'], FALSE);
            // Récupération des données
            // Titre
            $pdf->Cell(floor(0.4 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_FULLYEAR . ' (' . date('d/m/Y', $fullYearData['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $fullYearData['service']['date']['max']) . ')'), 0, 0, 'C', FALSE);
            // On affiche l'image
            // Liste des valeurs à afficher
            $input = $form->xpath('categorie/input[@radarPDFGraph="1"]');
            // Préparation des données
            $tempData = array();
            $tempData['settings'] = array('height' => 380, 'width' => 680, 'max' => 10);
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $fullYearData[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), 10, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // On affiche le radar sur la période du stage
            // On décale du 0.05*largeur
            $pdf->Cell(floor(0.05 * $A4Height));
            // On crée un rectangle contenant les données
            $pdf->Rect($pdf->getX(), $pdf->getY() - 10, 0.5 * $A4Height, 0.3 * $A4Height, 'F');
            // Titre
            $pdf->Cell(floor(0.5 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_START . ' ' . date('d/m/Y', $data['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $data['service']['date']['max'])), 0, 0, 'C', FALSE);
            // On ajoute l'image
            // Liste des valeurs à afficher
            $input = $form->xpath('categorie/input[@radarPDFGraph="1"]');
            // Préparation des données
            $tempData = array();
            $tempData['settings'] = array('height' => 380, 'width' => 650, 'max' => 10);
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // Affiche du logo
            $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG');
            // Pied de Page
            $pdf->SetX(0.5 * $A4Height);
            $pdf->SetY($A4Width - 40);
            $textSize = 10;
            $pdf->SetFont('Arial', 'I', $textSize);
            // Ligne de demarcation
            $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY());
            // Accès aux résultats
            $pdf->SetX(0.5 * $A4Height);
            $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0);
            // Coordonées CSG
            if ($commentMSG) {
                $pdf->SetFont('Arial', 'B', $textSize);
                $pdf->SetX(15);
                $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0);
            }
            /**
            							Commentaires
            						**/
            // Ajout des commentaires, points positifs et points négatifs : 'pdfComment'
            if ($comment) {
                $pdf->addPage('P', 'A4');
                // Titre
                $pdf->SetFont('Arial', 'B', $titleSize);
                $pdf->SetFillColor(70, 70, 242);
                $pdf->SetTextColor(255, 255, 255);
                $pdf->SetX(floor(0.1 * $A4Width));
                $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE);
                $pdf->SetTextColor(0, 0, 0);
                $pdf->SetFillColor(245, 245, 245);
                // Les commentaires
                $input = $form->xpath('categorie/input[@pdfComment="1"]');
                foreach ($input as $theinput) {
                    $categorie = $theinput->xpath('..')[0];
                    if ($theinput['type'] == 'text') {
                        // Création de l'array contenant les données à afficher sous forme [timestamp fin][timestamp début][timestamp commantaire][idMessage][] => message
                        $tempData = array();
                        foreach ($theinput->text as $value) {
                            if (isset($data[(string) $categorie['nom']][(string) $value['nomBDD']])) {
                                foreach ($data[(string) $categorie['nom']][(string) $value['nomBDD']] as $idEval => $textValue) {
                                    if (isset($data['donnees'][$idEval]['infos'])) {
                                        $tempData[$data['donnees'][$idEval]['infos']['dateFin']][$data['donnees'][$idEval]['infos']['dateDebut']][$data['donnees'][$idEval]['infos']['date']][$idEval][] = $textValue;
                                    }
                                }
                            }
                        }
                        $textArea = '';
                        $firstLoop = TRUE;
                        // On affiche les commentaires
                        krsort($tempData);
                        foreach ($tempData as $dateFin => $tempvalue) {
                            krsort($tempvalue);
                            foreach ($tempvalue as $dateDebut => $value2) {
                                krsort($value2);
                                foreach ($value2 as $date => $value3) {
                                    foreach ($value3 as $commentId => $comments) {
                                        foreach ($comments as $comment) {
                                            if ($comment != '') {
                                                if (!$firstLoop) {
                                                    $textArea .= PHP_EOL . PHP_EOL;
                                                } else {
                                                    $firstLoop = FALSE;
                                                }
                                                // Saut de ligne
                                                $textArea .= $comment . ' - ' . date('d/m/Y', $date) . ' #' . $commentId;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if ($textArea != '') {
                            // On affiche les textes dans le PDF
                            $pdf->Ln(20);
                            $pdf->SetX(20);
                            $pdf->setFont('Arial', '', $titleSize);
                            $pdf->Cell(0, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE);
                            $pdf->setFont('Arial', '', $textSize);
                            $pdf->SetX(20);
                            $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE);
                        }
                    } else {
                        if ($theinput['type'] == 'textarea') {
                            // Création de l'array contenant les données à afficher sous forme [timestamp fin][timestamp début][timestamp commantaire][idCommentaire] => commentaire
                            $tempData = array();
                            foreach ($data[(string) $categorie['nom']][(string) $theinput['nomBDD']] as $commentId => $commentData) {
                                if (isset($data['donnees'][$commentId]['infos'])) {
                                    $tempData[$data['donnees'][$commentId]['infos']['dateFin']][$data['donnees'][$commentId]['infos']['dateDebut']][$data['donnees'][$commentId]['infos']['date']][$commentId] = $commentData;
                                }
                            }
                            $textArea = '';
                            $firstLoop = TRUE;
                            // On affiche les commentaires
                            krsort($tempData);
                            foreach ($tempData as $dateFin => $tempvalue) {
                                krsort($tempvalue);
                                foreach ($tempvalue as $dateDebut => $value2) {
                                    krsort($value2);
                                    foreach ($value2 as $date => $value3) {
                                        foreach ($value3 as $commentId => $comment) {
                                            if ($comment != '') {
                                                if (!$firstLoop) {
                                                    $textArea .= PHP_EOL . PHP_EOL;
                                                } else {
                                                    $firstLoop = FALSE;
                                                }
                                                // Saut de ligne
                                                $textArea .= $comment . ' - ' . date('d/m/Y', $date) . ' #' . $commentId;
                                            }
                                        }
                                    }
                                }
                            }
                            if ($textArea != '') {
                                // On affiche les textes dans le PDF
                                $pdf->Ln(20);
                                $pdf->SetX(20);
                                $pdf->setFont('Arial', '', $titleSize);
                                $pdf->Cell(0 * $A4Width, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE);
                                $pdf->setFont('Arial', '', $textSize);
                                $pdf->SetX(20);
                                $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE);
                            }
                        }
                    }
                }
            }
            // On retourne le fichier PDF
            $pdf->Output($pdfPath, 'F');
            $output['pdfPath'] = $pdfPath;
            $output['pdfURI'] = $pdfPathURI;
            return $output;
        }
        exit;
    } else {
        return FALSE;
    }
}
示例#11
0
/**
 * generatePDF - Génère un fichier PDF à partir des données d'évaluation d'un service
 *
 * @category : eval_ccpc_functions
 * @param array $data Données d'évaluation récupérées à partir de la fonction {@link getEvaluationCCPCFullData()}
 * @param boolean $comment TRUE si on incut les commentaire, FALSE si on ne les inclut pas
 * @param boolean $commentMSG TRUE si on incut un message concernant la CSG, FALSE si on ne l'inclut pas
 * @return array Array contenant les informations du fichier généré
 *
 * @Author Ali Bellamine
 *
 * Contenu de l'array retourné :<br>
 * 	['pdfPath'] => (string) Chemin local vers le fichier généré<br>
 * 	['pdfURI'] => (string) URI pointant vers le fichier généré
 *
 */
function generatePDF($data, $comment = FALSE, $commentMSG = FALSE)
{
    // Array contenant les résultats
    $output = array();
    // On vérifie l'existence des données
    if (isset($data) && count($data) > 0) {
        /* 
        	Mise en cache
        */
        // Calcul du md5
        $hashdata = $data;
        $hashdata['optionsPDF'] = array('comment' => $comment, 'commentMSG' => $commentMSG);
        $hash = md5(json_encode($hashdata));
        $pdfPath = PLUGIN_PATH . 'cache/' . $hash . '.pdf';
        $pdfPathURI = ROOT . 'evaluations/ccpc/cache/' . $hash . '.pdf';
        if (is_file($pdfPath)) {
            $output['pdfPath'] = $pdfPath;
            $output['pdfURI'] = $pdfPathURI;
            return $output;
        } else {
            // On charge la librairie
            require_once PLUGIN_PATH . 'core/fpdf17/fpdf.php';
            // On charge le fichier XML
            if (is_file(PLUGIN_PATH . 'formulaire.xml')) {
                $form = simplexml_load_file(PLUGIN_PATH . 'formulaire.xml');
            }
            // Promotion
            if (count($data['service']['promotion']) > 1) {
                $promotion = false;
            } else {
                foreach ($data['service']['promotion'] as $promotionData) {
                    $promotion = $promotionData['id'];
                }
            }
            ob_end_clean();
            // On crée le PDF
            $A4Height = 842;
            $A4Width = 595;
            $titleSize = 15;
            $textSize = 11;
            $pdf = new FPDF('L', 'pt', 'A4');
            $pdf->SetTopMargin(10);
            $pdf->SetLeftMargin(15);
            $pdf->SetAutoPageBreak(TRUE, 10);
            /**
            						Page contenant le résumé des données d'évaluation
            					**/
            $pdf->AddPage();
            $pdf->SetFont('Arial', 'B', $titleSize);
            // On affiche le titre
            $pdf->SetFillColor(70, 70, 242);
            $pdf->SetTextColor(255, 255, 255);
            $pdf->SetX(floor(0.1 * $A4Height));
            $pdf->Cell(floor(0.8 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_TITLE), 'LRTB', 0, 'C', TRUE);
            // Première ligne
            $pdf->Ln(2 * $titleSize);
            $pdf->SetFont('Arial', '', $textSize);
            // On affiche les informations concernant le service
            // Récupération des données
            $textToDisplay = LANG_FORM_CCPC_FILTER_SERVICE_TITLE . ' : ' . $data['service']['FullName'] . PHP_EOL . LANG_FORM_CCPC_PDF_STAGEPERIODE . ' : ' . date('d/m/Y', $data['service']['date']['min']) . ' - ' . date('d/m/Y', $data['service']['date']['max']) . PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTPROMOTION . ' : ';
            $firstLoop = true;
            foreach ($data['service']['promotion'] as $promotionData) {
                if (!$firstLoop) {
                    $textToDisplay .= ', ';
                } else {
                    $firstLoop = FALSE;
                }
                $textToDisplay .= $promotionData['nom'] . ' (' . $promotionData['nb'] . ')';
            }
            $textToDisplay .= PHP_EOL . LANG_FORM_CCPC_PDF_STUDENTNB . ' : ' . $data['service']['nbEvaluation'] . PHP_EOL . LANG_FORM_CCPC_PDF_EVALUATIONNB . ' : ' . $data['nb'];
            $textToDisplay = utf8_decode($textToDisplay);
            // Affichage
            $pdf->SetFillColor(231, 231, 231);
            $pdf->SetTextColor(0, 0, 0);
            $pdf->MultiCell(floor(0.35 * $A4Height), $textSize + 5, $textToDisplay, 'LRTB', 'L', TRUE);
            // On affiche les graphiques : mainGraphPDF
            // Récupération des données
            // Liste des graphiques à afficher
            $input = $form->xpath('categorie/input[@mainPDFGraph="1"]');
            $nbGraph = count($input);
            // Nombre de graphiques à intégrer
            // On génère $tempData, contenant les données utilisées pour génération du png
            foreach ($input as $select) {
                if ($select['type'] == 'select') {
                    $categorie = $select->xpath('..')[0];
                    // Catégorie du graphique
                    $tempData = array();
                    $tempData['settings'] = array('width' => 450, 'height' => 230);
                    foreach ($select->option as $option) {
                        if (isset($data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']])) {
                            $value = $data[(string) $categorie['nom']][(string) $select['nomBDD']]['nb'][(string) $option['value']];
                            if (is_numeric($value)) {
                                $tempData['data'][constant((string) $option['text'])] = $value;
                            } else {
                                $tempData['data'][constant((string) $option['text'])] = 0;
                            }
                        } else {
                            $tempData['data'][constant((string) $option['text'])] = 0;
                        }
                    }
                    // On inclut l'image
                    $pdf->Image(eval_ccpc_genGraphPie($tempData), 0.4 * $A4Height, 3 * $titleSize, floor(0.4 * $A4Height), 0, 'PNG');
                    break;
                }
            }
            // On affiche l'icone des filtres
            $filtres = eval_ccpc_checkFilterExistence($data['service']['id'], $data['service']['date']['min'], $data['service']['date']['max'], $promotion);
            if (is_array($filtres)) {
                foreach ($filtres as $filtre) {
                    if (isset($filtre['icone'])) {
                        $pdf->Image($filtre['icone'], 0.8 * $A4Height, 3 * $titleSize, floor(0.2 * $A4Height), 0, 'PNG');
                        break;
                    }
                }
            }
            // Deuxième ligne
            $pdf->Ln(8 * $titleSize);
            // On affiche le radar sur 1 an de données
            $fullYearData = getEvaluationCCPCFullData($data['service']['id'], $promotion, $data['service']['date']['max'] - 31536000, $data['service']['date']['max'], FALSE);
            // Récupération des données
            // Titre
            $pdf->Cell(floor(0.4 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_FULLYEAR . ' (' . date('d/m/Y', $fullYearData['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $fullYearData['service']['date']['max']) . ')'), 0, 0, 'C', FALSE);
            // On affiche l'image
            // Liste des valeurs à afficher
            $input = $form->xpath('categorie/input[@radarPDFGraph="1"]');
            // Préparation des données
            $tempData = array();
            $tempData['settings'] = array('height' => 380, 'width' => 680, 'max' => 10);
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $fullYearData[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), 10, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // On affiche le radar sur la période du stage
            // On décale du 0.05*largeur
            $pdf->Cell(floor(0.05 * $A4Height));
            // On crée un rectangle contenant les données
            $pdf->Rect($pdf->getX(), $pdf->getY() - 10, 0.5 * $A4Height, 0.3 * $A4Height, 'F');
            // Titre
            $pdf->Cell(floor(0.5 * $A4Height), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_STAGEPERIODE_START . ' ' . date('d/m/Y', $data['service']['date']['min']) . ' ' . LANG_FORM_CCPC_PDF_STAGEPERIODE_END . ' ' . date('d/m/Y', $data['service']['date']['max'])), 0, 0, 'C', FALSE);
            // On ajoute l'image
            // Liste des valeurs à afficher
            $input = $form->xpath('categorie/input[@radarPDFGraph="1"]');
            // Préparation des données
            $tempData = array();
            $tempData['settings'] = array('height' => 380, 'width' => 650, 'max' => 10);
            foreach ($input as $theinput) {
                // Récupération du parent
                $categorie = $theinput->xpath('..')[0];
                // Catégorie du graphique
                if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'])) {
                    $tempData['data'][constant($theinput['label'] . '_SHORT')] = $data[(string) $categorie['nom']][(string) $theinput['nomBDD']]['moyenne'] + 5;
                }
            }
            // Affichage de l'image
            $pdf->Image(eval_ccpc_genGraphRadar($tempData), $pdf->getX() - 0.45 * $A4Height, $pdf->getY() + 40, floor(0.4 * $A4Height), 0, 'PNG');
            // Affiche du logo
            $pdf->Image(ROOT . 'theme/img/logo.png', 10, $A4Width - 100, 0, 50, 'PNG');
            // Pied de Page
            $pdf->SetX(0.5 * $A4Height);
            $pdf->SetY($A4Width - 40);
            $textSize = 10;
            $pdf->SetFont('Arial', 'I', $textSize);
            // Ligne de demarcation
            $pdf->Line(15, $pdf->getY(), $A4Height - 15, $pdf->getY());
            // Accès aux résultats
            $pdf->SetX(0.5 * $A4Height);
            $pdf->Cell(0.5 * $A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_FULLRESULT . ' ' . getPageUrl('evalView', array('evaluationType' => 1, 'service' => $data['service']['id']))), 0, 1, 'R', 0);
            // Coordonées CSG
            if ($commentMSG) {
                $pdf->SetFont('Arial', 'B', $textSize);
                $pdf->SetX(15);
                $pdf->Cell($A4Height - 15, $textSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_FOOTER_STRUCTURENAME . ' - ' . CONTACT_STAGE_MAIL), 0, 0, 'C', 0);
            }
            /**
            							Commentaires
            						**/
            // Ajout des commentaires, points positifs et points négatifs : 'pdfComment'
            if ($comment) {
                $pdf->addPage('P', 'A4');
                // Titre
                $pdf->SetFont('Arial', 'B', $titleSize);
                $pdf->SetFillColor(70, 70, 242);
                $pdf->SetTextColor(255, 255, 255);
                $pdf->SetX(floor(0.1 * $A4Width));
                $pdf->Cell(floor(0.8 * $A4Width), $titleSize + 5, utf8_decode(LANG_FORM_CCPC_PDF_COMMENT_TITLE), 'LRTB', 1, 'C', TRUE);
                $pdf->SetTextColor(0, 0, 0);
                $pdf->SetFillColor(245, 245, 245);
                // Les commentaires
                $input = $form->xpath('categorie/input[@pdfComment="1"]');
                foreach ($input as $theinput) {
                    $categorie = $theinput->xpath('..')[0];
                    if ($theinput['type'] == 'text') {
                        $textArea = '';
                        $firstLoop = TRUE;
                        foreach ($theinput->text as $text) {
                            if (isset($data[(string) $categorie['nom']][(string) $text['nomBDD']])) {
                                foreach ($data[(string) $categorie['nom']][(string) $text['nomBDD']] as $comment) {
                                    if ($comment != '') {
                                        if (!$firstLoop) {
                                            $textArea .= PHP_EOL . PHP_EOL;
                                        } else {
                                            $firstLoop = FALSE;
                                        }
                                        // Saut de ligne
                                        $textArea .= $comment;
                                    }
                                }
                            }
                        }
                        if ($textArea != '') {
                            // On affiche les textes dans le PDF
                            $pdf->Ln(20);
                            $pdf->SetX(20);
                            $pdf->setFont('Arial', '', $titleSize);
                            $pdf->Cell(0, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE);
                            $pdf->setFont('Arial', '', $textSize);
                            $pdf->SetX(20);
                            $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE);
                        }
                    } else {
                        if ($theinput['type'] == 'textarea') {
                            $textArea = '';
                            $firstLoop = TRUE;
                            if (isset($data[(string) $categorie['nom']][(string) $theinput['nomBDD']])) {
                                foreach ($data[(string) $categorie['nom']][(string) $theinput['nomBDD']] as $comment) {
                                    if (!$firstLoop) {
                                        $textArea .= PHP_EOL . PHP_EOL;
                                    } else {
                                        $firstLoop = FALSE;
                                    }
                                    // Saut de ligne
                                    $textArea .= $comment;
                                }
                            }
                            if ($textArea != '') {
                                // On affiche les textes dans le PDF
                                $pdf->Ln(20);
                                $pdf->SetX(20);
                                $pdf->setFont('Arial', '', $titleSize);
                                $pdf->Cell(0 * $A4Width, $titleSize + 5, utf8_decode(constant($theinput['label'] . '_SHORT')), 0, 1, 'L', FALSE);
                                $pdf->setFont('Arial', '', $textSize);
                                $pdf->SetX(20);
                                $pdf->MultiCell($A4Width - 40, $textSize + 5, utf8_decode($textArea), 'LTRB', 'L', TRUE);
                            }
                        }
                    }
                }
            }
            // On retourne le fichier PDF
            $pdf->Output($pdfPath, 'F');
            $output['pdfPath'] = $pdfPath;
            $output['pdfURI'] = $pdfPathURI;
            return $output;
        }
        exit;
    } else {
        return FALSE;
    }
}
示例#12
0
 private function generateJobOrderReportPDF()
 {
     /* E_STRICT doesn't like FPDF. */
     $errorReporting = error_reporting();
     error_reporting($errorReporting & ~E_STRICT);
     include_once './lib/fpdf/fpdf.php';
     error_reporting($errorReporting);
     // FIXME: Hook?
     $isASP = $_SESSION['CATS']->isASP();
     $unixName = $_SESSION['CATS']->getUnixName();
     $siteName = $this->getTrimmedInput('siteName', $_GET);
     $companyName = $this->getTrimmedInput('companyName', $_GET);
     $jobOrderName = $this->getTrimmedInput('jobOrderName', $_GET);
     $periodLine = $this->getTrimmedInput('periodLine', $_GET);
     $accountManager = $this->getTrimmedInput('accountManager', $_GET);
     $recruiter = $this->getTrimmedInput('recruiter', $_GET);
     $notes = $this->getTrimmedInput('notes', $_GET);
     if (isset($_GET['dataSet'])) {
         $dataSet = $_GET['dataSet'];
         $dataSet = explode(',', $dataSet);
     } else {
         $dataSet = array(4, 3, 2, 1);
     }
     /* PDF Font Face. */
     // FIXME: Customizable.
     $fontFace = 'Arial';
     $pdf = new FPDF();
     $pdf->AddPage();
     if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) {
         return;
     }
     if ($isASP && $unixName == 'cognizo') {
         /* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */
         $pdf->SetFont($fontFace, 'B', 10);
         $pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20);
         $pdf->SetXY(129, 27);
         $pdf->Write(5, 'Information Technology Consulting');
     }
     $pdf->SetXY(25, 35);
     $pdf->SetFont($fontFace, 'BU', 14);
     $pdf->Write(5, "Recruiting Summary Report\n");
     $pdf->SetFont($fontFace, '', 10);
     $pdf->SetX(25);
     $pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n");
     $pdf->SetFont($fontFace, 'B', 10);
     $pdf->SetX(25);
     $pdf->Write(5, 'Company: ' . $companyName . "\n");
     $pdf->SetFont($fontFace, '', 10);
     $pdf->SetX(25);
     $pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n");
     $pdf->SetFont($fontFace, '', 10);
     $pdf->SetX(25);
     $pdf->Write(5, 'Period: ' . $periodLine . "\n\n");
     $pdf->SetFont($fontFace, '', 10);
     $pdf->SetX(25);
     $pdf->Write(5, 'Account Manager: ' . $accountManager . "\n");
     $pdf->SetFont($fontFace, '', 10);
     $pdf->SetX(25);
     $pdf->Write(5, 'Recruiter: ' . $recruiter . "\n");
     /* Note that the server is not logged in when getting this file from
      * itself.
      */
     // FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
     //        really don't like this... There has to be a way.
     // FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
     //        in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
     $URI = CATSUtility::getAbsoluteURI(CATSUtility::getIndexName() . '?m=graphs&a=jobOrderReportGraph&data=' . urlencode(implode(',', $dataSet)));
     $pdf->Image($URI, 70, 95, 80, 80, 'jpg');
     $pdf->SetXY(25, 180);
     $pdf->SetFont($fontFace, '', 10);
     $pdf->Write(5, 'Total Candidates ');
     $pdf->SetTextColor(255, 0, 0);
     $pdf->Write(5, 'Screened');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Write(5, ' by ' . $siteName . ": \n\n");
     $pdf->SetX(25);
     $pdf->SetFont($fontFace, '', 10);
     $pdf->Write(5, 'Total Candidates ');
     $pdf->SetTextColor(0, 125, 0);
     $pdf->Write(5, 'Submitted');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Write(5, ' to ' . $companyName . ": \n\n");
     $pdf->SetX(25);
     $pdf->SetFont($fontFace, '', 10);
     $pdf->Write(5, 'Total Candidates ');
     $pdf->SetTextColor(0, 0, 255);
     $pdf->Write(5, 'Interviewed');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Write(5, ' by ' . $companyName . ": \n\n");
     $pdf->SetX(25);
     $pdf->SetFont($fontFace, '', 10);
     $pdf->Write(5, 'Total Candidates ');
     $pdf->SetTextColor(255, 75, 0);
     $pdf->Write(5, 'Placed');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Write(5, ' at ' . $companyName . ": \n\n\n");
     if ($notes != '') {
         $pdf->SetX(25);
         $pdf->SetFont($fontFace, '', 10);
         $pdf->Write(5, "Notes:\n");
         $len = strlen($notes);
         $maxChars = 70;
         $pdf->SetLeftMargin(25);
         $pdf->SetRightMargin(25);
         $pdf->SetX(25);
         $pdf->Write(5, $notes . "\n");
     }
     $pdf->SetXY(165, 180);
     $pdf->SetFont($fontFace, 'B', 10);
     $pdf->Write(5, $dataSet[0] . "\n\n");
     $pdf->SetX(165);
     $pdf->Write(5, $dataSet[1] . "\n\n");
     $pdf->SetX(165);
     $pdf->Write(5, $dataSet[2] . "\n\n");
     $pdf->SetX(165);
     $pdf->Write(5, $dataSet[3] . "\n\n");
     $pdf->Rect(3, 6, 204, 285);
     if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_POST'))) {
         return;
     }
     $pdf->Output();
     die;
 }
 $address = create_address($parties[$i]);
 // Figure out what the longest line is
 $pdf->SetFont("Astrud", "", NAME_SIZE_PTS);
 $name_width = $pdf->GetStringWidth($name_string);
 $pdf->SetFont("ufonts.com_century-gothic", "", ADDR_SIZE_PTS);
 $max_addr_width = $pdf->GetStringWidth($address[0]);
 for ($j = 1; $j < count($address); ++$j) {
     $addr_line_width = $pdf->GetStringWidth($address[$j]);
     if ($addr_line_width > $max_addr_width) {
         $max_addr_width = $addr_line_width;
     }
 }
 $max_line_width = max($name_width, $max_addr_width);
 // Center the longest line, and make everything else left justified to that
 $left_x = $start_x + $col * ($x_size + $row_sep) + ($x_size - $max_line_width) / 2;
 $pdf->SetLeftMargin($left_x);
 // Draw the name line
 $pdf->SetFont("Astrud", "", NAME_SIZE_PTS);
 //$name_width = $pdf->GetStringWidth($name_string);
 //$name_x = $start_x + ($col * ($x_size + $row_sep)) + (($x_size - $name_width) / 2);
 $name_y = $start_y + $row * $y_size + TOP_MARGIN_IN;
 //$pdf->setXY($name_x, $name_y);
 $pdf->setXY($left_x, $name_y);
 $pdf->write($name_height, $name_string);
 // Draw the address lines
 $pdf->SetFont("ufonts.com_century-gothic", "", ADDR_SIZE_PTS);
 //$address = create_address($parties[$i]);
 // Determine the max address line width
 /*
 $max_addr_width = $pdf->GetStringWidth($address[0]);
 for ($j = 1; $j < count($address); ++$j) {
示例#14
0
    public function makepdf()
    {
        global $user;
        // Get required files.
        require_once 'others/fpdf/fpdf.php';
        // Set some document variables
        $author = "eduCloud";
        $x = 35;
        $text = <<<EOT
Hello
EOT;
        // Create fpdf object
        $pdf = new FPDF('P', 'pt', 'Letter');
        // Set base font to start
        $pdf->SetFont('Arial', 'B', 16);
        // Add a new page to the document
        $pdf->addPage();
        $pdf->setLeftMargin($x);
        //page border
        $pdf->Line(35, 30, 35, 750);
        $pdf->Line(35, 30, 575, 30);
        $pdf->Line(575, 30, 575, 750);
        $pdf->Line(575, 750, 35, 750);
        //end of page border
        // Set the x,y coordinates of the cursor
        $pdf->SetXY($x + 20, 40);
        // Write 'Simple PDF' with a line height of 1 at the current position
        $pdf->Write(25, 'Employee Details');
        $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/cloud/images/school_logo.jpg', 500, 35, 50, 50, 'JPG');
        // Reset the font
        // Reset font, color, and coordinates
        $pdf->SetFont('Arial', '', 12);
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetLeftMargin($x + 50);
        $pdf->setXY($x + 50, 90);
        global $objPDO;
        require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/teacher_class.php';
        $record = new Teacher($objPDO);
        if ($user->checkAdmin()) {
            $eid = $_GET['uid'];
        } else {
            $student = new Student($objPDO, $user->getuserId());
            $eid = $student->getID();
        }
        $record->loadByUserId($eid);
        // Write out a long text blurb.
        //$array=$record->getAsArray();
        //$x=0;
        /* TEMPLATE 1 DESIGN*/
        $pdf->SetFont('Arial', '', 8);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Employee Id (reference) : ' . $record->getTeacherId(), 0, 1, 'L', true);
        $pdf->SetFont('Arial', '', 12);
        $pdf->setFillColor(50, 50, 50);
        $pdf->setTextColor(255, 255, 255);
        $pdf->cell(450, 20, 'Employee Details', 0, 1, 'C', true);
        $pdf->setTextColor(0, 0, 0);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Employee Name', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getName(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Qualification', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getQualification(), 0, 1, 'C', true);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/subject_class.php';
        $subject_id = new Subject($objPDO);
        $subject_id->setID($record->getSubjectId());
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Subject', 0, 0, 'C', true);
        $pdf->cell(250, 20, $subject_id->getName(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Date Of Birth', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getDateOfBirth(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Gender', 0, 0, 'C', true);
        $pdf->cell(250, 20, ucfirst($record->getGender()), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Blood Group', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getBloodGroup(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, '', 0, 0, 'C', true);
        $pdf->cell(250, 20, '', 0, 1, 'C', true);
        $pdf->setFillColor(50, 50, 50);
        $pdf->setTextColor(255, 255, 255);
        $pdf->cell(450, 20, 'Contact Details', 0, 1, 'C', true);
        $pdf->setTextColor(0, 0, 0);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Correspondence Address', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceAddressLine1(), 0, 1, 'C', true);
        $pdf->cell(200, 20, '', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceAddressLine2(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'City', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceCity(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'State', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondenceState(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Pincode', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getCorrespondencePincode(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Phone', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getPhone(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Mobile', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getMobile(), 0, 1, 'C', true);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Email', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getEmail(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(450, 20, '', 0, 1, 'C', true);
        $pdf->setFillColor(50, 50, 50);
        $pdf->setTextColor(255, 255, 255);
        $pdf->cell(450, 20, 'Login Details', 0, 1, 'C', true);
        $pdf->setTextColor(0, 0, 0);
        $pdf->setFillColor(221, 221, 221);
        $pdf->cell(200, 20, 'Employee Id *', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getTeacherId(), 0, 1, 'C', true);
        $pdf->setFillColor(255, 255, 255);
        $pdf->cell(200, 20, 'Temporary Password **', 0, 0, 'C', true);
        $pdf->cell(250, 20, $record->getTempPass(), 0, 1, 'C', true);
        /* TEMPLATE 1 DESIGN END*/
        $pdf->SetFont('Arial', '', 10);
        $pdf->SetXY($x + 100, 620);
        $pdf->write(15, 'Employee\'s Signature');
        $pdf->SetXY($x + 350, 620);
        $pdf->write(15, 'Admin\'s Signature');
        $pdf->SetFont('Arial', '', 8);
        $pdf->SetXY($x + 20, 710);
        $pdf->write(15, '* Employee Id may be Temporary , ** Please Change the Password for Security Reasons');
        $pdf->SetXY($x + 20, 720);
        $pdf->write(15, 'This is a Computer Generated Form. If any Discrepancy Contact Admin : eduCloud Reference Number ' . $user->getuserId());
        // Close the document and save to the filesystem with the name simple.pdf
        $pdf->Output('generated_files/enroll' . $record->getUserId() . '.pdf', 'F');
        header('Location:http://localhost/cloud/generated_files/enroll' . $record->getUserId() . '.pdf');
    }
示例#15
0
 public function drawPDF()
 {
     $pdf = new \FPDF('P', 'mm', 'Letter');
     $width = 52;
     // tag width in mm
     $height = 31;
     // tag height in mm
     $left = 5.5;
     // left margin
     $top = 15;
     // top margin
     $pdf->SetTopMargin($top);
     //Set top margin of the page
     $pdf->SetLeftMargin($left);
     //Set left margin of the page
     $pdf->SetRightMargin($left);
     //Set the right margin of the page
     $pdf->SetAutoPageBreak(False);
     // manage page breaks yourself
     $data = $this->loadItems();
     $num = 0;
     // count tags
     $x = $left;
     $y = $top;
     foreach ($data as $item) {
         // extract & format data
         $price = $item['normal_price'];
         $desc = strtoupper(substr($item['posDescription'], 0, 27));
         $brand = strtoupper(substr($item['brand'], 0, 13));
         $pak = $item['units'];
         $size = $item['units'] . "-" . $item['size'];
         $sku = $item['sku'];
         $ppu = $item['pricePerUnit'];
         $vendor = substr($item['vendor'], 0, 7);
         $upc = $item['upc'];
         if ($num % 32 == 0) {
             $pdf->AddPage();
             $x = $left;
             $y = $top;
         } else {
             if ($num % 4 == 0) {
                 $x = $left;
                 $y += $height;
             }
         }
         $args = array('height' => 7, 'valign' => 'T', 'align' => 'L', 'suffix' => date('  n/j/y'), 'fontsize' => 8, 'font' => $this->font);
         $pdf = $this->drawBarcode($upc, $pdf, $x + 7, $y + 4, $args);
         $pdf->SetFont($this->font, '', 8);
         $pdf->SetXY($x, $y + 12);
         $pdf->Cell($width, 4, $desc, 0, 1, 'L');
         $pdf->SetX($x);
         $pdf->Cell($width, 4, $brand, 0, 1, 'L');
         $pdf->SetX($x);
         $pdf->Cell($width, 4, $size, 0, 1, 'L');
         $pdf->SetX($x);
         $pdf->Cell($width, 4, $sku . ' ' . $vendor, 0, 0, 'L');
         if (strstr($ppu, '/') && $ppu[strlen($ppu) - 1] != '/') {
             $pdf->SetX($x);
             $pdf->Cell($width - 5, 4, $ppu, 0, 0, 'R');
         }
         $pdf->SetXY($x, $y + 16);
         $pdf->SetFont($this->font, 'B', 24);
         //change font size
         $pdf->Cell($width - 5, 8, $price, 0, 0, 'R');
         // move right by tag width
         $x += $width;
         $num++;
     }
     $pdf->Output('Tags4x8P.pdf', 'I');
 }
<?php

require 'fpdf16/fpdf.php';
require 'connection.php';
validate_user();
$request = filter_input_array(INPUT_POST);
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->SetTopMargin(4);
$pdf->SetLeftMargin(4);
$pdf->SetAutoPageBreak(1, 0.5);
$pdf->SetDisplayMode(100);
$pdf->SetAutoPageBreak(true, 7);
$pdf->AddPage();
//$pdf->AddPage('L');
$pdf->SetDisplayMode(110, "single");
$pdf->SetTitle("Netherhall House");
$border = 1;
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFillColor(255, 255, 255);
if ($request[name] != "") {
    $r = mysql_query("SELECT * FROM residents " . "LEFT JOIN countries on residents.country_id = countries.country_id " . "WHERE name LIKE '%{$request[name]}%' OR surname LIKE '%{$request[name]}%'");
} else {
    $today = date("Y", time()) . "-" . date("m", time()) . "-" . date("d", time());
    if (!isset($request[academic_year]) || $request[academic_year] == "current") {
        // >= 28 days = 4 weeks
        //$condition_search=" AND bookings.arrival <= '$today' AND bookings.departure >= '$today' AND DATEDIFF(bookings.departure,bookings.arrival) >= 28  ";
        // 06-Feb-2010 - They want to see all the residents in the current residents list. So I remove the condition about days.
        $condition_search = " AND bookings.arrival <= '{$today}' AND bookings.planned_departure >= '{$today}' ";
    } elseif ($request[academic_year] == "short") {
        // < 28 days = 4 weeks
             $attendence = 60;
             $status_msg = "has successfully completed";
         }
     }
 }
 //End Status Message................
 if ($attendence >= 50) {
     $pdf->AddPage();
     $pdf->SetFont("Arial", "", "10");
     $pdf->Cell(0, 5, "", 0, 1, "C");
     $pdf->Cell(0, 0, $pdf->Image("../images/logo1.jpg", $x = null, $y = null, $w = 34, $h = 30, $type = 'jpg', $link = ''), 0, 1, "C");
     $pdf->Cell(0, -25, "", 0, 1, "R");
     $pdf->SetFont("Arial", "U", "15");
     $pdf->Cell(0, 10, "", 0, 1, "C");
     $pdf->Cell(0, -23, "", 0, 1, "R");
     $pdf->SetLeftMargin("60");
     //$pdf->SetLeftMargin("50");
     $pdf->Cell(0, 0, $pdf->Image("../images/bg_cert.png", $x = null, $y = null, $w = 140, $h = 45, $type = 'png', $link = ''), 0, 1, "R");
     $pdf->Cell(0, -50, "", 0, 1, "R");
     $pdf->SetRightMargin("20");
     $pdf->SetFont("Arial", "B", "18");
     $pdf->SetTextColor("48", "77", "131");
     $pdf->Cell(0, 22, "ERP Foundation", 0, 1, "R");
     $pdf->SetTextColor("", "", "");
     $pdf->SetFont("Arial", "", "10");
     $pdf->Cell(0, -7, "", 0, 1, "R");
     $pdf->Cell(0, 5, "B-34, First Floor, Shivaji Vihar,", 0, 1, "R");
     $pdf->Cell(0, 5, "Rajori Garden, New Delhi - 110027 (INDIA)", 0, 1, "R");
     $pdf->Cell(0, 5, "Ph. : 9810504404, 9997088839, 8057665988", 0, 1, "R");
     $pdf->SetTextColor("", "", "145");
     $pdf->Cell(0, 5, "http://www.erpfoundation.com", 0, 1, "R");
示例#18
0
 function __construct($lineItems, $lineItemTotals, $filename, $save = false)
 {
     App::import('vendor', 'fpdf/fpdf');
     $orientation = 'P';
     $unit = 'pt';
     $format = 'A4';
     $margin = 40;
     $pdf = new FPDF($orientation, $unit, $format);
     App::import('Helper', 'Time');
     $timeHelper = new TimeHelper();
     setlocale(LC_MONETARY, 'th_TH');
     $pdf->AddPage();
     $pdf->SetTopMargin($margin);
     $pdf->SetLeftMargin($margin);
     $pdf->SetRightMargin($margin);
     $pdf->SetAutoPageBreak(true, $margin);
     $pdf->SetY($pdf->GetY() + 60);
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetTextColor(0);
     $pdf->SetFillColor(255);
     $pdf->SetLineWidth(1);
     $pdf->SetFont('Arial', 'B', '10');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 30;
     $pdf->MultiCell($cell_width, 25, "No.\n ", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $pdf->Cell(250, 25, "Description", 'LTR', 0, 'C');
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "# Ordered", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 48;
     $pdf->MultiCell($cell_width, 25, "# Supplied", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount Wholesale", 'LTR', 'C');
     $pdf->SetXY($current_x + $cell_width, $current_y);
     $current_y = $pdf->GetY();
     $current_x = $pdf->GetX();
     $cell_width = 70;
     $pdf->MultiCell($cell_width, 25, "Amount Retail", 'LTR', 'C');
     $pdf->SetY($pdf->GetY() - 25);
     $pdf->SetFont('Arial', '');
     $pdf->SetFillColor(238);
     $pdf->SetLineWidth(0.2);
     $pdf->SetY($pdf->GetY() + 25);
     $num = 1;
     $number_ordered = 0;
     $number_supplied = 0;
     foreach ($lineItems as $lineItem) {
         $pdf->Cell(30, 20, $num++, 1, 0, 'L');
         $pdf->Cell(250, 20, $lineItem['Product']['short_description'], 1, 0, 'L');
         $pdf->Cell(48, 20, $lineItem['LineItem']['ordered'], 1, 0, 'R');
         $pdf->Cell(48, 20, $lineItem['LineItem']['supplied'], 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_wholesale']), 1, 0, 'R');
         $pdf->Cell(70, 20, money_format("%i", $lineItem['LineItem']['amount_retail']), 1, 1, 'R');
     }
     $pdf->SetX($pdf->GetX() + 30);
     $pdf->SetFont('Arial', 'B');
     $pdf->Cell(250, 20, "TOTALS", 1);
     $pdf->SetFont('Arial', '');
     $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R');
     $pdf->Cell(48, 20, $lineItemTotals['LineItem']['ordered'], 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_wholesale']), 1, 0, 'R');
     $pdf->Cell(70, 20, money_format("%i", $lineItemTotals['LineItem']['amount_retail']), 1, 1, 'R');
     if ($save) {
         $pdf->Output($filename, 'F');
     } else {
         $pdf->Output($filename, 'I');
     }
 }
示例#19
0
 $Pheight = 279.4;
 // Letter Paper Height in millimeters
 if (isset($_GET['size'])) {
     $size = explode('-', $_GET['size']);
     $Pwidth = is_numeric($size[0]) ? $size[0] : $Pwidth;
     $Pheight = is_numeric($size[1]) ? $size[1] : $Pheight;
 }
 $fontSize = 16;
 $width = $Pwidth;
 $height = $Pheight;
 require $Fpdf_loc;
 $pdf = new FPDF('P', 'mm', array($width, $height));
 $full = isset($_GET['full']);
 $marginLeft = $full ? 0 : $width / 21.59;
 $marginTop = $full ? 0 : $height / 13.97;
 $pdf->SetLeftMargin($marginLeft);
 $pdf->SetRightMargin($marginLeft);
 $pdf->SetTopMargin($marginTop / 2);
 $pdf->SetAutoPageBreak(true, $marginTop);
 $pages = 0;
 $files = json_decode($_GET['json']);
 if ($files == null) {
     $files = array();
 }
 foreach ($files as $key => $val) {
     $file = $key;
     if (is_numeric(strpos($file, "/"))) {
         $file = substr($file, strrpos($file, "/") + 1);
     }
     $file = "Scan_{$file}";
     if (!is_file("scans/file/{$file}")) {
<?php

require 'fpdf16/fpdf.php';
require 'connection.php';
require 'functions.php';
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->SetTopMargin(4);
$pdf->SetLeftMargin(6);
$pdf->SetAutoPageBreak(1, 0.5);
$pdf->SetDisplayMode(100);
$pdf->SetAutoPageBreak(true, 7);
$pdf->AddPage();
//$pdf->AddPage('L');
$pdf->SetDisplayMode(110, "single");
$pdf->SetTitle("Netherhall House");
$border = 1;
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFillColor(255, 255, 255);
//------------
$pdf->Cell(180, 5, "Netherhall House", 0, 0, '', true);
$pdf->Ln();
$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(95, 5, $header, 0, 0, '', true);
$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(103, 5, date("d/m/Y"), 0, 0, 'R', true);
$pdf->SetFont('Arial', '', 7);
//ver_array("REQUEST", $request);
$arrClasses = array();
//ver_array("arrClasses",$arrClasses);
//The purpose of this page should only be to keep track of the residents who are currently in Netherhall.
示例#21
0
$bdd = 'tp11';
$base = mysql_connect($host, $user, $password);
mysql_select_db($bdd) or die("Impossible de se connecter a la base de donnees {$bdd}");
$id = $_GET['id'];
$pdf = new FPDF('L', 'mm', array(90, 55));
// Creation de la page pdf
$pdf->AddPage();
$pdf->SetFillColor(100, 149, 237);
// Requete d'affichage des datas du contact
$sql = "SELECT * FROM contacts where id =" . $id;
$envoi_requete = mysql_query($sql);
$pdf->SetFont('arial', '', 9);
if ($resultats = mysql_fetch_assoc($envoi_requete)) {
    $pdf->SetAutoPageBreak(false);
    // Affichage photo
    $pdf->SetLeftMargin(10);
    $pdf->image($resultats['photo'], null, null, 20);
    // Affichage nom du contact
    $pdf->SetFont('Arial', "B");
    $pdf->SetTextColor(100, 149, 237);
    $pdf->SetLeftMargin(50);
    $pdf->SetY(-45);
    $pdf->Cell(40, 6, $resultats['nom_prenom']);
    $pdf->Ln();
    // Affichage téléphone
    $pdf->SetFont('Arial', "");
    $pdf->SetTextColor('0', '0', '0');
    $telephone = str_split($resultats['telephone'], 2);
    $num_tel = "";
    for ($x = 0; $x < count($telephone); $x++) {
        if ($x > 0 && $x < count($telephone)) {
}
if (isset($_SESSION["TIPO_SOLICITUD"])) {
    $tipoSolicitud = $_SESSION["TIPO_SOLICITUD"];
}
$pdf = new FPDF('P', 'mm', array(215.9, 330.2));
$pdf->AddFont('Calibri', 'B', 'calibrib.php');
$pdf->AddFont('Cambria', 'BI', 'cambriaz.php');
$pdf->AddFont('Cambria', 'I', 'cambriai.php');
$pdf->AddFont('Cambria', 'B', 'cambriab.php');
$pdf->AddFont('Cambria', '', 'Cambria.php');
$pdf->AddPage();
$pdf->SetFont('Arial', '', 18);
$pdf->Image($maindir . 'assets/img/Encabezado de documentos.jpg', 4.0, 0.5, 209.6, 32.2, 'JPG');
$pdf->Image($maindir . "assets/img/Pie de documentos.jpg", 4.0, 191, 208.8, 137, 'JPG');
$pdf->SetRightMargin(15);
$pdf->SetLeftMargin(15);
$pdf->SetFont('Calibri', 'B', 11);
$pdf->Cell(0, -4.5, utf8_decode("FACULTAD DE CIENCIAS JURÍDICAS"), 0, 0, 'R');
$pdf->Ln(2);
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(0, 0, utf8_decode("Teléfono: 2232-2290"), 0, 1, 'R');
$pdf->Ln(4.1);
$pdf->Cell(0, 0, utf8_decode("Edificio A-2"), 0, 1, 'R');
$pdf->Ln(4.1);
$pdf->Cell(0, 0, utf8_decode("Ciudad Universitaria"), 0, 1, 'R');
$pdf->Ln(4.1);
$pdf->Cell(0, 0, utf8_decode("Tegucigalpa, Honduras"), 0, 1, 'R');
$pdf->SetRightMargin(10);
$pdf->SetLeftMargin(10);
$pdf->Cell(18, 10, '', 0);
//$pdf->Ln(20);
示例#23
0
//Pie de página
function Footer()
{
    //Posición: a 1,5 cm del final
    $this->SetY(-15);
    //Arial italic 8
    $this->SetFont('Arial','I',8);
    //Número de página
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}*/
$pdf = new FPDF('P', 'cm', 'custom', 597.73, 467.42);
//ingreso medida puntos
//$pdf->Open();
$pdf->AliasNbPages();
$pdf->SetLeftMargin(0.9);
$pdf->PageNo();
$pdf->SetTopMargin(5.5);
$pdf->SetAutoPageBreak(0.9);
$pdf->AddPage();
$pdf->SetFont('Arial', '', 9);
$venta->ventas_ver($_REQUEST['codigo']);
$cliente_nombre = $venta->_cli_razonsocial;
$cliente_direccion = $venta->_cli_direccion;
$cliente_ruc = $venta->_cli_ruc;
if ($venta->_ven_guia == 0) {
    $guia = '';
} else {
    $guia = $venta->_ven_guia;
}
$e_fecha = $venta->_util->obtienefecha($venta->_ven_fecha);
<?php

require 'fpdf16/fpdf.php';
require 'connection.php';
validate_user();
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->SetTopMargin(20);
$pdf->SetLeftMargin(45);
$pdf->SetAutoPageBreak(1, 0.5);
$pdf->SetDisplayMode(100);
$pdf->SetAutoPageBreak(true, 10);
$pdf->AddPage();
//$pdf->AddPage('L');
$pdf->SetDisplayMode(110, "single");
$pdf->SetTitle("Netherhall House");
$border = 0;
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFillColor(255, 255, 255);
$request = filter_input_array(INPUT_POST);
if ($request[name] != "") {
    $r = mysql_query("SELECT * FROM residents LEFT JOIN countries on residents.country_id = countries.country_id WHERE name LIKE '%{$request[name]}%' OR surname LIKE '%{$request[name]}%'");
} else {
    $today = date("Y", time()) . "-" . date("m", time()) . "-" . date("d", time());
    if (!isset($request[academic_year]) || $request[academic_year] == "current") {
        // >= 28 days = 4 weeks
        //$condition_search=" AND bookings.arrival <= '$today' AND bookings.departure >= '$today' AND DATEDIFF(bookings.departure,bookings.arrival) >= 28  ";
        // 06-Feb-2010 - They want to see all the residents in the current residents list. So I remove the condition about days.
        $condition_search = " AND bookings.arrival <= '{$today}' AND bookings.planned_departure >= '{$today}' ";
    } elseif ($request[academic_year] == "short") {
        // < 28 days = 4 weeks
示例#25
0
 public function post_id_handler()
 {
     global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ROOT, $FANNIE_ARCHIVE_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $cards = "(";
     $args = array();
     if (!is_array($this->id)) {
         $this->id = array($this->id);
     }
     foreach ($this->id as $c) {
         $cards .= "?,";
         $args[] = $c;
     }
     $cards = rtrim($cards, ",");
     $cards .= ")";
     $cardsClause = " AND m.card_no IN {$cards} ";
     if ($cards == "(") {
         $cardsClause = "";
     }
     /**
       Look up transactions involving AR over last 90 days
     */
     $transP = $dbc->prepare("\n            SELECT card_no, \n                CASE WHEN trans_subtype='MI' THEN -total ELSE 0 END AS charges,\n                CASE WHEN department=990 then total ELSE 0 END as payments, \n                tdate, \n                trans_num\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "dlog_90_view AS m \n            WHERE m.card_no IN " . $cards . "\n                AND (department=990 OR trans_subtype='MI')\n            ORDER BY card_no, \n                tdate, \n                trans_num");
     $transP = $dbc->prepare("\n            SELECT card_no,\n                charges,\n                payments,\n                tdate,\n                trans_num,\n                'OLD' as timespan\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history \n            WHERE card_no IN " . $cards . "\n                AND tdate >= ?\n            UNION ALL\n            SELECT card_no,\n                charges,\n                payments,\n                tdate,\n                trans_num,\n                'TODAY' as timespan\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history_today\n            WHERE card_no IN " . $cards . "\n            ORDER BY tdate");
     $date = date('Y-m-d', mktime(0, 0, 0, date('n'), date('j') - 90, date('Y')));
     $trans_args = $args;
     $trans_args[] = $date;
     foreach ($args as $a) {
         // need cards twice for the union
         $trans_args[] = $a;
     }
     $transR = $dbc->execute($transP, $trans_args);
     $arRows = array();
     while ($w = $dbc->fetch_row($transR)) {
         if (!isset($arRows[$w['card_no']])) {
             $arRows[$w['card_no']] = array();
         }
         $arRows[$w['card_no']][] = $w;
         $date = explode(' ', $w['tdate']);
         $date_id = date('Ymd', strtotime($date[0]));
     }
     /**
       Lookup details of AR related transactions
       Stucture is:
       * card_no
         => trans_num
            => line item description(s)
     */
     $detailsQ = '
         SELECT card_no,
             description,
             department,
             trans_num
         FROM ' . $FANNIE_ARCHIVE_DB . $dbc->sep() . 'dlogBig
         WHERE tdate BETWEEN ? AND ?
             AND trans_num=?
             AND card_no=?
             AND trans_type IN (\'I\', \'D\')
     ';
     $todayQ = str_replace($FANNIE_ARCHIVE_DB . $dbc->sep() . 'dlogBig', $FANNIE_TRANS_DB . $dbc->sep() . 'dlog', $detailsQ);
     $detailsP = $dbc->prepare($detailsQ);
     $todayP = $dbc->prepare($todayQ);
     $details = array();
     foreach ($arRows as $card_no => $trans) {
         $found_charge = false;
         foreach ($trans as $info) {
             if ($info['charges'] != 0) {
                 $found_charge = true;
             }
             $dt = strtotime($info['tdate']);
             $args = array(date('Y-m-d 00:00:00', $dt), date('Y-m-d 23:59:59', $dt), $info['trans_num'], $info['card_no']);
             if ($info['timespan'] == 'TODAY') {
                 $r = $dbc->execute($todayP, $args);
             } else {
                 $r = $dbc->execute($detailsP, $args);
             }
             while ($w = $dbc->fetch_row($r)) {
                 $tn = $w['trans_num'];
                 if (!isset($details[$w['card_no']])) {
                     $details[$w['card_no']] = array();
                 }
                 if (!isset($details[$w['card_no']][$tn])) {
                     $details[$w['card_no']][$tn] = array();
                 }
                 $details[$w['card_no']][$tn][] = $w['description'];
             }
         }
         if ($found_charge) {
             $actual = array();
             $i = 0;
             while ($arRows[$card_no][$i]['charges'] == 0) {
                 $i++;
             }
             for ($i; $i < count($arRows[$card_no]); $i++) {
                 $actual[] = $arRows[$card_no][$i];
             }
             $arRows[$card_no] = $actual;
         }
     }
     $today = date("d-F-Y");
     $month = date("n");
     $year = date("Y");
     $stateDate = date("d F, Y", mktime(0, 0, 0, date('n'), 0, date('Y')));
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
     $pdf->SetAutoPageBreak(false);
     //Meat of the statement
     $balP = $dbc->prepare('
         SELECT balance
         FROM ' . $this->config->get('TRANS_DB') . $dbc->sep() . 'ar_live_balance
         WHERE card_no=?');
     $rowNum = 0;
     foreach ($this->id as $card_no) {
         $account = \COREPOS\Fannie\API\member\MemberREST::get($card_no);
         $primary = array();
         foreach ($account['customers'] as $c) {
             if ($c['accountHolder']) {
                 $primary = $c;
                 break;
             }
         }
         $balance = $dbc->getValue($balP, array($card_no));
         $pdf->AddPage();
         $pdf->Image('new_letterhead_horizontal.png', 5, 10, 200);
         $pdf->SetFont('Gill', '', '12');
         $pdf->Ln(45);
         $pdf->Cell(10, 5, sprintf("Invoice #: %s-%s", $card_no, date("ymd")), 0, 1, 'L');
         $pdf->Cell(10, 5, $stateDate, 0);
         $pdf->Ln(8);
         //Member address
         $name = $primary['lastName'];
         if (!empty($primary['firstName'])) {
             $name = $primary['firstName'] . ' ' . $name;
         }
         $pdf->Cell(50, 10, trim($card_no) . ' ' . trim($name), 0);
         $pdf->Ln(5);
         $pdf->Cell(80, 10, $account['addressFirstLine'], 0);
         $pdf->Ln(5);
         if ($account['addressSecondLine']) {
             $pdf->Cell(80, 10, $account['addressSecondLine'], 0);
             $pdf->Ln(5);
         }
         $pdf->Cell(90, 10, $account['city'] . ', ' . $account['state'] . '   ' . $account['zip'], 0);
         $pdf->Ln(25);
         $txt = "If payment has been made or sent, please ignore this invoice. If you have any questions about this invoice or would like to make arrangements to pay your balance, please write or call the Finance Department at the above address or (218) 728-0884.";
         $pdf->MultiCell(0, 5, $txt);
         $pdf->Ln(10);
         $priorQ = $dbc->prepare("\n                SELECT SUM(charges) - SUM(payments) AS priorBalance\n                FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history\n                WHERE " . $dbc->datediff('tdate', $dbc->now()) . " < -90\n                    AND card_no = ?");
         $priorR = $dbc->execute($priorQ, array($card_no));
         $priorW = $dbc->fetch_row($priorR);
         $priorBalance = is_array($priorW) ? $priorW['priorBalance'] : 0;
         $indent = 10;
         $columns = array(75, 35, 30, 30);
         $pdf->Cell($indent, 8, '');
         $pdf->SetFillColor(200);
         $pdf->Cell(40, 8, 'Balance Forward', 0, 0, 'L', 1);
         $pdf->Cell(25, 8, '$ ' . sprintf("%.2f", $priorBalance), 0, 0, 'L');
         $pdf->Ln(8);
         $pdf->Cell(0, 8, "90-Day Billing History", 0, 1, 'C');
         $pdf->SetFillColor(200);
         $pdf->Cell($indent, 8, '', 0, 0, 'L');
         $pdf->Cell($columns[0], 8, 'Date', 0, 0, 'L', 1);
         $pdf->Cell($columns[1], 8, 'Receipt', 0, 0, 'L', 1);
         $pdf->Cell($columns[2], 8, '', 0, 0, 'L', 1);
         $pdf->Cell($columns[3], 8, 'Amount', 0, 1, 'L', 1);
         $gazette = false;
         if (!isset($arRows[$card_no])) {
             $arRows[$card_no] = array();
         }
         foreach ($arRows[$card_no] as $arRow) {
             $date = $arRow['tdate'];
             $trans = $arRow['trans_num'];
             $charges = $arRow['charges'];
             $payment = $arRow['payments'];
             $detail = $details[$card_no][$trans];
             if (strstr($detail[0], "Gazette Ad")) {
                 $gazette = true;
             }
             $lineitem = count($detail) == 1 ? $detail[0] : '(multiple items)';
             foreach ($detail as $line) {
                 if ($line == 'ARPAYMEN') {
                     $lineitem = 'Payment Received - Thank You';
                 }
             }
             $pdf->Cell($indent, 8, '', 0, 0, 'L');
             $pdf->Cell($columns[0], 8, $date, 0, 0, 'L');
             $pdf->Cell($columns[1], 8, $trans, 0, 0, 'L');
             $pdf->Cell($columns[2], 8, '', 0, 0, 'L');
             if ($payment > $charges) {
                 $pdf->Cell($columns[3], 8, '$ ' . sprintf('%.2f', $payment - $charges), 0, 0, 'L');
             } else {
                 $pdf->Cell($columns[3], 8, '$ ' . sprintf('(%.2f)', abs($payment - $charges)), 0, 0, 'L');
             }
             if ($pdf->GetY() > 245) {
                 $pdf->AddPage();
             } else {
                 $pdf->Ln(5);
             }
             if (!empty($lineitem)) {
                 $pdf->SetFontSize(10);
                 $pdf->Cell($indent + 10, 8, '', 0, 0, 'L');
                 $pdf->Cell(60, 8, $lineitem, 0, 0, 'L');
                 if ($pdf->GetY() > 245) {
                     $pdf->AddPage();
                 } else {
                     $pdf->Ln(5);
                 }
                 $pdf->SetFontSize(12);
             }
         }
         $pdf->Ln(15);
         $pdf->Cell($indent, 8, '');
         $pdf->SetFillColor(200);
         if ($balance >= 0) {
             $pdf->Cell(35, 8, 'Amount Due', 0, 0, 'L', 1);
         } else {
             $pdf->Cell(35, 8, 'Credit Balance', 0, 0, 'L', 1);
         }
         $pdf->Cell(25, 8, '$ ' . sprintf("%.2f", $balance), 0, 0, 'L');
         if ($gazette) {
             $pdf->SetLeftMargin(10);
             $pdf->Image('logo_bw.png', 85, 213, 25);
             $pdf->SetY(205);
             $pdf->Cell(0, 8, '', 'B', 1);
             $pdf->Ln(5);
             $pdf->Cell(30, 5, 'Whole Foods Co-op');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Invoice Date:', 0, 0, 'R');
             $pdf->Cell(20, 5, date("m/d/Y"), 0, 1, 'L');
             $pdf->Cell(30, 5, '610 East 4th Street');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Customer Number:', 0, 0, 'R');
             $pdf->Cell(20, 5, $card_no, 0, 1, 'L');
             $pdf->Cell(30, 5, 'Duluth, MN 55805');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Invoice Total:', 0, 0, 'R');
             $pdf->Cell(20, 5, $balance, 0, 1, 'L');
             $pdf->Ln(5);
             $pdf->Cell(10, 10, trim($card_no), 0);
             $pdf->Ln(5);
             $pdf->Cell(50, 10, trim($primary['lastName']), 0);
             $pdf->Ln(5);
             $pdf->Cell(80, 10, $account['addressFirstLine'], 0);
             if ($account['addressSecondLine']) {
                 $pdf->Ln(5);
                 $pdf->Cell(80, 10, $account['addressSecondLine'], 0);
             }
             $pdf->Ln(5);
             $pdf->Cell(90, 10, $account['city'] . ', ' . $account['state'] . '   ' . $account['zip'], 0);
             $pdf->SetXY(80, 240);
             $pdf->SetFontSize(10);
             $pdf->MultiCell(110, 6, "( ) Please continue this ad in the next issue.\n( ) I would like to make some changes to my ad for the next issue.\n( ) I do not wish to continue an ad in the next issue.\n( ) I will contact you at a later date with my advertising decision.");
             $pdf->Ln(3);
             $pdf->SetFontSize(12);
             $pdf->Cell(0, 8, 'Please Return This Portion With Your Payment', 0, 0, 'C');
         }
     }
     $pdf->Output('makeStatement.pdf', 'D');
     return false;
 }
示例#26
0
 function SetLeftMargin($margin)
 {
     parent::SetLeftMargin($margin);
     $this->_makePageSize();
 }
示例#27
0
<?php

//require("libs/fc_sessoes.php");
require "libs/classes.class";
require "libs/funcoes.php";
require "libs/form.class";
require 'fpdf151/fpdf.php';
$db = new db();
$db->_DEBUG = 1;
$pdf = new FPDF("L", 'mm', "A4");
$pdf->open();
$pdf->AddPage();
$fonte = 'times';
$pdf->SetLeftMargin(5);
$pdf->SetAutoPageBreak("on", 2);
$pdf->SetFont($fonte, "", 12);
$pdf->sety(15);
$pdf->SetFont($fonte, "b", 12);
$pdf->setx(5);
$pdf->ln();
$pdf->SetFont($fonte, "", 14);
$pdf->setx(5);
$pdf->cell(50, 5, "Controle de Entregas", 0, 1);
$pdf->line(5, $pdf->GetY(), 290, $pdf->GetY());
$pdf->ln(10);
$pdf->setfont($fonte, "B", "14");
$pdf->cell(0, 5, $_GET["dtvenda"], 0, 1, "C");
$pdf->setfillcolor(235);
$pdf->SetFont($fonte, "b", 10);
$total = $db->entregas["total"];
$sql = " SELECT fun_nome,count(*) as total\n         FROM   comandas inner join comandaentrega \n                on cet_comid = com_id\n                inner join funcionarios on fun_id = cet_funid\n         WHERE com_dtcomanda = '" . strformat($_GET["dtvenda"], "dten") . "' group by fun_nome order by fun_nome";
    function Footer()
    {
        //Posición: a 1,5 cm del final
        $this->SetY(-15);
        //Arial italic 8
        $this->SetFont('Arial', 'I', 8);
        //Número de página
        $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }
}
//$pdf->FPDF('P','mm','A4');
$pdf = new FPDF('P', 'cm', 'custom', 300.28, 458.92);
//ingreso medida puntos
//$pdf->Open();
$pdf->AliasNbPages();
$pdf->SetLeftMargin(0.7);
$pdf->PageNo();
$pdf->SetTopMargin(5);
$pdf->SetAutoPageBreak(0.6);
$pdf->AddPage();
$pdf->SetFont('Arial', '', 9);
$venta->ventas_ver($_REQUEST['venta']);
$nro_documento = $venta->ven_nrodoc;
$cliente_nombre = $venta->cli_razonsocial;
$cliente_direccion = $venta->cli_direccion;
$cliente_ruc = $venta->cli_ruc;
$e_fecha = $venta->_util->obtiene_fecha($venta->ven_fecha);
$fecha = explode("/", $e_fecha);
//si fecha esta en formato dia-mes-año
$dia = $fecha[0];
$mes = $venta->_util->ver_nombre_mes($fecha[1]);
示例#29
0
文件: welcome.php 项目: abreio/Abre
require_once dirname(__FILE__) . '/../../modules/directory/permissions.php';
require_once dirname(__FILE__) . '/../../core/portal_functions.php';
//Display welcome letter for allowed users
if ($pageaccess == 1) {
    $id = $_GET['id'];
    include "../core/portal_dbconnect.php";
    $sql = "SELECT *  FROM directory where id={$id} and archived=0";
    $result = $db->query($sql);
    while ($row = $result->fetch_assoc()) {
        $firstname = htmlspecialchars($row["firstname"], ENT_QUOTES);
        $firstname = stripslashes(decrypt($firstname, ""));
        $title = htmlspecialchars($row["title"], ENT_QUOTES);
        $title = stripslashes(decrypt($title, ""));
        $location = htmlspecialchars($row["location"], ENT_QUOTES);
        $location = stripslashes(decrypt($location, ""));
        $effectivedate = htmlspecialchars($row["effectivedate"], ENT_QUOTES);
        $effectivedate = stripslashes(decrypt($effectivedate, ""));
    }
    require 'fpdf.php';
    $pdf = new FPDF();
    $pdf->AddPage();
    $todaysdate = date("F d, Y");
    $content = "\n\n\n\n\n\n\n\n{$todaysdate}\n\n\n\nDear {$firstname},\n\nCongratulations! You have been appointed to the position of {$title} at {$location} for the Hamilton City School District effective {$effectivedate}. I am confident that you will make a fine contribution to our school system.\n\nPlease contact the Treasurer's Office to complete the necessary forms for fridge benefits, such as medical insurance, life insurance, etc. within thirty (30) days of the effective date of your appointment. Life insurance is at no cost, as it is paid by the Board of Education.\n\nPlease feel free to contact me if you have any questions, now or in the future.\n\nSincerely,\n\n\n\nDr. Chad Konkle\nAssistant Superintendent for Human Resources\n\nCK: lf\n\ncc: Robert Hancock, Treasurer";
    $pdf->SetFont("Arial", "", "");
    $pdf->SetLeftMargin(20);
    $pdf->SetRightMargin(20);
    $pdf->MultiCell(0, 6, "{$content}", 0, 1);
    //$pdf->Output();
    $filename = "welcome.pdf";
    $pdf->Output($filename, 'I');
}
function createContentFile($mod, $statement, $c_username, $bild)
{
    //Erzeugung der pdf-Galerie
    //echo $statement;
    //$statement fuer exif, desc, zeit, kat(ausser Wurzel) uebergeben
    include '../share/global_config.php';
    include $sr . '/bin/share/db_connect1.php';
    switch ($mod) {
        case 'geo':
            $num100 = count($statement);
            break;
        default:
            $result100 = mysql_query("{$statement}");
            @($num100 = mysql_num_rows($result100));
            break;
    }
    if ($statement !== '') {
        //echo $statement;
        //echo "gefundene Bilder: ".$num100."<BR>";
        $seiten = floor($num100 / 20) + 1;
        define('FPDF_FONTPATH', '../share/fpdf/font/');
        require $sr . '/bin/share/fpdf/fpdf.php';
        $pdf = new FPDF('P', 'mm', 'A4');
        $pdf->SetLeftMargin(20);
        $pdf->SetFont('Arial', '', 10);
        $aktdatum = date('d.m.Y');
        for ($seite = '0'; $seite < $seiten; $seite++) {
            $pdf->AddPage();
            $pdf->Cell(0, 5, 'pic2base-Galerie', 0, 1, 'C');
            $pdf->Cell(0, 5, 'Tipp: Mit einem Klick auf den Dateinamen erhalten Sie die vergr' . utf8_decode(ö) . 'sserte Ansicht des betreffenden Bildes.', 0, 1, 'C');
            for ($zeile = '0'; $zeile < '5'; $zeile++) {
                $y_mitte = 50 + $zeile * 48;
                for ($spalte = '0'; $spalte < '4'; $spalte++) {
                    $x_mitte = 45 + $spalte * 45;
                    //Ermittlung des QH-/Ori-Dateinamens und der Bild-Masse
                    $zaehler = $spalte + $zeile * 4 + $seite * 20;
                    if ($zaehler < $num100) {
                        //echo $zaehler;
                        switch ($mod) {
                            case 'geo':
                                switch ($bild) {
                                    case '0':
                                        $result102 = mysql_query("SELECT * FROM {$table2} WHERE pic_id = '{$statement[$zaehler]}'");
                                        $FileNameV = mysql_result($result102, 0, 'FileNameV');
                                        //$FileNameHQ = mysql_result($result102, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/thumbs/' . $FileNameV));
                                        break;
                                    case '1':
                                        $result102 = mysql_query("SELECT * FROM {$table2} WHERE pic_id = '{$statement[$zaehler]}'");
                                        $FileNameHQ = mysql_result($result102, 0, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/hq-preview/' . $FileNameHQ));
                                        break;
                                }
                                $FileName = mysql_result($result102, 0, 'FileName');
                                break;
                            default:
                                switch ($bild) {
                                    case '0':
                                        $FileNameV = mysql_result($result100, $zaehler, 'FileNameV');
                                        $FileNameHQ = mysql_result($result100, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/thumbs/' . $FileNameV));
                                        break;
                                    case '1':
                                        $FileNameHQ = mysql_result($result100, $zaehler, 'FileNameHQ');
                                        @($parameter_v = getimagesize($sr . '/images/vorschau/hq-preview/' . $FileNameHQ));
                                        break;
                                }
                                $FileName = mysql_result($result100, $zaehler, 'FileName');
                                break;
                        }
                        $breite = $parameter_v[0];
                        $hoehe = $parameter_v[1];
                        $ratio = $breite / $hoehe;
                        if ($ratio > '1') {
                            //Breitformat
                            $Breite = 40;
                            $Hoehe = number_format($Breite / $ratio, 0, '.', ',');
                        } else {
                            //Hochformat
                            $Hoehe = 40;
                            $Breite = number_format($Hoehe * $ratio, 0, '.', ',');
                        }
                        $x0 = $x_mitte - $Breite / 2;
                        $y0 = $y_mitte - $Hoehe / 2;
                        switch ($bild) {
                            case '0':
                                $pdf->Image($sr . '/images/vorschau/thumbs/' . $FileNameV, $x0, $y0, $Breite, $Hoehe, 'jpg');
                                break;
                            case '1':
                                $pdf->Image($sr . '/images/vorschau/hq-preview/' . $FileNameHQ, $x0, $y0, $Breite, $Hoehe, 'jpg');
                                break;
                        }
                        //Ausgabe des Dateinamens:
                        $x1 = $x_mitte - 15;
                        $y1 = $y_mitte + 21;
                        $pdf->SetXY($x1, $y1);
                        $pdf->SetFont('Arial', '', 8);
                        $pdf->Cell(30, 5, $FileName, 0, 0, 'C', 5, 'http://' . $_SERVER['SERVER_NAME'] . $inst_path . '/pic2base/images/vorschau/hq-preview/' . $FileNameHQ);
                        //$pdf->Cell(30,5,$FileName,0,0,C,0,'http://www.pic2base.de');
                    }
                }
            }
            $seiten_nr = $seite + 1;
            $pdf->SetXY(25, 270);
            $pdf->Cell(0, 6, 'Druckdatum: ' . $aktdatum . ', Seite ' . $seiten_nr . ' von ' . $seiten, 0, 1, 'C');
            $pdf->SetFont('Arial', '', 10);
        }
        $pdf->Output($p2b_path . 'pic2base/userdata/' . $c_username . '/kml_files/thumb-gallery.pdf');
    }
}