Exemplo n.º 1
0
 function alku()
 {
     global $yhtiorow, $firstpage, $pdf, $rectparam, $norm, $norm_bold, $pieni, $ytunnus, $asiakasid, $kukarow, $kala, $tid, $otsikkotid;
     static $sivu;
     $sivu++;
     if (!isset($pdf)) {
         //PDF parametrit
         $pdf = new pdffile();
         $pdf->enable('template');
         $pdf->set_default('margin-top', 0);
         $pdf->set_default('margin-bottom', 0);
         $pdf->set_default('margin-left', 0);
         $pdf->set_default('margin-right', 0);
         $rectparam["width"] = 0.3;
         $norm["height"] = 12;
         $norm["font"] = "Courier";
         $norm_bold["height"] = 12;
         $norm_bold["font"] = "Courier-Bold";
         $pieni["height"] = 8;
         $pieni["font"] = "Courier";
         $query = "SELECT *\n                 FROM asiakas\n                 WHERE yhtio = '{$kukarow['yhtio']}'\n                 and tunnus  = '{$asiakasid}'";
         $assresult = pupe_query($query);
         $assrow = mysql_fetch_assoc($assresult);
         // Tehdään firstpage
         $firstpage = $pdf->new_page("a4");
         //  Tehdään headertemplate
         $tid = $pdf->template->create();
         $pdf->template->rectangle($tid, 20, 20, 0, 580, $rectparam);
         $pdf->template->text($tid, 30, 5, $yhtiorow["nimi"], $pieni);
         $pdf->template->text($tid, 170, 5, "{$assrow['nimi']} {$assrow['nimitark']} ({$ytunnus}) " . t("alennustaulukko"));
         $pdf->template->place($tid, $firstpage, 0, 800);
         //  Tehdään otsikkoheader
         $otsikkotid = $pdf->template->create();
         $pdf->template->text($otsikkotid, 30, 20, t("Osasto"), $norm_bold);
         $pdf->template->text($otsikkotid, 30, 0, t("Tuoteryhmä") . "/" . t("Tuotenumero"), $norm_bold);
         $pdf->template->text($otsikkotid, 330, 0, t("Aleryhmä"), $norm_bold);
         $pdf->template->text($otsikkotid, 450, 0, t("Alennus"), $norm_bold);
         if ($yhtiorow['myynnin_alekentat'] > 1) {
             $pdf->template->text($otsikkotid, 520, 0, t("Alelaji"), $norm_bold);
         }
         $pdf->template->place($otsikkotid, $firstpage, 0, 665, $norm_bold);
         $kala = 650;
         //  Asiakastiedot
         //$pdf->draw_rectangle(737, 20,  674, 300, $firstpage, $rectparam);
         $pdf->draw_text(50, 759, t("Osoite", $kieli), $firstpage, $pieni);
         $pdf->draw_text(50, 747, $assrow["nimi"], $firstpage, $norm);
         $pdf->draw_text(50, 737, $assrow["nimitark"], $firstpage, $norm);
         $pdf->draw_text(50, 727, $assrow["osoite"], $firstpage, $norm);
         $pdf->draw_text(50, 717, $assrow["postino"] . " " . $assrow["postitp"], $firstpage, $norm);
         $pdf->draw_text(50, 707, $assrow["maa"], $firstpage, $norm);
     } else {
         //  Liitetään vaan valmiit templatet uudelle sivulle
         $firstpage = $pdf->new_page("a4");
         $pdf->template->place($tid, $firstpage, 0, 800);
         $pdf->template->place($otsikkotid, $firstpage, 0, 760);
     }
     $pdf->draw_text(520, 805, t("Sivu") . ": {$sivu}", $firstpage, $norm);
 }
function hae_saldovahvistus_pdf($saldovahvistus, $boss = false)
{
    global $kukarow, $yhtiorow, $pdf, $kala, $sivu, $norm, $pieni, $kieli, $bold, $lask, $rectparam, $sivu_numero_obj_ids;
    $sivu_numero_obj_ids = array();
    //PDF parametrit
    $pdf = new pdffile();
    $pdf->set_default('margin-top', 0);
    $pdf->set_default('margin-bottom', 0);
    $pdf->set_default('margin-left', 0);
    $pdf->set_default('margin-right', 0);
    $rectparam = array();
    $rectparam["width"] = 0.3;
    $lask = 1;
    $sivu = 1;
    $norm["height"] = 10;
    $norm["font"] = "Times-Roman";
    $pieni["height"] = 8;
    $pieni["font"] = "Times-Roman";
    $bold["height"] = 10;
    $bold["font"] = "Times-Bold";
    //Otetaan tässä asiakkaan kieli talteen
    $kieli = $saldovahvistus['asiakas']['kieli'];
    $firstpage = alku($saldovahvistus);
    $firstpage = rivit($firstpage, $saldovahvistus['laskut'], $saldovahvistus, $boss);
    $kala -= 20;
    $pdf->draw_text(250, $kala, t('Avoin saldo yhteensä', $kieli), $firstpage, $bold);
    $pdf->draw_text(452.5, $kala, $saldovahvistus['avoin_saldo_summa'], $firstpage, $bold);
    $pdf->draw_text(500, $kala, $saldovahvistus['valkoodi'], $firstpage, $bold);
    loppu($firstpage, $saldovahvistus);
    if (!empty($sivu_numero_obj_ids)) {
        foreach ($sivu_numero_obj_ids as $sivu_numero_obj_id) {
            $pdf->objects[$sivu_numero_obj_id]['text'] .= $pdf->currentPage['number'] + 1;
        }
    }
    //keksitään uudelle failille joku varmasti uniikki nimi:
    list($usec, $sec) = explode(' ', microtime());
    mt_srand((double) $sec + (double) $usec * 100000);
    $pdffilenimi = "/tmp/saldovahvistus-" . md5(uniqid(mt_rand(), true)) . ".pdf";
    //kirjoitetaan pdf faili levylle..
    $fh = fopen($pdffilenimi, "w");
    if (fwrite($fh, $pdf->generate()) === FALSE) {
        die("PDF kirjoitus epäonnistui {$pdffilenimi}");
    }
    fclose($fh);
    return $pdffilenimi;
}
Exemplo n.º 3
0
function generoi_pdf_tiedostot(&$data_array, $params, $kieli)
{
    global $pdf, $asiakasrow, $yhtiorow, $sivu, $norm, $pieni, $pvm, $alkuvv, $alkukk, $alkupp, $loppuvv, $loppukk, $loppupp, $kala, $sivu, $lask, $sumkpled, $sumkplva, $sumed, $sumva, $asiakas_numero;
    $alkuvv = $params['alkuvv'];
    $alkukk = $params['alkukk'];
    $alkupp = $params['alkupp'];
    $loppuvv = $params['loppuvv'];
    $loppukk = $params['loppukk'];
    $loppupp = $params['loppupp'];
    $pdf_tiedostot = array();
    $i = 0;
    echo '<br/>' . t('Tehdään pdf tiedostot') . '<br/>';
    $bar2 = new ProgressBar();
    $bar2->initialize(count($data_array) - 1);
    foreach ($data_array as &$data) {
        $bar2->increase();
        $pdf = new pdffile();
        $pdf->set_default('margin-top', 0);
        $pdf->set_default('margin-bottom', 0);
        $pdf->set_default('margin-left', 0);
        $pdf->set_default('margin-right', 0);
        // defaultteja layouttiin
        $kala = 575;
        $lask = 1;
        $sivu = 1;
        $asiakasrow = $data['asiakasrow'];
        // kirjotetaan header
        $firstpage = alku("osasto");
        $firstpage = rivi_kaikki($firstpage, 'osasto', $data['tilaukset_ilman_try'], $params);
        $sumkpled = $data['summat_ilman_try']['sumkpled'];
        $sumkplva = $data['summat_ilman_try']['sumkplva'];
        $sumed = $data['summat_ilman_try']['sumed'];
        $sumva = $data['summat_ilman_try']['sumva'];
        // kirjotetaan footer
        loppu($firstpage, "dontsend");
        // defaultteja layouttiin
        $kala = 575;
        $lask = 1;
        $sivu = 1;
        // uus pdf header
        $firstpage = alku();
        $firstpage = rivi_kaikki($firstpage, '', $data['tilaukset_try']);
        $sumkpled = $data['summat_try']['sumkpled'];
        $sumkplva = $data['summat_try']['sumkplva'];
        $sumed = $data['summat_try']['sumed'];
        $sumva = $data['summat_try']['sumva'];
        $asiakas_numero = $data['asiakasrow']['asiakasnro'];
        // kirjotetaan footer ja palautetaan luodun tiedoston polku
        $pdf_tiedostot[] = loppu($firstpage);
        $data['tiedosto'] = $pdf_tiedostot[$i];
        $i++;
    }
    return $pdf_tiedostot;
}
} else {
    die;
}
$requete = "SELECT id_adh, nom_adh, prenom_adh, adresse_adh,\n\t\t\t\t\t\t\t\t\ttitre_adh, cp_adh, ville_adh, pays_adh, adresse2_adh\n\t\t\t\t\t\t\t\t\tFROM " . PREFIX_DB . "adherents\n\t\t\t       \t\t\t\tWHERE ";
$where_clause = "";
while (list($key, $value) = each($mailing_adh)) {
    if ($where_clause != "") {
        $where_clause .= " OR ";
    }
    $where_clause .= "id_adh=" . $DB->qstr($value, get_magic_quotes_gpc());
}
$requete .= $where_clause . " ORDER by nom_adh, prenom_adh;";
// echo $requete;
$resultat =& $DB->Execute($requete);
$pdf = new pdffile();
$pdf->set_default('margin', 0);
$param["height"] = PREF_ETIQ_CORPS;
$firstpage = $pdf->new_page("a4");
$param["fillcolor"] = $pdf->get_color('#000000');
$param["align"] = "center";
$param["width"] = 1;
$param["color"] = $pdf->get_color('#DDDDDD');
if ($resultat->EOF) {
    die;
}
$yorigin = 842 - round(PREF_ETIQ_MARGES_V * 2.835);
$xorigin = round(PREF_ETIQ_MARGES_H * 2.835);
$col = 1;
$row = 1;
$nb_etiq = 0;
$concatname = "";
Exemplo n.º 5
0
if (($tee == 'Z' or $tee == 'H') and $ulos == '') {
    if ($lets == 'go') {
        $query = "SELECT komento\n              FROM kirjoittimet\n              WHERE yhtio = '{$kukarow['yhtio']}'\n              and tunnus  = '{$kirjoitin}'";
        $komres = pupe_query($query);
        $komrow = mysql_fetch_array($komres);
        $komento = $komrow['komento'];
        if (!isset($tuotteet)) {
            $tuotteet = array();
            $tuotteet[$tuoteno] = $tuoteno;
        }
        require_once "pdflib/phppdflib.class.php";
        if ($malli == 'PDF24' or $malli == 'PDF40' or $malli == 'PDF') {
            //PDF parametrit
            if (!isset($pdf)) {
                $pdf = new pdffile();
                $pdf->set_default('margin-top', 0);
                $pdf->set_default('margin-bottom', 0);
                $pdf->set_default('margin-left', 0);
                $pdf->set_default('margin-right', 0);
            }
        }
        foreach ($tuotteet as $key => $tuoteno) {
            if ($malli != 'Zebra' and $malli != 'Zebra_hylly' and $malli != 'Zebra_tuote') {
                for ($a = 0; $a < $tkpl; $a++) {
                    if ($malli == 'Tec') {
                        require "inc/tulosta_tuotetarrat_tec.inc";
                    } elseif ($malli == 'Intermec') {
                        require "inc/tulosta_tuotetarrat_intermec.inc";
                    } elseif ($malli == 'PDF24' or $malli == 'PDF40' or $malli == 'PDF') {
                        require "inc/tulosta_tuotetarrat_pdf.inc";
                    }
Exemplo n.º 6
0
function siirtokehoitus_pdf($pdf_data)
{
    //PDF:n luonti ja defaultit
    require_once "pdflib/phppdflib.class.php";
    //PDF parametrit
    $pdf = new pdffile();
    $pdf->set_default('margin-top', 0);
    $pdf->set_default('margin-bottom', 0);
    $pdf->set_default('margin-left', 0);
    $pdf->set_default('margin-right', 0);
    //fontit
    $pieni["height"] = 11;
    $pieni["font"] = "Times-Roman";
    $bold["height"] = 11;
    $bold["font"] = "Times-Bold";
    // sitten aletaan piirtämään itse PDF sisältöä
    $sivu = $pdf->new_page("a4");
    $x = 40;
    $y = 800;
    $xx = array(20, 580);
    $pdf->draw_text($x, $y, 'Tyyppi', $sivu, $bold);
    $pdf->draw_text($x + 100, $y, 'Tuotenumero', $sivu, $bold);
    $pdf->draw_text($x + 200, $y, 'Tuotepaikka', $sivu, $bold);
    $pdf->draw_text($x + 300, $y, 'Hyllyssä', $sivu, $bold);
    $pdf->draw_text($x + 400, $y, 'Hälytysraja', $sivu, $bold);
    $y -= 20;
    $yy[0] = $yy[1] = $y;
    $pdf->draw_line($xx, $yy, $sivu);
    $y -= 20;
    foreach ($pdf_data as $row) {
        $korkeus = 20 + count($row['varapaikat']) * 20;
        if ($korkeus > $y) {
            $sivu = $pdf->new_page("a4");
            $y = 800;
            $pdf->draw_text($x, $y, 'Tyyppi', $sivu, $bold);
            $pdf->draw_text($x + 100, $y, 'Tuotenumero', $sivu, $bold);
            $pdf->draw_text($x + 210, $y, 'Tuotepaikka', $sivu, $bold);
            $pdf->draw_text($x + 320, $y, 'Hyllyssä', $sivu, $bold);
            $pdf->draw_text($x + 420, $y, 'Hälytysraja', $sivu, $bold);
            $y -= 15;
            $yy[0] = $yy[1] = $y;
            $pdf->draw_line($xx, $yy, $sivu);
            $y -= 20;
        }
        $pdf->draw_text($x, $y, 'Oletuspaikka', $sivu, $pieni);
        $pdf->draw_text($x + 100, $y, $row['tuoteno'], $sivu, $pieni);
        $pdf->draw_text($x + 210, $y, $row['tuotepaikka'], $sivu, $pieni);
        $pdf->draw_text($x + 320, $y, $row['myytavissa'], $sivu, $pieni);
        $pdf->draw_text($x + 420, $y, $row['haly'], $sivu, $pieni);
        foreach ($row['varapaikat'] as $vararow) {
            $y -= 20;
            $pdf->draw_text($x, $y, 'Varapaikka', $sivu, $pieni);
            $pdf->draw_text($x + 210, $y, $vararow['tuotepaikka'], $sivu, $pieni);
            $pdf->draw_text($x + 320, $y, $vararow['myytavissa'], $sivu, $pieni);
        }
        $y -= 15;
        $yy[0] = $yy[1] = $y;
        $pdf->draw_line($xx, $yy, $sivu);
        $y -= 20;
    }
    //keksitään uudelle failille joku varmasti uniikki nimi:
    $pdffilenimi = "/tmp/kuitti-" . md5(uniqid(rand(), true)) . ".pdf";
    //kirjoitetaan pdf faili levylle..
    $fh = fopen($pdffilenimi, "w");
    if (fwrite($fh, $pdf->generate()) === FALSE) {
        die("PDF kirjoitus epäonnistui {$pdffilenimi}");
    }
    fclose($fh);
    return $pdffilenimi;
}
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: example-packer.php 221 2005-06-25 01:22:54Z deelight $
*/
require '../phppdflib.class.php';
$pdf = new pdffile();
$pdf->enable('packer');
$page = $pdf->packer->new_page();
$pdf->set_default('smode', 'fill');
$pdf->set_default('fillcolor', $pdf->get_color('red'));
$space = new field(100, 200, 100, 200);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(200, 100, 100, 200, $page);
$pdf->set_default('fillcolor', $pdf->get_color('blue'));
$space = new field(150, 300, 150, 400);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(400, 150, 150, 300, $page);
$pdf->set_default('fillcolor', $pdf->get_color('green'));
$space = new field(400, 600, 600, 800);
$pdf->packer->allocate($space);
$pdf->draw_rectangle(800, 400, 600, 600, $page);
$pdf->set_default('fillcolor', $pdf->get_color('black'));
$pdf->set_default('height', 10);
$text = implode('', file('text.txt'));
Exemplo n.º 8
0
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

   $Id: example-wrap.php 221 2005-06-25 01:22:54Z deelight $
*/
set_time_limit(600);
require "../phppdflib.class.php";
// Starts a new pdffile object
$pdf = new pdffile();
$pdf->set_default('margin', 0);
$pdf->set_default('font', 'Courier');
$pdf->set_default('height', 10);
$fname = "../phppdflib.class.php";
$fh = fopen($fname, "r");
$data = fread($fh, filesize($fname));
fclose($fh);
$start = gettimeofday();
$p = explode("\n", $data);
$top = 720;
$page = $firstpage = $pdf->new_page("letter");
foreach ($p as $one) {
    while (is_string($one)) {
        $one = $pdf->draw_one_paragraph($top, 72, 72, 540, $one, $page);
        if (is_string($one)) {
            $page = $pdf->new_page("letter");
Exemplo n.º 9
0
             if (strpos($sarake, "::") !== FALSE) {
                 list($muuarray, $arvo) = explode("::", $sarake);
                 $sarakenimi = ${$muuarray}[$arvo] . "\n";
             } else {
                 $sarakenimi = "";
             }
             $worksheet->writeString(0, $pi, $sarakenimi . $kaudet[$i], $format_bold);
             $pi++;
         }
     }
 }
 // PDF-koodia
 if (isset($teepdf) and $teepdf == "OK") {
     require_once 'pdflib/phppdflib.class.php';
     $pdf = new pdffile();
     $pdf->set_default('margin', 0);
     $pdf->set_default('margin-left', 5);
     $rectparam["width"] = 0.3;
     $p["height"] = 10;
     $p["font"] = "Times-Roman";
     $b["height"] = 8;
     $b["font"] = "Times-Bold";
     if (count($kaudet) > 10 and $kaikkikaudet != "") {
         $p["height"]--;
         $b["height"]--;
         $saraklev = 49;
         $yhteensasaraklev = 66;
         $rivikork = 13;
     } else {
         $saraklev = 60;
         $yhteensasaraklev = 70;