/** * PDF Text renderer * * @param PDF $pdf * * @return void */ function render($pdf) { // Set up the style if ($pdf->getCurrentStyle() != $this->styleName) { $pdf->setCurrentStyle($this->styleName); } $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); // Paint the text color or they might use inherited colors by the previous function $match = array(); if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); $pdf->SetTextColor($r, $g, $b); } else { $pdf->SetTextColor(0, 0, 0); } $temptext = spanLTRRTL($temptext, "BOTH"); $temptext = str_replace(array('<br><span dir="rtl" >', '<br><span dir="ltr" >', '> ', ' <'), array('<span dir="rtl" ><br>', '<span dir="ltr" ><br>', '> ', ' <'), $temptext); $pdf->writeHTML($temptext, false, false, true, false, ""); //change height - line break etc. - the form is mirror on rtl pages // Reset the text color to black or it will be inherited $pdf->SetTextColor(0, 0, 0); }
/** * PDF image renderer * * @param PDF $pdf * * @return void */ function render($pdf) { global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright; // Check for a pagebreak first if ($pdf->checkPageBreakPDF($this->height + 5)) { $this->y = $pdf->GetY(); } $curx = $pdf->GetX(); // If current position (left)set "." if ($this->x == ".") { $this->x = $pdf->GetX(); } else { $this->x = $pdf->addMarginX($this->x); $pdf->SetX($curx); } if ($this->y == ".") { //-- first check for a collision with the last picture if (isset($lastpicbottom)) { if ($pdf->PageNo() == $lastpicpage && $lastpicbottom >= $pdf->GetY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) { $pdf->SetY($lastpicbottom + 5); } } $this->y = $pdf->GetY(); } else { $pdf->SetY($this->y); } if ($pdf->getRTL()) { $pdf->Image($this->file, $pdf->getPageWidth() - $this->x, $this->y, $this->width, $this->height, "", "", $this->line, false, 72, $this->align); } else { $pdf->Image($this->file, $this->x, $this->y, $this->width, $this->height, "", "", $this->line, false, 72, $this->align); } $lastpicpage = $pdf->PageNo(); $pdf->lastpicpage = $pdf->getPage(); $lastpicleft = $this->x; $lastpicright = $this->x + $this->width; $lastpicbottom = $this->y + $this->height; // Setup for the next line if ($this->line == "N") { $pdf->SetY($lastpicbottom); } }
/** * Write the Footnote text * Uses style name "footnote" by default * * @param PDF $pdf * * @return void */ function renderFootnote($pdf) { if ($pdf->getCurrentStyle() != $this->styleName) { $pdf->setCurrentStyle($this->styleName); } $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text); // Set the link to this y/page position $pdf->SetLink($this->addlink, -1, -1); // Print first the source number // working if ($pdf->getRTL()) { $pdf->writeHTML("<span> ." . $this->num . "</span>", false, false, false, false, ""); } else { $temptext = "<span>" . $this->num . ". </span>" . $temptext; } // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); $pdf->writeHTML($temptext, true, false, true, false, ''); }
/** * Show footer of page. Need this->emetteur object * * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text * @return void */ function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); //return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object); $paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT'; $marge_basse = $this->marge_basse; $marge_gauche = $this->marge_gauche; $page_hauteur = $this->page_hauteur; // Line of free text $line = !empty($conf->global->{$paramfreetext}) ? $outputlangs->convToOutputCharset($conf->global->{$paramfreetext}) : ""; $pdf->SetFont('', '', $default_font_size - 3); $pdf->SetDrawColor(224, 224, 224); // On positionne le debut du bas de page selon nbre de lignes de ce bas de page $nbofline = dol_nboflines_bis($line, 0, $outputlangs->charset_output); //print 'e'.$line.'t'.dol_nboflines($line);exit; $posy = $marge_basse + $nbofline * 3; if ($line) { $pdf->SetXY($marge_gauche, -$posy); $pdf->MultiCell(20000, 3, $line, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. $posy -= $nbofline * 3; // 6 of ligne + 3 of MultiCell } $pdf->SetY(-$posy); $pdf->line($marge_gauche, $page_hauteur - $posy, 200, $page_hauteur - $posy); $posy--; /*if ($line1) { $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $line1, 0, 'C', 0); } if ($line2) { $posy-=3; $pdf->SetXY($marge_gauche,-$posy); $pdf->MultiCell(200, 2, $line2, 0, 'C', 0); }*/ // Show page nb only on iso languages (so default Helvetica font) if (pdf_getPDFFont($outputlangs) == 'Helvetica') { $pdf->SetXY(-20, -$posy); $pdf->MultiCell(11, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0); } }
$this->Cell(30, 10, $this->title, 1, 0, 'C'); //spacing after header via line break $this->Ln(20); } //Footer for each page function Footer() { // Position at 1.5 cm from bottom $this->SetY(-15); // Arial italic 8 $this->SetFont('Arial', 'I', 8); // Page number $this->Cell(0, 10, $this->footer_txt, 0, 0, 'C'); } } // Instanciation of inherited class $pdf = new PDF(); //Tell it to count page number for us $pdf->AliasNbPages(); //we need a page to put things on $pdf->footer_txt = 'Page ' . $pdf->PageNo() . '/{nb}'; $pdf->logo = 'click-realty-logo-1-with-effect.png'; $pdf->AddPage(); $pdf->SetFont('Times', '', 12); //Content! for ($i = 1; $i <= 40; $i++) { $pdf->Cell(0, 10, 'Printing line number ' . $i, 0, 1); } //$pdf->Output('Test.pdf','D'); $pdf->Output('Test.pdf', 'D'); echo '<pre>' . $pdf->logo . '</pre><br />';
$pdf->setXY($margin, $pdf->ypos); foreach ($cols_value as $rkey => $cr) { if ($rkey == $col_image - 1) { $pdf->Cell($colwidth, $lineheight, '', 1, 0, 'C'); // die($cols_value[0]); $items = $class_pm->retrieveDetail($cols_value[0], 'p'); $img_path = DIR_WS_IMAGES . 'imagecache/'; $img_file = basename(webImageSource($items['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1)); $img = $img_path . $img_file; $x_col = $margin + ($col_image - 1) * $colwidth; $posx_image = $x_col + 3; $pdf->Image($img, $posx_image, $pdf->ypos + 4, 20); //PRINT TEXT BELOW IMAGE $pdf->setXY($x_col, $pdf->ypos + $lineheight - ($lineheight / 2 + 2)); $text_under_image_height = $lineheight; if ($pdf->PageNo() > 1) { $text_under_image_height -= 3.1; } else { $text_under_image_height -= 2; } $pdf->Cell($colwidth, $text_under_image_height, $cr, 0, 0, 'C'); $pdf->setXY($x_col + $colwidth, $pdf->ypos); //RESET BACK CELL POSITION SAME WITH CELL BEFORE } else { $pdf->Cell($colwidth, $lineheight, $cr, 1, 0, 'C'); } } if ($key % 5 == 0) { $pdf->AddPage(); $pdf->ypos = 0; }
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); } }
/** * Show footer of page for PDF generation * * @param PDF $pdf The PDF factory * @param Translate $outputlangs Object lang for output * @param string $paramfreetext Constant name of free text * @param Societe $fromcompany Object company * @param int $marge_basse Margin bottom we use for the autobreak * @param int $marge_gauche Margin left (no more used) * @param int $page_hauteur Page height (no more used) * @param Object $object Object shown in PDF * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both) * @param int $hidefreetext 1=Hide free text, 0=Show free text * @return int Return height of bottom margin including footer text */ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0) { global $conf, $user; $outputlangs->load("dict"); $line = ''; $dims = $pdf->getPageDimensions(); // Line of free text if (empty($hidefreetext) && !empty($conf->global->{$paramfreetext})) { // Make substitution $substitutionarray = array('__FROM_NAME__' => $fromcompany->name, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat); complete_substitutions_array($substitutionarray, $outputlangs, $object); $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray); $line .= $outputlangs->convToOutputCharset($newfreetext); } // First line of company infos $line1 = ""; $line2 = ""; $line3 = ""; $line4 = ""; if ($showdetails) { // Company name if ($fromcompany->name) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name; } // Address if ($fromcompany->address) { $line1 .= ($line1 ? " - " : "") . $fromcompany->address; } // Zip code if ($fromcompany->zip) { $line1 .= ($line1 ? " - " : "") . $fromcompany->zip; } // Town if ($fromcompany->town) { $line1 .= ($line1 ? " " : "") . $fromcompany->town; } // Phone if ($fromcompany->phone) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone; } // Fax if ($fromcompany->fax) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax; } // URL if ($fromcompany->url) { $line2 .= ($line2 ? " - " : "") . $fromcompany->url; } // Email if ($fromcompany->email) { $line2 .= ($line2 ? " - " : "") . $fromcompany->email; } } if ($showdetails || $fromcompany->country_code == 'DE') { // Managers if ($fromcompany->managers) { $line2 .= ($line2 ? " - " : "") . $fromcompany->managers; } } // Line 3 of company infos // Juridical status if ($fromcompany->forme_juridique_code) { $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital if ($fromcompany->capital) { $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) { $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); } else { $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs); } } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 if ($fromcompany->idprof2) { $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2); } // Line 4 of company infos // Prof Id 3 if ($fromcompany->idprof3) { $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 if ($fromcompany->idprof4) { $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $line4 .= ($line4 ? " - " : "") . $outputlangs->transnoentities("VATIntraShort") . ": " . $outputlangs->convToOutputCharset($fromcompany->tva_intra); } $pdf->SetFont('', '', 7); $pdf->SetDrawColor(224, 224, 224); // The start of the bottom of this page footer is positioned according to # of lines $freetextheight = 0; if ($line) { $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { $width = 200; $align = 'C'; } $freetextheight = $pdf->getStringHeight($width, $line); } $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0); $posy = $marginwithfooter + 0; if ($line) { $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell(0, 3, $line, 0, $align, 0); $posy -= $freetextheight; } $pdf->SetY(-$posy); $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); $posy--; if (!empty($line1)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line1, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line2)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line2, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line3)) { $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line3, 0, 'C', 0); } if (!empty($line4)) { $posy -= 3; $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line4, 0, 'C', 0); } // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY(-20, -$posy); //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; if (empty($conf->global->MAIN_USE_FPDF)) { $pdf->MultiCell(13, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0); } else { $pdf->MultiCell(13, 2, $pdf->PageNo() . '/{nb}', 0, 'R', 0); } } return $marginwithfooter; }
private function ImprimeCartaDecanatura() { $this->load->library('fpdf/pdf'); $pdf = new PDF(); $pdf->AddPage(); $pdf->Image(base_url('public/images/logo.jpg'), 80, 15, 60, 18); $Dep = $this->parametros_model->TraeDependencias(); #ENCABEZADO $pdf->SetFont('Arial', 'b', 10); $pdf->Text(178, 35, 'GD-026-F'); $pdf->SetFillColor(230, 230, 230); $pdf->SetXY(25, 38); $pdf->Cell(170, 5, 'MEMORANDO', 0, 0, 'C', true); $pdf->Text(25, 48, strtoupper($this->input->post('CONSECUTIVO'))); $pdf->SetFont('Arial', '', 10); $pdf->Text(25, 58, 'Medellín, ' . MesNombre(date('m')) . ' ' . round(date('d')) . ' de ' . date('Y')); #PARA $pdf->SetFont('Arial', 'b', 10); $pdf->Text(25, 75, 'PARA:'); $pdf->Text(50, 75, ($Dep->DECANATURA_TITULO == 0 ? 'Ingeniera' : 'Ingeniero') . ' ' . $Dep->DECANATURA); $pdf->SetFont('Arial', '', 10); $pdf->Text(50, 80, ($Dep->DECANATURA_TITULO == 0 ? 'Decana' : 'Decano') . ' Facultad de ingeniería'); #DE $pdf->SetFont('Arial', 'b', 10); $pdf->Text(25, 90, 'DE:'); $pdf->Text(50, 90, $this->input->post('TITULO') . ' ' . $this->session->userdata('NOMBRE_USUARIO')); $pdf->SetFont('Arial', '', 10); $pdf->Text(50, 95, 'Docente Asesor de Prácticas'); #ASUNTO $pdf->SetFont('Arial', 'b', 10); $pdf->Text(25, 103, 'ASUNTO:'); $pdf->SetFont('Arial', '', 10); $pdf->SetXY(50, 100); $pdf->MultiCell(130, 4, $this->input->post('ASUNTO')); $pdf->Text(25, 130, 'Cordial Saludo,'); $pdf->SetXY(25, 140); $pdf->MultiCell(165, 4, $this->input->post('CARTA')); $pdf->Text(25, 20 + $pdf->GetY(), 'Atentamente,'); $pdf->SetFont('Arial', 'b', 10); $pdf->Text(25, $pdf->GetY() + 40, $this->session->userdata('NOMBRE_USUARIO')); $pdf->SetFont('Arial', '', 10); $pdf->Text(25, $pdf->GetY() + 45, 'Docente Asesor de Prácticas'); $pdf->Output(); $pdf->Cell($pdf->PageNo()); }
function BuildPDF($report, $delivery_method = 'D') { // for forms only - PDF style global $db, $messageStack, $FieldValues, $posted_currencies; // Generate a form for each group element $output = array(); $pdf = new PDF(); foreach ($report->recordID as $formNum => $Fvalue) { $pdf->StartPageGroup(); // find the single line data from the query for the current form page $TrailingSQL = " from " . $report->sqlTable . " where " . ($report->sqlCrit ? $report->sqlCrit . " AND " : '') . prefixTables($report->formbreakfield) . " = '" . $Fvalue . "'"; $FieldValues = array(); if ($report->special_class) { $form_class = $report->special_class; $special_form = new $form_class(); $FieldValues = $special_form->load_query_results($report->formbreakfield, $Fvalue); } else { if (strlen($report->sqlField) > 0) { //echo 'sql = select ' . $report->sqlField . $TrailingSQL . '<br />'; exit(); $result = $db->Execute("select " . $report->sqlField . $TrailingSQL); $FieldValues = $result->fields; } } // load the posted currency values $posted_currencies = array(); if (ENABLE_MULTI_CURRENCY && strpos($report->sqlTable, TABLE_JOURNAL_MAIN) !== false) { $sql = "select currencies_code, currencies_value " . $TrailingSQL; $result = $db->Execute($sql); $posted_currencies = array('currencies_code' => $result->fields['currencies_code'], 'currencies_value' => $result->fields['currencies_value']); } else { $posted_currencies = array('currencies_code' => DEFAULT_CURRENCY, 'currencies_value' => 1); } foreach ($report->fieldlist as $key => $field) { // Build the text block strings if ($field->type == 'TBlk') { if (!$field->boxfield[0]->fieldname) { return $messageStack->add(PHREEFORM_EMPTYFIELD . $field->fieldname, 'error'); } if ($report->special_class) { $TextField = $special_form->load_text_block_data($field->boxfield); } else { $arrTxtBlk = array(); // Build the fieldlist foreach ($field->boxfield as $idx => $entry) { $arrTxtBlk[] = prefixTables($entry->fieldname) . ' as r' . $idx; } $strTxtBlk = implode(', ', $arrTxtBlk); $result = $db->Execute("select " . $strTxtBlk . $TrailingSQL); $TextField = ''; for ($i = 0; $i < sizeof($field->boxfield); $i++) { $temp = $field->boxfield[$i]->formatting ? ProcessData($result->fields['r' . $i], $field->boxfield[$i]->formatting) : $result->fields['r' . $i]; $TextField .= AddSep($temp, $field->boxfield[$i]->processing); } } $report->fieldlist[$key]->text = $TextField; } if ($field->type == 'LtrData') { // letter template if (!$field->boxfield) { return $messageStack->add(PHREEFORM_EMPTYFIELD . $field->description, 'error'); } $tblField = ''; $data = array(); if ($report->special_class) { $report->LetterData = $special_form->load_letter_data($field->boxfield); } else { $tblField = array(); foreach ($field->boxfield as $key => $TableField) { $tblField[] = prefixTables($TableField->fieldname) . " as {$TableField->description} "; } $tblField = implode(', ', $tblField); $result = $db->Execute("select {$tblField} {$TrailingSQL} LIMIT 1"); foreach ($field->boxfield as $key => $TableField) { if ($TableField->processing) { $result->fields[$TableField->description] = ProcessData($result->fields[$TableField->description], $TableField->processing); } } $report->LetterData = $result->fields; } } // Pre-load all total fields with 'Continued' label for multipage if ($field->type == 'Ttl') { $report->fieldlist[$key]->text = TEXT_CONTINUED; } } $pdf->PageCnt = $pdf->PageNo(); // reset the current page numbering for this new form $pdf->AddPage(); // Send the table foreach ($report->fieldlist as $TableObject) { if ($TableObject->type == 'Tbl') { if (!$TableObject->boxfield) { return $messageStack->add(PHREEFORM_EMPTYFIELD . $TableObject->description, 'error'); } // Build the sql $tblField = ''; $tblHeading = array(); foreach ($TableObject->boxfield as $TableField) { $tblHeading[] = $TableField->description; } $data = array(); if ($report->special_class) { $data = $special_form->load_table_data($TableObject->boxfield); } else { $tblField = array(); foreach ($TableObject->boxfield as $key => $TableField) { $tblField[] = prefixTables($TableField->fieldname) . ' as r' . $key; } $tblField = implode(', ', $tblField); $result = $db->Execute("select " . $tblField . $TrailingSQL); while (!$result->EOF) { $data[] = $result->fields; $result->MoveNext(); } } array_unshift($data, $tblHeading); // set the first data element to the headings $TableObject->data = $data; $StoredTable = clone $TableObject; $pdf->FormTable($TableObject); } } // Send the duplicate data table (only works if each form is contained in a single page [no multi-page]) foreach ($report->fieldlist as $field) { if ($field->type == 'TDup') { if (!$StoredTable) { return $messageStack->add(PHREEFORM_EMPTYTABLE . $field->description, 'error'); } // insert new coordinates into existing table $StoredTable->abscissa = $field->abscissa; $StoredTable->ordinate = $field->ordinate; $pdf->FormTable($StoredTable); } } foreach ($report->fieldlist as $key => $field) { // Set the totals (need to be on last printed page) - Handled in the Footer function in FPDF if ($field->type == 'Ttl') { if (!$field->boxfield) { return $messageStack->add(PHREEFORM_EMPTYFIELD . $field->description, 'error'); } $report->fieldlist[$key]->processing = $field->boxfield[0]->processing; // assume first processing setting carries for the total if ($report->special_class) { $FieldValues = $special_form->load_total_results($field); } else { $ttlField = ''; foreach ($field->boxfield as $TotalField) { $ttlField[] = prefixTables($TotalField->fieldname); } $sql = "select sum(" . implode(' + ', $ttlField) . ") as form_total" . $TrailingSQL; $result = $db->Execute($sql); $FieldValues = $result->fields['form_total']; } $report->fieldlist[$key]->text = $FieldValues; } // Set the data for the last Page if last page only flag checked, pull from temp save if ($field->type == 'Data' && $field->display == '2') { $report->fieldlist[$key]->text = $report->fieldlist[$key]->texttemp; } } // set the printed flag field if provided if ($report->setprintedflag) { $id_field = $report->formbreakfield; $temp = explode('.', $report->setprintedflag); if (sizeof($temp) == 2) { // need the table name and field name $sql = "update " . $temp[0] . " set " . $temp[1] . " = " . $temp[1] . " + 1 where " . $report->formbreakfield . " = '" . $Fvalue . "'"; $db->Execute($sql); } } } // Add additional headers needed for MSIE and send page header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); $output['filename'] = $report->filename; $output['pdf'] = $pdf->Output($report->filename, $delivery_method); if ($delivery_method == 'S') { return $output; } exit; // needs to be here to properly render the pdf file if delivery_method = I or D }
/** * PDF Cell renderer * * @param PDF $pdf * * @return void */ function render($pdf) { // Set up the text style if ($pdf->getCurrentStyle() != $this->styleName) { $pdf->setCurrentStyle($this->styleName); } $temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text); // underline «title» part of Source item $temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext); $match = array(); // Indicates if the cell background must be painted (1) or transparent (0) if ($this->fill == 1) { if (!empty($this->bgcolor)) { // HTML color to RGB if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); $pdf->SetFillColor($r, $g, $b); } } else { $this->fill = 0; } } // Paint the Border color if set if (!empty($this->bocolor)) { // HTML color to RGB if (preg_match("/#?(..)(..)(..)/", $this->bocolor, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); $pdf->SetDrawColor($r, $g, $b); } } // Paint the text color or they might use inherited colors by the previous function if (preg_match("/#?(..)(..)(..)/", $this->tcolor, $match)) { $r = hexdec($match[1]); $g = hexdec($match[2]); $b = hexdec($match[3]); $pdf->SetTextColor($r, $g, $b); } else { $pdf->SetTextColor(0, 0, 0); } // If current position (left) if ($this->left == ".") { $cX = $pdf->GetX(); } else { $cX = $pdf->addMarginX($this->left); } // Check the width if set to page wide OR set by xml to larger then page wide if ($this->width == 0 || $this->width > $pdf->getRemainingWidthPDF()) { $this->width = $pdf->getRemainingWidthPDF(); } // For current position if ($this->top == ".") { $this->top = $pdf->GetY(); } else { $pdf->SetY($this->top); } // Check the last cell height and adjust the current cell height if needed if ($pdf->lastCellHeight > $this->height) { $this->height = $pdf->lastCellHeight; } // Check for pagebreak if (!empty($temptext)) { $cHT = $pdf->getNumLines($temptext, $this->width); $cHT = $cHT * $pdf->getCellHeightRatio() * $pdf->getCurrentStyleHeight(); $cM = $pdf->getMargins(); // Add padding if (is_array($cM['cell'])) { $cHT += $cM['padding_bottom'] + $cM['padding_top']; } else { $cHT += $cM['cell'] * 2; } // Add a new page if needed if ($pdf->checkPageBreakPDF($cHT)) { $this->top = $pdf->GetY(); } $temptext = spanLTRRTL($temptext, "BOTH"); } // HTML ready - last value is true $pdf->MultiCell($this->width, $this->height, $temptext, $this->border, $this->align, $this->fill, $this->newline, $cX, $this->top, $this->reseth, $this->stretch, true); // Reset the last cell height for the next line if ($this->newline >= 1) { $pdf->lastCellHeight = 0; } elseif ($pdf->lastCellHeight < $pdf->getLastH()) { $pdf->lastCellHeight = $pdf->getLastH(); } // Set up the url link if exists ontop of the cell if (!empty($this->url)) { $pdf->Link($cX, $this->top, $this->width, $this->height, $this->url); } // Reset the border and the text color to black or they will be inherited $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); }
$this->SetY(-15); $this->SetFont('Arial', 'I', 8); //$this->Cell(10,10,'Page '.$this->PageNo(),0,0,'C'); } } $nmBrg = makeOption($dbname, 'log_5masterbarang', 'kodebarang,namabarang', $whBrg); $nmKar = makeOption($dbname, 'datakaryawan', 'karyawanid,namakaryawan', $whKar); $nmOrg = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi'); $pdf = new PDF('P', 'mm', 'A4'); /*for($i=1;$i<=4;$i++) { $pdf->AddPage(); } $pdf->Ln(); */ $halaman = $pdf->PageNo(); for ($halaman = 1; $halaman <= 4; $halaman++) { $pdf->AddPage(); $iHt = "select * from " . $dbname . ".pmn_faktur where nofaktur='" . $nofaktur . "' "; $nHt = mysql_query($iHt) or die(mysql_error($conn)); $dHt = mysql_fetch_assoc($nHt); $noKontrak = $dHt['nokontrak']; $qStatus = "SELECT b.statusberikat FROM " . $dbname . ".pmn_kontrakjual a\n\t\t\tLEFT JOIN " . $dbname . ".pmn_4customer b ON a.koderekanan=b.kodecustomer\n\t\t\twhere a.nokontrak='" . $noKontrak . "'"; $resStatus = fetchData($qStatus); $sBerikat = $resStatus[0]['statusberikat']; $height = 5; $height2 = 6; $pdf->SetFont('Arial', '', 6); $pdf->SetXY(130, 10); if ($halaman == 1) { $isiLampiran = "Lembar ke-1 : Untuk Pembelian BKP / Penerimaan JKP sebagai bukti";
include_once "../../class/programas.php"; $programas = new programas(); include_once "../../class/informeprograma.php"; $informeprograma = new informeprograma(); include_once "../../class/impresora.php"; $impresora = new impresora(); $imp = array_shift($impresora->mostrar($inf['codimpresora'])); $pdf = new PDF("P", "mm", "letter"); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->CuadroCuerpoPersonalizado(20, " Fecha:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(40, date("d/m/Y", strtotime($inf['fecha'])), 1, "C", 1); $pdf->CuadroCuerpoPersonalizado(20, " Hora:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(40, date("H:i:s", strtotime($inf['hora'])), 1, "C", 1); $pdf->CuadroCuerpoPersonalizado(20, " Página:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(40, $pdf->PageNo() . " de {nb}", 1, "C", 1); $pdf->ln(10); $pdf->CuadroCuerpoPersonalizado(25, " Solicitante:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(60, $usus1['nombre'] . " " . $usus1['paterno'] . " " . $usus1['materno'], 1, "C", 1); $pdf->CuadroCuerpoPersonalizado(20, " Cargo:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(40, $usus1['cargo'], 1, "C", 1); $pdf->ln(); $pdf->CuadroCuerpoPersonalizado(25, " Lugar:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(60, $usus1['lugar'], 1, "C", 1); $pdf->CuadroCuerpoPersonalizado(20, " Unidad:", 1, 1, 1, "B"); $pdf->CuadroCuerpo(40, $usus1['unidad'], 1, "C", 1); $pdf->ln(10); $pdf->CuadroCuerpoPersonalizado(60, " Trabajos a Realizar", 0, 1, 0, "B"); $pdf->Ln(7); $i = 0; foreach ($trabajo->mostrarTodos("", "nombre") as $t) {
/** * @param PDF $pdf * @param $bug_ids * @param $version_date * @param $chapter_prefix * @param $option_show_duration * @param $detail_flag */ function process_content(PDF $pdf, $bug_ids, $version_date, $chapter_prefix, $option_show_duration, $detail_flag) { $specmanagement_editor_api = new specmanagement_editor_api(); $bug_counter = 10; foreach ($bug_ids as $bug_id) { if (bug_exists($bug_id)) { $bug_data = $specmanagement_editor_api->calculate_bug_data($bug_id, $version_date); if ($detail_flag) { $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')'); $pdf->SetFont('Arial', '', 12); if ($option_show_duration == '1' && !($bug_data[7] == 0 || is_null($bug_data[7]))) { $pdf->SetFont('Arial', 'B', 12); $pdf->Cell(95, 10, plugin_lang_get('editor_bug_duration') . ': ' . $bug_data[7] . ' ' . plugin_lang_get('editor_duration_unit'), '', 0, 0); $pdf->SetFont('Arial', '', 12); } $pdf->Ln(); $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[2])), 0, 1); $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[3])), 0, 1); $pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[4])), 0, 1); if (!empty($bug_data[5])) { $bug_attachements = file_get_visible_attachments($bug_id); $bug_attachements_count = count($bug_attachements); $pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_attachments')) . ' (' . $bug_attachements_count . ')', 0, 1); foreach ($bug_attachements as $bug_attachement) { // var_dump( $bug_attachement ); /** TODO: Bilder anzeigen */ if ($bug_attachement['type'] == 'image') { $file_download_url = config_get_global('path') . $bug_attachement['download_url']; // $file_download_url = 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Bayerischer_Wald_-_Aufichtenwald_001.jpg'; fopen($file_download_url, 'r'); $contents = file_get_contents($file_download_url); $savename = '_' . $bug_attachement['id'] . $bug_attachement['display_name']; $savefile = fopen($savename, 'w'); fwrite($savefile, $contents); fclose($savefile); // $pdf->Image( $savename ); } } } if (!is_null($bug_data[6]) && $bug_data[6] != 0) { $pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_notes_note')) . ' (' . $bug_data[6] . ')', 0, 1); } } else { $pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')', 0, 0); $pdf->Cell(95, 10, $pdf->PageNo(), 0, 1, 'R'); } $bug_counter += 10; } } }
function BuildPDF($ReportID, $Prefs, $delivery_method = 'D') { // for forms only global $db, $messageStack; global $FieldListings, $FieldValues, $posted_currencies; $output = array(); // first fetch all the fields we need to display $FieldListings = ''; $sql = "select seqnum, params from " . TABLE_REPORT_FIELDS . " \r\n\t\twhere reportid = " . $ReportID . " and entrytype = 'fieldlist' and visible = 1\r\n\t\torder by seqnum"; $result = $db->Execute($sql); while (!$result->EOF) { $result->fields['params'] = unserialize($result->fields['params']); $FieldListings[] = $result->fields; $result->MoveNext(); } // check for at least one field selected to show if (!$FieldListings) { // No fields are checked to show, that's bad $messageStack->add(RW_RPT_NOROWS, 'caution'); return; } // Let's build the sql field list for the general data fields (not totals, blocks or tables) $strField = ''; $index = 0; // index each field to allow one field to be used multiple times since $db->Execute returns assoc array foreach ($FieldListings as $OneField) { // check for a data field and build sql field list if ($OneField['params']['index'] == 'Data' || $OneField['params']['index'] == 'BarCode') { // then it's data field make sure it's not empty if ($OneField['params']['DataField'] != '') { $strField .= $OneField['params']['DataField'] . ' as d' . $index . ', '; $index++; } else { // the field is empty, bad news, error and exit $messageStack->add(RW_RPT_EMPTYFIELD . $OneField['seqnum'], 'error'); return; } } } $strField = substr($strField, 0, -2); // strip the extra comma, space and continue // fetch the sort order and add to group by string to finish ORDER BY string $strSort = $strGroup; if (is_array($Prefs['SortListings'])) { while ($FieldValues = array_shift($Prefs['SortListings'])) { if ($FieldValues['params']['default'] == '1') { // then it's the sort by field match if ($strSort == '') { $strSort .= $FieldValues['fieldname']; } else { $strSort .= ', ' . $FieldValues['fieldname']; } $Prefs['filterdesc'] .= RW_RPT_SORTBY . ' ' . $FieldValues['displaydesc'] . '; '; break; } } } // fetch date filter info (skip if criteria was passed to generate function) $strDate = ''; if (!isset($Prefs['PassedCrit'])) { $dates = gen_build_sql_date($Prefs['datedefault'], $Prefs['datefield']); $strDate = $dates['sql']; } // Fetch the Criteria $criteria = build_criteria($Prefs['CritListings']); $strCrit = $criteria['sql']; if (isset($Prefs['PassedCrit'])) { // add the passed criteria to the default criteria for ($i = 0; $i < count($Prefs['PassedCrit']); $i++) { $temp = explode(':', $Prefs['PassedCrit'][$i]); switch (count($temp)) { case 2: // single value passed (assume equal to) if ($strCrit) { $strCrit .= ' and '; } $strCrit .= $temp[0] . " = '" . $temp[1] . "'"; break; case 3: // range passed (assume between inclusive) if ($strCrit) { $strCrit .= ' and '; } $strCrit .= $temp[0] . " >= '" . $temp[1] . "' and " . $temp[0] . " <= '" . $temp[2] . "'"; break; default: // error in passed parameters } } } // fetch the tables to query $tables = array($Prefs['table1'], $Prefs['table2'], $Prefs['table3'], $Prefs['table4'], $Prefs['table5'], $Prefs['table6']); $sqlTable = DB_PREFIX . $Prefs['table1']; if ($Prefs['table2']) { $sqlTable .= ' inner join ' . DB_PREFIX . $Prefs['table2'] . ' on ' . $Prefs['table2criteria']; } if ($Prefs['table3']) { $sqlTable .= ' inner join ' . DB_PREFIX . $Prefs['table3'] . ' on ' . $Prefs['table3criteria']; } if ($Prefs['table4']) { $sqlTable .= ' inner join ' . DB_PREFIX . $Prefs['table4'] . ' on ' . $Prefs['table4criteria']; } if ($Prefs['table5']) { $sqlTable .= ' inner join ' . DB_PREFIX . $Prefs['table5'] . ' on ' . $Prefs['table5criteria']; } if ($Prefs['table6']) { $sqlTable .= ' inner join ' . DB_PREFIX . $Prefs['table6'] . ' on ' . $Prefs['table6criteria']; } // Build query string and execute $sqlCrit = ''; if ($strCrit && $strDate) { $sqlCrit .= $strDate . ' and ' . $strCrit; } if (!$strCrit && $strDate) { $sqlCrit .= $strDate; } if ($strCrit && !$strDate) { $sqlCrit .= $strCrit; } // We now have the sql, find out how many groups in the query (to determine the number of forms) $PageBreakField = $Prefs['formbreakfield']; $form_field_list = $Prefs['filenamesource'] == '' ? $PageBreakField : $PageBreakField . ', ' . $Prefs['filenamesource']; $sql = 'select ' . $form_field_list . ' from ' . $sqlTable; if ($sqlCrit) { $sql .= ' where ' . $sqlCrit; } $sql .= ' group by ' . $PageBreakField; if ($strSort) { $sql .= ' order by ' . $strSort; } // replace table aliases (needed for DB_PREFIX values <> '') $sql = GenReplaceTables($sql, $tables); // execute sql to see if we have data //echo 'sql = ' . $sql . '<br />'; $result = $db->Execute($sql); if (!$result->RecordCount()) { $messageStack->add(RW_RPT_NOROWS, 'caution'); return; } // set the filename for download or email if ($Prefs['filenameprefix'] || $Prefs['filenamesource']) { $output['filename'] = $Prefs['filenameprefix'] . $result->fields[strip_tablename($Prefs['filenamesource'])] . '.pdf'; } else { $output['filename'] = ReplaceNonAllowedCharacters($Prefs['description']) . '.pdf'; } // create an array for each form while (!$result->EOF) { $FormPageID[] = $result->fields[strip_tablename($PageBreakField)]; $result->MoveNext(); } // retrieve the company information foreach ($FieldListings as $key => $SingleObject) { if ($SingleObject['params']['index'] == 'CDta') { $FieldListings[$key]['params']['TextField'] = constant($SingleObject['params']['DataField']); } if ($SingleObject['params']['index'] == 'CBlk') { if (!$SingleObject['params']['Seq']) { $messageStack->add(RW_RPT_EMPTYFIELD . $SingleObject['seqnum'], 'error'); return; } $TextField = ''; foreach ($SingleObject['params']['Seq'] as $OneField) { $TextField .= AddSep(constant($OneField['TblField']), $OneField['Processing']); } $FieldListings[$key]['params']['TextField'] = $TextField; } } // patch for special_reports (forms) where the data file is generated externally from the standard class if ($Prefs['special_report']) { $temp = explode(':', $Prefs['special_report']); $form_class = $temp[1]; if (file_exists(DIR_FS_MY_FILES . 'custom/reportwriter/classes/' . $form_class . '.php')) { $success = (include DIR_FS_MY_FILES . 'custom/reportwriter/classes/' . $form_class . '.php'); } elseif (file_exists(DIR_FS_MODULES . 'reportwriter/classes/' . $form_class . '.php')) { $success = (include DIR_FS_MODULES . 'reportwriter/classes/' . $form_class . '.php'); } else { $success = false; } if (!$success) { $messageStack->add('Special form class: ' . $form_class . ' was called but could not be found!', 'error'); return; } } // Generate a form for each group element $pdf = new PDF(); foreach ($FormPageID as $formNum => $Fvalue) { $pdf->StartPageGroup(); // find the single line data from the query for the current form page $TrailingSQL = " from " . $sqlTable . " where " . ($sqlCrit ? $sqlCrit . " AND " : '') . $PageBreakField . " = '" . $Fvalue . "'"; if ($Prefs['special_report']) { $special_form = new $form_class(); $FieldValues = $special_form->load_query_results($PageBreakField, $Fvalue); } else { $sql = "select " . $strField . $TrailingSQL; $sql = GenReplaceTables($sql, $tables); // replace table aliases (needed for DB_PREFIX values <> '') $result = $db->Execute($sql); $FieldValues = $result->fields; } // load the posted currency values $posted_currencies = array(); if (ENABLE_MULTI_CURRENCY && strpos($sqlTable, TABLE_JOURNAL_MAIN) !== false) { $sql = "select currencies_code, currencies_value " . $TrailingSQL; $sql = GenReplaceTables($sql, $tables); $result = $db->Execute($sql); $posted_currencies = array('currencies_code' => $result->fields['currencies_code'], 'currencies_value' => $result->fields['currencies_value']); } else { $posted_currencies = array('currencies_code' => DEFAULT_CURRENCY, 'currencies_value' => 1); } foreach ($FieldListings as $key => $SingleObject) { // Build the text block strings if ($SingleObject['params']['index'] == 'TBlk') { if (!$SingleObject['params']['Seq']) { $messageStack->add(RW_RPT_EMPTYFIELD . $SingleObject['seqnum'], 'error'); return; } if ($Prefs['special_report']) { $TextField = $special_form->load_text_block_data($SingleObject['params']['Seq']); } else { $strTxtBlk = ''; // Build the fieldlist foreach ($SingleObject['params']['Seq'] as $OneField) { $strTxtBlk .= $OneField['TblField'] . ', '; } $strTxtBlk = substr($strTxtBlk, 0, -2); $sql = "select " . $strTxtBlk . $TrailingSQL; $sql = GenReplaceTables($sql, $tables); $result = $db->Execute($sql); $TxtBlkValues = $result->fields; $TextField = ''; $t = 0; foreach ($TxtBlkValues as $Temp) { $TextField .= AddSep($Temp, $SingleObject['params']['Seq'][$t]['Processing']); $t++; // mapping counter to separator directive } } $FieldListings[$key]['params']['TextField'] = $TextField; } // Pre-load all total fields with 'Continued' label for multipage if ($SingleObject['params']['index'] == 'Ttl') { $FieldListings[$key]['params']['TextField'] = TEXT_CONTINUED; } } $pdf->PageCnt = $pdf->PageNo(); // reset the current page numbering for this new form $pdf->AddPage(); // Send the table foreach ($FieldListings as $TableObject) { if ($TableObject['params']['index'] == 'Tbl') { if (!$TableObject['params']['Seq']) { $messageStack->add(RW_RPT_EMPTYFIELD . $TableObject['seqnum'], 'error'); return; } // Build the sql $tblField = ''; $tblHeading = array(); foreach ($TableObject['params']['Seq'] as $TableField) { $tblHeading[] = $TableField['TblDesc']; } if ($Prefs['special_report']) { $TableObject['params']['Data'] = $special_form->load_table_data($TableObject['params']['Seq']); } else { foreach ($TableObject['params']['Seq'] as $TableField) { $tblField .= $TableField['TblField'] . ', '; } $tblField = substr($tblField, 0, -2); // remove the last two chars (comma and space) $sql = "select " . $tblField . $TrailingSQL; $sql = GenReplaceTables($sql, $tables); $result = $db->Execute($sql); while (!$result->EOF) { $TableObject['params']['Data'][] = $result->fields; $result->MoveNext(); } } array_unshift($TableObject['params']['Data'], $tblHeading); // set the first data element to the headings $StoredTable = $TableObject['params']; $pdf->FormTable($TableObject['params']); } } // Send the duplicate data table (only works if each form is contained in a single page [no multi-page]) foreach ($FieldListings as $SingleObject) { if ($SingleObject['params']['index'] == 'TDup') { if (!$StoredTable) { $messageStack->add(RW_RPT_EMPTYTABLE . $SingleObject['seqnum'], 'error'); return; } // insert new coordinates into existing table $StoredTable['LineXStrt'] = $SingleObject['params']['LineXStrt']; $StoredTable['LineYStrt'] = $SingleObject['params']['LineYStrt']; $pdf->FormTable($StoredTable); } } foreach ($FieldListings as $key => $SingleObject) { // Set the totals (need to be on last printed page) - Handled in the Footer function in FPDF if ($SingleObject['params']['index'] == 'Ttl') { if (!$SingleObject['params']['Seq']) { $messageStack->add(RW_RPT_EMPTYFIELD . $SingleObject['seqnum'], 'error'); return; } if ($Prefs['special_report']) { $FieldValues = $special_form->load_total_results($SingleObject['params']); } else { $ttlField = ''; foreach ($SingleObject['params']['Seq'] as $Temp) { $ttlField .= $Temp . '+'; } $sql = "select sum(" . substr($ttlField, 0, -1) . ") as form_total" . $TrailingSQL; $sql = GenReplaceTables($sql, $tables); $result = $db->Execute($sql); $FieldValues = $result->fields['form_total']; } $FieldListings[$key]['params']['TextField'] = $FieldValues; } // Set the data for the last Page if last page only flag checked, pull from temp save if ($SingleObject['params']['index'] == 'Data' && $SingleObject['params']['LastOnly'] == '2') { $FieldListings[$key]['params']['TextField'] = $FieldListings[$key]['params']['TextTemp']; } } // set the printed flag field if provided if ($Prefs['setprintedflag']) { $tmp = GenReplaceTables($PageBreakField, $tables); $id_field = $tmp; $tmp = GenReplaceTables($Prefs['setprintedflag'], $tables); $temp = explode('.', $tmp); if (sizeof($temp) == 2) { // need the table name and field name $sql = "update " . $temp[0] . " set " . $temp[1] . " = " . $temp[1] . " + 1 where " . $id_field . " = '" . $Fvalue . "'"; $db->Execute($sql); } } } // Add additional headers needed for MSIE and send page header('Pragma: cache'); header('Cache-Control: public, must-revalidate, max-age=0'); $output['pdf'] = $pdf->Output($output['filename'], $delivery_method); if ($delivery_method == 'S') { return $output; } exit; // needs to be here to properly render the pdf file if delivery_method = I or D }
public function imprimirgastostransporte($id) { if (isset($id) && is_numeric($id)) { $Gastos = $this->informes_model->TraeGastosTransporte($id); if (!is_null($Gastos)) { if ($Gastos->num_rows() == 0) { redirect(site_url(), 'refresh'); } } else { redirect(site_url(), 'refresh'); } } else { redirect(site_url(), 'refresh'); } $pdf = new PDF(); $pdf->AddPage(); $Detalle = $this->informes_model->TraeRegistro($id, 'GT'); $pdf->Image(base_url('public/images/logo.jpg'), 10, 15, 70, 15); $pdf->SetFont('Arial', 'B', 10); #ENCABEZADO $pdf->Text(180, 45, 'DO-69-F'); $pdf->Text(70, 48, 'FORMATO REPORTE GASTOS DE TRANSPORTE'); $pdf->Text(75, 55, 'FUNDACIÓN UNIVERSITARIA MARÍA CANO'); $pdf->Text(78, 60, 'PROGRAMA DE INGENIERÍA DE SISTEMAS'); $pdf->SetFont('Arial', '', 10); $pdf->Text(10, 65, 'Período: ' . (date('m', strtotime($Detalle->FECHA_REGISTRO)) > 6 ? 2 : 1) . ' Semestre ' . date('Y', strtotime($Detalle->FECHA_REGISTRO))); $pdf->Text(10, 75, 'Páguese a nombre de: ' . $this->session->userdata('NOMBRE_USUARIO') . ' C.C ' . number_format($this->session->userdata('DOCUMENTO'), 0, ',', ',')); #Headers $pdf->SetFont('Arial', 'B', 9); $pdf->SetXY(5, 82); $pdf->Cell(25, 10, 'FECHA', 1, 0, 'C'); $pdf->SetXY(30, 82); $pdf->Cell(50, 10, 'LUGAR', 1, 0, 'C'); $pdf->SetXY(80, 82); $pdf->Cell(40, 10, 'ACTIVIDAD', 1, 0, 'C'); $pdf->SetXY(120, 82); $pdf->MultiCell(34, 5, 'NÚMERO DE DESPLAZAMIENTOS', 1, 'C'); $pdf->SetXY(154, 82); $pdf->MultiCell(25, 5, 'VALOR UNITARIO', 1, 'C'); $pdf->SetXY(179, 82); $pdf->MultiCell(27, 10, 'VALOR TOTAL', 1, 'C'); $pdf->SetFont('Arial', '', 9); $pdf->SetWidths([25, 50, 40, 34, 25, 27]); $pdf->SetAligns(['C', 'C', 'C', 'C', 'C']); $Total = 0; foreach ($Gastos->result() as $gasto) { $pdf->SetX(5); $pdf->Row([Fecha($gasto->FECHA_GASTO), utf8_encode($gasto->LUGAR), utf8_encode($gasto->ACTIVIDAD), $gasto->NUMERO_DESPLAZAMIENTOS, number_format($gasto->VALOR_UNITARIO, 0, '', ','), number_format($gasto->VALOR_TOTAL, 0, '', ',')]); $Total += $gasto->VALOR_TOTAL; } $pdf->SetFont('Arial', 'B', 9); $pdf->SetX(5); $pdf->Row(['', '', '', '', 'Total', number_format($Total, 0, '', ',')]); #Footer $pdf->Text(25, $pdf->GetY() + 20, 'Firma Coordinador de Práctica'); $pdf->Line(10, $pdf->GetY() + 15, 90, $pdf->GetY() + 15); $pdf->Text(140, $pdf->GetY() + 20, 'CENTRO DE PRÁCTICAS'); $pdf->Output(); $pdf->Cell($pdf->PageNo()); }
/** * @param PDF $pdf * @param $Persona */ private function Observaciones($pdf, $Persona = null) { ######################Page Nro 2###################### $pdf->AddPage('L'); $pdf->Image(base_url('public/images/logo.jpg'), 20, 10, 40, 10); #ENCABEZADO $pdf->SetFont('Arial', 'B', 9); $pdf->Text(260, 15, 'DO-075-F'); $pdf->Text(80, 20, 'FACULTAD DE CIENCIAS EMPRESARIALES Y FACULTAD DE INGENIERÍAS'); $pdf->Text(97, 25, 'FORMATO SEGUIMIENTO A ESTUDIANTES EN PRÁCTICA'); #Fields $h = 5; $f = 0; $c = 25; $x = 12; $pdf->SetFont('Arial', '', 8); $pdf->Rect($x, $c + $h * ++$f, 93, 160); $pdf->Rect($x + 93, $c + $h * $f, 93, 160); $pdf->Rect($x + 186, $c + $h * $f, 93, 160); $pdf->Text($x + 1, $c + $h * $f + 3, 'OBSERVACIONES:'); $pdf->SetXY($x + 1, $c + $h * $f + 7); $pdf->MultiCell(91, 4, $Persona->OBS_SABERSER); $pdf->Text($x + 94, $c + $h * $f + 3, 'OBSERVACIONES:'); $pdf->SetXY($x + 94, $c + $h * $f + 7); $pdf->MultiCell(91, 4, $Persona->OBS_SABERHACER); $pdf->Text($x + 187, $c + $h * $f + 3, 'OBSERVACIONES:'); $pdf->SetXY($x + 187, $c + $h * $f + 7); $pdf->MultiCell(91, 4, $Persona->OBS_SABERSABER); $pdf->Text(270, 200, 'Página ' . $pdf->PageNo()); }