} } $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']; $data_array[] = ': ' . $qty . ' piece(s)'; $data_array[] = ': ' . displayCurrency($e['price_currency'], $e['elements_price']) . " / " . $e['price_quantity_type']; $data_array[] = ': ' . $e['elements_id']; //.' / '.$e['elements_code']; $data = implode("\n", $data_array); $pdf->setXY($xpos, $ypos); $pdf->MultiCell($value_width, $line_height, $data); $ypos += $img_size - $text_middling; $counter++; }
$mypdf->SetFont('Arial', '', 9); $x_axis = $mypdf->GetX(); $y_axis = $mypdf->GetY(); $sql = "SELECT count(ExCategory) from tbluserexpenses Where `UserName`= '{$User}' "; $res = $dbh->prepare($sql); $res->execute(); $Rcnt = $res->fetchColumn(); if ($Rcnt > 0) { $sql = "SELECT * from tbluserexpenses Where `UserName`= '{$User}' AND `Currency`='USD' AND ExCategory IN ('Flight','Railway','Taxi','Fairy','Bus') ORDER BY ExCategory,ClaimDate"; $result = $dbh->prepare($sql); $result->execute(); $RCount = $result->rowCount(); if ($RCount > 0) { $y = $mypdf->GetY(); if ($y != $y_axis) { $mypdf->setXY($x_axis, $y + 10); } else { $mypdf->setXY($x_axis, $y_axis); } while ($row = $result->fetch()) { $mypdf->SetFont('Arial', '', 9); $mypdf->Cell(30, 10, $row[1], 'LTR', 0, 'C'); $x = $mypdf->GetX(); $y = $mypdf->GetY(); $mypdf->MultiCell(95, 5, $row[4], 'T', 'C'); $mypdf->setXY($x + 95, $y); $mypdf->Cell(30, 10, $row[2], 'LT', 0, 'C'); $mypdf->setXY($x + 125, $y); $Amt = "\$ " . $row[3]; $mypdf->Cell(30, 10, $Amt, 'LTR', 0, 'C'); $mypdf->Ln();
$pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง $abs_x = 30; ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Page 1')); ##---- เลขหน้า ---------- $he = "The 8th Annual Meeting of the Thai Cleft Lip-Palate and Craniofacial Association : International Congress"; $he2 = " " . "Conference"; $he3 = "Theme : Comprehensive Cleft Car in Greater Mekong Subregion for Better Quality of Life"; $pdf->setXY($abs_x, $y_absolute + $r * 2); $pdf->SetFont('angsana', '', 13); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', ' ' . $he)); /* $pdf->setXY( 10, $y_absolute + ($r*3) ); $pdf->SetFont('angsana','',13); $pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' ,' '.$he2)); */ $pdf->setXY($abs_x, $y_absolute + $r * 3); $pdf->SetFont('angsana', '', 13);
$pdf->AddPage(); $x = 15.202; $y = 36.617; } if ($i % 3 == 0 && $i % 9 != 0) { $x = 15.202; $y += 76.268; } $pdf->ImageCenter("../" . $fila->imgpath, $x + $border, $y + $border, $w, $imgh); $codigo = $fila->codigo; if ($codigo != null) { $txt = utf8_decode("Código: " . $codigo); $pdf->SetFont('Arial', 'B', 8); $pdf->SetFillColor(255); $stringw = $pdf->GetStringWidth($txt); $pdf->setXY($x + $border + $w - $stringw, $y + $border + $imgh - 3); $pdf->Cell($stringw, 3, $txt, 0, 0, 'C', true); } $cellh = 3.6085; if (strcasecmp($fila->distincion, "no") == 0) { $txt = $fila->nombre; } else { $txt = $fila->nombre . " " . $fila->distincion . " " . $fila->descripcion; } $txt = utf8_decode($txt); $pdf->SetFont('Arial', '', 10); $pdf->SetXY($x + $border, $y + $border + $imgh); $pdf->MultiCell($w, 3.6085, $txt, 0, 'C'); $pdf->Ln(); $pdf->SetX($x); $txt = "\$U " . $fila->precio;
//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); $ypos += $lineheight;
// เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Page 1')); ##---- เลขหน้า ---------- /* $he= "8 th Annual Meeting of the Thai Cleft Lip-Palate and Craniofacial Association : International"; $he2=" "."Conference"; $he3="Theme : Comprehensive Cleft Car in Greater Mekong Subregion for Better Quality of Life"; ##-- head table ----- $pdf->head_table(50,20,17,'',''.$he); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->head_table(50,25,17,'',''.$he2); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->head_table(50,30,17,'',''.$he3); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana','BU',20); */ /* //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY( 60, $y_absolute + ($r*3) );
$value_total = 0; foreach ($contents as $page => $data) { $value[$page] = array(); foreach ($data as $no => $c) { $value[$page][$no] = displayCurrency('USD', $c['pri']); $value_total += $c['pri']; } } $line_height = 4.5; $head_line_height = $line_height + 2; for ($p = 1; $p <= $page_counter; $p++) { if ($p > 1) { $pdf->AddPage(); $ypos = $pdf->top_margin; } $pdf->setXY(10, 10); $pdf->Cell(20, $line_height, "Page {$p} of {$page_counter}"); $xpos = $pdf->left_margin; foreach ($columns as $col => $header) { $pdf->SetXY($xpos, $ypos); $width = ${$col . '_width'}; $pdf->MultiCell($width, $head_line_height, $header, 1, 'C'); $xpos += $width; } $ypos += $head_line_height; $xpos = $pdf->left_margin; foreach ($columns as $col => $header) { $pdf->SetXY($xpos, $ypos); $width = ${$col . '_width'}; $align = ${$col . '_align'}; $pdf->MultiCell($width, $line_height, implode("\n", ${$col}[$p]), 1, $align);
// เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Page 1')); ##---- เลขหน้า ---------- $he = "8 th Annual Meeting of the Thai Cleft Lip-Palate and Craniofacial Association : International"; $he2 = " " . "Conference"; $he3 = "Theme : Comprehensive Cleft Car in Greater Mekong Subregion for Better Quality of Life"; ##-- head table ----- $pdf->head_table(50, 20, 17, '', '' . $he); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->head_table(50, 25, 17, '', '' . $he2); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->head_table(50, 30, 17, '', '' . $he3); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana', 'BU', 20); //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY(60, $y_absolute + $r * 3);
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); } }
$order_counter = 0; $order_counter_max = 6; $firstorder = true; foreach ($clean_picklists as $bin_code => $data) { if ($ypos >= 260 || $order_counter >= $order_counter_max) { $pdf->AddPage(); $ypos = $margin; $order_counter = 0; } else { if (!$firstorder) { $pdf->SetDrawColor(200, 200, 200); $pdf->Line($margin - 5, $ypos - 5, 210 - $margin, $ypos - 5); } } $order_counter++; $pdf->setXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->cell($counter_size, 5, $class_bin->getCleanBinCode($data['code']), 0, 0, 'C'); if ($data['products_ean'] != '') { $pdf->EANBarcode($data['products_ean'], $barcode_start, $ypos, $barcode_width); } $pdf->setFont('Arial', 'B', '12'); //$pdf->cell($barcode_start+20, 40, $data['products_ean'], 0, 0, 'C'); $pdf->setXY($cellstart, $ypos); $pdf->setFont('Arial', 'B', '10'); $pdf->Cell($cell1size, $cell_height, 'PRODUCT ID'); $pdf->Cell($cell1size, $cell_height, 'ARTICLE ID'); $pdf->Cell($counter_size + 10, $cell_height, 'QTY'); $pdf->Cell($counter_size, $cell_height, 'QTY ACTUAL', 0, 1); $pdf->setFont('Arial', '', '10'); $pdf->setX($cellstart);
$pdf->SetXY($margin, $pdf->ypos); //Order Items if (count($items) > 0) { //DRAW BARCODE $items_key = array_keys($items); $barcode_width = 35; $pdf->order_barcode = 'JR-' . $items[$items_key[0]]['jng_sp_orders_items_id']; $sh_name = "{$order['customer_shipping_title']} {$order['customer_shipping_firstname']} {$order['customer_shipping_lastname']}"; $sh_addr = "{$order['customer_shipping_address']} {$order['customer_shipping_address2']}"; $sh_city = "{$order['customer_shipping_postcode']} {$order['customer_shipping_city']}"; $feedback = 'Bestellformular an desiree.bock@julie-grace.de oder per Fax an: 04065584051'; $logo_height = 8; $pdf->Image(FPDF_IMGPATH . 'jng-logo.png', $margin, $pdf->ypos, 64.5, $logo_height); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->ypos += $logo_height + 2; $pdf->setXY($margin, $pdf->ypos); $pdf->Cell(80, $lineheight, $sh_name, 0, 1); $pdf->setFont('Arial', '', $fontsize_med); $pdf->Cell(80, $lineheight, $sh_addr, 0, 1); $pdf->Cell(80, $lineheight, $sh_city, 0, 0); $pdf->Cell(80, $lineheight, $feedback, 0, 1); $pdf->OrderBarcode(297 - ($margin + $barcode_width), $margin, $barcode_width); $pdf->ypos += 15; $lineheight = 5; $pdf->setXY($colpos, $pdf->ypos); $pdf->setFont('Arial', 'B', $fontsize_med); $pdf->SetFillColor(191, 191, 191); $pdf->Cell($col_subcol_width[1], $lineheight, 'Pos.', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[2], $lineheight, 'Bild', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[3], $lineheight, 'Größe', 1, 0, 'C', true); $pdf->Cell($col_subcol_width[4], $lineheight, 'Produktkategorie', 1, 0, 'C', true);
// เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Page 1/2')); ##---- เลขหน้า ---------- ##-- head table ----- $pdf->head_table(70, 20, 25, 'b'); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana', 'BU', 20); //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY(60, $y_absolute + $r * 1); $pdf->SetFont('angsana', 'B', 18); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "" . 'Academic service and Research Unit: Pharmaceutical care service')); $pdf->setXY(60, $y_absolute + $r * 2); $pdf->SetFont('angsana', 'B', 19); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', " " . 'Faculty of Pharmaceutical Sciences KKU'));
$r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- /* $pdf->SetFont('angsana','',12); $pdf->setXY( $x_absolute + 160 , $y_absolute - 10 ); $pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'Page 1' ) ); */ ##---- เลขหน้า ---------- ##-- head table ----- $pdf->head_table(45, 20, 17, 'b'); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana', 'BU', 20); //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY(40, $y_absolute + $r * 1); $pdf->SetFont('angsana', 'B', 18); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "" . ' Tawanchai Foundation for Cleft Lip , Cleft Palate and Craniofacial Deformities (TFC) ')); $pdf->setXY(40, $y_absolute + $r * 2); $pdf->SetFont('angsana', 'B', 12); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "" . 'สำนักงาน ')); $pdf->setXY(60, $y_absolute + $r * 2); $pdf->SetFont('angsana', '', 12); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "อาคารคณะแพทยศาสตร์ มหาวิทยาลัยขอนแก่น 123 ถ.มิตรภาพ ต.ในเมือง อ.เมือง จ.ขอนแก่น 40002 ")); $pdf->setXY(40, $y_absolute + $r * 3); $pdf->SetFont('angsana', 'B', 12); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "" . ' Office '));
$this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C'); } } $tgl = date('d - m - Y'); $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Times', '', 12); //$pdf->text(90,30,'PT. NYALINDUNG'); $tahun = $_GET['tahun']; $pdf->text(55, 36, 'LAPORAN ANGGOTA KOPERASI PT. MEDAN JAYA ' . $tahun); $yi = 50; $ya = 44; $pdf->setFont('Arial', '', 6); $pdf->setFillColor(222, 222, 222); $pdf->setXY(35, $ya); $pdf->CELL(20, 5, 'NO ANGGOTA', 1, 0, 'C', 1); $pdf->CELL(20, 5, 'NAMA', 1, 0, 'C', 1); $pdf->CELL(25, 5, 'NO KTP', 1, 0, 'C', 1); $pdf->CELL(30, 5, 'ALAMAT', 1, 0, 'C', 1); $pdf->CELL(15, 5, 'KOTA', 1, 0, 'C', 1); $pdf->CELL(15, 5, 'AKTIVASI', 1, 0, 'C', 1); $ya = $yi + $row; include "../config/koneksi.php"; $tahun = $_GET['tahun']; $sql = mysql_query("select * from mst_anggota where status_pegawai = 0") or die("salah sql"); $i = 1; $no = 1; $max = 31; $row = 6; while ($data = mysql_fetch_array($sql)) {
$interview_lastname = $row->interview_lastname; } //$pdf->SetFont('angsana','B',12); //$pdf->setXY( $x_absolute + 160 , $y_absolute - 20 ); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'หน้า 1' ) ); //$pdf->header_($x_absolute,$y_absolute); $pdf->header_number($x_absolute, $y_absolute, 1); // $pdf->SetFont('angsana','B',18); // $pdf->setXY( $x_absolute + 20 , $y_absolute - 10 ); // $pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , '(Appendix 1) แบบบันทึกข้อมูลพื้นฐานของผู้ป่วยเมื่อเริ่มการรักษา (first visit)' ) ); $pdf->title1_($x_absolute, $y_absolute); //หัวโปรแกรม //$va=" (Appendix 1) แบบบันทึกข้อมูลพื้นฐานของผู้ป่วยเมื่อเริ่มการรักษา (first visit) "; //$pdf->title1_($x_absolute,$y_absolute,$va); //หัวโปรแกรม $pdf->SetFont('angsana', '', 16); $pdf->setXY($x_absolute, $y_absolute); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'HN : ' . $HN . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 1); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'เลขที่บัตรประชาชน : ' . $person_id . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 2); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Epilepsy No : ' . $ep_no . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 3); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'ชื่อ - นามสกุล : ' . $name . ' ' . $surname . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 4); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'เพศ : ' . $sex_detail . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 5); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'จังหวัด : ' . $prov_name . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 6); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'อำเภอ : ' . @$amphur_name . '')); $pdf->setXY($x_absolute, $y_absolute + $r * 7); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'ตำบล : ' . @$district_name . ''));
//HEADER ROWS $pdf->SetFont('Arial', 'B', $fontsize_med); $pdf->SetFillColor(191, 191, 191); foreach ($cols_value as $hkey => $ch) { $header = "{$ch}\n "; if ($hkey > 0) { $ch = strip_tags($ch); // $h2 = substr($ch, strlen($ch)-13, 13); // $h1 = str_replace($h2, '', $ch); // $header = "$h1\n$h2"; $header = str_replace("|n|", "\n", $ch); $colsize += $colwidth; } else { $colsize = 0; } $pdf->setXY($margin + $colsize, $pdf->ypos); $pdf->MultiCell($colwidth, $lineheight_header, $header, 1, 'C', true); } } else { $pdf->ypos += $key == 1 ? $lineheight_header + 5.2 : $lineheight; $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;
$this->Ln(); $this->Ln(); $this->SetFont('Arial', '', 9); $this->Cell(0, 0.5, 'INDONESIA POWER', 0, 0, 'C'); } } $pdf = new PDF('L', 'mm', 'A4'); $pdf->Open(); $pdf->text(10, 25, 'LAPORAN DATA BARANG'); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 12); $yi = 30; $ya = 24; $pdf->setFont('Arial', '', 9); $pdf->setFillColor(222, 222, 222); $pdf->setXY(10, $ya); $pdf->Cell(8, 5, 'NO', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Kode', 1, 0, 'C', 1); $pdf->Cell(30, 5, 'No Extracom', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Header', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'NO Urut', 1, 0, 'C', 1); $pdf->Cell(40, 5, 'Nama Barang', 1, 0, 'C', 1); $pdf->Cell(10, 5, 'Merk', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Jumlah', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Satuan', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Keadaan', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Lokasi', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Supplier', 1, 0, 'C', 1); $pdf->Cell(20, 5, 'Harga', 1, 0, 'C', 1); $pdf->Cell(15, 5, 'Validasi', 1, 0, 'C', 1); $ya = $yi + $row;
/** * * @global array $DIAMOND_BRAND_IDS * @global string $server * @global jng_sp $class_sp * @global products_minierp $class_pm * @global logger $logger * @global string $icon_diamond * @global string $icon_gold_585_w * @global string $icon_gold_585_g * @param string $timestamp * @param int $jng_sp_id * @return boolean */ function generateReports($timestamp, $jng_sp_id) { global $DIAMOND_BRAND_IDS, $server, $class_sp, $class_pm, $logger, $icon_diamond, $icon_gold_585_w, $icon_gold_585_g; $log_date = strtotime($timestamp); $sp_detail = $jng_sp_id > 0 ? $class_sp->retrieveDetail($jng_sp_id) : array('package_prefix' => 'JG.DE'); $filter_sold = 1; $filter_age = 56; $logger->write("GENERATING REPORT {$sp_detail['package_prefix']}"); /* * Query get new products which: * 1) age <= 8 weeks (56 days) * 2) total sold >= 1 */ $q = "SELECT p.products_id, p.products_model, p.products_image, p.products_price, p.material_expenses, p.stars "; $q .= " , ptc.categories_id AS catid, cd.categories_name"; $q .= " , IFNULL(plps.sold_monthly_1, 0) AS sold_monthly_1, IFNULL(plps.sold_monthly_2, 0) AS sold_monthly_2"; if ($jng_sp_id > 0) { $q .= " , ((jc.total_returned / jc.total_sold) * 100) AS returned_rate, jc.active_age"; } else { $q .= " , 'N/A' AS returned_rate, DATEDIFF(NOW(), p.products_date_added) AS active_age"; } $q .= " FROM products p"; if ($jng_sp_id > 0) { $q .= " INNER JOIN jng_sp_catalog jc ON jc.jng_sp_id = {$jng_sp_id} AND jc.products_id = p.products_id"; } else { $q .= " INNER JOIN orders_products op ON op.products_id = p.products_id"; } $q .= " LEFT JOIN products_log_per_sp plps ON plps.products_id = p.products_id AND plps.jng_sp_id = {$jng_sp_id}"; $q .= " LEFT JOIN products_to_categories ptc ON ptc.products_id = p.products_id"; $q .= " LEFT JOIN categories_description cd ON cd.categories_id = ptc.categories_id AND cd.language_id = 1"; $q .= " WHERE"; if ($jng_sp_id > 0) { $q .= " jc.active_age <= {$filter_age}"; $q .= " AND jc.active_status = 1"; $q .= " AND total_sold >= {$filter_sold}"; } else { //$q .= " p.products_date_added >= '2013-01-01 00:00:00'"; $q .= " DATEDIFF(NOW(), p.products_date_added) <= {$filter_age}"; $q .= " AND p.products_status = 1"; $q .= " AND op.status NOT IN (10, 12)"; $q .= " GROUP BY p.products_id"; $q .= " HAVING SUM(op.products_quantity) >= {$filter_sold}"; } //$q .= " LIMIT 5"; $dbq = tep_db_query($q); $products = array(); while ($row = tep_db_fetch_array($dbq)) { $row['margin'] = $class_pm->calculateMargin($row['products_price'], $row['material_expenses'], 1); $products[$row['catid']][$row['products_id']] = $row; } if (count($products) == 0) { $logger->write("NO DATA RETRIEVED"); return false; } //Start Creating PDF Reports $margin = 20; $ypos = 10; $col_width = 48; $col_height = 77; $line_height = 5; $cell_text_width = $col_width - 3; $no = 0; $row = 1; $icon_w = 4; $icon_h = 4; $first_page = true; $pdf = new PDF('P', 'mm', 'A4'); $pdf->setTitle('New Comer Report'); $pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('Manobo PDF Generator'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(true, 25); $pdf->AliasNbPages(); $pdf->AddPage('L'); $pdf->setXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->cell(240, 5, 'SALES REPORT NEWCOMER PRODUCT ' . $sp_detail['package_prefix'] . ' (' . date('d.m.Y', $log_date) . ')', 0, 0, 'C'); $pdf->setFont('Arial', '', '10'); $ypos += 15; $pdf->setXY($margin, $ypos); $catids = load_config('products-categories-sorting'); foreach ($catids as $catid) { $xpos = $margin; if (is_array($products[$catid])) { foreach ($products[$catid] as $pid => $p) { $obj_product = new product($pid); $no++; if ($ypos >= 150 || $no == 1 && !$first_page) { //Reset vars to new page state $xpos = $margin; $ypos = 25; $row = 1; $pdf->AddPage('L'); $pdf->setXY($margin, $ypos); } //Draw product box $pdf->Cell($col_width, $col_height, '', 1, 0); //Start drawing contents $pdf->drawProductsImage($xpos + 10, $ypos + 1, $p['products_image']); if (is_object($obj_product) && in_array($obj_product->brand_id, $DIAMOND_BRAND_IDS)) { $ypos_icon = $ypos + 3; $pdf->drawIcon($icon_diamond, $xpos + 39.5, $ypos_icon, $icon_w, $icon_h); } if (is_object($obj_product) && ($obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925)) { $icon_gold_selected = "icon_gold_" . $obj_product->metal_stamp_code . '_' . strtolower(substr($obj_product->metal_stamp_info, 0, 1)); $icon_gold = ${$icon_gold_selected}; $ypos_icon += $icon_h; //gold icon dimension is 21 x 16 $icon_gold_w = 21 / 16 * $icon_h; $pdf->drawIcon($icon_gold, $xpos + 38, $ypos_icon, $icon_gold_w, $icon_h); } $pdf->setXY($xpos + 2, $ypos + 3); $pdf->setFont('Arial', 'B', '10'); $pdf->Cell($col_width, $line_height, $no . ". " . ($no == 1 ? $p['categories_name'] : '')); $pdf->setFont('Arial', '', '10'); $pdf->drawStar($p['stars'], $xpos + 15, $ypos + 29); $pdf->setXY($xpos + 2, $ypos + 35); $link = "http://{$server}/?open=product-detail&products_id=" . $pid; $pdf->SetFont('Arial', 'U'); $pdf->SetTextColor(0, 0, 255); $pdf->Cell($cell_text_width, $line_height, $pid . ' / ' . $p['products_model'], 0, 0, 'C', 0, $link); $pdf->SetFont('Arial', ''); $pdf->SetTextColor(0, 0, 0); $pdf->setXY($xpos + 2, $ypos + 40); $pdf->Cell($cell_text_width, $line_height, 'Price: ' . displayCurrency('EUR', $p['products_price'], false) . ' EUR', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 45); $pdf->Cell($cell_text_width, $line_height, 'Margin: ' . number_format($p['margin'], 1) . '%', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 50); $pdf->Cell($cell_text_width, $line_height, 'Return Rate: ' . ($jng_sp_id > 0 ? number_format($p['returned_rate'], 1) . '%' : $p['returned_rate']), 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 60); $pdf->Cell($cell_text_width, $line_height, 'Age in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['active_age'] . ' days', 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 65); $pdf->Cell($cell_text_width, $line_height, 'Sold L30D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_1'], 0, 0, 'C'); $pdf->setXY($xpos + 2, $ypos + 70); $pdf->Cell($cell_text_width, $line_height, 'Sold L60D in ' . ($jng_sp_id > 0 ? 'SP' : 'JG') . ': ' . $p['sold_monthly_2'], 0, 0, 'C'); if ($no % 5 == 0) { $row++; $xpos = $margin; $ypos += $col_height * ($row - 1) + 5; } else { $xpos += $col_width + 5; } $pdf->setXY($xpos, $ypos); } $first_page = false; } $no = 0; } $filepath = 'sales-report-newcomer-products/'; $yeardir = $filepath . date('Y/', $log_date); if (!file_exists(DIR_FS_ARCHIVES . $yeardir) || !is_dir(DIR_FS_ARCHIVES . $yeardir)) { mkdir(DIR_FS_ARCHIVES . $yeardir); } $monthdir = $yeardir . date('m/', $log_date); if (!file_exists(DIR_FS_ARCHIVES . $monthdir) || !is_dir(DIR_FS_ARCHIVES . $monthdir)) { mkdir(DIR_FS_ARCHIVES . $monthdir); } $path_location = DIR_FS_ARCHIVES . $monthdir; $filename = date('YmdHi', strtotime($timestamp)) . '-sales-report-newcomer-products-' . $sp_detail['package_prefix'] . '.pdf'; $pdf->Output($path_location . $filename, 'F'); $logger->write("PDF CREATED: {$filename}"); //$pdf->Output($filename, 'D'); return true; }
// เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'หน้า 1')); ##---- เลขหน้า ---------- ##-- head table ----- $pdf->head_table(70, 20, 25, 'b'); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana', 'BU', 20); //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY(60, $y_absolute + $r * 1); $pdf->SetFont('angsana', '', 16); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์')); $pdf->Image('../icon/px.jpeg', 10, 12, 20, 0, '', ''); //Image(string file [, float x [, float y [, float w [, float h [, string type [, mixed link]]]]]]) $pdf->setXY(120, $y_absolute + $r * 2); $pdf->SetFont('angsana', '', 13); ##-- วันที่ วัน เดือน ปี
$pdf->Ln(3); $dispsem = 6; $pdf->Multicell(0, 5, 'I am herewith furnishing the progress report of your ward Mr./Ms. ' . $name . ' bearing Roll No: ' . $usn . ' of ' . $dispsem . ' Semester for the Second internal assessmenet examination as under. You are here by requested to go through the report and give us your feeback.'); $pdf->Ln(4); $pdf->SetFont('Arial', 'B', 12); $mon = "June"; $year = "2015"; $pdf->Cell(0, 0, 'Internal Assessment Examination: ' . $mon . ' ' . $year . ' ', 0, 0, 'C'); $pdf->Ln(3); $x = $pdf->GetX(); $y = $pdf->GetY(); $pdf->Cell(8, 6, " ", 'TLR', 2); $pdf->Cell(8, 6, "Sl.", 'LR', 2); $pdf->Cell(8, 6, "No", 'LR', 2); $pdf->Cell(8, 6, " ", 'BLR', 2); $pdf->setXY($x + 8, $y); $pdf->Cell(60, 24, "Subject Name", 'TBR', 2, 'C'); $pdf->setXY($x + 68, $y); $pdf->Cell(33, 10, "Test Marks", 'TBR', 2, 'C'); $pdf->setXY($x + 68, $y + 10); $pdf->Cell(14, 7, "Max", 'TR', 2, 'C'); $pdf->setXY($x + 68, $y + 17); $pdf->Cell(14, 7, "Marks", 'BR', 2, 'C'); $pdf->setXY($x + 68 + 14, $y + 10); $pdf->Cell(19, 7, "Marks", 'TR', 2, 'C'); $pdf->setXY($x + 68 + 14, $y + 17); $pdf->Cell(19, 7, "Obtained", 'BR', 2, 'C'); $pdf->setXY($x + 101, $y); $pdf->Cell(33, 10, "Quiz Marks", 'TBR', 2, 'C'); $pdf->setXY($x + 101, $y + 10); $pdf->Cell(14, 7, "Max", 'TR', 2, 'C');
$pdf->setTitle('Sales Report Weekly Products'); $pdf->SetAuthor('JULIE GRACE'); $pdf->SetCreator('Manobo PDF Generator'); $pdf->SetDisplayMode('real'); $pdf->SetAutoPageBreak(true, 25); $pdf->AliasNbPages(); $pdf->AddPage('L'); $margin = 30; $ypos = 10; $cellstart = $margin; $cellsize = 48; $cellsize_half = $cellsize / 2; $cellsizecollweek = $cellsize + $margin; $cell_height_col = 55; $cell_height = 5; $pdf->setXY($margin, $ypos); $pdf->setFont('Arial', 'B', '14'); $pdf->cell(240, 5, 'SALES REPORT WEEKLY PRODUCT KW ' . date('W') . ' (' . date('d.m.Y', strtotime($filter_date)) . ')', 0, 0, 'C'); $pdf->setFont('Arial', '', '10'); $ypos += 10; $pdf->setXY($cellstart, $ypos); $firstorder = true; $no = 1; $catids = load_config('products-categories-sorting'); if (SERVER_IS_LOCAL) { use_class('CategoryTop'); //load all categories which not sorted while ($ct = CategoryTop::getOneByOneAsObject()) { if ($ct->getCategoriesTotalCount() > 0) { while ($cat = $ct->getCategoriesOneByOneAsObject()) { if (!in_array($cat->id, $catids)) {
// เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'B', 'angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'I', 'angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana', 'BI', 'angsaz.php'); $x_absolute = 25; //พิกัด X $y_absolute = 20; //พิกัด Y $r = 7; //ระยะห่าง ##-- PAGE 1 ##---- เลขหน้า ---------- $pdf->SetFont('angsana', '', 12); $pdf->setXY($x_absolute + 160, $y_absolute - 10); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Page 1')); ##---- เลขหน้า ---------- ##-- head table ----- $pdf->head_table(70, 20, 25, 'b'); //($x_absolute,$y_absolute,$fontSize,$b) //หัวโปรแกรม $pdf->SetFont('angsana', 'BU', 20); //$pdf->setXY( $x_absolute, $y_absolute + ($r*1) ); $pdf->setXY(60, $y_absolute + $r * 1); $pdf->SetFont('angsana', 'B', 18); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', "" . 'Academic service and Research Unit: Pharmaceutical care service')); $pdf->setXY(60, $y_absolute + $r * 2); $pdf->SetFont('angsana', 'B', 19); //$pdf->MultiCell( 0 , 0 , iconv( 'UTF-8','cp874' , 'คลินิคผู้ป่วยนอกโรคลมชัก โรงพยาบาลศรีนครินทร์' )); $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', " " . 'Faculty of Pharmaceutical Sciences KKU'));