private function create_ex_coupon($vendor_id)
 {
     $pdf = new PDF_Code128();
     // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana
     $pdf->AddFont('angsana', '', 'angsa.php');
     // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
     $pdf->AddFont('angsana', 'B', 'angsab.php');
     $pdf->AddFont('angsana', 'I', 'angsai.php');
     $pdf->AddFont('angsana', 'BI', 'angsaz.php');
     //สร้างหน้าเอกสาร
     $pdf->AddPage();
     $sql = "\tSELECT sc.deal_start,\n\t\t\t\t\t\t\t\t\tsc.deal_expile,\n\t\t\t\t\t\t\t\t\tsc.round_start,\n\t\t\t\t\t\t\t\t\tsc.round_end,\n\t\t\t\t\t\t\t\t\tsc.deal_name,\n\t\t\t\t\t\t\t\t\tp.product_name,\n\t\t\t\t\t\t\t\t\tp.product_detail,\n\t\t\t\t\t\t\t\t\tv.vendor_id,\n\t\t\t\t\t\t\t\t\tv.vendor_name,\n\t\t\t\t\t\t\t\t\tv.vendor_contact_fname,\n\t\t\t\t\t\t\t\t\tv.vendor_contact_sname,\n\t\t\t\t\t\t\t\t\tv.vendor_email,\n\t\t\t\t\t\t\t\t\tv.vendor_address,\n\t\t\t\t\t\t\t\t\tv.vendor_website,\n\t\t\t\t\t\t\t\t\tv.vendor_logo,\n\t\t\t\t\t\t\t\t\tv.vendor_map,\n\t\t\t\t\t\t\t\t\tv.vendor_about_us,\n\t\t\t\t\t\t\t\t\tv.vendor_pay_type,\n\t\t\t\t\t\t\t\t\td.deal_main_detail,\n\t\t\t\t\t\t\t\t\td.deal_main_condition\n\t\t\t\t\t\tFROM view_sell_coupon sc\n\t\t\t\t\t\tLEFT JOIN tbl_vendor_profile v ON sc.vendor_id\t=\tv.vendor_id\n\t\t\t\t\t\tLEFT JOIN tbl_deal_product p ON p.deal_id = sc.deal_id\n\t\t\t\t\t\tLEFT JOIN tbl_deal_main d ON sc.deal_id = d.deal_id\n\t\t\t\t\t\tWHERE v.vendor_id = '" . $vendor_id . "'\n\t\t\t\t\t\tORDER BY sc.round_id DESC\n\t\t\t\t\t\tLIMIT 0,1";
     $query = $this->db->query($sql);
     $data = $query->row_array();
     $year = date("Y", time()) + 543;
     $year = substr($year, 2);
     $deal_name = $data["deal_name"];
     $vendor_logo = $data["vendor_logo"];
     $location = $data["vendor_address"];
     $fine_print = $data["deal_main_detail"];
     $deal_main_condition = $data["deal_main_condition"];
     $vendor_email = $data["vendor_email"];
     $vendor_website = $data["vendor_website"];
     $mem_name = "คุณ xxxxxxxxxxx xxxxxxxxxxxxx";
     $member_id = $year . "0000xx";
     $coupon = "1";
     $coupon_c = "0000" . rand("1000", "9999");
     $coupon_price = "00" . rand("1000", "9999") . "00";
     $barcode = $coupon_c . $coupon_price;
     $voucher_number = $vendor_id . "-0000xx";
     $order_id = $year . date("m", time()) . "0000xx";
     $redemption_code = rand("1111", "9999");
     $product_name = $data["product_name"];
     $product_detail = $data["product_detail"];
     $coupon_can_use = $data["deal_start"];
     $coupon_expire = $data["deal_expile"];
     $coupon_can_use_full = $this->thai_date(strtotime(date_format(date_create($coupon_can_use), "Y-m-d")));
     $coupon_expire_full = $this->thai_date(strtotime(date_format(date_create($coupon_expire), "Y-m-d")));
     unset($coupon_data);
     $image1 = " ../../assets/images/company_logo.png";
     $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 30);
     $Line_V = " ../../assets/images/Line_Vertical.png";
     $pdf->Image($Line_V, 100, 0, 1.6);
     $Line_H = " ../../assets/images/Line_H.png";
     $pdf->Image($Line_H, 0, 105, 180);
     // กำหนดฟอนต์
     $pdf->SetFont('angsana', '', 11);
     // พิมพ์ข้อความลงเอกสาร
     $pdf->setXY(10, 33);
     //$pdf->MultiCell( 70  , 4 , iconv( 'UTF-8','cp874' , $product_detail),0,'L' );
     $pdf->SetFont('angsana', '', 9);
     $pdf->Ln(3);
     $pdf->MultiCell(70, 4, iconv('UTF-8', 'cp874', $deal_name . "   # " . $product_name));
     $pdf->setXY(10, 59);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'PURCHASED BY:'));
     $pdf->setXY(10, 69);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'VOUCHER NUMBER:'));
     $pdf->setXY(40, 69);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'ORDER ID:'));
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(10, 81);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'CUSTOMER ID:'));
     $pdf->setXY(40, 81);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'REDEMPTION CODE:'));
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(10, 63);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $mem_name));
     $pdf->SetFont('angsana', '', 15);
     $pdf->setXY(10, 73);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $voucher_number));
     $pdf->setXY(40, 73);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $order_id));
     $pdf->SetFont('angsana', '', 13);
     $pdf->setXY(10, 85);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $member_id));
     $pdf->setXY(40, 85);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $redemption_code));
     // วาดรูปกรอกสี่เหลี่ยม
     $pdf->SetDrawColor(195, 195, 195);
     $pdf->SetLineWidth(0.2835);
     $pdf->Rect(107, 19, 70, 23, 'D');
     if (!empty($barcode)) {
         $pdf->Code128(116, 22, $barcode, 52, 11);
         $pdf->SetFont('angsana', '', 10);
         $pdf->setXY(156, 35);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'BARCODE'));
         $pdf->setXY(148, 38);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $barcode));
     }
     $pdf->SetFont('angsana', '', 10);
     $pdf->setXY(110, 48);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'สงวนสิทธิ์ไม่คืนเงินสำหรับคูปองที่ไม่ได้ใช้งานในระยะเวลา'));
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(110, 55);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'VALID FROM:'));
     $pdf->SetFont('angsana', '', 20);
     $pdf->SetTextColor(255, 0, 0);
     $pdf->setXY(109, 60);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $coupon_can_use_full . ' to ' . $coupon_expire_full));
     // วาดรูปกรอกสี่เหลี่ยม
     $pdf->SetDrawColor(195, 195, 195);
     $pdf->SetLineWidth(0.2835);
     $pdf->Rect(107, 68, 70, 31, 'D');
     $pdf->SetFont('angsana', '', 14);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->setXY(130, 71);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Need Assistance?'));
     $pdf->SetFont('angsana', '', 9);
     $pdf->setXY(116, 76);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Call Thebestdeal1 : 02 938 4399 | Email : info@thebestdeal1.com'));
     $image2 = " ../../assets/images/thebestdeal1.png";
     $pdf->Image($image2, 123, 79, 15);
     $image3 = " ../../assets/images/facebook.png";
     $pdf->Image($image3, 147, 79, 15);
     $pdf->SetFont('angsana', '', 10);
     $pdf->setXY(121, 95);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Thebestdeal1.com'));
     $pdf->SetFont('angsana', '', 10);
     $pdf->setXY(149, 95);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Facebook'));
     /*	
     				 	$pdf->SetFont('angsana','',10);
     					$pdf->setXY( 10, 100  );
     					$pdf->MultiCell( 0  , 0 , iconv( 'UTF-8','cp874' , '--------------------------------------------------------------------------------------------------------------------------------------------') ); 
     */
     $pdf->SetFont('angsana', 'B', 14);
     $pdf->setXY(8, 110);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Fine Print:'));
     $pdf->SetFont('angsana', 'B', 14);
     $pdf->setXY(105, 110);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Location:'));
     $pdf->SetFont('angsana', '', 12);
     $pdf->setXY(105, 140);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Email :'));
     $pdf->SetFont('angsana', '', 12);
     $pdf->setXY(115, 140);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $vendor_email));
     $pdf->SetFont('angsana', '', 12);
     $pdf->setXY(105, 145);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Website :'));
     $pdf->SetFont('angsana', '', 12);
     $pdf->setXY(118, 145);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $vendor_website));
     $fine_print = $this->clear_text_editor($fine_print);
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(8, 115);
     $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874//TRANSLIT//IGNORE', $fine_print), 0, 'L');
     $location = $this->clear_text_editor($location);
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(105, 113);
     $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874//TRANSLIT//IGNORE', $location), 0, 'L');
     $pdf->SetFont('angsana', 'B', 14);
     $pdf->setXY(105, 161);
     $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Other:'));
     $deal_main_condition = $this->clear_text_editor($deal_main_condition);
     $pdf->SetFont('angsana', '', 11);
     $pdf->setXY(105, 165);
     $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874//TRANSLIT//IGNORE', $deal_main_condition), 0, 'L');
     unlink($_SERVER["DOCUMENT_ROOT"] . "/assets/media/vendor_pdf/" . $vendor_id . ".pdf");
     $pdf->Output($_SERVER["DOCUMENT_ROOT"] . "/assets/media/vendor_pdf/" . $vendor_id . ".pdf", "F");
     chmod($_SERVER["DOCUMENT_ROOT"] . "/assets/media/vendor_pdf/" . $vendor_id . ".pdf", 0777);
 }
 /**
  * @return void
  * @param integer $linha
  */
 private function _gerarLinha()
 {
     $yRec = 1.6;
     $xRec = 1.6;
     $yImagem = $yRec + 0.3;
     $xImagem = $xRec + 0.3;
     $yHeader = $yRec + 0.5;
     $xHeader = $xRec + 1.8;
     $yTexto = $yRec + 1.5;
     $xTexto = $xRec + 0.3;
     $hRec = 6;
     // Linhas para interessados, cada caracter ocupa em média 1.51cm
     // A etiqueta possui 11.4cm para escrita na horizontal, que seria igual a 75 caracteres.
     $listLinhasInteressados = array();
     $llinhaInteressados = 0;
     $lchar = 75;
     $lstop = false;
     $this->_txInteressado = "Interessados: " . $this->_txInteressado;
     if (strlen($this->_txInteressado) > $lchar) {
         if ($llinhaInteressados == count($listLinhasInteressados)) {
             $lchar = 75;
             $lstop = true;
         }
         $listInteressados = explode(",", $this->_txInteressado);
         $txInteressadoLinha = "";
         foreach ($listInteressados as $key => $txInteressado) {
             $txInteressadoLinha .= $txInteressado;
             $endValue = end($listInteressados);
             if (strlen($txInteressadoLinha) < $lchar) {
                 if ($lstop && $endValue != $txInteressado) {
                     $txInteressadoLinha .= " e outros";
                 }
                 $listLinhasInteressados[] = $txInteressadoLinha;
                 $txInteressadoLinha = "";
             } else {
                 if (!$lstop && $endValue != $txInteressado) {
                     $txInteressadoLinha .= ", ";
                 } else {
                     $listWordsInteressado = explode(' ', $txInteressadoLinha);
                     $txLinhaDoInteressadoLen = "";
                     $txLinhaDoInteressadoTex = "";
                     foreach ($listWordsInteressado as $key => $word) {
                         $txLinhaDoInteressadoLen .= $word . " ";
                         if (strlen($txLinhaDoInteressadoLen) < $lchar) {
                             $txLinhaDoInteressadoTex .= $word . " ";
                             if ($listWordsInteressado[$key] == end($listWordsInteressado)) {
                                 $txLinhaDoInteressadoTex = rtrim($txLinhaDoInteressadoTex);
                                 $listLinhasInteressados[] = $txLinhaDoInteressadoTex;
                                 $txLinhaDoInteressadoTex = "";
                                 $txLinhaDoInteressadoLen = "";
                             }
                         } else {
                             $listLinhasInteressados[] = $txLinhaDoInteressadoTex;
                             $txLinhaDoInteressadoTex = "";
                             $txLinhaDoInteressadoLen = "";
                         }
                     }
                 }
             }
             if ($lstop) {
                 break;
             }
         }
     } else {
         $listLinhasInteressados[] = $this->_txInteressado;
     }
     // linhas para assunto complementar
     $listLinhasAssuntoCompl = array();
     $llinhaAssunto = 1;
     $lchar = 75;
     $lstop = false;
     $txAssuntoComplLabel = "Assunto Complementar: ";
     if (strlen($this->_txAssuntoComplementar) > 0) {
         $this->_txAssuntoComplementar = mb_strtoupper($this->_txAssuntoComplementar, 'UTF-8');
         $this->_txAssuntoComplementar = preg_replace('/\\s+/', " ", $this->_txAssuntoComplementar);
         $this->_txAssuntoComplementar = $txAssuntoComplLabel . $this->_txAssuntoComplementar;
     }
     if (strlen($this->_txAssuntoComplementar) > $lchar) {
         $listWords = explode(" ", $this->_txAssuntoComplementar);
         $totalWords = count($listWords) - 1;
         $linhaAssunto = "";
         foreach ($listWords as $key => $word) {
             $lenlinha = strlen($linhaAssunto);
             $lenword = strlen($word);
             $endvalue = end($listWords);
             $lcharC = $lchar;
             if ($key == 0) {
                 $lcharC = $lchar - strlen($txAssuntoComplLabel);
             }
             if ($lenlinha + $lenword <= $lcharC) {
                 $linhaAssunto .= " " . $word;
             } else {
                 $listLinhasAssuntoCompl[] = utf8_decode($linhaAssunto);
                 $linhaAssunto = " " . $word;
             }
             if ($key == $totalWords && $endvalue == $word) {
                 $listLinhasAssuntoCompl[] = utf8_decode($linhaAssunto);
             }
         }
     } else {
         if (strlen($this->_txAssuntoComplementar) > 0) {
             $listLinhasAssuntoCompl[] = utf8_decode($this->_txAssuntoComplementar);
         }
     }
     // POSICIONAMENTO DO QUADRO
     $totYTex = $yTexto + 0.35 * (12 + count($listLinhasInteressados) + count($listLinhasAssuntoCompl));
     $diffHRec = ($totYTex - ($hRec + $yRec)) / 2;
     $yHeader -= ($totYTex - ($hRec + $yRec)) / 2;
     $yRec -= $diffHRec + 0.15;
     $xImagem -= ($totYTex - ($hRec + $yRec)) / 2 - 0.2;
     $yTexto = $yHeader + count($this->_listTxHeader) * 0.35;
     $this->_pdf->Image($this->_flLogo, $yImagem, $xImagem, 1);
     foreach ($this->_listTxHeader as $txHeader) {
         $this->_pdf->SetFont('Arial', 'B', 8);
         $this->_pdf->Text($xHeader, $yHeader, utf8_decode($txHeader));
         $yHeader += 0.35;
     }
     if (!is_null($this->getCoAmbitoProcesso()) && $this->getCoAmbitoProcesso() != 'F') {
         $nuEtiqueta = $this->_nuArtefato;
     } else {
         $nuEtiqueta = $this->_maskNumber->filter($this->_nuArtefato);
     }
     $this->_pdf->SetFont("Arial", "B", 8);
     $yTexto += 0.5;
     $labelNrProcesso = utf8_decode("Número do Processo: ");
     $this->_pdf->Text($xTexto, $yTexto, $labelNrProcesso . $nuEtiqueta);
     $yTexto += 0.35;
     $this->_pdf->Text($xTexto, $yTexto, utf8_decode("Autuação: ") . $this->_dtAutuacao);
     foreach ($listLinhasInteressados as $key => $txLinhaInteressado) {
         if ($txLinhaInteressado != end($listLinhasInteressados)) {
             $txLinhaInteressado .= " ";
         } else {
             $txLinhaInteressado .= ".";
         }
         $yTexto += 0.35;
         $this->_pdf->Text($xTexto, $yTexto, utf8_decode($txLinhaInteressado));
     }
     $yTexto += 0.35;
     $this->_pdf->Text($xTexto, $yTexto, "Assunto: " . utf8_decode($this->_txAssunto));
     $this->_pdf->SetFont("Arial", "B", 7);
     if (count($listLinhasAssuntoCompl)) {
         foreach ($listLinhasAssuntoCompl as $txLinhaAssuntoCompl) {
             $yTexto += 0.35;
             $this->_pdf->Text($xTexto, $yTexto, trim($txLinhaAssuntoCompl));
         }
     }
     // Dados da Digital
     $this->_pdf->SetFont("Arial", "B", 8);
     $yTexto += 0.35;
     $digital = $this->getDocumentoAutuado();
     if ($digital instanceof \Sgdoce\Model\Entity\Artefato) {
         $nuDigital = $digital->getNuDigital()->getNuEtiqueta();
         if (strlen($nuDigital) <= 7) {
             $nuDigital = str_pad($nuDigital, 7, "0", STR_PAD_LEFT);
         }
         $nuDigitalLinha = "Digital: " . $nuDigital;
         $tipoDocumentoLinha = " Tipo: " . $digital->getSqTipoDocumento()->getNoTipoDocumento();
         $nuArtefatoLinha = "Número: " . $digital->getNuArtefato();
         if (strlen($nuDigitalLinha . $tipoDocumentoLinha . $nuArtefatoLinha) > 68) {
             $text = $nuDigitalLinha . $tipoDocumentoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
             $yTexto += 0.35;
             $text = $nuArtefatoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
         } else {
             $text = $nuDigitalLinha . $tipoDocumentoLinha . " - " . $nuArtefatoLinha;
             $text = utf8_decode($text);
             $this->_pdf->Text($xTexto, $yTexto, $text);
         }
     }
     $yTexto += 0.2;
     $this->_pdf->Code128($xTexto + 1.8, $yTexto, $this->_nuArtefato, 7.9, 0.9);
     $yTexto += 1.25;
     $this->_pdf->SetFont("Arial", "", 9);
     $this->_pdf->Text($xTexto + 3.8, $yTexto, $nuEtiqueta);
     $this->_pdf->Rect($xRec, $yRec, 11.8, $hRec + $diffHRec * 0.6);
 }
 function printPDF($member_id = "", $deal_id = "", $coupon_id = "")
 {
     $pdf = new PDF_Code128();
     // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana
     $pdf->AddFont('angsana', '', 'angsa.php');
     // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
     $pdf->AddFont('angsana', 'B', 'angsab.php');
     $pdf->AddFont('angsana', 'I', 'angsai.php');
     $pdf->AddFont('angsana', 'BI', 'angsaz.php');
     //สร้างหน้าเอกสาร
     $pdf->AddPage();
     if ($coupon_id != "") {
         $coupon_data = $this->coupon_main->get_coupon($member_id, $deal_id, $coupon_id);
         $deal_name = $coupon_data["deal_main"]["deal_name"];
         $vendor_logo = $coupon_data["deal_main"]["vendor_logo"];
         $location = $coupon_data["deal_main"]["location"];
         $fine_print = $coupon_data["deal_main"]["deal_main_detail"];
         $deal_main_condition = $coupon_data["deal_main"]["deal_main_condition"];
         $mem_name = $coupon_data["member"]["member_name"] . "   " . $coupon_data["member"]["member_sname"];
         $member_id = $coupon_data["member"]["member_id"];
         $coupon = $coupon_data["coupon"]["coupon_id"];
         $barcode = $coupon_data["coupon"]["barcode"];
         $voucher_number = $coupon_data["coupon"]["voucher_number"];
         $order_id = $coupon_data["coupon"]["order_id"];
         $redemption_code = $coupon_data["coupon"]["redemption_code"];
         $product_name = $coupon_data["coupon"]["product_name"];
         $product_detail = $coupon_data["coupon"]["product_detail"];
         $coupon_can_use = $coupon_data["coupon"]["coupon_can_use"];
         $coupon_expire = $coupon_data["coupon"]["coupon_expire"];
         $coupon_can_use_full = $this->thai_date(strtotime(date_format(date_create($coupon_can_use), "Y-m-d")));
         $coupon_expire_full = $this->thai_date(strtotime(date_format(date_create($coupon_expire), "Y-m-d")));
         unset($coupon_data);
         $image1 = " ../../assets/images/company_logo.png";
         $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 30);
         $Line_V = " ../../assets/images/Line_Vertical.png";
         $pdf->Image($Line_V, 100, 0, 1.6);
         $Line_H = " ../../assets/images/Line_H.png";
         $pdf->Image($Line_H, 0, 105, 180);
         // กำหนดฟอนต์
         $pdf->SetFont('angsana', '', 11);
         // พิมพ์ข้อความลงเอกสาร
         $pdf->setXY(10, 33);
         $pdf->MultiCell(90, 4, iconv('UTF-8', 'cp874', $product_detail), 0, 'L');
         $pdf->SetFont('angsana', '', 9);
         $pdf->Ln(2);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $product_name));
         $pdf->setXY(10, 51);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'PURCHASED BY:'));
         $pdf->setXY(10, 61);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'VOUCHER NUMBER:'));
         $pdf->setXY(40, 61);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'ORDER ID:'));
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(10, 73);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'CUSTOMER ID:'));
         $pdf->setXY(40, 73);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'REDEMPTION CODE:'));
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(10, 55);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $mem_name));
         $pdf->SetFont('angsana', '', 15);
         $pdf->setXY(10, 65);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $voucher_number));
         $pdf->setXY(40, 65);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $order_id));
         $pdf->SetFont('angsana', '', 13);
         $pdf->setXY(10, 77);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $member_id));
         $pdf->setXY(40, 77);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $redemption_code));
         // วาดรูปกรอกสี่เหลี่ยม
         $pdf->SetDrawColor(195, 195, 195);
         $pdf->SetLineWidth(0.2835);
         $pdf->Rect(107, 19, 70, 23, 'D');
         if (!empty($barcode)) {
             $pdf->Code128(116, 22, $barcode, 52, 11);
             $pdf->SetFont('angsana', '', 10);
             $pdf->setXY(156, 35);
             $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'BARCODE'));
             $pdf->setXY(148, 38);
             $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $barcode));
         }
         $pdf->SetFont('angsana', '', 10);
         $pdf->setXY(110, 48);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'สงวนสิทธิ์ไม่คืนเงินสำหรับคูปองที่ไม่ได้ใช้งานในระยะเวลา'));
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(110, 55);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'VALID FROM:'));
         $pdf->SetFont('angsana', '', 20);
         $pdf->SetTextColor(255, 0, 0);
         $pdf->setXY(109, 60);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', $coupon_can_use_full . ' to ' . $coupon_expire_full));
         // วาดรูปกรอกสี่เหลี่ยม
         $pdf->SetDrawColor(195, 195, 195);
         $pdf->SetLineWidth(0.2835);
         $pdf->Rect(107, 68, 70, 31, 'D');
         $pdf->SetFont('angsana', '', 14);
         $pdf->SetTextColor(0, 0, 0);
         $pdf->setXY(130, 71);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Need Assistance?'));
         $pdf->SetFont('angsana', '', 9);
         $pdf->setXY(116, 76);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Call Thebestdeal1 : 02 938 4399 | Email : info@thebestdeal1.com'));
         $image2 = " ../../assets/images/thebestdeal1.png";
         $pdf->Image($image2, 123, 79, 15);
         $image3 = " ../../assets/images/facebook.png";
         $pdf->Image($image3, 147, 79, 15);
         $pdf->SetFont('angsana', '', 10);
         $pdf->setXY(121, 95);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Thebestdeal1.com'));
         $pdf->SetFont('angsana', '', 10);
         $pdf->setXY(149, 95);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Facebook'));
         /*	$pdf->SetFont('angsana','',10);
         			$pdf->setXY( 10, 100  );
         			$pdf->MultiCell( 0  , 0 , iconv( 'UTF-8','cp874' , '--------------------------------------------------------------------------------------------------------------------------------------------') ); */
         $pdf->SetFont('angsana', 'B', 14);
         $pdf->setXY(8, 110);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Fine Print:'));
         $pdf->SetFont('angsana', 'B', 14);
         $pdf->setXY(105, 110);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Location:'));
         $fine_print = str_replace('&nbsp;', ' ', $fine_print);
         $fine_print = str_replace('&bull;', ' ', $fine_print);
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(8, 115);
         $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874//TRANSLIT//IGNORE', strip_tags($fine_print)), 0, 'L');
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(105, 113);
         $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874', strip_tags($location)), 0, 'L');
         $pdf->SetFont('angsana', 'B', 14);
         $pdf->setXY(105, 161);
         $pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', 'Other:'));
         $pdf->SetFont('angsana', '', 11);
         $pdf->setXY(105, 165);
         $pdf->MultiCell(90, 5, iconv('UTF-8', 'cp874', strip_tags($deal_main_condition)), 0, 'L');
         $pdf->Output();
     }
 }