$pdf->AddFont($defFont,'','ARIALUNI.TTF',true); //...$pdf->AddFont($defFont.'B','','ARIALUNI.TTF',true); $pdf->AddFont($defFont.'B','','ARIALUNI.TTF',true); $pdf->SetCreator("Hotel"); $pdf->SetAuthor("Hotel"); $pdf->SetTitle("Hotel"); $pdf->SetSubject("Hotel", true); $pdf->SetMargins(10,2); $pdf->SetDrawColor(0,0,0); $pdf->SetTextColor(0,0,0); $pdf->SetPadding(0); $pdf->SetSpacing(0,0); $pdf->AddPage(); $pdf->SetFont($defFont,'',20); $pdf->Image("../../themes/default/img/logo.png",135,10,60); $pdf->htmltable("<table width=190> <tr><td size=30 width=30>Hotel </td><td color=#FF6600 size=30> Voucher</td></tr> <tr><td size=9 colspan=2>Please present either an electronic or paper copy of your hotel voucher upon check-in</td></tr> </table>"); $pdf->Line(0, $pdf->y, 220, $pdf->y); $pdf->Ln(3); $pdf->SetFont($defFont,'',10,true); $pdf->htmltable(" <table width=190> <tr><td width=40>Hotel:</td> <td>Keio Plaza Hotel</td></tr>
public function printPDF($booking_info) { require_once _TAS_TOOL_DIR_ . "/tfpdf/pdftable.inc.php"; $title = "Voucher"; $defFont = 'MyFont'; $pdf = new PDFTable(); /*switch (self::$cookie->LanguageID) { case 1: //...English */ $pdf->AddFont($defFont, '', 'ARIALUNI.TTF', true); //...$pdf->AddFont($defFont.'B','','ARIALUNI.TTF',true); $pdf->AddFont($defFont . 'B', '', 'ARIALUNI.TTF', true); /*break; case 2: //...China(GB2312) $pdf->AddFont($defFont,'','SIMSUN.TTF',true); $pdf->AddFont($defFont.'B','','SIMSUNB.TTF',true); break; case 3: //...China(GBK) $pdf->AddFont($defFont,'','MINGLIU.TTF',true); $pdf->AddFont($defFont.'B','','MINGLIUB.TTF',true); break; case 4: //...Japan $pdf->AddFont($defFont,'','MSGOTHIC.TTF',true); $pdf->AddFont($defFont.'B','','MSGOTHICB.TTF',true); break; };*/ $pdf->SetCreator("Hotel"); $pdf->SetAuthor("Hotel"); $pdf->SetTitle("Hotel"); $pdf->SetSubject("Hotel", true); $pdf->SetMargins(10, 2, 0, 20); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->SetPadding(0); $pdf->SetSpacing(0, 0); $pdf->AddPage(); $pdf->SetFont($defFont, '', 20); $pdf->SetHeaderFooter("header", "footer"); $pdf->Ln(3); $pdf->SetFont($defFont, '', 10, true); $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t\t\t\t<tr><td size=12>Hotel: {$booking_info['hotel_info']['HotelName']}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(-2); $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t\t\t\t<tr><td size=12>Address: {$booking_info['hotel_info']['HotelAddress']}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(-2); $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t\t\t\t<tr><td size=12>Hotel Contact No: {$booking_info['hotel_info']['HotelContactNo']}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(5); $pdf->SetFont($defFont, '', 8, true); $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t \t\t<tr><td size=10 family={$defFont}B>1.</td><td colspan=2 size=10 font-weight:bold>Customer Information(お客様情報)</td></tr> \t\t \t\t\r\n\t\t\t\t<tr><td size=3></td>\r\n\t\t\t\t<tr><td width=5></td><td width=80>Booking ID(予約番号): {$booking_info['BookingNo']}</td>\t\t\t\t<td>Guest Name(お客様 氏名): {$booking_info['contact_name']}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td width=80>E-mail: {$booking_info['contact_email']}</td>\t\t\t\t<td>Tel: {$booking_info['contact_tel']}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(3); $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t \t\t<tr><td size=10 family={$defFont}B>2. </td><td colspan=2 size=10 family={$defFont}B>Booking Information(予約情報)</td></tr>\r\n\t\t\t\t<tr><td size=3></td>\r\n\t\t\t\t<tr><td width=5></td><td width=80>Check In : {$booking_info['checkin']}</td>\t\t\t\t<td>Check Out : {$booking_info['checkout']}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td colspan=2>Total No or rooms: {$booking_info['roomString']}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(3); $pdf->htmltable("\r\n\t\t<table width=190>\r\n\t\t <tr><td width=5></td><td size=10 family={$defFont}B>Rooming Details(宿泊情報)</td></tr>\r\n\t\t </table>"); $i = 0; foreach ($booking_info['booked_roomplan_list'] as $roomplan) { $i++; $customer_count = count($roomplan['customer_info_list']); $customer_names = ""; foreach ($roomplan['customer_info_list'] as $customer) { if ($customer_names != "") { $customer_names .= " , "; } $customer_names .= ($customer['customer_sex'] == 1 ? "Mr " : "Mrs ") . $customer['customer_fnames'] . " " . $customer['customer_gnames'] . " (" . $customer['customer_country_name'] . ")"; } $breakfast = $roomplan['Breakfast'] == 1 ? "Included" : "None"; $Dinner = $roomplan['Dinner'] == 1 ? "Included" : "None"; $special = ""; if ($roomplan['req_nonsmoking'] == 1) { $special .= "Non Smoking, "; } if ($roomplan['req_smoking'] == 1) { $special .= "Smoking, "; } if ($roomplan['req_adjoin'] == 1) { $special .= "Adjoin room, "; } $special .= $roomplan['req_remark']; $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t \t\t<tr><td width=5></td><td size=8 family={$defFont}B>- Room {$i}</td></tr>\r\n\t \t\t<tr><td width=5></td><td>Room Plan(宿泊プラン): {$roomplan['RoomPlanName']}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td width=80>Room Type(ルームタイプ): {$roomplan['RoomTypeName']}</td>\t\t\t\t<td>no of pax stay at room: {$customer_count}</td></tr> \r\n\t\t\t</table>"); $pdf->htmltable("\r\n\t\t\t<table width=190>\r\n\t\t\t\t<tr><td width=5></td><td>Guest Name(宿泊者名): {$customer_names}</td></tr>\r\n\t\t\t</table>\r\n\t\t"); $pdf->htmltable("\r\n\t\t\t<table width=190>\r\n\t\t\t\t<tr><td width=5></td><td width=80>Breakfast(朝食): {$breakfast}</td>\t\t\t<td>Dinner(夕食): {$Dinner}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td colspan=2>Special Request(特別リクエスト): {$special}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td size=8>* All Special request are subjects to availability</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(2); if ($i % 4 == 0) { $pdf->AddPage(); } } $pdf->htmltable("\r\n\t \t<table width=190>\r\n\t \t\t<tr><td size=10 family={$defFont}B>3.</td><td colspan=2 size=10 family={$defFont}B>Agent Information(旅行会社情報)</td></tr>\r\n\t \t\t<tr><td size=3></td>\r\n\t\t\t\t<tr><td width=5></td><td>Name: {$booking_info['agent_info']->Name}</td></tr>\r\n\t\t\t\t<tr><td width=5></td><td width=80>Phone no: {$booking_info['agent_info']->Tel}</td>\t\t\t\t<td>Email: {$booking_info['agent_info']->Email}</td></tr>\r\n\t\t\t</table>"); $pdf->Ln(2); $pdf->htmltable("<table width=190><tr><td> Note: <br>\r\n\t\t\t-This voucher must be presented during check in. Failure to do so may result in the reservation not being honored.<br> \r\n\t\t\t-Hotel has right a right to request credit card or deposit upon arrival to cover and guaranteed any incidental cost that maybe incurred during the stay.<br>\r\n\t\t\t-If you expect to arrive after 21:00, please inform the hotel your arrival time to avoid being released. In the event of No show or Early check-out, the hotel reserves right to charge a full cancellation fee.<br> \r\n\t\t\t-In case where Breakfast is included with the room rate, please note that certain hotels may charge extra for children travelling with their parents. If applicable, the hotel will bill you directly. Upon arrival, if you have any question, please verify with hotel.<br>\r\n\t\t</td></tr></table>"); $pdf->Output("voucher.pdf", "D"); }
$pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->AddPage(); $pdf->Image($homedir . 'data' . $company['CR_COMP_E_LOGO'], 10, 6, 30); $pdf->SetFont($defFont, '', 15); $pdf->Cell(180, 10, $company['CR_COMP_E_TAGLINE'], 0, 0, 'R'); $pdf->Ln(20); $pdf->SetFont('malgunbd', '', 24); $title_width = 180; $pdf->SetX((210 - $title_width) / 2); $pdf->SetLineWidth(0.4); $pdf->Cell($title_width, 18, $title, 'TRBL', 1, 'C'); $pdf->Ln(6); $pdf->SetLineWidth(0.4); $pdf->SetPadding(2); $pdf->SetSpacing(2); $pdf->SetFont($defFont, '', 10, true); $pdf->htmltable($table1); $pdf->Ln(6); $pdf->SetFont($defFont, '', 12, true); $pdf->htmltable($table2); $pdf->SetFont($defFont, '', 10, true); $pdf->htmltable($table3); $pdf->SetFont($defFont, '', 12, true); $pdf->htmltable($table4); $pdf->SetFont($defFont, '', 10, true); $pdf->htmltable($table5); $pdf->Ln(6); $pdf->SetFont($defFont, '', 12, true); $pdf->Cell(190, 10, $company['CR_COMP_NAME'], 0, 0, 'R'); $pdf->lasth = 5;
public static function emailHotel($orderid, $orderstatus) { //1.获取订单信息 $bookingInfo = Booking::getBookingOrder($orderid); $BookingNo = $bookingInfo['BookingNo']; //订单编号 $ContactName = $bookingInfo['contact_name']; //1.Customer Information $ContactEmail = $bookingInfo['contact_email']; $ContactTel = $bookingInfo['contact_tel']; $CheckIn = $bookingInfo['checkin']; $CheckOut = $bookingInfo['checkout']; //2.获取下订单的用户信息 $userid = $bookingInfo['OrderUserId']; $userinfo = Member::getUserInfoById($userid); $AgentName = $userinfo['Name']; $AgentPhoneNo = $userinfo['Tel']; $AgentEmail = $userinfo['Email']; //3.获取酒店用户信息 $hotelid = $bookingInfo['hotel_id']; $hoteluserinfo = Member::getUserInfoByHotelId($hotelid); $UserName = $hoteluserinfo['Name']; $prefFax = $hoteluserinfo['PrefFax']; $prefEmail = $hoteluserinfo['PrefEmail']; $Fax = $hoteluserinfo['Fax']; $to = $hoteluserinfo['Email']; $languageid = $hoteluserinfo['LanguageID']; $iso = $hoteluserinfo['LanguageShortName']; if (!isset($hoteluserinfo['LanguageID'])) { $languageid = 4; } //4.获取酒店信息 $hotelinfo = HotelDetail::getHotelDescription($hotelid, $iso); $HotelName = $hotelinfo['HotelName']; $HotelAddress = $hotelinfo['HotelAddress']; $HotelContactNo = $hotelinfo['HotelContactNo']; $orderroominfo = RoomPlan::getOrderRoomInfo($orderid, $iso); $RoomList = ''; $RoomListFax = ''; $id = 1; foreach ($orderroominfo as $orderroom) { $RoomList .= "<table width='100%' cellspacing='10' style='font-size:12px;'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span style='color:#000000;font-weight:bold;font-zie:14px;'>- Room " . $id . "</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Room Plan(宿泊プラン):</span> " . $orderroom['RoomPlanName'] . " </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Room Type(ルームタイプ):</span> " . $orderroom['RoomTypeName'] . " </td>\t\t\t\t\n\t\t\t\t</tr> \n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Guest Name(宿泊者名):</span> " . $orderroom['CustomerName'] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width='30%'><span>Breakfast(朝食):</span> " . $orderroom['Breakfast'] . "</td>\t\t\t\n\t\t\t\t\t<td><span>Dinner(夕食):</span> " . $orderroom['Dinner'] . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>Special Request(特別リクエスト):</span> " . $orderroom['Special'] . " </td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><span>* All Special request are subjects to availability </span></td>\n\t\t\t\t</tr>\n\t\t\t</table>"; $RoomListFax .= "<table width=190 >\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2 size=11>- Room " . $id . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Room Plan(宿泊プラン): " . $orderroom['RoomPlanName'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Room Type(ルームタイプ): " . $orderroom['RoomTypeName'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Guest Name(宿泊者名): " . $orderroom['CustomerName'] . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td>Breakfast(朝食): " . $orderroom['Breakfast'] . "</td>\n \t\t\t\t\t<td>Dinner(夕食): " . $orderroom['Dinner'] . "</td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>Special Request(特別リクエスト): " . $orderroom['Special'] . " </td>\n \t\t\t\t</tr>\n \t\t\t\t<tr>\n \t\t\t\t\t<td width=5></td><td colspan=2>* All Special request are subjects to availability </td>\n \t\t\t\t</tr>\n \t\t\t</table>"; $id++; } $RoomString = RoomPlan::getRoomString($orderid, $iso); include_once substr(dirname(__FILE__), 0, -8) . '/config/mail.config.php'; global $from, $message, $subject; $search = array('{#BookingNo}', '{#HotelName}', '{#UserName}', '{#HotelAddress}', '{#HotelContactNo}', '{#ContactName}', '{#ContactEmail}', '{#ContactTel}', '{#CheckIn}', '{#CheckOut}', '{#RoomString}', '{#RoomList}', '{#AgentName}', '{#AgentPhoneNo}', '{#AgentEmail}'); $replace = array($BookingNo, $HotelName, $UserName, $HotelAddress, $HotelContactNo, $ContactName, $ContactEmail, $ContactTel, $CheckIn, $CheckOut, $RoomString, $RoomList, $AgentName, $AgentPhoneNo, $AgentEmail); $replaceFax = array($BookingNo, $HotelName, $UserName, $HotelAddress, $HotelContactNo, $ContactName, $ContactEmail, $ContactTel, $CheckIn, $CheckOut, $RoomString, $RoomListFax, $AgentName, $AgentPhoneNo, $AgentEmail); $msg = str_replace($search, $replace, $message[10][5][$languageid]); // $faxmsg = str_replace($search, $replaceFax, $message[21][5][$languageid]); $faxmsg = str_replace($search, $replaceFax, $message[21][5][4]); $sub = str_replace('{#BookingNo}', $BookingNo, $subject[$orderstatus][5][$languageid]); if ($orderstatus == 7) { $msg = str_replace('下記の予約をお願いいたします', '下記の予約のキャンセルをお願いいたします', $msg); $faxmsg = str_replace('下記の予約をお願いいたします', '下記の予約のキャンセルをお願いいたします', $faxmsg); } if ($prefEmail) { $headers = "From: {$from}" . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-Type: text/html; charset=utf-8' . "\r\n"; $headers .= 'Bcc: booking@tas-agent.com'; //echo $sub."<br/><br/><br/>".$msg; if ($sub != '' && $msg != '') { global $emailTail; $msgBody = $msg . $emailTail; self::sendEmail($to, $sub, $msg); //@mail($to, $sub, $msgBody, $headers); $Insertmsg = htmlentities($msg); $sql = 'insert into `HT_Mail`(MailTo, MailFrom, SubjectName, Body) value("' . $to . '", "' . $from . '", "' . $sub . '", "' . $Insertmsg . '")'; Db::getInstance()->ExecuteS($sql); } } if ($prefFax) { global $toemail, $faxTail, $faxHead; $emailBody = "<p>需要给酒店发送传真.</p>\n\t\t\t\t\t\t<p>传真号为: {$Fax}</p>\n\t\t\t\t\t\t<p>订单状态为: {$orderstatus}</p>"; $emailBody = "fax"; $faxsub = $faxHead[$orderstatus]; $faxsub2 = "<TAS-Agent.com> Booking ID:" . $BookingNo; $prefix = time(); require_once _TAS_TOOL_DIR_ . "/tfpdf/pdffax.inc.php"; $defFont = 'MyFont'; $pdf = new PDFTable(); $pdf->AddFont($defFont, '', 'ARIALUNI.TTF', true); $pdf->AddFont($defFont . 'B', '', 'ARIALUNI.TTF', true); $pdf->SetMargins(10, 2); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->SetPadding(0); $pdf->SetSpacing(0, 0); $pdf->AddPage(); //header $pdf->SetFont($defFont, '', 10); $pdf->Image(_TAS_THEME_DIR_ . "/img/logo_pdf.png", 140, 15, 60); $pdf->htmltable("<table width=190><tr><td size=20 > </td></tr></table>", 1); $pdf->Ln(2); $pdf->htmltable("<table width=190><tr><td size=14 colspan=2>" . $faxsub . " </td></tr>\n \t </table>", 1); $pdf->Image(_TAS_THEME_DIR_ . "/img/linep.png", 10, $pdf->y, 190); //内容 $pdf->htmltable($faxmsg); //footer $pdf->SetY(-30); $pdf->Image(_TAS_THEME_DIR_ . "/img/linep.png", 10, $pdf->y, 190); $pdf->Ln(1); $pdf->Image(_TAS_THEME_DIR_ . "/img/bottom_logo_pdf.png", 12, $pdf->y + 2, 20); $pdf->x = 35; $pdf->htmltable("<table width=90>\n \t <tr><td size=9>TAS Agent / TAS Co.Ltd<br>TEL 03-5565-5850<br>FAX 03-5565-5850<br>booking@tas-agent.com</td></tr>\n \t </table>", 0); $pdf->htmltable("<table width=190>\n \t <tr><td size=9>※TAS Agent はTAS Co.,Ltdが運営しております。 上記予約の内容については直接TASまでご連絡ください。\n \t </td></tr></table>", 1); $attachment_file = _TAS_ROOT_DIR_ . "/classes/temp/attachment_" . $prefix . ".pdf"; //$attachment_file=_TAS_ROOT_DIR_."/config/attachment_".$prefix.".pdf"; $pdf->Output($attachment_file); require_once _TAS_TOOL_DIR_ . "/PHPMailer/class.phpmailer.php"; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; // sets the prefix to the servier $mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "******"; // GMAIL username $mail->Password = "******"; // GMAIL password $mail->SetFrom('*****@*****.**', 'fax'); $mail->AddReplyTo("*****@*****.**", "fax"); $mail->Subject = $faxsub2; $mail->MsgHTML($emailBody); $toemail = $Fax . "@efaxsend.com"; $mail->AddAddress($toemail, $Fax); $mail->AddAttachment($attachment_file); // attachment $mail->Send(); //发邮件 if (file_exists($attachment_file)) { unlink($attachment_file); //删除文件 } } }