Exemple #1
0
 }
 $pdf->Cell(135, 6, ' ' . $sede, 1, 1);
 $pdf->Cell(40, 6, 'Periodo ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' da ' . strftime('%d/%m/%Y', strtotime($row['STA_DataInizio'])) . ' a ' . strftime('%d/%m/%Y', strtotime($row['STA_DataFine'])), 1, 1);
 $pdf->Cell(40, 6, 'Orario ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' ' . utf8_decode($row['STA_Orario']), 1, 1);
 $pdf->Cell(40, 6, 'Tutor aziendale ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' ' . utf8_decode($row['PAZ_Titolo']) . ' ' . utf8_decode($row['PAZ_Nome']), 1, 1);
 $pdf->Cell(40, 6, 'Tutor scolastico ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' prof. ' . utf8_decode($row['TUT_Nome']) . ' ' . utf8_decode($row['TUT_Cognome']), 1, 1);
 $pdf->Ln(3);
 $pdf->SetFont('abac', '', 11);
 $x = $pdf->GetX();
 $y = $pdf->GetY();
 $pdf->Cell(30, 10, 'Data', 1, 0, 'C', 1);
 $pdf->Rect($x + 30, $y, 74, 10);
 $pdf->Cell(74, 5, "Firma mattino", 0, 0, 'C');
 $pdf->Cell(74, 5, "Firma pomeriggio", 0, 1, 'C');
 $pdf->Cell(30);
 $pdf->SetFont('abalc', '', 10);
 $pdf->Rect($x + 104, $y, 74, 10);
 $pdf->Cell(74, 5, "(dalle ore   ...............       alle ore   ...............)", 0, 0, 'C');
 $pdf->Cell(74, 5, "(dalle ore   ...............       alle ore   ...............)", 0, 1, 'C');
 $pdf->SetFont('abac', '', 12);
 $pdf->Cell(30, 7, '', 1, 0, 'R');
 $pdf->Cell(74, 7, '', 1, 0, 'R');
 $pdf->Cell(74, 7, '', 1, 1, 'R');
 $pdf->Cell(30, 7, '', 1, 0, 'R');
 $pdf->Cell(74, 7, '', 1, 0, 'R');
 $pdf->Cell(74, 7, '', 1, 1, 'R');
 $pdf->Cell(30, 7, '', 1, 0, 'R');
 /**
  *   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);
 }
 }
 //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);
 $pdf->Cell($address_width, 4, "{$order['customer_billing_title']} {$order['customer_billing_firstname']} {$order['customer_billing_lastname']}");
 $q3 = mysql_query("select * from grade_history where grade_history_quarter = '{$reportid}' and grade_history_student='{$studentid}'");
 while ($r3 = mysql_fetch_array($q3)) {
     $q25 = mysql_query("select * from grade_subjects where grade_subject_id = {$r3['grade_history_subject']}");
     $r25 = mysql_fetch_array($q25);
     $info[0] = $r25['grade_subject_desc'];
     $q4 = mysql_query("select * from web_users where web_users_id = {$r3['grade_history_user']}");
     $r4 = mysql_fetch_array($q4);
     $info[1] = $r4['web_users_flname'];
     $info[2] = $r3['grade_history_grade'];
     $info[3] = $r3['grade_history_effort'];
     $info[4] = $r3['grade_history_conduct'];
     $info[5] = $r3['grade_history_notes'];
     $pdf->Row($info);
 }
 $pdf->SetLineWidth(2);
 $pdf->Rect(25, 25, 245, 130, '');
 if ($reportid > 1) {
     $pdf->AddPage();
     $pdf->SetFont('Times', 'IB', 16);
     $pdf->Write(1, $school);
     $pdf->SetFont('Times', '', 14);
     $pdf->Ln();
     $pdf->SetXY(30, 50);
     $pdf->Write(1, $name);
     $pdf->Ln();
     $pdf->SetXY(30, 55);
     $pdf->Write(1, $address1);
     $pdf->Ln();
     if (!empty($address2)) {
         $pdf->SetXY(30, 60);
         $pdf->Write(1, $address2);
Exemple #5
0
 }
 $query = "SELECT COUNT( risk ) AS count, risk, hostIP, ctx FROM \n                    (SELECT DISTINCT t1.hostIP, HEX(t1.ctx) AS ctx, t1.risk, t1.port, t1.protocol, t1.app, t1.scriptid, t1.msg\n                        FROM vuln_nessus_results t1\n                        WHERE report_id in ({$report_id})\n                        AND t1.falsepositive<>'Y'\n                    ) as t GROUP BY risk";
 $ecount = 0;
 $result = $dbconn->Execute($query);
 $index = 0;
 $pdf->Ln();
 $total_number1 = _("Total number of vulnerabilities identified on ") . " " . sizeof($hosts) . _(" system(s)");
 if ($chinese) {
     $total_number1 = mb_convert_encoding($total_number1, 'UTF-8', 'HTML-ENTITIES');
     $pdf->SetFont('GB', 'B', 12);
 } else {
     $total_number1 = mb_convert_encoding($total_number1, 'ISO-8859-1', 'HTML-ENTITIES');
     $pdf->SetFont('Helvetica', 'B', 12);
 }
 $pdf->Cell(0, 6, $total_number1, 0, 1, 'C');
 $pdf->Rect(10, 43, 190, 54);
 $pdf->Ln();
 $pdf->SetFont('Arial', '', 10);
 $Eriskcount = 0;
 $riskArray = array();
 $colorarray = array();
 while (list($riskcount, $risk, $hostIP, $ctx) = $result->fields) {
     if ($ecount > 0) {
         $Eriskcount += $ecount;
         $riskcount -= $ecount;
     }
     $riskArray[getrisk($risk)] = $riskcount;
     $colorarray[$index] = getriskcolor($risk);
     $index++;
     $result->MoveNext();
 }
class PDF extends FPDF
{
    function Footer()
    {
        $this->SetY(-10);
        $this->SetX(5);
        $this->SetFont('helvetica', 'I', 5);
        $this->Cell(48, 5, utf8_decode("Fecha Impresión " . Date::today()), 0, 0, 'L');
        $this->Cell(48, 5, utf8_decode('Página') . $this->PageNo() . '/{nb}', 0, 0, 'R');
    }
}
$pdf = new PDF('P', 'mm', array(105, 148));
$pdf->AliasNbPages();
for ($i = 0; $i < 2; $i++) {
    $pdf->AddPage();
    $pdf->Rect(10, 10, 85, 128);
    $pdf->Line(10, 20, 95, 20);
    $pdf->Line(10, 30, 95, 30);
    $pdf->SetFont('helvetica', 'B', 7);
    $pdf->SetFillColor(120, 120, 120);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetX(10);
    $pdf->SetY(10);
    $pdf->Cell(85, 10, utf8_decode($this->planillaDataDet[0]['id_personal'] . " - " . $this->planillaDataDet[0]['nombre_personal']), 1, 0, 'C', true);
    $pdf->Ln(13);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Cell(15, 5, utf8_decode('BOLETA INFORMATIVA DETALLE'), 0, 0, 'L');
    $pdf->Ln(10);
    $pdf->Cell(65, 5, utf8_decode('Básico ' . $this->planillaDataDet[0]['nom_planilla'] . ' ( ' . $this->planillaDataDet[0]['periodo'] . ' )'), 0, 0, 'L');
    $pdf->Cell(20, 5, utf8_decode($this->planillaDataDet[0]['neto_total'] + $this->planillaDataDet[0]['monto_asig_familiar'] + $this->planillaDataDet[0]['otros_descuentos']), 0, 0, 'R');
    $pdf->Ln(5);
 /**
  *   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 $langs;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $langs->load("main");
     $langs->load("bills");
     if (empty($hidetop)) {
         $pdf->SetFont('', 'B', $default_font_size - 2);
         $pdf->SetXY(10, $tab_top);
         $pdf->MultiCell(10, 5, "LS", 0, 'C', 1);
         $pdf->line(20, $tab_top, 20, $tab_top + $tab_height);
         $pdf->SetXY(20, $tab_top);
         $pdf->MultiCell(10, 5, "LR", 0, 'C', 1);
         $pdf->line(30, $tab_top, 30, $tab_top + $tab_height);
         $pdf->SetXY(30, $tab_top);
         $pdf->MultiCell(20, 5, $outputlangs->transnoentities("Ref"), 0, 'C', 1);
         $pdf->SetXY(50, $tab_top);
         $pdf->MultiCell(90, 5, $outputlangs->transnoentities("Description"), 0, 'L', 1);
         $pdf->SetXY(140, $tab_top);
         $pdf->MultiCell(30, 5, $outputlangs->transnoentities("QtyOrdered"), 0, 'C', 1);
         $pdf->SetXY(170, $tab_top);
         $pdf->MultiCell(30, 5, $outputlangs->transnoentities("QtyToShip"), 0, 'C', 1);
     }
     $pdf->Rect(10, $tab_top, 190, $tab_height);
 }
Exemple #8
0
        if (strpos($angle, '1') === false) {
            $this->_out(sprintf('%.2f %.2f l', $x * $k, ($hp - $y) * $k));
            $this->_out(sprintf('%.2f %.2f l', ($x + $r) * $k, ($hp - $y) * $k));
        }
        //else
        //$this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
        $this->_out($op);
    }
    function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
    {
        $h = $this->h;
        $this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1 * $this->k, ($h - $y1) * $this->k, $x2 * $this->k, ($h - $y2) * $this->k, $x3 * $this->k, ($h - $y3) * $this->k));
    }
}
/*$pdf=new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetDrawColor(200);
$pdf->DashedRect(40,10,165,40);
$pdf->SetFont('Arial','B',30);
$pdf->SetXY(40,10);
$pdf->Cell(125,30,'Enjoy dashes!',0,0,'C',0);
$pdf->Output();*/
$pdf = new PDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetDrawColor(0);
$pdf->SetFillColor(192);
//$pdf->RoundedRect(60, 30, 68, 46, 5, 'DF', '13');
$pdf->Rect(50, 50, 10, 10, 'FD');
$pdf->Output();
 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);
     }
 }
        $this->widths = $w;
    }
    function Header()
    {
        $this->AddFont('Amble-Regular', '', 'Amble-Regular.php');
        $this->SetFont('Amble-Regular', '', 10);
    }
}
$pdf = new PDF('P', 'mm', 'a4');
$pdf->AddPage();
$pdf->SetMargins(10, 0, 0, 0);
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(true, 10);
$pdf->AddFont('Amble-Regular', '', 'Amble-Regular.php');
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Rect(25, 25, 165, 40, 'D');
////3 INFO TRIBUTARIA
$pdf->SetY(33);
$pdf->SetX(85);
$pdf->multiCell(180, 6, utf8_decode('SERVICIO RENTAS INTERNAS'), 0);
//NOMBRE cliente
$pdf->Text(60, 45, utf8_decode('RUC: '));
//ruc cliente
$pdf->Text(42, 50, utf8_decode('RAZON SOCIAL: '));
//ruc cliente
$pdf->Text(48, 55, utf8_decode('IMPUESTOL: '));
//ruc cliente
$pdf->Text(40, 60, utf8_decode('PERIODO FISCAL: '));
//ruc cliente
$pdf->Rect(25, 65, 165, 10, 'D');
////3 INFO TRIBUTARIA
 /**
  *  Show top header of page.
  *
  * 	@param	PDF			$pdf     		Object PDF
  *  @param  Translate	$outputlangs	Object lang for output
  * 	@param	int			$pagenb			Page nb
  *  @return	void
  */
 function _pagehead(&$pdf, $outputlangs, $pagenb)
 {
     global $conf, $langs;
     // Do not add the BACKGROUND as this is a report
     //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
     // New page
     $pdf->AddPage();
     // Show title
     $pdf->SetFont('', 'B', 10);
     $pdf->SetXY($this->marge_gauche, $this->marge_haute);
     $pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0);
     // Show page nb only on iso languages (so default Helvetica font)
     if (pdf_getPDFFont($outputlangs) == 'Helvetica') {
         $pdf->SetXY($this->page_largeur - $this->marge_droite - 40, $this->marge_haute);
         $pdf->MultiCell(40, 1, $pagenb . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
     }
     $y = $pdf->GetY() + 2;
     $pdf->Rect($this->marge_gauche, $y, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $this->page_hauteur - $this->marge_haute - $this->marge_basse);
     $y = $pdf->GetY() + 1;
     return $y;
 }
Exemple #12
0
     getHeader();
     $ystart += 9;
 }
 // $pdf->Write(5,$pdf->GetY());
 $xstart = $leftmargin;
 if ($i % 2 != 0) {
     $sred = $redfill0;
     $sgreen = $greenfill0;
     $sblue = $bluefill0;
 } else {
     $sred = $redfill1;
     $sgreen = $greenfill1;
     $sblue = $bluefill1;
 }
 $pdf->SetFillColor($sred, $sgreen, $sblue);
 $pdf->Rect($xstart, $ystart, 50, 9, 'DF');
 $pdf->SetY($ystart + 2);
 $pdf->SetX($xstart);
 $pdf->Write(4, $rooms[$i][name]);
 $xstart += 50;
 for ($j = 0; $j < count($roomcal[$i]); $j++) {
     if ($view == 'type') {
         $red = hexdec(substr($roomcal[$i][$j][bookingtypecolor], 1, 2));
         $green = hexdec(substr($roomcal[$i][$j][bookingtypecolor], 3, 2));
         $blue = hexdec(substr($roomcal[$i][$j][bookingtypecolor], 5, 2));
     } else {
         $red = hexdec(substr($roomcal[$i][$j][color], 1, 2));
         $green = hexdec(substr($roomcal[$i][$j][color], 3, 2));
         $blue = hexdec(substr($roomcal[$i][$j][color], 5, 2));
     }
     if (count($roomcal[$i][$j]) > 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 - 1, $tab_top + 2);
     $pdf->MultiCell(80, 2, $outputlangs->transnoentities("Tasks"), '', 'L');
 }
Exemple #14
0
$pdf->AliasNbPages();
$pdf->SetMargins(15.202, 6.088, 15.202);
$pdf->SetAutoPageBreak(true, 6.088);
$pdf->AddFont('Bodoni MT', 'B', 'bod_b.php');
$pdf->AddFont('Arial', '', 'arial.php');
$pdf->AddFont('Arial', 'B', 'arialbd.php');
$hoy = date_create();
$pdf->AddPage();
//TALMET
$x = 15.175;
$y = 297 - 283.295;
$border = $x - 14.32;
$height = 58.779;
$width = 180.656;
$pdf->SetFillColor(0, 0, 128);
$pdf->Rect($x - $border, $y - $border, $width + 2 * $border, $height + 2 * $border, 'F');
$pdf->Image('../images/pdf/talmet.jpg', $x, $y, $width, $height);
//FONTANERO
$pdf->Image('../images/pdf/fontanero.jpg', 53.734, 297 - 201.132, 97.852);
//FERE
$x = 17.141;
$y = 297 - 66.26000000000001;
$height = 19.707;
$width = 48.605;
$pdf->SetFillColor(0);
$pdf->Rect($x - $border, $y - $border, $width + 2 * $border, $height + 2 * $border, 'F');
$pdf->Image('../images/pdf/fere.jpg', $x, $y, $width, $height);
//CLIUS
$x = 80.06699999999999;
$pdf->SetFillColor(255, 0, 0);
$pdf->Rect($x - $border, $y - $border, $width + 2 * $border, $height + 2 * $border, 'F');
$oi_printed_sp = array();
//CREATE ENVELOPE
//    echo "<pre>";var_dump($orders);die();
foreach ($orders as $po) {
    $firstorder = true;
    $pdf->AddPage();
    $pdf->current_page = 0;
    $margin_env = $margin + 10;
    $boxes_tab_env = $boxes_tab + 15;
    $ypos = $margin + 10;
    $ev_width = 170;
    $ev_height = 170;
    $dash_style = array('width' => 0.1, 'dash' => '2, 2');
    $solid_style = array('width' => 0.2, 'dash' => 0);
    $solid_style_med = array('width' => 0.4, 'dash' => 0);
    $pdf->Rect($margin_env, $ypos, $ev_width, $ev_height, 'D', array('all' => $dash_style));
    $pdf->setXY($margin_env + 10, $ypos + 5);
    $pdf->setFont('Arial', '', '12');
    //FILL JNG ADDRESS HEADER
    $jng_from = "JULIE & GRACE ({$sp_detail['jng_id']})";
    $hamburg_office_address = "{$jng_from}\n";
    $hamburg_office_address .= JNG_ADDRESS_STREET . "\n";
    $hamburg_office_address .= JNG_ADDRESS_ZIPCODE . " " . JNG_ADDRESS_CITY . "\n";
    $hamburg_office_address .= JNG_ADDRESS_COUNTRY;
    $pdf->MultiCell(100, $lineheight, $hamburg_office_address);
    $ypos = +30;
    $pdf->Line($boxes_tab_env, $ypos, 80, $ypos, $solid_style);
    $ypos += $lineheight;
    $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
    $ypos += $lineheight;
    $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
Exemple #16
0
 #Hasta aquí el fondo, ahora el texto:
 // CABECERA
 $pdf->Image('./carnet/junta.png', $x + 3, $y + 4, 24);
 $pdf->Image('./carnet/consejeria.png', $x + 57, $y + 4, 24);
 $pdf->SetTextColor(59, 113, 59);
 $pdf->SetFont('Arial', 'B', 7);
 $pdf->Text(33 + $x, 6.1 + $y, $curso);
 $pdf->SetFont('Arial', 'B', 5);
 $pdf->Text(57.2 + $x, 7.7 + $y, $config['centro_denominacion']);
 $pdf->SetTextColor(0, 0, 0);
 $longnie = strlen($claveal);
 $dplz = 0;
 if ($longnie < 7) {
     $dplz = 4;
 }
 $pdf->Rect(2 + $x, 12 + $y, 23, 30, 'F');
 #$pdf->Rect(46+$x,36+$y,33,11,F);
 $fileExtension = ".jpg";
 $foto_al = "../fotos/" . $claveal . ".jpg";
 if (file_exists($foto_al)) {
     $pdf->Image($foto_al, 2.5 + $x, 12.5 + $y, 22);
 }
 //$pdf->SetFont('c128ab','',40);
 //$cadena= chr(124) . chr(172). $claveal . codigo_control($claveal) . chr(126);
 //$pdf->Text(32+$x+$dplz,40+$y,$cadena);
 /*	if (stristr($_SERVER['SERVER_NAME'],"iesmonterroso.org")==TRUE){
     		$pdf->Rect(34+$x+$dplz,36+$y,40-$dplz,13,'F');
     		$pdf->Image('http://'.$config['dominio'].'/intranet/xml/jefe/carnet/Barcode/test.php?text='.$c_bib,36+$x+$dplz,37+$y,33,0,'PNG');
     }
 	    
 	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']];
 $data_array = array();
 $data_array[] = ': ' . $e['item_number'];
 $dados5 = $row["4"];
 $dados6 = $row["5"];
 $dados7 = $row["6"];
 $l = 5 * contaLinhas($dados2, 48);
 // Eu criei a função "contaLinhas" para contar quantas linhas um campo pode conter se tiver largura = 48
 if ($y + $l >= 230) {
     // 230 É O TAMANHO MAXIMO ANTES DO RODAPE
     $pdf->AddPage();
     // SE ULTRAPASSADO, É ADICIONADO UMA PÁGINA
     $y = 59;
     // E O Y INICIAL É RESETADO
 }
 //DADOS
 $pdf->SetY($y);
 $pdf->SetX(10);
 $pdf->Rect(10, $y, 70, $l);
 $pdf->MultiCell(70, 6, $dados2, 0, 2);
 // ESTA É A CELULA QUE PODE TER DADOS EM MAIS DE UMA LINHA
 $pdf->SetFont('Arial', '', 6);
 $pdf->SetY($y);
 $pdf->SetX(20);
 $pdf->Rect(20, $y, 31, $l);
 $pdf->MultiCell(31, 6, $dados1, 0, 2);
 $pdf->SetY($y);
 $pdf->SetX(51);
 $pdf->Rect(51, $y, 10, $l);
 $pdf->MultiCell(10, 5, $dados3, 0, 2);
 $pdf->SetY($y);
 $pdf->SetX(121);
 $pdf->Rect(121, $y, 12, $l);
 $pdf->MultiCell(12, 6, $dados4, 0, 2, 'C');
    if ($data == 1) {
        return 'BAKING';
    }
}
function round_up($value, $precision)
{
    $pow = pow(10, $precision);
    return (ceil($pow * $value) + ceil($pow * $value - ceil($pow * $value))) / $pow;
}
$height = 7;
$font = 'Arial';
$size = 10;
foreach ($rows->result() as $data) {
    $pdf->AddPage();
    $pdf->SetLineWidth(1);
    $pdf->Rect(10, 19, 32 * 4, 162);
    $pdf->Rect(10, 19 + $height * 4, 32 * 4, $height);
    $pdf->Rect(10, 19 + $height * 5, 32 * 4, $height * 2);
    $pdf->Rect(10, 19 + $height * 11, 32 * 4, $height);
    $pdf->SetLineWidth(0.2);
    $pdf->SetFont($font, 'B', $size - 1);
    $pdf->Cell(32, $height, 'TGL P/O', 1, 0, 'L');
    $pdf->SetFont($font, '', $size);
    $pdf->Cell(32, $height, tgl($data->t_po_header_date), 1, 0, 'C');
    //Tanggal po
    $pdf->SetFont($font, 'B', $size - 1);
    $pdf->Cell(32, $height, 'CUSTOMER', 1, 0, 'L');
    $pdf->SetFont($font, '', $size);
    $pdf->Cell(32, $height, $data->t_po_detail_cust, 1, 0, 'C');
    // Kode Cust
    $pdf->Ln($height);
 /**
  *  Show top header of page.
  *
  *  @param	PDF			$pdf     		Object PDF
  *  @param  int			$page	     	Object to show
  *  @param  int	    	$showaddress    0=no, 1=yes
  *  @param  Translate	$outputlangs	Object lang for output
  *  @return	void
  */
 function _pagehead(&$pdf, $page, $showaddress, $outputlangs)
 {
     global $langs;
     // Do not add the BACKGROUND as this is a report
     //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $title = $outputlangs->transnoentities("ListOfCustomerPayments");
     $title .= ' - ' . dol_print_date(dol_mktime(0, 0, 0, $this->month, 1, $this->year), "%B %Y", false, $outputlangs, true);
     $pdf->SetFont('', 'B', $default_font_size + 1);
     $pdf->SetXY($this->marge_gauche, 10);
     $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->marge_gauche, 2, $title, 0, 'C');
     $pdf->SetFont('', '', $default_font_size);
     $pdf->SetXY($this->posxdate, 16);
     $pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild") . " : " . dol_print_date(time(), "day", false, $outputlangs, true), 0, 'L');
     $pdf->SetXY($this->posxdate, 22);
     $pdf->MultiCell(80, 2, $outputlangs->transnoentities("Page") . " : " . $page, 0, 'L');
     // Title line
     $pdf->SetXY($this->posxdate, $this->tab_top + 2);
     $pdf->MultiCell($this->posxpaymenttype - $this->posxdate, 2, 'Date');
     $pdf->line($this->posxpaymenttype - 1, $this->tab_top, $this->posxpaymenttype - 1, $this->tab_top + $this->tab_height + 10);
     $pdf->SetXY($this->posxpaymenttype, $this->tab_top + 2);
     $pdf->MultiCell($this->posxinvoice - $this->posxpaymenttype, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
     $pdf->line($this->posxinvoice - 1, $this->tab_top, $this->posxinvoice - 1, $this->tab_top + $this->tab_height + 10);
     $pdf->SetXY($this->posxinvoice, $this->tab_top + 2);
     $pdf->MultiCell($this->posxinvoiceamount - $this->posxinvoice, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
     $pdf->line($this->posxinvoiceamount - 1, $this->tab_top, $this->posxinvoiceamount - 1, $this->tab_top + $this->tab_height + 10);
     $pdf->SetXY($this->posxinvoiceamount, $this->tab_top + 2);
     $pdf->MultiCell($this->posxpaymentamount - $this->posxinvoiceamount - 1, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'R');
     $pdf->line($this->posxpaymentamount - 1, $this->tab_top, $this->posxpaymentamount - 1, $this->tab_top + $this->tab_height + 10);
     $pdf->SetXY($this->posxpaymentamount, $this->tab_top + 2);
     $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount - 1, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
     $pdf->line($this->marge_gauche, $this->tab_top + 10, $this->page_largeur - $this->marge_droite, $this->tab_top + 10);
     $pdf->Rect($this->marge_gauche, $this->tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $this->tab_height + 10);
 }
         $pdf->RotatedText($px, $py + 3, utf8_decode($couch[0]['libelle_them']), $angle);
     } else {
         $py = $py + 3;
         $pdf->RotatedText($px, $py, utf8_decode($couch[0]['libelle_them']), $angle);
     }
     $idprov = $id;
     if ($vision == "pay") {
         $px = $px + 2;
     } else {
         $py = $py + 2;
     }
 }
 $coul = explode(",", $couleu);
 $pdf->SetAlpha($apocit);
 $pdf->SetFillColor($coul[0], $coul[1], $coul[2]);
 $pdf->Rect($px, $py, $rect, $rect, F);
 $pdf->SetAlpha(1);
 $pdf->Rect($px, $py, $rect, $rect, D);
 //$pdf->Text(8,$pyy,$legend);
 if ($vision == "pay") {
     $pdf->RotatedText($px + 3, $py - 2, utf8_decode($legend), $angle);
 } else {
     $pdf->RotatedText($px + 5, $py + 3, utf8_decode($legend), $angle);
 }
 //$pyy=$pyy+3;
 if ($vision == "pay") {
     $px = $px + 5;
 } else {
     $py = $py + 5;
     if ($_GET['format'] == 'A4' && $py > 280) {
         $py = 200;
Exemple #22
0
<?php

require 'multicellmax.php';
$pdf = new PDF();
$pdf->AddPage();
$txt = '';
for ($i = 1; $i < 19; $i++) {
    $txt .= 'all work and no play makes jack a dull boy ';
}
$pdf->Rect(20, 20, 100, 100);
$pdf->Rect(80, 20, 40, 40);
$pdf->Rect(20, 80, 40, 40);
$pdf->SetXY(20, 20);
$pdf->SetFont('Arial', '', 10);
$txt = $pdf->MultiCell(60, 5, $txt, 0, 'J', 0, 8);
$txt = $pdf->MultiCell(100, 5, $txt, 0, 'J', 0, 4);
$pdf->SetX(60);
$txt = $pdf->MultiCell(60, 5, $txt, 0, 'J', 0, 8);
$pdf->Output();
 /**
  *   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');
 }
 /**
  *   Show miscellaneous information (payment mode, payment term, ...)
  *
  *   @param		PDF			$pdf     		Object PDF
  *   @param		Object		$object			Object to show
  *   @param		int			$posy			Y
  *   @param		Translate	$outputlangs	Langs object
  *   @return	void
  */
 function _tableau_info(&$pdf, $object, $posy, $outputlangs)
 {
     global $conf, $mysoc;
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     $pdf->SetFont('', '', $default_font_size);
     $pdf->SetXY($this->marge_gauche, $posy);
     $larg_sign = ($this->page_largeur - $this->marge_gauche - $this->marge_droite) / 3;
     $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
     $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
     $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For") . ' ' . $outputlangs->convToOutputCharset($mysoc->name) . ":", '', 'L');
     $pdf->Rect(2 * $larg_sign + $this->marge_gauche, $posy + 1, $larg_sign, 25);
     $pdf->SetXY(2 * $larg_sign + $this->marge_gauche + 2, $posy + 2);
     $pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer") . ':', '', 'L');
 }
Exemple #25
0
 }
 if (!is_null($row['ta_Email']) && $row['ta_Email'] != '') {
     $contatti .= $row['ta_Email'] . '  ';
 }
 $pdf->Cell(135, 6, ' ' . $contatti, 1, 1);
 $pdf->Cell(40, 6, 'Tutor scolastico ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' prof. ' . utf8_decode($row['TUT_Nome']) . ' ' . utf8_decode($row['TUT_Cognome']), 1, 1);
 $pdf->Cell(40, 6, 'Contatti ', 1, 0, 'R', 1);
 $pdf->Cell(135, 6, ' ' . $row['TUT_Cellulare'] . '  ' . $row['TUT_Email'], 1, 1);
 /*	$pdf->Cell(40,12,'Applicazione competenze ',1,0,'R',1);
 		$pdf->MultiCell(135,4,' '.utf8_decode($row['STA_Compito']),1,1);*/
 $pdf->Ln(3);
 $pdf->SetFont('abac', '', 11);
 $pdf->Cell(0, 8, "Polizze assicurative", 0, 2);
 $pdf->SetFont('abalc', '', 9);
 $pdf->Rect($pdf->GetX() + 6, $pdf->GetY(), 169, 8);
 $pdf->Cell(6);
 $pdf->Cell(0, 4, "INAIL Codice PAT n. " . $rsmeucci['INAIL_Pat'] . " - Infortuni sul lavoro Polizza n. " . $rsmeucci['ASS_Infortuni'], 0, 2);
 $pdf->Cell(0, 4, "Responsabilità civile Polizza n. " . $rsmeucci['ASS_RespCivile'] . " (Compagnia assicurativa " . $rsmeucci['ASS_Compagnia'] . ")");
 $pdf->Ln(5);
 $pdf->SetFont('abac', '', 11);
 $pdf->Cell(0, 8, "Obiettivi e modalità del Tirocinio", 0, 2);
 $pdf->SetFont('abalc', '', 9);
 $pdf->Cell(6);
 $pdf->MultiCell(169, 4, "Orientamento: Prendere coscienza delle abilità specifiche necessarie all'inserimento in un settore produttivo e delle possibilità di autorealizzazione in un ambiente diverso da quello familiare e scolastico.", 'TLR', 2);
 $pdf->Cell(6);
 $pdf->MultiCell(169, 4, "Socializzazione: Formare o potenziare le abilità comunicative e rafforzare determinate abilità cognitive, sociali e professionali; sviluppare le capacità di adattamento al fine di assumere atteggiamenti idonei rispetto all'ambiente operativo in cui gli alunni vengono inseriti.", 'LR', 2);
 $pdf->Cell(6);
 $pdf->MultiCell(169, 4, "Sviluppo di abilità: Acquisire la capacità di rendersi autonomo nello svolgere i compiti assegnati; Sviluppare precisione ed accuratezza nell'effettuare il lavoro assegnato.", 'LR', 2);
 $pdf->Cell(6);
 $pdf->MultiCell(169, 4, "Comportamento: Educazione al rispetto degli orari; sviluppare un corretto rapporto con gli altri dipendenti; capire l'importanza della cura delle attrezzature.", 'LR', 2);
Exemple #26
0
 $pdf->Cell(135, 8, ' ' . utf8_decode($row['TIR_Nome']) . ' ' . utf8_decode($row['TIR_Cognome']), 1, 1);
 $pdf->Cell(40, 8, 'Tutor aziendale ', 1, 0, 'R', 1);
 $pdf->Cell(135, 8, ' ' . utf8_decode($row['PAZ_Titolo']) . ' ' . utf8_decode($row['PAZ_Nome']), 1, 1);
 $pdf->Cell(40, 8, 'Azienda ospitante ', 1, 0, 'R', 1);
 $pdf->Cell(135, 8, ' ' . utf8_decode($row['AZ_RagioneSociale']), 1, 1);
 $pdf->Cell(40, 8, 'Sede del tirocinio ', 1, 0, 'R', 1);
 if (is_null($row['STA_Sede']) || $row['STA_Sede'] == '') {
     $sede = utf8_decode($row['AZ_Indirizzo']) . ' ' . utf8_decode($row['AZ_Localita']) . ' ' . $row['AZ_CAP'] . ' ' . utf8_decode($row['AZ_Comune']);
 } else {
     $sede = utf8_decode($row['STA_Sede']);
 }
 $pdf->Cell(135, 8, ' ' . $sede, 1, 1);
 $pdf->Cell(40, 8, 'Periodo ', 1, 0, 'R', 1);
 $pdf->Cell(135, 8, ' da ' . strftime('%d/%m/%Y', strtotime($row['STA_DataInizio'])) . ' a ' . strftime('%d/%m/%Y', strtotime($row['STA_DataFine'])), 1, 1);
 $pdf->Cell(40, 16, 'Applicazione competenze ', 1, 0, 'R', 1);
 $pdf->Rect($pdf->GetX(), $pdf->GetY(), 135, 16);
 $pdf->MultiCell(135, 5, ' ' . utf8_decode($row['STA_Compito']), 0, 1);
 $pdf->Ln(16);
 $pdf->SetFont('abac', '', 10);
 $x = $pdf->GetX();
 $y = $pdf->GetY();
 $pdf->Cell(40, 12, 'Grado di apprendimento ', 0, 0, 'R', 1);
 $pdf->Rect($x, $y, 40, 12);
 $pdf->Rect($pdf->GetX(), $pdf->GetY(), 135, 12);
 $pdf->SetFont('abalc', '', 9);
 $pdf->Cell(27, 6, 'Gravemente insuff.', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Insufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Sufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Buono', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Ottimo', 0, 1, 'C');
 $pdf->Rect(70, $pdf->GetY(), 3, 3);
Exemple #27
0
 /**
  * @param PDF $pdf
  * @param $Persona1
  * @param $Persona2
  */
 private function FuncionSumativa($pdf, $Persona1, $Persona2 = null)
 {
     $pdf->AddPage('L');
     $this->item = 0;
     $Notas = [];
     if (is_null($Persona2)) {
         $Notas = $Persona1->NOTA;
     } else {
         foreach ($Persona1->NOTA as $i => $calificacion) {
             $Notas[] = number_format(($calificacion + $Persona2[$i]) / 2, 1);
         }
     }
     $pdf->Image(base_url('public/images/logo.jpg'), 20, 10, 40, 10);
     #ENCABEZADO
     $pdf->SetFont('Arial', 'B', 9);
     $pdf->SetFillColor(210, 200, 200);
     $pdf->Text(260, 15, 'DO-075-F');
     $pdf->Text(85, 20, 'FACULTAD DE CIENCIAS EMPRESARIALES Y FACULTAD DE INGENIERÍAS');
     $pdf->Text(103, 25, 'FORMATO SEGUIMIENTO A ESTUDIANTES EN PRÁCTICA');
     $pdf->Text(125, 30, 'FUNCIÓN SUMATIVA');
     #Fields
     $h = 9;
     $f = 0;
     $c = 25;
     $x = 30;
     $pdf->SetFont('Arial', '', 7);
     $pdf->Rect($x, $c + $h * ++$f, 240, 59);
     $pdf->Rect($x, $c + $h * $f, 240, 5);
     #NUMERACIÓN
     $pdf->Text($x + 64, $c + $h * $f + 3, '1°            2°');
     $pdf->Text($x + 144, $c + $h * $f + 3, '1°            2°');
     $pdf->Text($x + 224, $c + $h * $f + 3, '1°            2°');
     $pdf->SetXY($x, $c + $h * $f);
     $pdf->Cell(60, 5, 'SABER SER (33%)', 1, 0, 'C');
     #bar 1
     $pdf->SetXY($x + 60, $c + $h * $f + 5);
     $pdf->Cell(20, 54, '', 1, 0, 'C', true);
     $pdf->SetXY($x + 60, $c + $h * $f);
     $pdf->Cell(10, 59, '', 1, 0, 'C');
     $pdf->SetXY($x + 80, $c + $h * $f);
     $pdf->Cell(60, 5, 'SABER HACER (34%)', 1, 0, 'C');
     #bar 2
     $pdf->SetXY($x + 140, $c + $h * $f + 5);
     $pdf->Cell(20, 54, '', 1, 0, 'C', true);
     $pdf->SetXY($x + 140, $c + $h * $f);
     $pdf->Cell(10, 59, '', 1, 0, 'C');
     $pdf->SetXY($x + 160, $c + $h * $f);
     $pdf->Cell(60, 5, 'SABER SABER (33%)', 1, 0, 'C');
     #bar 3
     $pdf->SetXY($x + 220, $c + $h * $f + 5);
     $pdf->Cell(20, 54, '', 1, 0, 'C', true);
     $pdf->SetXY($x + 220, $c + $h * $f);
     $pdf->Cell(10, 59, '', 1, 0, 'C');
     $ff = $f;
     $x += 4;
     $c += 1;
     $t = 0;
     #Saber ser Text
     $pdf->Text($x, $c + $h * ++$f, '1.   ADAPTABILIDAD');
     $saberser = $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, $t);
     }
     $pdf->Text($x, $c + $h * ++$f, '2.   COLABORACIÓN');
     $saberser += $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '3.   CREATIVIDAD');
     $saberser += $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '4.   RELACIONES INTERPERSONALES');
     $saberser += $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '5.   RESPONSABILIDAD');
     $saberser += $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '6.   ÉTICA');
     $saberser += $this->Nota($x + 59, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 69, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $f = $ff;
     $x += 82;
     #Saber hacer Text
     $pdf->Text($x, $c + $h * ++$f, '1.   CUMPLIMIENTO DE OBJETIVOS');
     $saberhacer = $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '2.   MANEJO DE RECURSOS');
     $saberhacer += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '3.   DETECCIÓN DE OPORTUNIDADES');
     $saberhacer += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '4.   PLANEACIÓN');
     $saberhacer += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '5.   COMUNICACIÓN ORAL Y ESCRITA');
     $saberhacer += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '6.   CALIDAD DEL TRABAJO');
     $saberhacer += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $f = $ff;
     $x += 80;
     #Saber saber Text
     $pdf->Text($x, $c + $h * ++$f, '1.   INTERPRETACIÓN');
     $sabersaber = $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '2.   ANÁLISIS');
     $sabersaber += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '3.   PROPOSICIÓN');
     $sabersaber += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '4.   ARGUMENTACIÓN');
     $sabersaber += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '5.   SÍNTESIS');
     $sabersaber += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, ++$t);
     }
     $pdf->Text($x, $c + $h * ++$f, '6.   ACTUALIZACIÓN');
     $sabersaber += $this->Nota($x + 57, $c + $h * $f, $pdf, $Notas, true);
     if (isset($this->Notas2['Notas'])) {
         $this->Nota($x + 67, $c + $h * $f, $pdf, $this->Notas2['Notas'], true, $t);
     }
     ##########################
     $c = 30;
     $x = 30;
     $f = $ff;
     $pdf->Rect($x, $c + $h * $f, 240, 9);
     $pdf->Rect($x, $c + $h * ++$f, 240, 9);
     $pdf->Rect($x, $c + $h * ++$f, 240, 9);
     $pdf->Rect($x, $c + $h * ++$f, 240, 9);
     $pdf->Rect($x, $c + $h * ++$f, 240, 9);
     $pdf->Rect($x, $c + $h * ++$f, 240, 9);
     $saberser = number_format($saberser / 6 * 0.33, 2);
     $saberhacer = number_format($saberhacer / 6 * 0.34, 2);
     $sabersaber = number_format($sabersaber / 6 * 0.33, 2);
     $f++;
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->SetWidths([50, 35, 35]);
     $pdf->SetAligns(['C', 'C', 'C']);
     $pdf->SetXY($x, $c + $h * ++$f);
     $pdf->Row(['TOTALES', 'PRIMER MOMENTO', 'SEGUNDO MOMENTO']);
     $pdf->SetAligns(['L', 'C', 'C']);
     $pdf->SetXY($x, $c + $h * $f + 5);
     $pdf->Row(['SABER SER (33%)', $saberser, isset($this->Notas2['Saberser']) ? $this->Notas2['Saberser'] : '']);
     $pdf->SetXY($x, $c + $h * $f + 10);
     $pdf->Row(['SABER HACER (34%)', $saberhacer, isset($this->Notas2['Saberhacer']) ? $this->Notas2['Saberhacer'] : '']);
     $pdf->SetXY($x, $c + $h * $f + 15);
     $pdf->Row(['SABER SABER (33%)', $sabersaber, isset($this->Notas2['Sabersaber']) ? $this->Notas2['Sabersaber'] : '']);
     $pdf->SetFont('Arial', '', 8);
     $f += 2;
     #######Nota Primer momento#########
     $nota1 = $sabersaber + $saberser + $saberhacer;
     $nota1 = $nota1 > 5 ? 5 : $nota1;
     $pdf->Text($x, $c + $h * ++$f, 'Nota primer momento');
     $pdf->SetXY($x + 32, $c + $h * $f - 3);
     $pdf->Cell(15, 4, number_format($nota1, 1), 1, 0, 'C');
     $pdf->Text($x + 48, $c + $h * $f, 'Fecha');
     $pdf->Text($x + 65, $c - 1 + $h * $f, Fecha($Persona1->FECHA_REGISTRO));
     $pdf->Line($x + 58, $c + $h * $f, 120, $c + $h * $f);
     $pdf->Text($x + 92, $c + $h * $f, 'Firma estudiante');
     $pdf->Line($x + 115, $c + $h * $f, 205, $c + $h * $f);
     $pdf->Text($x, $c + $h * ++$f, 'Firma asesor');
     $pdf->Line($x + 18, $c + $h * $f, 95, $c + $h * $f);
     $pdf->Text($x + 70, $c + $h * $f, 'Firma cooperador');
     $pdf->Line($x + 95, $c + $h * $f, 185, $c + $h * $f);
     ###Nota Segundo Memento########
     $pdf->Text($x, $c + $h * ++$f, 'Nota segundo momento');
     $nota2 = 0;
     if (isset($this->Notas2['Notas'])) {
         $nota2 = number_format($this->Notas2['Sabersaber'] + $this->Notas2['Saberser'] + $this->Notas2['Saberhacer'], 1);
         $nota2 = $nota2 > 5 ? 5 : $nota2;
     }
     $pdf->SetXY($x + 32, $c + $h * $f - 3);
     $pdf->Cell(15, 4, isset($this->Notas2['Notas']) ? $nota2 : '', 1, 0, 'C');
     $pdf->Text($x + 48, $c + $h * $f, 'Fecha');
     if (isset($this->Notas2['Notas'])) {
         $pdf->Text($x + 65, $c - 1 + $h * $f, Fecha($this->Notas2['Fecha']));
     }
     $pdf->Line($x + 58, $c + $h * $f, 120, $c + $h * $f);
     $pdf->Text($x + 92, $c + $h * $f, 'Firma estudiante');
     $pdf->Line($x + 115, $c + $h * $f, 205, $c + $h * $f);
     $pdf->Text($x, $c + $h * ++$f, 'Firma asesor');
     $pdf->Line($x + 18, $c + $h * $f, 95, $c + $h * $f);
     $pdf->Text($x + 70, $c + $h * $f, 'Firma cooperador');
     $pdf->Line($x + 95, $c + $h * $f, 185, $c + $h * $f);
     $pdf->Text($x, $c + $h * ++$f, 'Nota definitiva');
     $pdf->SetXY($x + 32, $c + $h * $f - 3);
     $pdf->Cell(15, 4, isset($this->Notas2['Notas']) ? number_format(($nota2 + $nota1) / 2, 1) : '', 1, 0, 'C');
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->Text($x, $c + $h * ++$f, 'Escala de calificación 0-5');
     $pdf->SetFont('Arial', '', 8);
     $pdf->Text($x + 50, $c + $h * $f, 'V°B° Coordinador de práctica');
     $pdf->Line($x + 90, $c + $h * $f, 205, $c + $h * $f);
     $pdf->Text($x, $c + $h * ++$f, 'NOTA: Anexar a este, los registros de asesoría que dan cuenta del acompañamiento al estudiante en el semestre');
     $pdf->Text(270, $c + $h * ++$f + 5, 'Página ' . $pdf->PageNo());
 }
 /**
  *   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');
     }
 }