예제 #1
0
function erstelle_neu($_drucktime)
{
    global $_user;
    global $_time;
    global $_settings;
    global $_absenz;
    global $_month;
    //Daten für die Anzeige
    $_sum = array();
    if ($_drucktime) {
        $tmp_jahr = date("Y", time());
        $tmp_monat = date("n", time()) - 1;
        if ($tmp_monat == 0) {
            $tmp_monat = 12;
            $tmp_jahr = $tmp_jahr - 1;
        }
        // Falls der Mitarbeiter Drucken darf ist das nur der letzte Monat
        $_monat = new time_month($_settings->_array[12][1], $_time->_letzterTag, $_user->_ordnerpfad, $tmp_jahr, $tmp_monat, $_user->_arbeitstage, $_user->_feiertage, $_user->_SollZeitProTag, $_user->_BeginnDerZeitrechnung, $_settings->_array[21][1], $_settings->_array[22][1], $_settings->_array[27][1]);
        $_jahr = new time_jahr($_user->_ordnerpfad, 0, $_user->_BeginnDerZeitrechnung, $_user->_Stunden_uebertrag, $_user->_Ferienguthaben_uebertrag, $_user->_Ferien_pro_Jahr, $_user->_Vorholzeit_pro_Jahr, $_user->_modell, $_drucktime);
    } else {
        $_monat = new time_month($_settings->_array[12][1], $_time->_letzterTag, $_user->_ordnerpfad, $_time->_jahr, $_time->_monat, $_user->_arbeitstage, $_user->_feiertage, $_user->_SollZeitProTag, $_user->_BeginnDerZeitrechnung, $_settings->_array[21][1], $_settings->_array[22][1], $_settings->_array[27][1]);
        $_jahr = new time_jahr($_user->_ordnerpfad, 0, $_user->_BeginnDerZeitrechnung, $_user->_Stunden_uebertrag, $_user->_Ferienguthaben_uebertrag, $_user->_Ferien_pro_Jahr, $_user->_Vorholzeit_pro_Jahr, $_user->_modell, $_time->_timestamp);
    }
    // PDF erstellen
    $pdf = new PDF();
    // Schrift auf Fett stellen (B)
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetDrawColor(150, 150, 150);
    $pdf->AddPage();
    $pdf->SetFillColor(220, 220, 220);
    // -------------------------------------------------------------------------
    // Mitarbeitername und Monat
    // -------------------------------------------------------------------------
    $pdf->Cell(11, 6, '', 0, '', 'L');
    $pdf->Cell(30, 6, 'Name : ', 0, 0, 'L', '1');
    $pdf->Cell(59, 6, $_user->_name, 0, 0, 'L', '1');
    $pdf->Cell(30, 6, 'Monat : ', 0, 0, 'L', '1');
    $_monatname = iconv("UTF-8", "ISO-8859-1", $_time->_monatname);
    $pdf->Cell(59, 6, $_monatname . " " . $_time->_jahr, 0, 0, 'L', '1');
    $pdf->Ln();
    $pdf->Ln(1);
    // -------------------------------------------------------------------------
    // Monatsveränderungen - Berechnungen und anzeigen
    // -------------------------------------------------------------------------
    // Hintergrund weiss setzten und Schriftart Arial, normal, 10px
    $_ferien = 0;
    $_absenzenvorhanden = 0;
    $_ftxt = "";
    $_ftxtA = "";
    $_ftxtE = "";
    foreach ($_monat->get_calc_absenz() as $werte) {
        if ($werte[1] == "F") {
            $_ferien = trim($werte[3]);
            if ($_ferien == 1) {
                $_ftxt = " Tag";
            } else {
                $_ftxt = " Tage";
            }
        }
        if ($werte[3] > 0 & $_absenzenvorhanden == 0) {
            $_absenzenvorhanden = 1;
        }
    }
    // $_ferienstart = $_jahr->_saldo_F + $_ferien;
    $_ferienstart = 0;
    $_ferienstart = round($_jahr->_saldo_F, 2);
    $_ferienstart = $_ferienstart + round($_ferien, 2);
    $_ferienstart = round($_ferienstart, 2);
    if ($_ferienstart == 1) {
        $_ftxtA = " Tag";
    } elseif ($_ferienstart > 1) {
        $_ftxtA = " Tage";
    }
    if ($_jahr->_saldo_F == 1) {
        $_ftxtE = " Tag";
    } else {
        $_ftxtE = " Tage";
    }
    $_saldo_start = 0;
    $_sum['zeit']['monat_ende'] = $_jahr->_saldo_t;
    $_sum['zeit']['vorholzeit'] = round($_jahr->_Vorholzeit_pro_Jahr / 12, 2);
    $ausz = new auszahlung($_time->_monat, $_time->_jahr);
    $wert = trim($ausz->get_auszahlung($_time->_monat, $_time->_jahr));
    $_sum['zeit']['auszahlung'] = $wert;
    $_sum['zeit']['summe'] = $_monat->_SummeSaldoProMonat;
    $_sum['ferien']['monat_ende'] = $_jahr->_saldo_F;
    $_sum['ferien']['bezug'] = $_ferien;
    if ($_time->_jahr == time_user::get_user_startyear() && $_time->_monat == time_user::get_user_startmonth()) {
        $_sum['zeit']['monat_start'] = 0;
        $_sum['zeit']['uebertrag'] = $_user->_Stunden_uebertrag;
        $_sum['ferien']['uebertrag'] = $_user->_Ferienguthaben_uebertrag;
    } else {
        $_sum['zeit']['monat_start'] = $_sum['zeit']['monat_ende'];
        $_sum['zeit']['monat_start'] += $_sum['zeit']['vorholzeit'];
        $_sum['zeit']['monat_start'] += $_sum['zeit']['auszahlung'];
        $_sum['zeit']['monat_start'] -= $_sum['zeit']['summe'];
        $_sum['zeit']['uebertrag'] = 0;
        $_sum['ferien']['uebertrag'] = 0;
    }
    $_sum['ferien']['monat_start'] = $_sum['ferien']['monat_ende'] - $_sum['ferien']['uebertrag'] + $_sum['ferien']['bezug'];
    $pdf->SetFont('Arial', '', 10);
    //$pdf->Line(21, 44, 199, 44);
    //$pdf->Line(21, 64, 199, 64);
    $pdf->SetFillColor(240, 240, 240);
    $pdf->Cell(11, 6, '', 0, '', 'L');
    $pdf->Cell(30, 6, 'Monatsanfang :', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, 'Zeit Saldo : ', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, $_sum['zeit']['monat_start'] . ' Std.', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, 'Feriensaldo : ', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, $_sum['ferien']['monat_start'] . $_ftxtA, 0, 0, 'L', '1');
    $pdf->Cell(28, 6, '', 0, 0, 'L', '1');
    $pdf->Ln();
    if ($_sum['zeit']['uebertrag'] != 0 or $_sum['ferien']['uebertrag'] != 0) {
        $pdf->Cell(11, 6, '', 0, '', 'L');
        $txt = iconv("UTF-8", "ISO-8859-1", 'Übertrag');
        $pdf->Cell(30, 6, $txt . ' : ', 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, $_sum['zeit']['uebertrag'] . " Std.", 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, $_sum['ferien']['uebertrag'] . ' Tage', 0, 0, 'L');
        $pdf->Cell(28, 6, '', 0, 0, 'L');
        $pdf->Ln();
    }
    $pdf->Cell(11, 6, '', 0, '', 'L');
    $txt = iconv("UTF-8", "ISO-8859-1", 'Veränderung');
    $pdf->Cell(30, 6, $txt . ' : ', 0, 0, 'L');
    $pdf->Cell(30, 6, '', 0, 0, 'L');
    $pdf->Cell(30, 6, $_sum['zeit']['summe'] . " Std.", 0, 0, 'L');
    $pdf->Cell(30, 6, '', 0, 0, 'L');
    $pdf->Cell(30, 6, '- ' . $_sum['ferien']['bezug'] . $_ftxt, 0, 0, 'L');
    $pdf->Cell(28, 6, '', 0, 0, 'L');
    $pdf->Ln();
    if ($_sum['zeit']['auszahlung'] != 0) {
        $pdf->Cell(11, 6, '', 0, '', 'L');
        $pdf->Cell(30, 6, 'Auszahlung : ', 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, $_sum['zeit']['auszahlung'] . " Std.", 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(28, 6, '', 0, 0, 'L');
        $pdf->Ln();
    }
    if ($_sum['zeit']['vorholzeit'] != 0) {
        $pdf->Cell(11, 6, '', 0, '', 'L');
        $pdf->Cell(30, 6, 'Vorholzeit : ', 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, $_sum['zeit']['vorholzeit'] . " Std.", 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(30, 6, '', 0, 0, 'L');
        $pdf->Cell(28, 6, '', 0, 0, 'L');
        $pdf->Ln();
    }
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->Cell(11, 6, '', 0, '', 'L');
    $pdf->Cell(30, 6, 'Monatsende :', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, '', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, $_sum['zeit']['monat_ende'] . " Std.", 0, 0, 'L', '1');
    $pdf->Cell(30, 6, '', 0, 0, 'L', '1');
    $pdf->Cell(30, 6, $_sum['ferien']['monat_ende'] . $_ftxtE, 0, 0, 'L', '1');
    $pdf->Cell(28, 6, '', 0, 0, 'L', '1');
    $pdf->Ln();
    $pdf->Ln(2);
    $pdf->SetFont('Arial', '', 10);
    // -------------------------------------------------------------------------
    // Monatstabelle
    // -------------------------------------------------------------------------
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetFillColor(200, 200, 200);
    $pdf->Cell(11, 5, '', 0, '', 'C');
    $pdf->Cell(18, 5, "Datum", 1, '', 'C', '1');
    //$pdf->Cell(7,5,"T",1,'','C', '1');
    $pdf->Cell(72, 5, "Stempelzeiten", 1, '', 'L', '1');
    $pdf->Cell(13, 5, "Summe", 1, '', 'C', '1');
    $pdf->Cell(13, 5, "Saldo", 1, '', 'C', '1');
    $pdf->Cell(14, 5, "Abw.", 1, '', 'L', '1');
    $pdf->Cell(48, 5, "Bemerkung", 1, '', 'L', '1');
    $pdf->Ln();
    $pdf->SetFont('Arial', '', 10);
    $i = 0;
    foreach ($_monat->_MonatsArray as $zeile) {
        if ($i != 0) {
            if ($zeile[4] > 0 and $zeile[5] < 0) {
                $pdf->SetFillColor(255, 255, 255);
            } else {
                $pdf->SetFillColor(220, 220, 220);
            }
            $pdf->Cell(11, 5, '', 0, '', 'C');
            $pdf->SetFont('Arial', 'B', 10);
            $pdf->Cell(11, 5, $zeile[1], 1, '', 'C', '1');
            $pdf->SetFont('Arial', '', 10);
            $pdf->Cell(7, 5, $zeile[3], 1, '', 'C', '1');
            $tmp = "";
            $trenn = "";
            for ($x = 0; $x < count($zeile[12]) and count($zeile[12]) > 0; $x++) {
                // Trennzeichen bei Stempelzeiten als $trenn
                if ($x == 0) {
                    $trenn = "";
                } elseif ($x % 2 and $x != 0) {
                    $trenn = " - ";
                } else {
                    $trenn = " / ";
                }
                $tmp = $tmp . $trenn;
                $tmp = $tmp . $zeile[12][$x];
            }
            $pdf->Cell(72, 5, $tmp, 1, '', 'L', '1');
            // Stempelzeiten in einer Schleife....
            if ($zeile[13] == 0) {
                $zeile[13] = "";
            }
            $pdf->Cell(13, 5, $zeile[13], 1, '', 'C', '1');
            if ($zeile[20] == 0 && $zeile[13] == 0) {
                $zeile[20] = "";
            }
            $pdf->Cell(13, 5, $zeile[20], 1, '', 'C', '1');
            $pdf->Cell(14, 5, $zeile[14], 1, '', 'L', '1');
            $_txt = iconv("UTF-8", "ISO-8859-1", $zeile[34]);
            $zeile[6] = iconv("UTF-8", "ISO-8859-1", $zeile[6]);
            $zeile[16] = iconv("UTF-8", "ISO-8859-1", $zeile[16]);
            $pdf->MultiCell(48, 5, $zeile[6] . $zeile[16] . $_txt, 1, '', 'L', '1');
            //$pdf->MultiCell(48,5,'',1,'','L','1');
        }
        $i++;
    }
    // --------------------------------------------------------------------------
    // Summen in der Tabelle
    // --------------------------------------------------------------------------
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->SetFillColor(200, 200, 200);
    $pdf->Cell(11, 5, '', 0, '', 'C');
    $pdf->Cell(18, 5, "", 1, '', 'C', '1');
    $pdf->Cell(72, 5, "Sollstunden :" . $_monat->_SummeSollProMonat . " Std.", 1, '', 'L', '1');
    $pdf->Cell(13, 5, $_monat->_SummeWorkProMonat, 1, '', 'C', '1');
    $pdf->Cell(13, 5, $_monat->_SummeSaldoProMonat, 1, '', 'C', '1');
    $pdf->Cell(14, 5, $_monat->_SummeAbsenzProMonat, 1, '', 'C', '1');
    $pdf->Cell(48, 5, "", 1, '', 'C', '1');
    $pdf->SetFillColor(255, 255, 255);
    $pdf->Ln();
    $pdf->Ln(2);
    // -------------------------------------------------------------------------
    // Absenzen anzeigen wenn Einträge vorhanden sind
    // -------------------------------------------------------------------------
    if ($_absenzenvorhanden) {
        $pdf->SetFillColor(240, 240, 240);
        $pdf->Cell(11, 6, '', 0, '', 'L');
        $pdf->Cell(30, 6, 'Absenzen:', 0, 0, 'L', '1');
        $pdf->Cell(60, 6, "", 0, 0, 'L', '1', '1');
        $pdf->Ln();
        $pdf->SetFont('Arial', '', 10);
        // -------------------------------------------------------------------------
        // Summen der Absenzen anzeigen (ab 0.87 erweiterbar pro Mitarbeiter)
        // -------------------------------------------------------------------------
        foreach ($_monat->get_calc_absenz() as $werte) {
            if ($werte[3] != 0) {
                $pdf->Cell(11, 6, '', 0, '', 'L');
                $pdf->Cell(30, 6, $werte[0] . " : ", 0, 0, 'L', '1');
                $pdf->Cell(60, 6, $werte[3] . " Tage (" . $werte[1] . ")", 0, 0, 'L', '1');
                $pdf->Ln();
            }
        }
        $pdf->Ln(2);
    }
    // --------------------------------------------------------------------------
    // Druckdatum und User anzeigen
    // --------------------------------------------------------------------------
    $pdf->SetFont('Arial', '', 7);
    $pdf->SetFillColor(255, 255, 255);
    $datum = 'Print : ';
    $datum .= date("j", time()) . '.';
    $datum .= date("n", time()) . '.';
    $datum .= date("Y", time());
    $datum .= ' / ';
    $datum .= date("H", time()) . ':';
    $datum .= date("i", time());
    $datum .= ' / von : ';
    $datum .= $_user->_name;
    $pdf->Cell(11, 5, '', 0, '', 'C');
    $pdf->Cell(178, 5, $datum, 0, '', 'L');
    $pdf->Ln();
    //$pdf->_checkoutput();
    $pdf->Output("./Data/" . $_user->_ordnerpfad . "/Dokumente/" . date("Y.m", $_time->_timestamp) . ".pdf");
}
                $pdf->setFont('Arial', 'B', '10');
                $pdf->Cell($cellsize, $cell_height, $p_weekly['past']);
                $pdf->setFont('Arial', '', '10');
                $pdf->setXY($cellsizecollweek + 2, $ypos + 8);
                $pdf->Cell($cellsize, $cell_height, $p_weekly['range_date']);
                $ypostTotal = $ypos + 13;
                foreach ($p_weekly['sales'] as $sales) {
                    $pdf->setXY($cellsizecollweek + 2, $ypostTotal);
                    $pdf->Cell($cellsize_half, $cell_height, $sales['name'] . ':');
                    $pdf->Cell($cellsize_half - 4, $cell_height, $sales['total'], 0, 0, 'R');
                    $ypostTotal += 5;
                }
                $line_ypos = $ypos + 43.5;
                $line_xpos_start = $cellsizecollweek + 2;
                $line_xpos_end = $cellsizecollweek + ($cellsize - 2);
                $pdf->SetDrawColor(200, 200, 200);
                $pdf->Line($line_xpos_start, $line_ypos, $line_xpos_end, $line_ypos);
                $pdf->SetDrawColor(0, 0, 0);
                $pdf->setXY($cellsizecollweek + 2, $ypos + 45);
                $pdf->Cell($cellsize_half, $cell_height, 'Total Sold:');
                $pdf->Cell($cellsize_half - 4, $cell_height, $p_weekly['total_sold'], 0, 0, 'R');
                $cellsizecollweek += $cellsize;
            }
            $ypos += 55;
            $pdf->setXY($cellstart, $ypos);
            $cellsizecollweek = $cellsize + $margin;
            $firstorder = false;
        }
        $no = 1;
    }
}
예제 #3
0
$nombreentidad = $_POST["nombrecobrador"];
$codentidad = $_POST["codcobrador"];
$where = "1=1";
if ($codcobrador != "") {
    $where .= " AND codcobrador='{$codcobrador}'";
}
if ($nombrecobrador != "") {
    $where .= " AND nombrecobrador like '%" . $nombrecobrador . "%'";
}
$where2 .= " ORDER BY nombrecobrador ASC";
//Ttulos de las columnas
$header = array('Cod. Cobrador', 'Nombre Cobrador');
//Colores, ancho de lnea y fuente en negrita
$pdf->SetFillColor(200, 200, 200);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetLineWidth(0.2);
$pdf->SetFont('Arial', 'B', 8);
//Cabecera
$pdf->SetX(60);
$w = array(20, 60);
for ($i = 0; $i < count($header); $i++) {
    $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$pdf->Ln();
$pdf->SetFont('Arial', '', 8);
$sel_resultado = "SELECT * FROM cobradores WHERE borrado=0 AND " . $where . $where2;
$res_resultado = mysql_query($sel_resultado);
$contador = 0;
while ($contador < mysql_num_rows($res_resultado)) {
    $pdf->SetX(60);
예제 #4
0
파일: pdf.php 프로젝트: raalveco/Escuela
/**
 * Genera un reporte en PDF
 *
 * @param array $result
 * @param array $sumArray
 * @param string $title
 * @param array $weightArray
 * @param array $headerArray
 */
function pdf($result, $sumArray, $title, $weightArray, $headerArray)
{
    $config = Config::read('config');
    $active_app = Router::get_application();
    //Orientación
    if ($sumArray > 200) {
        $orientation = 'L';
    } else {
        $orientation = 'P';
    }
    $numRows = 140;
    //Tipo de Papel
    if ($sumArray > 250) {
        $paper = 'legal';
    } else {
        $paper = 'letter';
    }
    if ($paper == 'letter' && $orientation == 'P') {
        $widthPage = 220;
        $numRows = 42;
    }
    if ($paper == 'legal' && $orientation == 'L') {
        $widthPage = 355;
        $numRows = 30;
    }
    if ($paper == 'letter' && $orientation == 'L') {
        $widthPage = 270;
        $numRows = 30;
    }
    //Crear Documento PDF
    $pdf = new PDF($orientation, 'mm', $paper);
    $pdf->Open();
    $pdf->AddPage();
    //Nombre del Listado
    $pdf->SetFillColor(255, 255, 255);
    $pdf->AddFont('Verdana', '', 'verdana.php');
    $pdf->SetFont('Verdana', '', 14);
    $pdf->SetY(20);
    $pdf->SetX(0);
    $pdf->Ln();
    if ($config->{$active_app}->name) {
        $pdf->MultiCell(0, 6, strtoupper($config->{$active_app}->name), 0, "C", 0);
    }
    $pdf->MultiCell(0, 6, "REPORTE DE " . strtoupper($title), 0, "C", 0);
    $pdf->SetFont('Verdana', '', 12);
    if (isset($_SESSION['fecsis'])) {
        $pdf->MultiCell(0, 6, "FECHA " . date("Y-m-d"), 0, "C", 0);
    }
    $pdf->Ln();
    //Colores, ancho de línea y fuente en negrita
    $pdf->SetFillColor(0xf2, 0xf2, 0xf2);
    $pdf->SetTextColor(0);
    $pdf->SetDrawColor(0, 0, 0);
    $pdf->SetLineWidth(0.2);
    $pdf->SetFont('Arial', 'B', 10);
    if ($weightArray[0] < 11) {
        $weightArray[0] = 11;
    }
    //Parametros del Reporte
    $pos = floor($widthPage / 2 - $sumArray / 2);
    $pdf->SetX($pos);
    for ($i = 0; $i <= count($headerArray) - 1; $i++) {
        $pdf->Cell($weightArray[$i], 7, $headerArray[$i], 1, 0, 'C', 1);
    }
    $pdf->Ln();
    //Restauración de colores y fuentes
    $pdf->SetFillColor(224, 235, 255);
    $pdf->SetTextColor(0);
    $pdf->SetFont('Arial', 'B', 7);
    //print_r($weightArray);
    //Buscamos y listamos
    $n = 1;
    $p = 1;
    $t = 0;
    foreach ($result as $row) {
        //$pdf->Cell(Ancho, Alto, contenido, ?, ?, Align)
        if ($n > $numRows || $p == 1 && $n > $numRows - 3) {
            $pdf->AddPage($orientation);
            $pdf->SetY(30);
            $pdf->SetX($pos);
            $pdf->SetFillColor(0xf2, 0xf2, 0xf2);
            $pdf->SetTextColor(0);
            $pdf->SetDrawColor(0, 0, 0);
            $pdf->SetLineWidth(0.2);
            $pdf->SetFont('Arial', 'B', 10);
            for ($i = 0; $i < count($headerArray); $i++) {
                $pdf->Cell($weightArray[$i], 7, $headerArray[$i], 1, 0, 'C', 1);
            }
            $pdf->Ln();
            $pdf->SetFillColor(224, 235, 255);
            $pdf->SetTextColor(0);
            $pdf->SetFont('Arial', 'B', 7);
            $n = 1;
            $p++;
        }
        $pdf->SetX($pos);
        for ($i = 0; $i <= count($row) - 1; $i++) {
            if (is_numeric($row[$i])) {
                $pdf->Cell($weightArray[$i], 5, trim($row[$i]), 'LRTB', 0, 'C');
            } else {
                $pdf->Cell($weightArray[$i], 5, trim($row[$i]), 'LRTB', 0, 'L');
            }
        }
        $n++;
        $t++;
        $pdf->Ln();
    }
    $pdf->SetX($pos);
    $pdf->SetFont('Arial', 'B', 7);
    $pdf->SetFillColor(0xf2, 0xf2, 0xf2);
    $pdf->Cell($weightArray[0], 5, "TOTAL", 'LRTB', 0, 'R');
    $pdf->Cell($weightArray[1], 5, $t, 'LRTB', 0, 'L');
    /*print "<div style='background: url(img/bg2.jpg) #F2f2f2;border:1px solid #c0c0c0'>
    	<table><td><img src='img/information.gif' width='64' height='64'/></td><td>";
    	print "Papel: $paper<br>";
    	print "Orientación: $orientation<br>";
    	print "Ancho Página: $widthPage mm<br>";
    	print "Número Páginas: $p<br>";
    	print "</td></table></div><br>";*/
    $file = md5(uniqid());
    $pdf->Output(CORE_PATH . 'public/temp/' . $file . ".pdf", 'F');
    if (isset($raw_output)) {
        print "<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".pdf', null); </script>";
    } else {
        Generator::forms_print("<script type='text/javascript'> window.open('" . KUMBIA_PATH . "temp/" . $file . ".pdf', null); </script>");
    }
}
예제 #5
0
    $nombre = str_replace('&#038;', '&', $nombre);
}
$sql = "Select *  " . "       from " . "       ges_comprobantes " . "where  ges_comprobantes.IdComprobante='{$IdComprobante}' " . "and    ges_comprobantes.IdLocal='{$IdLocal}' " . "and    ges_comprobantes.Eliminado='0'";
$res = query($sql);
$lafila = Row($res);
//$pdf=new PDF();
$pdf = new PDF('P', 'mm', array(210, 297));
$pdf->Open();
$pdf->AddPage();
$pdf->Ln(2);
$pdf->Cell(95);
$pdf->Cell(80, 4, "", '', 0, 'C');
$pdf->Ln(5);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(0, 0, 0);
$pdf->SetLineWidth(0.2);
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetX(130);
$pdf->Ln(40);
// Datos Cliente
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetX(27);
// NOMBRE
$pdf->Cell(130, 4, $nombre);
//$igv=$lafila["IGV"];
$igv = 0;
$pdf->Ln(6);
$pdf->SetX(180);
// NUM GUIA REMIS.
$pdf->Cell(70, 4, "");
$pdf->Cell(25, 5, '95', 0, 0, 'L');
$pdf->SetY(167);
$pdf->SetX(280);
$pdf->Cell(25, 5, '100', 0, 0, 'L');
$pdf->SetY(167);
$pdf->SetX(290);
$pdf->Cell(25, 5, '105', 0, 0, 'L');
$pdf->SetY(167);
$pdf->SetX(300);
$pdf->Cell(25, 5, '110', 0, 0, 'L');
$pdf->SetY(180);
$pdf->SetX(80);
$pdf->Cell(25, 5, '1:200,000', 0, 0, 'L');
if ($graphtax1 > 0) {
    $pdf->SetLineWidth(2);
    $pdf->SetDrawColor(255, 0, 0);
    $pdf->Line(80, 70, 80 + $graphtax1, 70);
}
$pdf->SetY(67);
$pdf->SetX(80 + $graphtax1 + 3);
$pdf->Cell(25, 5, 'Year ' . $dateprev . ' (' . number_format($sumtax1[0], 2) . ')', 0, 0, 'L');
if ($graphtax2 > 0) {
    $pdf->SetLineWidth(2);
    $pdf->SetDrawColor(255, 100, 0);
    $pdf->Line(80, 75, 80 + $graphtax2, 75);
}
$pdf->SetY(72);
$pdf->SetX(80 + $graphtax2 + 3);
$pdf->Cell(25, 5, 'Year ' . $datenext . ' (' . number_format($sumtax2[0], 2) . ')', 0, 0, 'L');
if ($graphfee1 > 0) {
    $pdf->SetLineWidth(2);
예제 #7
0
 /**
  *   Show table for lines
  *
  *   @param		PDF			$pdf     		Object PDF
  *   @param		string		$tab_top		Top position of table
  *   @param		string		$tab_height		Height of table (rectangle)
  *   @param		int			$nexY			Y
  *   @param		Translate	$outputlangs	Langs object
  *   @param		int			$hidetop		Hide top bar of array
  *   @param		int			$hidebottom		Hide bottom bar of array
  *   @return	void
  */
 function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
 {
     global $conf, $mysoc;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $pdf->SetDrawColor(128, 128, 128);
     // Rect prend une longueur en 3eme param
     $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
     // line prend une position y en 3eme param
     $pdf->line($this->marge_gauche, $tab_top + 6, $this->page_largeur - $this->marge_droite, $tab_top + 6);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('', '', $default_font_size);
     $pdf->SetXY($this->posxref, $tab_top + 1);
     $pdf->MultiCell($this->posxlabel - $this->posxref, 3, $outputlangs->transnoentities("Tasks"), '', 'L');
     $pdf->SetXY($this->posxlabel, $tab_top + 1);
     $pdf->MultiCell($this->posxworkload - $this->posxlabel, 3, $outputlangs->transnoentities("Description"), 0, 'L');
     $pdf->SetXY($this->posxworkload, $tab_top + 1);
     $pdf->MultiCell($this->posxprogress - $this->posxworkload, 3, $outputlangs->transnoentities("PlannedWorkloadShort"), 0, 'R');
     $pdf->SetXY($this->posxprogress, $tab_top + 1);
     $pdf->MultiCell($this->posxdatestart - $this->posxprogress, 3, '%', 0, 'R');
     $pdf->SetXY($this->posxdatestart, $tab_top + 1);
     $pdf->MultiCell($this->posxdateend - $this->posxdatestart, 3, '', 0, 'C');
     $pdf->SetXY($this->posxdateend, $tab_top + 1);
     $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxdatestart, 3, '', 0, 'C');
 }
예제 #8
0
 for ($i = 0; $i < count($data['qty']); $i++) {
     if ($data['qty'][$i] > 0) {
         fputs($f, '"' . $data['description'][$i] . '";"' . $data['partnumber'][$i] . '";' . $data['qty'][$i] . "\n");
     }
 }
 if ($_POST['notiz'] != '') {
     fputs($f, '"###' . $_POST['notiz'] . '"');
 }
 fclose($f);
 $pdf = new PDF();
 $data = $pdf->LoadData($dir . $filecsv);
 $pdf->SetFont('Arial', '', 10);
 $pdf->AddPage();
 $pdf->SetTitle('Packliste ab ' . $datum);
 $pdf->Titel('Packliste ab ' . $datum);
 $pdf->SetDrawColor(255, 255, 255);
 $pdf->BasicTable($data);
 $pdf->Output($dir . $filepdf, "F");
 if (file_exists($dir . $filepdf)) {
     if ($_POST['weg'] == 2) {
         $headers = array("From" => $_SESSION['email'], "X-Mailer" => "PHP/" . phpversion(), "Subject" => 'Packliste ab ' . $datum);
         $mime = new Mail_Mime(array('eol' => "\n"));
         $csv = $mime->addAttachment($dir . $filecsv, mime_content_type($dir . $filecsv), $filecsv);
         $pdf = $mime->addAttachment($dir . $filepdf, mime_content_type($dir . $filepdf), $filepdf);
         $mime->setTXTBody('Packliste');
         $hdrs = $mime->headers($headers);
         $body = $mime->get();
         $mail = Mail::factory("mail");
         $mail->_params = "-f " . $_SESSION['email'];
         $rc = $mail->send($_SESSION['email'], $hdrs, $body);
         $output = 'E-Mail verschickt';
예제 #9
0
파일: PDF.php 프로젝트: sadr110/webtrees
 /**
  * PDF Cell renderer
  *
  * @param PDF $pdf
  *
  * @return void
  */
 function render($pdf)
 {
     /**
      * Use these variables to update/manipulate values
      * Repeted classes would reupdate all their class variables again, Header/Page Header/Footer
      * This is the bugfree version
      */
     $cX = 0;
     // Class Left
     // Set up the text style
     if ($pdf->getCurrentStyle() != $this->styleName) {
         $pdf->setCurrentStyle($this->styleName);
     }
     $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
     // underline «title» part of Source item
     $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
     $match = array();
     // Indicates if the cell background must be painted (1) or transparent (0)
     if ($this->fill == 1) {
         if (!empty($this->bgcolor)) {
             // HTML color to RGB
             if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
                 $r = hexdec($match[1]);
                 $g = hexdec($match[2]);
                 $b = hexdec($match[3]);
                 $pdf->SetFillColor($r, $g, $b);
             }
         } else {
             $this->fill = 0;
         }
     }
     // Paint the Border color if set
     if (!empty($this->bocolor)) {
         // HTML color to RGB
         if (preg_match("/#?(..)(..)(..)/", $this->bocolor, $match)) {
             $r = hexdec($match[1]);
             $g = hexdec($match[2]);
             $b = hexdec($match[3]);
             $pdf->SetDrawColor($r, $g, $b);
         }
     }
     // Paint the text color or they might use inherited colors by the previous function
     if (preg_match("/#?(..)(..)(..)/", $this->tcolor, $match)) {
         $r = hexdec($match[1]);
         $g = hexdec($match[2]);
         $b = hexdec($match[3]);
         $pdf->SetTextColor($r, $g, $b);
     } else {
         $pdf->SetTextColor(0, 0, 0);
     }
     // If current position (left)
     if ($this->left == ".") {
         $cX = $pdf->GetX();
     } else {
         $cX = $pdf->addMarginX($this->left);
     }
     // Check the width if set to page wide OR set by xml to larger then page wide
     if ($this->width == 0 || $this->width > $pdf->getRemainingWidthPDF()) {
         $this->width = $pdf->getRemainingWidthPDF();
     }
     // For current position
     if ($this->top == ".") {
         $this->top = $pdf->GetY();
     } else {
         $pdf->SetY($this->top);
     }
     // Check the last cell height and adjust the current cell height if needed
     if ($pdf->lastCellHeight > $this->height) {
         $this->height = $pdf->lastCellHeight;
     }
     // Check for pagebreak
     if (!empty($temptext)) {
         $cHT = $pdf->getNumLines($temptext, $this->width);
         $cHT = $cHT * $pdf->getCellHeightRatio() * $pdf->getCurrentStyleHeight();
         $cM = $pdf->getMargins();
         // Add padding
         if (is_array($cM['cell'])) {
             $cHT += $cM['padding_bottom'] + $cM['padding_top'];
         } else {
             $cHT += $cM['cell'] * 2;
         }
         // Add a new page if needed
         if ($pdf->checkPageBreakPDF($cHT)) {
             $this->top = $pdf->GetY();
         }
         $temptext = spanLTRRTL($temptext, "BOTH");
     }
     // HTML ready - last value is true
     $pdf->MultiCell($this->width, $this->height, $temptext, $this->border, $this->align, $this->fill, $this->newline, $cX, $this->top, $this->reseth, $this->stretch, true);
     // Reset the last cell height for the next line
     if ($this->newline >= 1) {
         $pdf->lastCellHeight = 0;
     } elseif ($pdf->lastCellHeight < $pdf->getLastH()) {
         $pdf->lastCellHeight = $pdf->getLastH();
     }
     // Set up the url link if exists ontop of the cell
     if (!empty($this->url)) {
         $pdf->Link($cX, $this->top, $this->width, $this->height, $this->url);
     }
     // Reset the border and the text color to black or they will be inherited
     $pdf->SetDrawColor(0, 0, 0);
     $pdf->SetTextColor(0, 0, 0);
 }
예제 #10
0
파일: pdf.php 프로젝트: Shagril/gestcomp
        $this->Image($file, $x, $y, $w, $h);
        $this->Rotate(0);
    }
}
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 8);
$pdf->RotatedText(15, 11, utf8_decode('Je soussigné-e                                    formatrice(formateur) au centre de formation                                    certificie que le candidat(la candidate) a bien effectué en formation les activités et missions présentées dans ce tableau'), -90);
$pdf->SetFont('Arial', '', 14);
$pdf->RotatedText(200, 50, utf8_decode('BTS SERVICES INFORMATIQUES AUX ORGANISATIONS-TABLEAU DE SYNTHESE'), -90);
$pdf->SetFont('Arial', '', 12);
$pdf->RotatedText(180, 35, utf8_decode('Nom et prénom du candidat: ' . $nom . ' ' . $prenom . '                    Parcours: ' . $parcours . '                     Numéro du candidat: ' . $numeroINE), -90);
$pdf->SetFont('Arial', '', 5);
$pdf->SetX(30);
$pdf->Cell(15, 4, '', 1, 0, '');
$pdf->SetDrawColor(235, 235, 235);
$pdf->Cell(25, 4, '', 1, 0, '');
$pdf->SetDrawColor(0, 0, 0);
$pdf->Cell(60, 4, '', 1, 0, '');
$pdf->RotatedText(140, 11, 'Situation obligatoire', -90);
$pdf->Cell(20, 16, '', 1, 0, '');
$i = 0;
foreach ($rowsObligatoire as $data) {
    $i = $i + 1;
    $pdf->SetX(30);
    $ref = false;
    foreach ($rowsObligatoireRef as $data1) {
        if ($data['CODEOBLIGATIONSITUATION'] == $data1['codeobligationsituation'] and $data1['nbRef'] > 0) {
            $ref = true;
        }
    }
예제 #11
0
require_once ".././include/initialize.php";
$oferta = Oferta::find_by_id($_GET['id']);
$apartament = Apartament::find_by_id($oferta->idApartament);
$client = Client::find_by_id($apartament->idClient);
$agent = User::find_by_id($client->idUtilizator);
$pdf = new PDF();
$pdf->AddPage();
$pdf->SetMargins(15, 15);
//descriere proprietate
$pdf->Image(PDF_PATH . DS . 'bara1.png', 15, 45, 130.5);
$pdf->SetFont("Times", "", 14);
$pdf->SetXY(25, 42.5);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(15, 11, 'PROPRIETATE ', 0, 1);
$pdf->SetXY(15.35, 51);
$pdf->SetDrawColor(175, 37, 28);
$pdf->SetLineWidth(0.5);
$pdf->Cell(130, 18, "", 1);
// descriere proprietate
$pdf->SetXY(18, 53);
$pdf->SetTextColor(0);
$pdf->Cell(130, 7, $oferta->Titlu);
//$pdf->SetXY(18, 60);
//$pdf->Cell(130,7,$proprietate->Descriere);
//pret
$pdf->Image(PDF_PATH . DS . 'bara2.png', 155, 45, 42);
$pdf->SetFont("Times", "", 14);
$pdf->SetXY(165, 42.5);
$pdf->SetTextColor(255, 255, 255);
$pdf->Cell(15, 11, 'PRET', 0, 1);
$pdf->SetXY(155.35, 51);
예제 #12
0
    $pdf->Valor($participante['p_nserie_ipad']);
    $pdf->Ln(14);
    //$pdf->Cell(10);
    //$pdf->MultiCell(170,6,utf8_decode(''),'',1,'L',1);
    //$pdf->Cell(0);
    //$pdf->Ln(28);
    $pdf->SetFont('Helvetica', 'B', 12);
    $pdf->Cell(0, 6, utf8_decode('Certifico que los datos aquí expuestos son verídicos.'), '', 1, 'C');
    $pdf->Ln(8);
    $pdf->SetFont('Helvetica', '', 12);
    $pdf->Cell(0, 6, utf8_decode($fecha_validacion), '', 1, 'C');
    $pdf->Ln(8);
    $pdf->Cell(0, 6, '___________________________________', '', 1, 'C');
    $pdf->Cell(0, 6, utf8_decode($nombre_participante), '', 1, 'C');
    // ley de protección
    $pdf->Ln(20);
    $pdf->SetFont('Helvetica', '', 8);
    $pdf->SetFillColor(255, 255, 255);
    $pdf->SetTextColor(107, 107, 107);
    $pdf->SetDrawColor(239, 239, 239);
    $pdf->MultiCell(0, 6, utf8_decode('Los datos personales que nos proporcione serán protegidos conforme a lo dispuesto por la Ley Federal de Transparencia y Acceso a la Información Pública Gubernamental, los cuales serán incorporados y tratados en el sistema de datos personales denominado REGISTRO DE ORIENTACIÓN A LOS PARTICULARES. Dicho sistema fue registrado en el listado de sistemas de datos personales que administra el Instituto Federal de Acceso a la Información y Protección de Datos (www.ifai.mx).'), 'B', 1, 'L', 1);
    $pdf->Output();
    ?>

<?php 
}
// end of the loop.
?>

<?php 
//get_footer();
예제 #13
0
        //largor,ubicacion derecha,inicio,ubicacion izquierda
    }
}
$pdf = new PDF();
//'P'=vertical o 'L'=horizontal,'mm','A4' o 'Legal'
$pdf->AddPage('L', 'Legal');
$pdf->AliasNbPages();
$pdf->SetFont('Arial', 'B', 16);
$pdf->SetTitle('LISTADO DE SUELDOS');
$pdf->Cell(300, 10, 'Listado Sueldos por Funcionario', 100, 100, 'C');
//Titulo
//Set font and colors
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFillColor(153, 192, 141);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(153, 192, 141);
$pdf->SetLineWidth(0.3);
//Table header
/*$pdf->Cell(20,10,'SIAPE',1,0,'L',1);
$pdf->Cell(50,10,'Nome',1,1,'L',1);*/
$pdf->Cell(15, 10, 'Item', 1, 0, 'C', 1);
$pdf->Cell(55, 10, 'Funcionario', 1, 0, 'C', 1);
$pdf->Cell(20, 10, 'Fecha', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'Sueldo Bruto', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'IPS', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'Ausencia', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'Permisos', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'Judicial', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'ASO', 1, 0, 'C', 1);
$pdf->Cell(25, 10, 'Reposo', 1, 0, 'C', 1);
$pdf->Cell(30, 10, 'Otros Descuentos', 1, 0, 'C', 1);
 /**
  *   Show table for lines
  *
  *   @param		PDF			$pdf     		Object PDF
  *   @param		string		$tab_top		Top position of table
  *   @param		string		$tab_height		Height of table (rectangle)
  *   @param		int			$nexY			Y
  *   @param		Translate	$outputlangs	Langs object
  *   @param		int			$hidetop		Hide top bar of array
  *   @param		int			$hidebottom		Hide bottom bar of array
  *   @return	void
  */
 function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
 {
     global $conf, $mysoc;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $pdf->SetDrawColor(128, 128, 128);
     // Rect prend une longueur en 3eme param
     $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
     // line prend une position y en 3eme param
     $pdf->line($this->marge_gauche, $tab_top + 6, $this->page_largeur - $this->marge_droite, $tab_top + 6);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('', '', $default_font_size);
     $pdf->SetXY($this->posxref - 1, $tab_top + 2);
     $pdf->MultiCell(80, 2, $outputlangs->transnoentities("Tasks"), '', 'L');
 }
예제 #15
0
function home__memberlist_printview()
{
    global $base_url, $files_dir, $config;
    // $content='<html><head><meta http-equiv="Content-Type" content="application/pdf; charset=utf-8" />';
    // drupal_add_css(BOOTSTRAP.'/css/bootstrap.min.css');
    // drupal_add_css(CHURCHDB.'/cdb_printview.css');
    // $content=$content.drupal_get_header();
    if (!user_access("view memberliste", "churchdb")) {
        addErrorMessage(t("no.permission.for", t("list.of.members")));
        return " ";
    }
    require_once ASSETS . '/fpdf17/fpdf.php';
    $compact = true;
    if (isset($_GET["compact"])) {
        $compact = $_GET["compact"];
    }
    // Instanciation of inherited class
    $pdf = new PDF('P', 'mm', 'A4');
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 9);
    $res = home_getMemberList();
    $pdf->SetLineWidth(0.4);
    $pdf->SetDrawColor(200, 200, 200);
    $fields = _home__memberlist_getSettingFields()->fields;
    foreach ($res as $p) {
        $pdf->Line(8, $pdf->GetY() - 1, 204, $pdf->GetY() - 1);
        $pdf->Cell(10, 10, "", 0);
        if ($p->imageurl == null || !file_exists("{$files_dir}/fotos/{$p->imageurl}")) {
            $p->imageurl = "nobody.gif";
        }
        $pdf->Image("{$files_dir}/fotos/{$p->imageurl}", $pdf->GetX() - 10, $pdf->GetY() + 1, 9);
        $pdf->Cell(2);
        $pdf->Cell(13, 9, $p->anrede, 0, 0, 'L');
        $pdf->Cell(48, 9, utf8_decode("{$p->name}, {$p->vorname}"), 0, 0, 'L');
        $pdf->Cell(45, 9, utf8_decode("{$p->strasse}"), 0, 0, 'L');
        // TODO: second occurence of code part - whats this for?
        $birthday = "";
        if ($p->geburtsdatum != null) {
            if ($p->year < 7000) {
                $birthday = "{$p->day}.{$p->month}.";
            }
            if ($p->year != 1004 && $fields["memberlist_birthday_full"]->getValue()) {
                if ($p->year < 7000) {
                    $birthday = $birthday . $p->year;
                } else {
                    $birthday = $birthday . $p->year - 7000;
                }
            }
        }
        $pdf->Cell(20, 9, $birthday, 0, 0, 'L');
        if ($fields["memberlist_telefonprivat"]->getValue() && $p->telefonprivat != "") {
            $pdf->Cell(30, 9, $p->telefonprivat, 0, 0, 'L');
        } else {
            if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->telefongeschaeftlich != "") {
                $pdf->Cell(30, 9, $p->telefongeschaeftlich, 0, 0, 'L');
            } else {
                if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->fax != "") {
                    $pdf->Cell(30, 9, $p->fax . " (Fax)", 0, 0, 'L');
                } else {
                    $pdf->Cell(30, 9, "", 0, 0, 'L');
                }
            }
        }
        if ($fields["memberlist_telefonhandy"]->getValue() && $p->telefonhandy != "") {
            $pdf->Cell(30, 9, $p->telefonhandy, 0, 0, 'L');
        }
        // Zeilenumbruch
        $pdf->Ln(5);
        $pdf->Cell(73);
        $pdf->Cell(48, 10, "{$p->plz} " . utf8_decode($p->ort), 0, 0, 'L');
        $pdf->Cell(17);
        if ($fields["memberlist_email"]->getValue() && $p->email != "") {
            $pdf->SetFont('Arial', '', 8);
            $pdf->Cell(30, 9, $p->email);
            $pdf->SetFont('Arial', '', 9);
        }
        $pdf->Ln(12);
    }
    $pdf->Output(t("list.of.members") . '.pdf', 'I');
}
 function constructPIContent($pdf, $output, $order, $ignoreStockStatusDepot, $print_per_orders)
 {
     /*  NOTES!!!!!!!!!!!!!!!!
      *  if $print_per_orders == false, $order should contain "collections of orders"
      *  elseif $print_per_orders == true, $order should contain "one order only"
      */
     use_class('Product');
     use_class('ProductAttribute');
     global $class_pm, $class_pb, $product_categories_name, $DIAMOND_BRAND_IDS;
     if ($print_per_orders) {
         $orders[] = $order;
     } else {
         $orders = $order;
     }
     //echo "<pre>";var_dump($orders);die();
     $margin = 5;
     $fontsize_big = '9';
     $fontsize_med = '8';
     $fontsize_sml = '7';
     $fontsize_tny = '5';
     $barcode_width = 32;
     $barcode_pos = 210 - $margin - $barcode_width - 1;
     $element_name_max_chars = 30;
     if ($output == 'F') {
         //PRODUCE PDF FILE PER ITEM (MULTI PDF FILE PER ORDER)
         $pdf = new PDF('P', 'mm', 'A4');
         $pdf->setTitle('Production Instruction');
         $pdf->SetAuthor('JULIE GRACE / Bonofactum');
         $pdf->SetCreator('k-Auto Generated PDF');
         $pdf->SetDisplayMode('real');
         $pdf->SetAutoPageBreak(false);
         $pdf->AliasNbPages();
         $pdf->SetFillColor(191, 191, 191);
     }
     //start looping orders
     foreach ($orders as $order) {
         $o = $order['detail'];
         $is_ottob2b = $o['jng_sp_id'] == '11' || strpos(strtolower($o['customer']), 'otto b2b') !== false;
         foreach ($order['items'] as $oiid => $i) {
             if ($i['status'] < 8) {
                 $this->pi_printed[strtolower($o['type'])][] = $oiid;
             }
             $obj_product = new Product($i['products_id']);
             $is_gold_product = $obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925;
             $pdf->pi_number = $o['id'];
             if ($this->duplex_printing && isset($item_page_count) && $item_page_count % 2 != 0) {
                 $pdf->AddPage();
             }
             $pdf->AddPage();
             $item_page_count = 1;
             $product_key = $i['products_id'] . '-' . $i['articles_id'];
             $product_qty = intval($i['quantity']);
             $p = $this->products[$product_key];
             $is_elli_premium = $p['p']['products_brand_id'] == '29';
             $is_diamore = in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS);
             $is_pearl = $p['p']['products_brand_id'] == '7';
             $ean = $this->products_ean[$product_key];
             $product_complexity = strtoupper(productComplexityName($p['p']['complexity']));
             $order_type_code = '';
             if (strtoupper($o['type']) == 'DP') {
                 $order_type_code = strtoupper($o['type']);
                 $otc_width = 12;
             } else {
                 $order_type_code = $o['customer_type'];
                 $otc_width = 20;
             }
             $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $margin, $barcode_width);
             $pdf->setFont('Arial', 'B', '12');
             $YPOS = $margin;
             $lineheight = 4;
             //ORDER TYPE CODE (JG,SP,DP)
             $pdf->SetXY($barcode_pos - $otc_width, 10);
             $pdf->Cell(100, $lineheight, $order_type_code);
             //PROCESS DATE
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $process_date = date('d M Y', strtotime($i['prod_target_in']));
             $pdf->SetXY($barcode_pos, 22);
             $pdf->Cell($barcode_width, $lineheight, $process_date, 0, 2, 'R');
             //PRODUCT COMPLEXITY
             $pdf->setFont('Arial', 'B', '12');
             $pdf->SetXY($barcode_pos, 22 + $lineheight + 5);
             $pdf->Cell($barcode_width, $lineheight, $product_complexity, 0, 2, 'R');
             //PAGE HEADER
             $margin_orderinfo = $margin + 50;
             $pdf->SetXY($margin_orderinfo, $YPOS);
             $pdf->Cell(100, $lineheight, 'Production Instruction ' . $o['id'] . ' (' . $i['counter'] . ') - print ' . ($i['print_count'] + 1));
             $YPOS += $lineheight + 1;
             //ORDER INFORMATION
             $lineheight = 3.5;
             $orderilbl = array();
             $orderinfo = array();
             $orderilbl[] = 'Ship To (Country)';
             $orderinfo[] = ': ' . trim($o['shipto_name']) . ($o['shipto_address'] != '' ? ' (' . $o['shipto_address'] . ')' : '');
             //Show shipping window date only for order which using amazon logistic
             if (in_array($o['jng_sp_id'], array_keys(getSalesPartnerUseAmazonLogistic())) && isset($i['shipping_window_open'])) {
                 $orderilbl[] = 'Shipping Window Date';
                 $orderinfo[] = ': ' . date('d. M Y', strtotime($i['shipping_window_open']));
             }
             /* Moved to below barcode
                $orderilbl[] = 'Process Date';
                $orderinfo[] = ': '.date('d. M Y', strtotime($i['prod_target_in']));
                 */
             $orderilbl[] = 'Customer Name';
             $vip_status = $o['customer_is_vip'] ? ' ( VIP )' : '';
             if ($is_ottob2b) {
                 $orderinfo[] = ': OTTO B2B';
             } else {
                 $orderinfo[] = ': ' . $o['customer'] . $vip_status;
             }
             //$orderilbl[] = 'Order Source / Customer Name';
             //$orderinfo[] = ': '.$o['customer_type'].' / '.$o['customer'];
             //$orderilbl[] = 'Product Qty x EAN (ID / Code)';
             //$orderinfo[] = ': '.intval($i['quantity']).' x '.$ean.' ('.$p['p']['products_id'].' / '.$p['p']['products_model'].')';
             $orderilbl[] = 'Product Qty x EAN';
             $orderinfo[] = ': ' . $product_qty . ' x ' . $ean;
             $pdf->setFont('Arial', '', $fontsize_med);
             $pdf->setXY($margin_orderinfo, $YPOS);
             $pdf->MultiCell(50, $lineheight, implode("\n", $orderilbl));
             $pdf->setXY($margin_orderinfo + 30, $YPOS);
             $pdf->MultiCell(100, $lineheight, implode("\n", $orderinfo));
             $maxline = count($orderilbl);
             $YPOS += $maxline * $lineheight + 10;
             //STOCK PREPARATION
             $pdf->setFont('Arial', 'B', $fontsize_big);
             if ($i['stock_status'] == 'D' && !$ignoreStockStatusDepot) {
                 //USE DEPOT STOCK
                 $lineheight = 6;
                 $pdf->SetXY($margin + 1, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Depot Stock', 1, 0, 'C', true);
                 $YPOS += $lineheight + 3;
             } elseif ($i['stock_status'] == 'P') {
                 //USE FINISH GOOD STOCK
                 $lineheight = 6;
                 $pdf->SetXY($margin + 1, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Finish Good', 1, 0, 'C', true);
                 $YPOS += $lineheight + 3;
             } else {
                 //USE ELEMENTS STOCK
                 $lineheight = 4;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Elements Preparation');
                 $YPOS += $lineheight + 1;
                 $pue_total = count($p['elements']);
                 $pue_rows = ceil($pue_total / 2);
                 $max_rows_el_per_page_1 = 12;
                 //MAX ROWS ELEMENT ON PAGE 1
                 $max_rows_el_per_page_n = 14;
                 //MAX ROWS ELEMENT ON NEXT PAGE
                 $max_rows_el_per_page = $max_rows_el_per_page_1;
                 $pue_counter = 0;
                 $pue_number = 0;
                 $rowpos = $YPOS;
                 $colpos = $margin + 1;
                 $colheight = 20;
                 $col_subcol_width = array();
                 $col_subcol_width[1] = 6;
                 //          $col_subcol_width[2] = $colheight;
                 $col_subcol_width[2] = 20;
                 $col_subcol_width[3] = 10;
                 $col_subcol_width[4] = 51;
                 $col_subcol_width[5] = 10;
                 $col_subcol_imgepos = $col_subcol_width[1];
                 $col_subcol_infopos = $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3];
                 $colwidth = array_sum($col_subcol_width);
                 $print_header_el = false;
                 foreach ($p['elements'] as $element) {
                     if ($pue_counter == 0 || $print_header_el) {
                         $lineheight = 5;
                         $pdf->setXY($colpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell($col_subcol_width[1], $lineheight, 'No', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[2], $lineheight, 'Image', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[3], $lineheight, 'ID', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[4], $lineheight, 'Info', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[5], $lineheight, 'Qty', 1, 0, 'C', true);
                         $rowpos += $lineheight;
                     }
                     $pue_counter++;
                     $pue_number++;
                     $e = $this->elements[$element['elements_id']];
                     $element_image = $this->getImageForPDF($e->image, '80', '80');
                     $element_info = array();
                     $element_info['n'] = substr($e->detail['name'], 0, $element_name_max_chars) . (strlen($e->detail['name']) > $element_name_max_chars ? '...' : '');
                     //var_dump($e->attributes); exit;
                     $element_info['c'] = $e->attributes['color']['name'];
                     //$element_info['s'] = $e->attributes['size']['name'];
                     $material_name = array();
                     $material_name = explode(',', $e->attributes['material']['name']);
                     $element_info['m'] = count($material_name) > 1 ? $material_name[1] : $material_name[0];
                     $element_info['sh'] = '';
                     if (!eregi('other', $e->attributes['size']['name'])) {
                         $element_info['sh'] = $e->attributes['size']['name'];
                     }
                     if (!eregi('other', $e->attributes['shape']['name'])) {
                         if ($element_info['sh'] != '') {
                             $element_info['sh'] .= '.';
                         }
                         $element_info['sh'] .= $e->attributes['shape']['name'];
                     }
                     //$element_info['h'] = $e->attributes['shape']['name'];
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_hammer'] == '1') {
                         $element_info['f'][] = 'Hammered';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_brush'] == '1') {
                         $element_info['f'][] = 'Brushed';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_oxid'] == '1') {
                         $element_info['f'][] = 'Oxidized/No Antitarnish';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_goldplate'] == '1') {
                         $element_info['f'][] = 'Yellow Goldplated';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_rosegoldplate'] == '1') {
                         $element_info['f'][] = 'Rose Goldplate';
                     }
                     $element_info['f'] = count($element_info['f']) > 0 ? implode(',', $element_info['f']) : '';
                     if ($element_image != '') {
                         $pdf->Image($element_image, $colpos + $col_subcol_imgepos, $rowpos, $col_subcol_width[2]);
                     }
                     $pdf->setXY($colpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_med);
                     $pdf->Cell($col_subcol_width[1], $colheight, $pue_number, 1, 0, 'C', true);
                     $pdf->Cell($col_subcol_width[2], $colheight, '', 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[3], $colheight, $element['elements_id'], 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[4], $colheight, '', 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[5], 10, $product_qty * $element['quantity'], 1, 0, 'C');
                     $pdf->setXY($colpos + $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3] + $col_subcol_width[4], $rowpos + 10);
                     $pdf->SetTextColor(209, 209, 209);
                     $pdf->setFont('Arial', 'B', $fontsize_big + 2);
                     $pdf->Cell($col_subcol_width[5], 10, 'QC', 1, 0, 'C');
                     $pdf->SetTextColor(0, 0, 0);
                     $pdf->setFont('Arial', '', $fontsize_med);
                     //$pdf->setXY($colpos + $col_subcol_infopos, $rowpos);
                     //$pdf->MultiCell($col_subcol_width[4], 4, implode("\n", $element_info), 0, 'C');
                     $rowpos_incol = $rowpos + 1;
                     //TODO: make column table could wrapped for text and have flexible height, for example please find this reference : http://www.fpdf.de/downloads/addons/3/
                     $ei_labels = array('s' => 'Size: ', 'm' => 'Material: ', 'h' => 'Shape: ');
                     foreach ($element_info as $key => $ei) {
                         if ($ei != '') {
                             if ($key == 'c') {
                                 $pdf->setFont('Arial', 'B', $fontsize_big + 2);
                                 $lineheight = 4;
                             } elseif ($key == 'f') {
                                 $pdf->setFont('Arial', 'B', $fontsize_big);
                                 $lineheight = 4;
                             } else {
                                 $pdf->setFont('Arial', '', $fontsize_med);
                                 $lineheight = 3.5;
                             }
                             if (array_key_exists($key, $ei_labels)) {
                                 $ei = $ei_labels[$key] . $ei;
                             }
                             $pdf->setXY($colpos + $col_subcol_infopos, $rowpos_incol);
                             $pdf->Cell($col_subcol_width[4], $lineheight, $ei, 0, 0, 'C');
                             $rowpos_incol += $lineheight;
                         }
                     }
                     if ($pue_rows > $max_rows_el_per_page) {
                         //IF ELEMENT USED MORE THAN MAX ROWS ELEMENT COULD FIT PER PAGE
                         $n_rows = $max_rows_el_per_page;
                     } else {
                         $n_rows = $pue_rows;
                     }
                     if ($pue_counter == $n_rows) {
                         $colpos = $margin + $colwidth + 5;
                         $rowpos = $YPOS;
                         $print_header_el = true;
                     } else {
                         $print_header_el = false;
                         $rowpos += $colheight;
                         if ($pue_counter % $max_rows_el_per_page == 0 && $pue_counter / $max_rows_el_per_page > 1) {
                             //IF ELEMENT USED REACH THE END OF PAGE AND THERE STILL ELEMENT NEED TO BE PRINTED
                             $pdf->AddPage();
                             if ($pdf->PageNo() > 1) {
                                 $max_rows_el_per_page = $max_rows_el_per_page_n;
                             }
                             //SET MARGIN TO THE VERY TOP OF PAGE
                             $colpos = $margin + 1;
                             $rowpos = $margin;
                             $YPOS = $rowpos;
                             $pue_rows = ceil(($pue_total - $pue_number) / 2);
                             //RECALCULATE THE REST OF ELEMENTS THAT COULD DIVIDED INTO 2 COLUMNS
                             $pue_counter = 0;
                         }
                     }
                 }
                 $YPOS += 5 + 3 + $pue_rows * $colheight;
             }
             //PRODUCT INFORMATION
             if ($pue_rows > 9) {
                 $pdf->AddPage();
                 $item_page_count++;
                 $YPOS = $margin;
             }
             $lineheight = 4;
             $imgbig_width = 60;
             $imgsml_width = 25;
             $rowpos = $YPOS;
             $colpos = $margin + 1;
             $pdf->SetXY($margin, $YPOS);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Product Information');
             $YPOS += $lineheight + 1;
             $rowpos = $YPOS;
             $imgbig = $this->getImageForPDF($p['p']['products_image'], '', '212');
             //if($imgbig!='') $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width);
             if ($imgbig != '') {
                 $colposmainimage = $colpos;
                 $image_metadata = getimagesize($imgbig);
                 //MAKE IMAGE CENTERED WHEN SIZE IS PORTRAIT
                 if ($image_metadata[0] == 147) {
                     $colposmainimage = $colpos + 9;
                 }
                 $pdf->Image($imgbig, $colposmainimage, $rowpos, 0, $imgbig_width);
             }
             $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width);
             $rowpos_main_image = $YPOS + $imgbig_width + 2;
             $rowpos = $YPOS;
             $img_h_resized = 0;
             //SHOW LOGO DIAMORE AND ELLI PREMIUM FOR NON OTTO B2B ORDERS
             if ($i['products_id'] > 0 && ($is_diamore || $is_elli_premium)) {
                 $pb = $class_pb->retrieveDetail($p['p']['products_brand_id']);
                 $img_path = DIR_WS_IMAGES . $pb['brand_image'];
                 $imgsize = getimagesize($img_path);
                 $img_w = $imgsize[0];
                 $img_h = $imgsize[1];
                 $h_ratio = $img_h / $img_w;
                 $img_w_resized = 50;
                 $img_h_resized = $img_w_resized * $h_ratio;
                 $pdf->Image($img_path, 150, $YPOS, $img_w_resized, $img_h_resized);
             }
             /*USE IMAGE DIAMOND
               if($class_pm->productContainMaterials($i['products_id'], 52)) {
                   $img_path = FPDF_IMGPATH.'diamond.jpg';
                   $imgsize = getimagesize($img_path);
                   $img_w = $imgsize[0];
                   $img_h = $imgsize[1];
                   $h_ratio = $img_h/$img_w;
                   $img_w_resized = 40;
                   $img_h_resized = $img_w_resized * $h_ratio;
                   $pdf->Image($img_path,165,$YPOS,$img_w_resized,$img_h_resized);
               }
                */
             if ($is_gold_product) {
                 $lineheight = 6;
                 $leftpos = 150;
                 $rowpos = $YPOS + $img_h_resized + 2;
                 $pdf->SetFontSize($fontsize_big + 5);
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C');
             }
             //SPECIAL TREATMENT
             $product_finishing_array_st = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING);
             $finishing_product_st = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2');
             //echo "<pre>";var_dump($finishing_product_st);die();
             if (empty($finishing_product_st)) {
                 unset($finishing_product_st);
             }
             if ($finishing_product_st == NULL) {
                 $isset_product_finishing = false;
             } else {
                 $isset_product_finishing = true;
             }
             if (!$is_diamore && !$is_elli_premium) {
                 if ($isset_product_finishing) {
                     $rowpos = $YPOS + $img_h_resized;
                     $lineheight = 6;
                     $leftpos = 150;
                     //special treament
                     $pdf->SetFontSize($fontsize_big + 3);
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->Cell(50, $lineheight, 'SPECIAL TREATMENT', 0, 2, 'C');
                     if ($i['products_id'] > 0 && ($is_gold_product || $is_pearl)) {
                         if ($is_gold_product) {
                             //gold
                             $rowpos = $rowpos + 7;
                             $pdf->SetFontSize($fontsize_big + 1);
                             $pdf->SetXY($leftpos, $rowpos);
                             $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C');
                         }
                         /*
                                                     if ($is_elli_premium) {
                            $products_used_materials = $class_pm->retrieveProductMaterialsUsed($i['products_id']);
                            if (in_array(52, $products_used_materials)) {
                                $rowpos = $rowpos + 5;
                                $pdf->SetFontSize($fontsize_big+1);
                                $pdf->SetXY($leftpos, $rowpos);
                                $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C');
                            }
                            if (in_array(5, $products_used_materials)) {
                                $rowpos = $rowpos + 5;
                                $pdf->SetFontSize($fontsize_big+1);
                                $pdf->SetXY($leftpos, $rowpos);
                                $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C');
                            }
                                                     }
                                                     if ($is_diamore) {
                            //diamore
                            $rowpos = $rowpos + 5;
                            $pdf->SetFontSize($fontsize_big+1);
                            $pdf->SetXY($leftpos, $rowpos);
                            $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C');
                                                     }
                         * 
                         */
                         if ($is_pearl) {
                             //pearl
                             $rowpos = $rowpos + 5;
                             $pdf->SetFontSize($fontsize_big + 1);
                             $pdf->SetXY($leftpos, $rowpos);
                             $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C');
                         }
                     }
                     //$pdf->Rect(150, 120, $img_w_resized, 30);
                 }
             }
             $leftpos = $colpos + $imgbig_width + 2;
             $rowpos = $YPOS;
             $lineheight = 4;
             $linesep = 1;
             $pilbl = array();
             $pinfo = array();
             $pilbl[] = 'Product Category';
             $pinfo[] = ': ' . $product_categories_name[$p['categories_id']];
             $pilbl[] = 'Product ID';
             $pinfo[] = ': ' . $i['products_id'];
             $pilbl[] = 'Product Code';
             $pinfo[] = ': ' . $p['p']['products_model'];
             /* HIDE PRICE (REQUESTED BY CANTY & WAYAN TO PREVENT SMITH SPOTTED THE PRICE)
                $pilbl[] = 'Product Price';
                $pinfo[] = ': '.displayCurrency('EUR', $p['p']['products_price']);
                 */
             if ($p['length'] > 0) {
                 $pilbl[] = 'Product Length';
                 $pinfo[] = ': ' . textLength($p['length']);
             }
             $pilbl[] = 'Product Quantity';
             $pinfo[] = ': ' . $product_qty;
             $lbl_width = 30;
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pilbl), 0, 'L');
             $pdf->SetXY($leftpos + $lbl_width, $rowpos);
             $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pinfo), 0, 'L');
             $rowpos += count($pilbl) * ($lineheight + $linesep) + 2 * $linesep;
             //                $pdf->SetXY($leftpos, $rowpos);
             //                $pdf->setFont('Arial','B',$fontsize_med);
             //                $prodinfo = 'Product ID: '.$p['p']['products_id'];
             //                $pdf->Cell(100, $lineheight, $prodinfo);
             //                $rowpos += $lineheight + $linesep;
             //                $pdf->SetXY($leftpos, $rowpos);
             //                $pdf->setFont('Arial','B',$fontsize_med);
             //                $prodinfo = 'Product Code: '.$p['p']['products_model'];
             //                $pdf->Cell(100, $lineheight, $prodinfo);
             //                $rowpos += $lineheight + $linesep;
             //                if($p['length']>0) {
             //                    $pdf->SetXY($leftpos, $rowpos);
             //                    $pdf->setFont('Arial','B',$fontsize_med);
             //                    $prodinfo = 'Product Length: '.textLength($p['length']);
             //                    $pdf->Cell(100, $lineheight, $prodinfo);
             //                    $rowpos += $lineheight + $linesep;
             //                }
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Product Name:');
             $rowpos += $lineheight;
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', '', $fontsize_big);
             $pdf->Cell(100, $lineheight, $p['pd'][2]['products_name']);
             $rowpos += $lineheight + 2 * $linesep;
             if ($p['pnc']['production_instruction_id'] != '') {
                 $rowpos += $lineheight;
                 $piids = explode(",", $p['pnc']['production_instruction_id']);
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Production Instruction:');
                 $pdf->setFont('Arial', '');
                 $pims = array();
                 //MERGE ALL MANUAL PI THAT ATTACHED TO PRODUCT
                 foreach ($piids as $piid) {
                     $pim = new production_instruction_manual($piid);
                     $pi_temp = "\n" . $pim->cat_name . ' - ' . $pim->name;
                     if (trim($pim->description) != '') {
                         $pi_temp .= "\n" . $pim->description;
                     }
                     $pims[] = $pi_temp;
                 }
                 //EXPLODE EACH MANUAL PI WITH LINE FEED
                 $pi_manual = implode("\n", $pims);
                 $rowpos += $lineheight;
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->MultiCell(0, $lineheight, trim($pi_manual), 0, 'L');
                 $manpi_rows = explode("\n", trim($pi_manual));
                 //            $rowpos += $lineheight * 3;
             } else {
                 if ($p['pnc']['products_instruction'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Production Instruction:');
                     $pdf->setFont('Arial', '');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->MultiCell(0, $lineheight, $p['pnc']['products_instruction'], 0, 'L');
                     $manpi_rows = explode("\n", $p['pnc']['products_instruction']);
                     //$rowpos += ceil(($lineheight-1)*count($manpi_rows));
                 }
             }
             $rowpos_manpi = $pdf->GetY();
             $rowpos = $rowpos_manpi + 5;
             $leftpos = $colpos + $imgbig_width + 2;
             $rowpos_addimage = 0;
             $nei = 0;
             if (strtoupper($o['type']) == 'JG' && $i['custom_img'] != '') {
                 //$imgcus_width = 37; //150px
                 $imgcus_width = $imgsml_width;
                 //100px
                 $imgcus = $this->getImageForPDF($i['custom_img'], '100', '100');
                 if ($imgcus != '') {
                     $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width);
                     $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width);
                 }
                 $leftpos += $imgcus_width + 2;
                 //                } elseif((count($p['pei'])>0 && ($p['categories_id']==2||$p['categories_id']==3||$p['categories_id']==30)) || (count($p['pei'])>1 && $p['categories_id']==9)) {
                 //Show Extra Images only for NL,BL,SETS OR CH that have 2 extra images (only show 1st extra_images)
             } elseif (count($p['pei']) > 0) {
                 //                    show extra images for all categories since tends now extra images is used for explain detailly of a product
                 $rowpos = $YPOS + $imgbig_width + 2;
                 $pdf->SetXY($margin, $rowpos);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Additional Images');
                 $rowpos += $lineheight + 1;
                 foreach ($p['pei'] as $pei) {
                     $nei++;
                     //                        if($p['categories_id']==9 && $nei>1) continue;    //display only 1st extra image for CH
                     $reset_leftpos = true;
                     if ($is_diamore) {
                         //IF DIAMORE PRODUCTS
                         $print_image = false;
                         if (($p['categories_id'] == 2 || $p['categories_id'] == 30) && in_array($nei, array(1, 3))) {
                             $print_image = true;
                         }
                         if ($p['categories_id'] == 4 && in_array($nei, array(2, 3))) {
                             $print_image = true;
                         }
                         if (($p['categories_id'] == 29 || $p['categories_id'] == 3) && in_array($nei, array(1, 2))) {
                             $print_image = true;
                         }
                         if (($p['categories_id'] == 9 || $p['categories_id'] == 28) && in_array($nei, array(1))) {
                             $print_image = true;
                         }
                         if ($print_image) {
                             $leftpos = $colpos;
                             if ($rowpos > 214) {
                                 $pdf->show_footer_page_info = true;
                                 $pdf->AddPage();
                                 $YPOS = $margin + 5;
                                 $rowpos = $YPOS;
                                 $rowpos_manpi = $YPOS;
                             }
                             $imgsml = $this->getImageForPDF($pei, '212', '212');
                             if ($imgsml != '') {
                                 $pdf->Image($imgsml, $leftpos, $rowpos, $imgbig_width);
                                 $pdf->Rect($leftpos, $rowpos, $imgbig_width, $imgbig_width);
                                 $rowpos += $imgbig_width + 2;
                             }
                         }
                     } else {
                         //IF NOT DIAMORE PRODUCTS
                         $check_nei = $nei % 2;
                         if ($check_nei == 1) {
                             if ($nei != 1) {
                                 $reset_leftpos = false;
                                 //print additional image using 2 columns when manual pi is exceeded bottom of main image
                                 if ($nei > 2 && $rowpos_manpi > $rowpos_main_image) {
                                     $rowpos += $imgsml_width + 2;
                                     $reset_leftpos = true;
                                 }
                             }
                         } else {
                             $reset_leftpos = false;
                         }
                         if ($reset_leftpos) {
                             $leftpos = $colpos;
                         } else {
                             $leftpos += $imgsml_width + 2;
                         }
                         $imgsml = $this->getImageForPDF($pei, '100', '100');
                         if ($imgsml != '') {
                             $pdf->Image($imgsml, $leftpos, $rowpos, $imgsml_width);
                             $pdf->Rect($leftpos, $rowpos, $imgsml_width, $imgsml_width);
                             //$rowpos += $imgsml_width + 2;
                         }
                     }
                 }
                 if ($is_diamore) {
                     //IF DIAMORE PRODUCTS
                     $rowpos_addimage = $rowpos + 2;
                 } else {
                     $rowpos_addimage = $rowpos + $imgsml_width + 2;
                     $leftpos += $imgsml_width + 2;
                 }
             }
             //CUSTOMIZE PRODUCTS & PRINTED GIFT VOUCHER FROM JULIE & GRACE
             if (strtoupper($o['type']) == 'JG') {
                 if (strpos($p['p']['products_model'], 'GIFT-P') !== false) {
                     $gift_amount = substr($p['p']['products_model'], 7);
                     $cgq_query = "SELECT c.coupon_code, c.coupon_amount, c.coupon_expire_date FROM coupon_gv_queue cgq";
                     $cgq_query .= " LEFT JOIN coupons c ON c.coupon_id=cgq.coupon_id";
                     $cgq_query .= " WHERE cgq.order_id={$o['id']} AND cgq.amount={$gift_amount}";
                     $cgq_result = tep_db_query($cgq_query);
                     $vouchers = array();
                     while ($row = tep_db_fetch_array($cgq_result)) {
                         $vouchers[] = $row;
                     }
                     $vcounter = 0;
                     foreach ($vouchers as $v) {
                         $vcounter++;
                         $pdf->SetXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Voucher ' . $vcounter . ':');
                         $rowpos += $lineheight;
                         $vilbl = array();
                         $vinfo = array();
                         $vilbl[] = '- Code';
                         $vinfo[] = ': ' . $v['coupon_code'];
                         $vilbl[] = '- Amount';
                         $vinfo[] = ': ' . number_format($v['coupon_amount'], 0) . ' EUR';
                         $vilbl[] = '- Expired Date';
                         $vinfo[] = ': ' . date('d. M Y', strtotime($v['coupon_expire_date']));
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->SetXY($leftpos, $rowpos);
                         $pdf->MultiCell($lbl_width, $lineheight, implode("\n", $vilbl));
                         $pdf->SetXY($leftpos + $lbl_width, $rowpos);
                         $pdf->MultiCell(100, $lineheight, implode("\n", $vinfo));
                         $rowpos += count($vilbl) * $lineheight + 2 * $linesep;
                     }
                 }
                 if ($i['custom_text'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Text:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', 12);
                     $pdf->MultiCell(0, 4, $i['custom_text']);
                     $rowpos += 2 * $lineheight + 2 * $linesep;
                 }
                 if ($i['custom_img'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Image:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_big);
                     $pdf->Cell(0, $lineheight, basename($i['custom_img']));
                     $rowpos += $lineheight + 2 * $linesep;
                 }
                 if ($i['custom_imgcm'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Image Comment:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_big);
                     $pdf->MultiCell(0, $lineheight, basename($i['custom_imgcm']), 0, 'L');
                 }
             } else {
                 if ($p['article']['text'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Text:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', 12);
                     $pdf->MultiCell(0, 4, $p['article']['text']);
                     $rowpos += 2 * $lineheight + 2 * $linesep;
                 }
             }
             //$YPOS += (($rowpos>($YPOS+$imgbig_width)) ? $rowpos : $imgbig_width) + 10;    //CHANGE THIS TO BELOW
             //if($rowpos>($YPOS+$imgbig_width)) $YPOS = $rowpos + 5;
             //else $YPOS += $imgbig_width + 10;
             if (in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS)) {
                 if ($rowpos_manpi > $rowpos_addimage) {
                     $YPOS = $rowpos_manpi + 5;
                 } elseif ($rowpos_addimage > $rowpos_manpi) {
                     $YPOS = $rowpos_addimage + 15;
                 }
                 //if manual pi printed smaller than displayed additional images
                 if ($rowpos_main_image > $rowpos_manpi && $nei == 0) {
                     $YPOS = $rowpos_main_image + 5;
                 }
                 //if manual pi printed smaller than displayed main images and theres no additional images printed
                 if ($rowpos_manpi == $rowpos_addimage) {
                     $YPOS = $rowpos_manpi;
                 }
                 //if manual pi printed and additional images were the same row height
             } else {
                 if ($rowpos_manpi > $rowpos_addimage) {
                     $YPOS = $rowpos_manpi + 5;
                 } elseif ($rowpos_addimage > $rowpos_manpi) {
                     $YPOS = $rowpos_addimage + 5;
                 }
                 //if manual pi printed smaller than displayed additional images
                 if ($rowpos_main_image > $rowpos_manpi && $nei == 0) {
                     $YPOS = $rowpos_main_image + 5;
                 }
                 //if manual pi printed smaller than displayed main images and theres no additional images printed
                 if ($rowpos_manpi == $rowpos_addimage) {
                     $YPOS = $rowpos_manpi;
                 }
                 //if manual pi printed and additional images were the same row height
             }
             //PRODUCTION
             if ($YPOS > 240) {
                 $pdf->show_footer_page_info = true;
                 $pdf->AddPage();
                 $YPOS = $margin + 5;
             }
             $lineheight = 5;
             $pdf->SetXY($margin, $YPOS);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Production');
             $YPOS += $lineheight + 1;
             //IF NEED NEW QC COLUMN, ONLY NEED TO ADD BELOW ARRAY
             $col = array();
             $col[1] = 'Workshop';
             $col[2] = 'Beading';
             $col[3] = 'Enamel';
             $col[4] = 'Ferido';
             $col[5] = 'Packing';
             $leftpos = $margin + 1;
             $pdf->setXY($leftpos, $YPOS);
             $qc_table_max_width = 198;
             $colwidth = number_format($qc_table_max_width / count($col), 1);
             //$colwidth = 39.6;
             foreach ($col as $cval) {
                 $pdf->Cell($colwidth, $lineheight, $cval, 1, 0, 'C', true);
             }
             $YPOS += $lineheight;
             $leftpos = $margin + 1;
             $pdf->setFont('Arial', 'B', $fontsize_big + 5);
             $pdf->SetTextColor(209, 209, 209);
             $pdf->setXY($leftpos, $YPOS);
             for ($x = 1; $x <= count($col); $x++) {
                 $pdf->Cell($colwidth, 15, 'QC', 1, 0, 'C');
             }
             //PRODUCT FINISHING
             //echo "<pre>";var_dump($finishing);die();
             $finishing = array();
             /* UPDATE: NOW WE USE PRODUCTS FINISHING IN PRODUCT ATTRIBUTES TO 
                   FLAG WHETHER THE PRODUCTS NEEDS RHODIUM OR MICRON
                */
             /* RHODIUM RULES
                   Rule1: OttoB2B, Elli Premium which Silver "without plated" and whitegold product
                   Rule2: Diamore
                */
             /*
                             $rhodium_rule1 = ( ($is_ottob2b || $is_elli_premium) 
                    && ($obj_product->metal_stamp_code == Product::METAL_STAMP_CODE_925 
                        || $obj_product->metal_stamp_info == Product::METAL_STAMP_INFO_WHITEGOLD) );
                             $rhodium_rule2 = $is_diamore;
             */
             //$rhodium_and_micron_rule = in_array_r($finishing_product, $product_finishing_array);
             //if ($rhodium_rule1 || $rhodium_rule2) {
             //if ($rhodium_and_micron_rule) {
             //$finishing[] = 'Rhodium';
             //}
             $is_partial_plated = $p['p']['is_partial_plated'] == '1';
             $is_goldplated = false;
             foreach ($p['finishing'] as $ftext => $fval) {
                 if ($fval) {
                     $is_goldplated = $fval == 'Goldplated' || $fval == 'Rose Goldplate';
                     if ($is_partial_plated) {
                         if ($fval == 'Goldplated' || $fval == 'Rose Goldplate') {
                             continue;
                         }
                     }
                     //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron
                     /*
                     if (($is_ottob2b || $is_elli_premium) 
                             && ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) {
                         $ftext .= ' 1.5 micron';
                     }
                     */
                     $finishing[] = $ftext;
                 }
             }
             if ($is_partial_plated) {
                 //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron
                 //if (($is_ottob2b || $is_elli_premium)
                 //$finishing_micron_key = array_search('micron', $finishing);
                 //if ($finishing_micron_key !== false
                 //&& ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) {
                 //$finishing[] = 'Partial Plated 1.5 micron';
                 //} else {
                 $finishing[] = 'Partial Plated';
                 //}
             }
             $product_finishing_array = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING);
             $finishing_product = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2');
             if (!empty($finishing_product)) {
                 $finishing[] = $finishing_product;
             }
             /*
             if ($is_goldplated || $is_partial_plated) {
                 //If using plating, removed finishing Rhodium since it will antitarnished as standard for plated products
                 $finishing_rhodium_key = array_search('Rhodium', $finishing);
                 if ($finishing_rhodium_key !== false) {
                     unset($finishing[$finishing_rhodium_key]);
                 }
             }
             */
             //echo "<pre>";var_dump($finishing);die();
             if (count($finishing) > 0) {
                 if ($YPOS > 250) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $finishing = implode(', ', $finishing);
                 $pdf->SetTextColor(0, 0, 0);
                 $YPOS += $lineheight + 15;
                 $lineheight = 4;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Product Finishing');
                 $YPOS += $lineheight + 1;
                 $lineheight = 15;
                 $colwidth = array();
                 $colwidth[1] = 178;
                 $colwidth[2] = 20;
                 $leftpos = $margin + 1;
                 $pdf->setXY($leftpos, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big + 5);
                 $pdf->Cell($colwidth[1], $lineheight, $finishing, 1, 2, 'C');
                 $leftpos += $colwidth[1];
                 $pdf->setXY($leftpos, $YPOS);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->Cell($colwidth[2], $lineheight, 'QC', 1, 2, 'C');
             }
             $pdf->SetTextColor(0, 0, 0);
             //PRODUCT GOLD WEIGHT CHECK (PGWC)
             if ($is_gold_product) {
                 if ($YPOS > 220) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $YPOS += $lineheight + 15;
                 $lineheight = 5;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Product Gold Weight Check');
                 $YPOS += $lineheight + 1;
                 $gold_weight_check_process = array();
                 $gold_weight_check_process["Safe-WH"] = 'Safe to WH';
                 $gold_weight_check_process["WH-QC"] = 'WH to QC';
                 $gold_weight_check_process["QC-GS"] = 'QC to Goldsmith';
                 $gold_weight_check_process["GS-QC"] = 'Goldsmith to QC';
                 $leftpos = $margin + 1;
                 $pdf->SetXY($leftpos, $YPOS);
                 $gwc_table_max_width = $qc_table_max_width;
                 $n_col_weight_check = 8;
                 $colwidth = number_format($gwc_table_max_width / $n_col_weight_check, 1);
                 foreach ($gold_weight_check_process as $key => $val) {
                     if ($key == "QC-GS" || $key == "GS-QC") {
                         $pdf->Cell($colwidth * 3, $lineheight, $val, 1, 0, 'C', true);
                     } else {
                         $pdf->Cell($colwidth, $lineheight, $val, 1, 0, 'C', true);
                     }
                 }
                 //Draw PGWC Total Weight Box
                 $YPOS += $lineheight;
                 $leftpos = $margin + 1;
                 $pdf->setFont('Arial', 'B', $fontsize_sml);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->SetXY($leftpos, $YPOS);
                 $gw_colheight_big = 10;
                 $gw_colheight_sml = number_format($gw_colheight_big / 2, 1);
                 for ($x = 1; $x <= $n_col_weight_check; $x++) {
                     if ($x == 1) {
                         $pdf->Cell($colwidth, $gw_colheight_sml, 'GW:', 1, 2, 'L');
                         $pdf->SetX($leftpos);
                         $pdf->Cell($colwidth, $gw_colheight_sml, 'NW:', 1, 0, 'L');
                     } else {
                         if ($x == 2) {
                             $pdf->SetXY($leftpos + $colwidth, $YPOS);
                         }
                         $box_start = $x == $n_col_weight_check ? 2 : 0;
                         $pdf->Cell($colwidth, $gw_colheight_sml, "Total Weight", 'LR', $box_start, 'C');
                     }
                 }
                 $pdf->SetX($leftpos + $colwidth);
                 for ($x = 2; $x <= $n_col_weight_check; $x++) {
                     $box_start = $x == $n_col_weight_check ? 2 : 0;
                     $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', $box_start, 'C');
                 }
                 //Draw PGWC Total Signature Box
                 $colwidth_signature = number_format($colwidth / 2, 1);
                 $pdf->SetX($leftpos);
                 $pdf->SetFontSize($fontsize_med);
                 foreach ($gold_weight_check_process as $key => $val) {
                     if ($key == "QC-GS" || $key == "GS-QC") {
                         $loop = 3;
                     } else {
                         $loop = 1;
                     }
                     list($lsign, $rsign) = explode("-", $key);
                     for ($x = 1; $x <= $loop; $x++) {
                         $pdf->Cell($colwidth_signature, $gw_colheight_big, $lsign, 1, 0, 'C');
                         $pdf->Cell($colwidth_signature, $gw_colheight_big, $rsign, 1, 0, 'C');
                     }
                 }
                 $YPOS += $lineheight - 2 + $gw_colheight_big * 2;
                 $pdf->setFont('Arial', '', $fontsize_sml);
                 $pdf->Text($leftpos, $YPOS, 'GW: Total Weight of Gold Elements');
                 $YPOS += $lineheight - 2;
                 $pdf->Text($leftpos, $YPOS, 'NW: Total Weight of Non-Gold Elements');
                 //Draw PGWC Dust Box
                 if ($YPOS > 250) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $YPOS += $lineheight;
                 $pdf->SetXY($leftpos, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->SetTextColor(0, 0, 0);
                 $pdf->Cell($colwidth, $lineheight, 'Dust', 1, 2, 'C', true);
                 $pdf->SetFontSize($fontsize_sml);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->Cell($colwidth, $gw_colheight_sml, 'Total Weight', 'LR', 2, 'C');
                 $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', 2, 'C');
                 $pdf->Cell($colwidth_signature, $gw_colheight_big, 'QC', 1, 0, 'C');
                 $pdf->Cell($colwidth_signature, $gw_colheight_big, 'GS', 1, 0, 'C');
             }
             $pdf->SetTextColor(0, 0, 0);
             //ENGRAVING ORDER SLIP
             global $ENGRAVED_PRODUCTS;
             if (strtoupper($o['type']) == 'JG' && in_array($i['products_id'], $ENGRAVED_PRODUCTS)) {
                 if ($this->duplex_printing && $item_page_count % 2 != 0) {
                     $pdf->AddPage();
                     $item_page_count++;
                 }
                 $pdf->AddPage();
                 $item_page_count++;
                 $lineheight = 4;
                 $midpage = 148.5;
                 $rowpos = $margin + 10;
                 //repeat 2 times
                 for ($s = 1; $s <= 2; $s++) {
                     if ($s == 2) {
                         $rowpos = $midpage + 10;
                         $slipinfo = 'Face2Face';
                     } else {
                         $slipinfo = 'Bonofactum';
                     }
                     $colpos = $margin + 1;
                     $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $rowpos, $barcode_width);
                     $pdf->SetXY($margin, $rowpos);
                     $pdf->setFont('Arial', 'B', '12');
                     $pdf->Cell(100, $lineheight, 'Engraving Order Slip (' . $slipinfo . ')');
                     $rowpos += $lineheight + 5;
                     $rowpos_fixed = $rowpos;
                     if ($imgbig != '') {
                         $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width);
                     }
                     $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width);
                     $colpos += $imgbig_width + 5;
                     $es_ilbl_width = 30;
                     $es_ilbl = array();
                     $es_info = array();
                     $es_ilbl[] = 'Order By';
                     $es_info[] = ': Bonofactum';
                     $es_ilbl[] = 'Order Date';
                     $es_info[] = ': ' . date('d. M Y');
                     $es_ilbl[] = 'Order Quantity';
                     $es_info[] = ': ' . $product_qty;
                     $pdf->setFont('Arial', 'B', $fontsize_med);
                     $pdf->SetXY($colpos, $rowpos);
                     $pdf->MultiCell($es_ilbl_width, $lineheight, implode("\n", $es_ilbl));
                     $pdf->SetXY($colpos + $es_ilbl_width, $rowpos);
                     $pdf->MultiCell($es_ilbl_width * 2, $lineheight, implode("\n", $es_info));
                     $rowpos += (count($es_ilbl) + 1) * $lineheight + 1;
                     $pdf->SetXY($colpos, $rowpos);
                     $pdf->Cell(100, $lineheight, 'Custom Text');
                     $rowpos += $lineheight + 1;
                     $pdf->SetDrawColor(128, 128, 128);
                     $pdf->Rect($colpos + 1, $rowpos, 132, 30);
                     $pdf->SetDrawColor(0, 0, 0);
                     if ($i['custom_text'] != '') {
                         $pdf->SetXY($colpos + 3, $rowpos + 3);
                         $pdf->setFont('Arial', 'B', '12');
                         $pdf->MultiCell(100, $lineheight, $i['custom_text']);
                     }
                     $rowpos = $rowpos_fixed + $imgbig_width + 5;
                     if ($i['custom_img'] != '') {
                         $leftpos = $margin + 1;
                         if ($imgcus != '') {
                             $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width);
                             $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width);
                         }
                         $leftpos += $imgcus_width + 2;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Custom Image:');
                         $rowpos += $lineheight;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->Cell(100, $lineheight, basename($i['custom_img']));
                         $rowpos += $lineheight + 1;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Graving Request:');
                         $rowpos += $lineheight;
                         $engraving_options_pos = $leftpos + $lineheight + 1;
                         $engraving_options = array();
                         $engraving_options[] = 'Full (gravir penuh)';
                         $engraving_options[] = 'Centered (gravir tengah, atas dan bawah kosong)';
                         $engraving_options[] = 'Bottom (gravir bawah penuh, atas kosong)';
                         $pdf->setXY($engraving_options_pos, $rowpos);
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->MultiCell(100, $lineheight, implode("\n", $engraving_options));
                         $cb_sep = 0.5;
                         $cbsize = $lineheight - $cb_sep;
                         $leftpos += 1;
                         $pdf->SetDrawColor(128, 128, 128);
                         foreach ($engraving_options as $eo) {
                             $pdf->Rect($leftpos, $rowpos, $cbsize, $cbsize);
                             $rowpos += $lineheight;
                         }
                         $pdf->SetDrawColor(0, 0, 0);
                     }
                 }
                 $pdf->Line($margin, $midpage, 210 - $margin, $midpage);
             }
             if ($i['print_count'] == '0' || $i['print_count'] == '') {
                 $this->qty_total_first_printed++;
             }
         }
         //end looping items
     }
     //end looping orders
     if ($output == 'F') {
         $filename = $this->filename != '' ? $this->filename : DIR_FS_MINIERP . DIR_WS_GATEWAY . "ready_orders/" . strtoupper($o['type']) . '/' . strtoupper($o['type']) . '-' . $oiid;
         //            $priority_rule_1 = in_array($o['jng_sp_id'], $sp_using_red_paper);
         //            $priority_rule_2 = $o['customer_is_vip'];
         $priority_rule_1 = $o['priority'] == '1';
         //            if($priority_rule_1 || $priority_rule_2 || $priority_rule_3) $filename .= '-RED';
         if ($priority_rule_1 && $this->filename == '') {
             $filename .= '-RED';
         }
         $pdf->Output($filename . '.pdf', $output);
     }
 }
예제 #17
0
$pdf = new PDF();
/*Se define las propiedades de la página */
$pdf->AliasNbPages();
$pdf->AddPage();
/* Se añade una nueva página */
$pdf->SetFont('Arial', 'B', 10);
/* Se define el tipo de fuente: Arial en negrita de ta */
$cons1 = mysql_query("SELECT  * FROM cliente  order by id_cliente", $conexion);
$lk = 0;
$pdf->SetFont('Arial', '', 9);
//Títulos de las columnas
$header = array('Nº', 'Login', 'Nombre', 'Apellido', 'Teléfono', 'Direcciòn');
//Colores, ancho de línea y fuente en negrita
$pdf->SetFillColor(255, 0, 0);
$pdf->SetTextColor(255);
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetLineWidth(0.3);
$pdf->SetFont('', 'B');
//Cabecera
$w = array(10, 25, 40, 37, 37, 37);
for ($i = 0; $i < count($header); $i++) {
    $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1);
}
$pdf->Ln();
//Restauración de colores y fuentes
$pdf->SetFillColor(224, 235, 255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
//Datos
$fill = false;
$i = 0;
예제 #18
0
 /**
  * Fonction realisant une croix aux 4 coins des cartes
  *
  * @param PDF	$pdf				PDF
  * @param int	$x1					X1
  * @param int	$y1					Y1
  * @param int	$x2					X2
  * @param int	$y2					Y2
  * @param int	$epaisseur			Epaisseur
  * @param int	$taille             Size
  * @return void
  */
 function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4)
 {
     $pdf->SetDrawColor(192, 192, 192);
     $pdf->SetLineWidth($epaisseur);
     $lg = $taille / 2;
     // croix haut gauche
     $pdf->Line($x1, $y1 - $lg, $x1, $y1 + $lg);
     $pdf->Line($x1 - $lg, $y1, $x1 + $lg, $y1);
     // croix bas gauche
     $pdf->Line($x1, $y2 - $lg, $x1, $y2 + $lg);
     $pdf->Line($x1 - $lg, $y2, $x1 + $lg, $y2);
     // croix haut droit
     $pdf->Line($x2, $y1 - $lg, $x2, $y1 + $lg);
     $pdf->Line($x2 - $lg, $y1, $x2 + $lg, $y1);
     // croix bas droit
     $pdf->Line($x2, $y2 - $lg, $x2, $y2 + $lg);
     $pdf->Line($x2 - $lg, $y2, $x2 + $lg, $y2);
     $pdf->SetDrawColor(0, 0, 0);
 }
예제 #19
0
$pdf->RotatedCell($angle, $xtitre, $ytitre, $wtitre, $htitre, $_GET['titre'], 0, 0, 'C');
$pdf->RotatedText(15, 15, $titre, 0);
$pdf->SetFont('arial', '', $sizeechelle);
if ($_GET['echelle'] == 0) {
    $pdf->RotatedText($posixechelle, $posiyechelle, 'Sans échelle', $angle);
} else {
    $pdf->RotatedText($posixechelle, $posiyechelle, '1/' . $_GET['echelle'] . ' ème', $angle);
}
if ($print_basic_copyright) {
    $pdf->SetFont('arial', '', 6);
    $pdf->RotatedText(5, 5, "Les photographies sont propriétées de l'IGN, les données cadastrales sont propriétées de la DGI. Reproduction interdite.", 0);
}
//génération du qrcode;
$url_qrcode = "https://" . $_SERVER["HTTP_HOST"] . "/interface/qrprint.php?var=" . $application . "\$" . $_GET['x'] . "\$" . $_GET['y'] . "\$" . $_GET['lar'] . "\$" . $_GET['hau'] . "\$" . $_GET['zoom'] . "\$" . $_GET['format'] . "\$" . $_GET['legende'] . "\$" . $_GET['titre'] . "\$" . $_GET['echelle'] . "\$" . $_GET['parce'] . "\$" . $_GET['raster'];
$pdf->Image(generateQRCode($url_qrcode, 100), $xqrcode, $yqrcode, 30, 30, 'PNG');
$pdf->SetDrawColor(0);
$pdf->SetFont('arial', '', 10);
if ($_GET['legende'] == 1 || $_GET['legende'] == 3) {
    $legende = "";
    //$pyy=250;
    $idprov = "";
    for ($i = 0; $i < count($rastx); $i++) {
        $ra = explode(".", $rastx[$i]);
        $id = $ra[0];
        $lib = str_replace("_", " ", $ra[1]);
        if ($id != "") {
            $req1 = "select col_theme.intitule_legende as intitule_legende,theme.libelle_them,col_theme.fill,col_theme.symbole,col_theme.opacity,col_theme.ordre,col_theme.stroke_rgb,style.fill as style_fill,style.symbole as style_symbole,style.opacity as style_opacity,style.font_size  as style_fontsize,style.stroke_rgb  as style_stroke from admin_svg.appthe left outer join admin_svg.col_theme on appthe.idappthe=col_theme.idappthe join admin_svg.theme on appthe.idtheme=theme.idtheme left outer join admin_svg.style on appthe.idtheme=style.idtheme where appthe.idappthe='" . $id . "'  and (intitule_legende='" . $lib . "' or libelle_them='" . $lib . "')";
            $couch = $DB->tab_result($req1);
            if ($couch[0]['intitule_legende'] == "") {
                $legend = $couch[0]['libelle_them'];
                if ($couch[0]['style_fill'] != "" && $couch[0]['style_fill'] != "none") {
 /**
  *   	Show footer of page. Need this->emetteur object
  *
  *   	@param	PDF			$pdf     			PDF
  * 		@param	Object		$object				Object to show
  *      @param	Translate	$outputlangs		Object lang for output
  *      @param	int			$hidefreetext		1=Hide free text
  *      @return	void
  */
 function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
 {
     global $conf;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
     $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT';
     $marge_basse = $this->marge_basse;
     $marge_gauche = $this->marge_gauche;
     $page_hauteur = $this->page_hauteur;
     // Line of free text
     $line = !empty($conf->global->{$paramfreetext}) ? $outputlangs->convToOutputCharset($conf->global->{$paramfreetext}) : "";
     $pdf->SetFont('', '', $default_font_size - 3);
     $pdf->SetDrawColor(224, 224, 224);
     // On positionne le debut du bas de page selon nbre de lignes de ce bas de page
     $nbofline = dol_nboflines_bis($line, 0, $outputlangs->charset_output);
     //print 'e'.$line.'t'.dol_nboflines($line);exit;
     $posy = $marge_basse + $nbofline * 3;
     if ($line) {
         $pdf->SetXY($marge_gauche, -$posy);
         $pdf->MultiCell(20000, 3, $line, 0, 'L', 0);
         // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
         $posy -= $nbofline * 3;
         // 6 of ligne + 3 of MultiCell
     }
     $pdf->SetY(-$posy);
     $pdf->line($marge_gauche, $page_hauteur - $posy, 200, $page_hauteur - $posy);
     $posy--;
     /*if ($line1)
     		{
     			$pdf->SetXY($marge_gauche,-$posy);
     			$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
     		}
     
     		if ($line2)
     		{
     			$posy-=3;
     			$pdf->SetXY($marge_gauche,-$posy);
     			$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
     		}*/
     // Show page nb only on iso languages (so default Helvetica font)
     if (pdf_getPDFFont($outputlangs) == 'Helvetica') {
         $pdf->SetXY(-20, -$posy);
         $pdf->MultiCell(11, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
     }
 }
예제 #21
0
//Create pdf
$pdf = new PDF();
$pdf->AddPage();
//set document properties
$pdf->SetAuthor('Anon');
$pdf->SetTitle($name);
// Set the page break to 'true' and the bottom margin height
$pdf->SetAutoPageBreak(1, 10);
//set font for the entire document
$pdf->SetFont('Helvetica', 'B', 20);
$pdf->SetTextColor(50, 60, 100);
//insert Collage logo
$pdf->Image('logo.png', 10, 10, 33, 0);
//display the title without a border around it
$pdf->SetXY(50, 15);
$pdf->SetDrawColor(50, 60, 100);
$pdf->Cell(100, 10, $name, 0, 0, 'C', 0);
// Insert a dynamic image from a URL
$pdf->Image($image, 11, 30, 0, 50);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY(65, 30);
$pdf->SetLeftMargin(65);
$pdf->SetFontSize(10);
$pdf->Write(5, $characteristics);
$pdf->Ln(8);
//Output the clues
$pdf->SetFont('Helvetica', '', 9);
$pdf->SetXY(10, 90);
$column_width = $pdf->w - 10;
// For bullet list - width and bullet array variables
$cluesBullet = array();
예제 #22
0
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times', '', 12);
$pdf->SetTextColor(32);
$pdf->Cell(0, 5, $company, 0, 1, 'R');
$pdf->Cell(0, 5, $address, 0, 1, 'R');
$pdf->Cell(0, 5, $email, 0, 1, 'R');
$pdf->Cell(0, 5, 'Tel: ' . $telephone, 0, 1, 'R');
$pdf->Cell(0, 30, '', 0, 1, 'R');
$pdf->SetFillColor(200, 220, 255);
//$pdf->ChapterTitle('Invoice Number ',$number);
$pdf->ChapterTitle('Invoice Date ', date('d-m-Y'));
$pdf->Cell(0, 20, '', 0, 1, 'R');
$pdf->SetFillColor(224, 235, 255);
$pdf->SetDrawColor(192, 192, 192);
$pdf->Cell(170, 7, 'Item', 1, 0, 'L');
$pdf->Cell(20, 7, 'Price', 1, 1, 'C');
while ($row = $result->fetch_array()) {
    $pdf->Cell(20, 7, $row[0], 1, 0, 'L', 0);
    $pdf->Cell(150, 7, $row[1], 1, 0, 'L', 0);
    $pdf->Cell(20, 7, $row[3] . 'Rs', 1, 1, 'C', 0);
}
$pdf->Cell(0, 0, '', 0, 1, 'R');
$pdf->Cell(170, 7, 'VAT', 1, 0, 'R', 0);
$pdf->Cell(20, 7, $vat, 1, 1, 'C', 0);
$pdf->Cell(170, 7, 'Total', 1, 0, 'R', 0);
$pdf->Cell(20, 7, $re . 'Rs', 1, 0, 'C', 0);
$pdf->Cell(0, 20, '', 0, 1, 'R');
//$pdf->Cell(0,5,$pay,0,1,'L');
//$pdf->Cell(0,5,$bank,0,1,'L');
예제 #23
0
/**
 *  Show footer of page for PDF generation
 *
 *	@param	PDF			$pdf     		The PDF factory
 *  @param  Translate	$outputlangs	Object lang for output
 * 	@param	string		$paramfreetext	Constant name of free text
 * 	@param	Societe		$fromcompany	Object company
 * 	@param	int			$marge_basse	Margin bottom we use for the autobreak
 * 	@param	int			$marge_gauche	Margin left (no more used)
 * 	@param	int			$page_hauteur	Page height (no more used)
 * 	@param	Object		$object			Object shown in PDF
 * 	@param	int			$showdetails	Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both)
 *  @param	int			$hidefreetext	1=Hide free text, 0=Show free text
 * 	@return	int							Return height of bottom margin including footer text
 */
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0)
{
    global $conf, $user;
    $outputlangs->load("dict");
    $line = '';
    $dims = $pdf->getPageDimensions();
    // Line of free text
    if (empty($hidefreetext) && !empty($conf->global->{$paramfreetext})) {
        // Make substitution
        $substitutionarray = array('__FROM_NAME__' => $fromcompany->name, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat);
        complete_substitutions_array($substitutionarray, $outputlangs, $object);
        $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray);
        $line .= $outputlangs->convToOutputCharset($newfreetext);
    }
    // First line of company infos
    $line1 = "";
    $line2 = "";
    $line3 = "";
    $line4 = "";
    if ($showdetails) {
        // Company name
        if ($fromcompany->name) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name;
        }
        // Address
        if ($fromcompany->address) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->address;
        }
        // Zip code
        if ($fromcompany->zip) {
            $line1 .= ($line1 ? " - " : "") . $fromcompany->zip;
        }
        // Town
        if ($fromcompany->town) {
            $line1 .= ($line1 ? " " : "") . $fromcompany->town;
        }
        // Phone
        if ($fromcompany->phone) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone;
        }
        // Fax
        if ($fromcompany->fax) {
            $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax;
        }
        // URL
        if ($fromcompany->url) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->url;
        }
        // Email
        if ($fromcompany->email) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->email;
        }
    }
    if ($showdetails || $fromcompany->country_code == 'DE') {
        // Managers
        if ($fromcompany->managers) {
            $line2 .= ($line2 ? " - " : "") . $fromcompany->managers;
        }
    }
    // Line 3 of company infos
    // Juridical status
    if ($fromcompany->forme_juridique_code) {
        $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
    }
    // Capital
    if ($fromcompany->capital) {
        $tmpamounttoshow = price2num($fromcompany->capital);
        // This field is a free string
        if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
            $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
        } else {
            $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
        }
    }
    // Prof Id 1
    if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
        $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1);
    }
    // Prof Id 2
    if ($fromcompany->idprof2) {
        $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2);
    }
    // Line 4 of company infos
    // Prof Id 3
    if ($fromcompany->idprof3) {
        $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3);
    }
    // Prof Id 4
    if ($fromcompany->idprof4) {
        $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code);
        if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
            $field = $reg[1];
        }
        $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof4);
    }
    // IntraCommunautary VAT
    if ($fromcompany->tva_intra != '') {
        $line4 .= ($line4 ? " - " : "") . $outputlangs->transnoentities("VATIntraShort") . ": " . $outputlangs->convToOutputCharset($fromcompany->tva_intra);
    }
    $pdf->SetFont('', '', 7);
    $pdf->SetDrawColor(224, 224, 224);
    // The start of the bottom of this page footer is positioned according to # of lines
    $freetextheight = 0;
    if ($line) {
        //$line="eee<br>\nfd<strong>sf</strong>sdf<br>\nghfghg<br>";
        if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
            $width = 20000;
            $align = 'L';
            // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
            if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) {
                $width = 200;
                $align = 'C';
            }
            $freetextheight = $pdf->getStringHeight($width, $line);
        } else {
            $freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0));
            // New method (works for HTML content)
            //print '<br>'.$freetextheight;exit;
        }
    }
    $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
    $posy = $marginwithfooter + 0;
    if ($line) {
        $pdf->SetXY($dims['lm'], -$posy);
        if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
            $pdf->MultiCell(0, 3, $line, 0, $align, 0);
        } else {
            $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk'] - $marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 0));
        }
        $posy -= $freetextheight;
    }
    $pdf->SetY(-$posy);
    $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy);
    $posy--;
    if (!empty($line1)) {
        $pdf->SetFont('', 'B', 7);
        $pdf->SetXY($dims['lm'], -$posy);
        $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line1, 0, 'C', 0);
        $posy -= 3;
        $pdf->SetFont('', '', 7);
    }
    if (!empty($line2)) {
        $pdf->SetFont('', 'B', 7);
        $pdf->SetXY($dims['lm'], -$posy);
        $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line2, 0, 'C', 0);
        $posy -= 3;
        $pdf->SetFont('', '', 7);
    }
    if (!empty($line3)) {
        $pdf->SetXY($dims['lm'], -$posy);
        $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line3, 0, 'C', 0);
    }
    if (!empty($line4)) {
        $posy -= 3;
        $pdf->SetXY($dims['lm'], -$posy);
        $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line4, 0, 'C', 0);
    }
    // Show page nb only on iso languages (so default Helvetica font)
    if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') {
        $pdf->SetXY(-20, -$posy);
        //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
        if (empty($conf->global->MAIN_USE_FPDF)) {
            $pdf->MultiCell(13, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
        } else {
            $pdf->MultiCell(13, 2, $pdf->PageNo() . '/{nb}', 0, 'R', 0);
        }
    }
    return $marginwithfooter;
}
예제 #24
0
 $mypdf->setFillColor(265, 265, 265);
 $mypdf->Cell(170, 6, $User, 0, 0, 'L', true);
 $mypdf->Ln();
 $mypdf->SetFont('Arial', '', 10);
 $mypdf->setFillColor(265, 265, 265);
 $mypdf->Cell(15, 6, "Date   :-", 0, 0, 'L', true);
 $date = date('d-m-Y H:i:s');
 $mypdf->Cell(170, 6, $date, 0, 0, 'L', true);
 $mypdf->Ln();
 $mypdf->Ln();
 $mypdf->Ln();
 $mypdf->Ln();
 //table heading
 $mypdf->SetFont('Arial', '', 10);
 $mypdf->setFillColor(178, 211, 230);
 $mypdf->SetDrawColor(178, 211, 230);
 $mypdf->Cell(30, 10, 'Category', 1, 0, 'C', true);
 $mypdf->setFillColor(178, 211, 230);
 $mypdf->Cell(95, 10, 'Description', 1, 0, 'C', true);
 $mypdf->setFillColor(178, 211, 230);
 $mypdf->Cell(30, 10, 'Expense Date', 1, 0, 'C', true);
 $mypdf->setFillColor(178, 211, 230);
 $mypdf->Cell(30, 10, 'Amount', 1, 0, 'C', true);
 $mypdf->Ln();
 $mypdf->SetFont('Arial', '', 9);
 $x_axis = $mypdf->GetX();
 $y_axis = $mypdf->GetY();
 $sql = "SELECT count(ExCategory) from tbluserexpenses Where `UserName`= '{$User}' ";
 $res = $dbh->prepare($sql);
 $res->execute();
 $Rcnt = $res->fetchColumn();
예제 #25
0
</body>
</html>
<?php 
} else {
    //
    //
    //	Begin Report Generation
    //
    //
    $pdf = new PDF();
    $pdf->AliasNbPages();
    include_once "loadfonts.php";
    $pdf->SetFont($config->ParameterArray['PDFfont'], '', 8);
    $pdf->SetFillColor(0, 0, 0);
    $pdf->SetTextColor(255);
    $pdf->SetDrawColor(128, 0, 0);
    $pdf->SetLineWidth(0.3);
    $pdf->SetfillColor(224, 235, 255);
    $pdf->SetTextColor(0);
    $column = 0;
    $pdf->SetLeftMargin(10);
    $pdf->AddPage();
    $pdf->Bookmark("Surplus/Salvage by Date");
    $pdf->Cell(80, 5, __("Surplus/Salvage by Date"));
    $pdf->Ln();
    $headerTags = array(__("Surplus Date"), __("Name"), __("Serial Number"), __("Asset Tag"), __("UserName"));
    $cellWidths = array(30, 40, 40, 30, 30);
    $fill = 0;
    $maxval = count($headerTags);
    for ($col = 0; $col < $maxval; $col++) {
        $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 1);
     $xpos = $margin_left + 100;
 } else {
     $xpos = $margin_left;
 }
 $box_pad = 2;
 $img_path = DIR_WS_IMAGES . 'imagecache/';
 $img_file = basename(webImageSource($e['image'], '', '80', '80'));
 $img = $img_path . $img_file;
 if ($img != $img_path) {
     $test = getimagesize($img);
     if ($test[2] == 2) {
         $pdf->Image($img, $xpos + $box_pad, $ypos + $box_pad, $img_size, $img_size);
     }
 }
 $box_size = $img_size + 2 * $box_pad;
 $pdf->SetDrawColor(200, 200, 200);
 $pdf->SetLineWidth(0.2);
 $pdf->Rect($xpos, $ypos, $box_size, $box_size);
 $text_middling = 1;
 $xpos += $img_size + $spacing;
 $ypos += $text_middling;
 $data_array = array();
 $data_array[] = 'Code';
 $data_array[] = 'Qty';
 $data_array[] = 'Price';
 $data_array[] = 'J&G ID';
 $data = implode("\n", $data_array);
 $pdf->setXY($xpos, $ypos);
 $pdf->MultiCell($label_width, $line_height, $data);
 $xpos += $label_width;
 $qty = $elements_qty[$e['elements_id']];
예제 #27
0
 /**
  *   Affiche la grille des lignes de factures
  *
  *   @param     PDF			$pdf     		Object PDF
  *   @param		int			$tab_top		Tab top
  *   @param		int			$tab_height		Tab height
  *   @param		int			$nexY			next y
  *   @param		Translate	$outputlangs	Output langs
  *   @return	void
  */
 function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
 {
     global $conf;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Amount in (at tab_top - 1)
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('', '', $default_font_size - 2);
     $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency" . $conf->currency));
     $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 4), $tab_top - 4);
     $pdf->MultiCell($pdf->GetStringWidth($titre) + 3, 2, $titre);
     $pdf->SetDrawColor(128, 128, 128);
     // Rect prend une longueur en 3eme param
     $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height);
     // line prend une position y en 3eme param
     $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
     $pdf->SetFont('', '', 8);
     // Accountancy piece
     $pdf->SetXY($this->posxpiece - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxdesc - $this->posxpiece - 1, 1, '', '', 'R');
     // Comments
     $pdf->line($this->posxdesc - 1, $tab_top, $this->posxdesc - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxdate - $this->posxdesc - 1, 1, $outputlangs->transnoentities("Description"), '', 'L');
     // Date
     $pdf->line($this->posxdate - 1, $tab_top, $this->posxdate - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxdate - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxtype - $this->posxdate - 1, 2, $outputlangs->transnoentities("Date"), '', 'C');
     // Type
     $pdf->line($this->posxtype - 1, $tab_top, $this->posxtype - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxtype - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxprojet - $this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C');
     // Project
     $pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxprojet - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxtva - $this->posxprojet - 1, 2, $outputlangs->transnoentities("Project"), '', 'C');
     // VAT
     if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
         $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
         $pdf->SetXY($this->posxtva - 1, $tab_top + 1);
         $pdf->MultiCell($this->posxup - $this->posxtva - 1, 2, $outputlangs->transnoentities("VAT"), '', 'C');
     }
     // Unit price
     $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxup - 1, $tab_top + 1);
     $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceU"), '', 'C');
     // Quantity
     $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
     $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
     $pdf->MultiCell($this->postotalttc - $this->posxqty, 2, $outputlangs->transnoentities("Qty"), '', 'R');
     // Total with all taxes
     $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
     $pdf->SetXY($this->postotalttc - 1, $tab_top + 1);
     $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"), '', 'R');
     $pdf->SetTextColor(0, 0, 0);
 }
예제 #28
0
$pdf->Cell(50, 4, $eminima . ' ' . $unidad);
//Detalle
$pdf->Ln(8);
$pdf->SetX(18);
$pdf->SetFont('Courier', 'UB', 10);
$pdf->Cell(18, 4, utf8_decode('Movimientos'));
$pdf->SetX(41);
$pdf->SetFont('Courier', 'B', 10);
$pdf->Cell(1, 4, ':');
$pdf->Ln(6);
// las lineas de los productos
$pdf->SetX(17);
$pdf->Cell(1);
$pdf->SetFillColor(210, 210, 210);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(210, 210, 210);
$pdf->SetLineWidth(0.2);
$pdf->SetFont('Courier', 'B', 8);
$pdf->Cell(6, 4, "#", 1, 0, 'C', 1);
$pdf->Cell(30, 4, utf8_decode("Fecha"), 1, 0, 'D', 1);
$pdf->Cell(70, 4, utf8_decode("Operación"), 1, 0, 'C', 1);
$pdf->Cell(20, 4, "Movimiento", 1, 0, 'C', 1);
$pdf->Cell(35, 4, "Cantidad", 1, 0, 'C', 1);
$pdf->Cell(20, 4, "C.U.(" . $Moneda[1]['S'] . ")", 1, 0, 'C', 1);
$pdf->Cell(20, 4, "C.T.(" . $Moneda[1]['S'] . ")", 1, 0, 'C', 1);
$pdf->Cell(35, 4, "Saldo", 1, 0, 'C', 1);
$pdf->Cell(28, 4, "Usuario", 1, 0, 'C', 1);
$pdf->SetFillColor(0, 0, 0);
$pdf->SetTextColor(0);
$pdf->SetDrawColor(210, 210, 210);
$pdf->SetLineWidth(0.2);
예제 #29
0
     }
 }
 //Order Counter
 $order_counter++;
 //DRAW BARCODE
 //$pdf->OrderBarcode($barcode_nr, 160, 12, 35);
 //START DRAWING INVOICE
 //Invoice Header
 $header_text = 'Rechnung für das Monatspaket – ' . $german_month[date('n', $order_date)] . ' ' . date('Y', $order_date);
 //Shipping Address
 $boxpos1x = $margin + 1;
 $boxpos2x = 80;
 $boxpos_y = 23;
 $address_height_used = $order['customer_billing_address2'] != '' ? $address_height2 : $address_height;
 $pdf->setFont('Arial', '', '10');
 $pdf->SetDrawColor($gray, $gray, $gray);
 $pdf->Rect($boxpos1x, $boxpos_y, $address_width, $address_height_used);
 if ($print_address_note) {
     $pdf->Rect($boxpos2x, $boxpos_y, $address_width, $address_height_used);
 }
 $box1x = $boxpos1x + 2;
 $box2x = $boxpos2x + 2;
 $box_y = $boxpos_y + 4;
 $ypos = $box_y;
 $pdf->SetXY($box1x, $ypos);
 $pdf->SetTextColor($gray, $gray, $gray);
 $pdf->Cell($address_width, 4, 'Bestellt von:');
 $ypos += 6;
 $pdf->SetXY($box1x, $ypos);
 $pdf->setFont('Arial', 'B', '10');
 $pdf->SetTextColor(0, 0, 0);
예제 #30
-1
 /**
  *   Show table for lines
  *
  *   @param		PDF			$pdf     		Object PDF
  *   @param		string		$tab_top		Top position of table
  *   @param		string		$tab_height		Height of table (rectangle)
  *   @param		int			$nexY			Y (not used)
  *   @param		Translate	$outputlangs	Langs object
  *   @param		int			$hidetop		1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
  *   @param		int			$hidebottom		Hide bottom bar of array
  *   @param		string		$currency		Currency code
  *   @return	void
  */
 function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
 {
     global $conf;
     // Force to disable hidetop and hidebottom
     $hidebottom = 0;
     if ($hidetop) {
         $hidetop = -1;
     }
     $currency = !empty($currency) ? $currency : $conf->currency;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Amount in (at tab_top - 1)
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('', '', $default_font_size - 2);
     if (empty($hidetop)) {
         $titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency" . $currency));
         $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4);
         $pdf->MultiCell($pdf->GetStringWidth($titre) + 3, 2, $titre);
         //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
         if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) {
             $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
         }
     }
     $pdf->SetDrawColor(128, 128, 128);
     $pdf->SetFont('', '', $default_font_size - 1);
     // Output Rect
     $this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $tab_height, $hidetop, $hidebottom);
     // Rect prend une longueur en 3eme param et 4eme param
     if (empty($hidetop)) {
         $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur - $this->marge_droite, $tab_top + 5);
         // line prend une position y en 2eme param et 4eme param
         $pdf->SetXY($this->posxdesc - 1, $tab_top + 1);
         $pdf->MultiCell(108, 2, $outputlangs->transnoentities("Designation"), '', 'L');
     }
     if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) {
         $pdf->line($this->posxpicture - 1, $tab_top, $this->posxpicture - 1, $tab_top + $tab_height);
         if (empty($hidetop)) {
             //$pdf->SetXY($this->posxpicture-1, $tab_top+1);
             //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
         }
     }
     if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
         $pdf->line($this->posxtva - 1, $tab_top, $this->posxtva - 1, $tab_top + $tab_height);
         if (empty($hidetop)) {
             $pdf->SetXY($this->posxtva - 3, $tab_top + 1);
             $pdf->MultiCell($this->posxup - $this->posxtva + 3, 2, $outputlangs->transnoentities("VAT"), '', 'C');
         }
     }
     $pdf->line($this->posxup - 1, $tab_top, $this->posxup - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         $pdf->SetXY($this->posxup - 1, $tab_top + 1);
         $pdf->MultiCell($this->posxqty - $this->posxup - 1, 2, $outputlangs->transnoentities("PriceUHT"), '', 'C');
     }
     $pdf->line($this->posxqty - 1, $tab_top, $this->posxqty - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         $pdf->SetXY($this->posxqty - 1, $tab_top + 1);
         if ($conf->global->PRODUCT_USE_UNITS) {
             $pdf->MultiCell($this->posxunit - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
         } else {
             $pdf->MultiCell($this->posxdiscount - $this->posxqty - 1, 2, $outputlangs->transnoentities("Qty"), '', 'C');
         }
     }
     if ($conf->global->PRODUCT_USE_UNITS) {
         $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height);
         if (empty($hidetop)) {
             $pdf->SetXY($this->posxunit - 1, $tab_top + 1);
             $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', 'C');
         }
     }
     $pdf->line($this->posxdiscount - 1, $tab_top, $this->posxdiscount - 1, $tab_top + $tab_height);
     if (empty($hidetop)) {
         if ($this->atleastonediscount) {
             $pdf->SetXY($this->posxdiscount - 1, $tab_top + 1);
             $pdf->MultiCell($this->postotalht - $this->posxdiscount + 1, 2, $outputlangs->transnoentities("ReductionShort"), '', 'C');
         }
     }
     if ($this->atleastonediscount) {
         $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height);
     }
     if (empty($hidetop)) {
         $pdf->SetXY($this->postotalht - 1, $tab_top + 1);
         $pdf->MultiCell(30, 2, $outputlangs->transnoentities("TotalHT"), '', 'C');
     }
 }