Exemplo n.º 1
0
 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);
             //删除文件
         }
     }
 }
                <div id="weather"></div>
            </div>
            <!-- left navigation end -->


<!-- Author: quyennd
Description: display weather -->
<?php 
$_smarty_tpl->tpl_vars["request_uri"] = new Smarty_variable($_SERVER['REQUEST_URI'], null, null);
if (strstr($_smarty_tpl->getVariable('request_uri')->value, "hoteldetail") || strstr($_smarty_tpl->getVariable('request_uri')->value, "hotelpage")) {
    ?>
    <?php 
    $_smarty_tpl->tpl_vars["mid"] = new Smarty_variable($_GET['mid'], null, null);
    ?>
    <?php 
    $_smarty_tpl->tpl_vars['hotel'] = new Smarty_variable(HotelDetail::getHotelDescription($_smarty_tpl->getVariable('mid')->value), null, null);
    ?>
    <?php 
    $_smarty_tpl->tpl_vars['cityName'] = new Smarty_variable(HotelDetail::getCityName($_smarty_tpl->getVariable('hotel')->value['HotelCity']), null, null);
} else {
    ?>
    <?php 
    $_smarty_tpl->tpl_vars['cityName'] = new Smarty_variable('Tokyo', null, null);
}
?>
<!-- left navigation end -->

<!-- include flatWeatherPlugin.js -->
<script src="themes/default/js/jquery.flatWeatherPlugin.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
Exemplo n.º 3
0
 public static function buildBookingInfoFromPost($companyId)
 {
     //从Post表单中建立预定信息
     $booking_info = array();
     $booking_info = Tools::element_copy($_POST, 'order_id', 'hotel_id', 'checkin', 'checkout', 'contact_name', 'contact_email', 'contact_tel', 'contact_hp');
     $booking_info['order_id'] = Tools::get_default_val(@$_POST['order_id'], 0);
     //获取订单编号,没有则认为是0
     $nights = (strtotime($booking_info['checkout']) - strtotime($booking_info['checkin'])) / (24 * 60 * 60);
     // diff day
     $booking_info['nights'] = $nights;
     //计算预定几个晚上
     $booking_info['hotel_info'] = HotelDetail::getHotelDescription($_POST['hotel_id']);
     //获取酒店信息
     //OrderRoom表中会用到
     $ids = $_POST['ids'];
     $orid_list = array();
     $rpid_list = array();
     foreach ($ids as $id) {
         $orid_list[] = $_POST['or_ids_' . $id];
         $rpid_list[] = $_POST['roomplan_ids_' . $id];
     }
     //获取房间列表
     $roomplan_list = RoomPlan::getRoomPlanListForBooking($rpid_list, $booking_info['checkin'], $booking_info['checkout']);
     $total_price = 0.0;
     //计算总价格
     $org_total_price = 0.0;
     //计算不含手数料总价格
     $booked_roomplan_list = array();
     foreach ($roomplan_list as $key => $booked_roomplan) {
         $id = $ids[$key];
         $orid = $orid_list[$id];
         $booked_roomplan['OrderRoomId'] = $orid;
         $booked_roomplan['req_nonsmoking'] = Tools::get_default_val($_POST['req_nonsmoking_' . $id], 0);
         $booked_roomplan['req_smoking'] = Tools::get_default_val($_POST['req_smoking_' . $id], 0);
         $booked_roomplan['req_adjoin'] = Tools::get_default_val($_POST['req_adjoin_' . $id], 0);
         $booked_roomplan['req_remark'] = Tools::get_default_val($_POST['req_remark_' . $id], '');
         $customer_info_list = array();
         if (array_key_exists('customer_fnames_' . $id, $_POST)) {
             foreach ($_POST['customer_fnames_' . $id] as $i => $val) {
                 if ($_POST['customer_fnames_' . $id][$i] != '' || $_POST['customer_gnames_' . $id][$i] != '') {
                     $customer_info = array();
                     $customer_info['customer_fnames'] = $_POST['customer_fnames_' . $id][$i];
                     $customer_info['customer_gnames'] = $_POST['customer_gnames_' . $id][$i];
                     $customer_info['customer_sex'] = Tools::get_default_val($_POST['customer_sex_' . $id . "_{$i}"], 0);
                     $customer_info['customer_country'] = $_POST['customer_country_' . $id][$i];
                     $customer_info['customer_country_name'] = Tools::getCountryName($customer_info['customer_country']);
                     $customer_info_list[] = $customer_info;
                 }
             }
         } else {
             // empty customers info
             for ($i = 0; $i < $booked_roomplan['RoomMaxPersons']; $i++) {
                 // default value
                 $customer_info['customer_fnames'] = '';
                 $customer_info['customer_gnames'] = '';
                 $customer_info['customer_sex'] = 1;
                 // male
                 $customer_info['customer_country'] = 109;
                 // japan
                 $customer_info_list[] = $customer_info;
             }
         }
         $booked_roomplan['customer_info_list'] = $customer_info_list;
         $price_result = Booking::calculation_roomplan_price($booked_roomplan['RoomPlanId'], $booking_info['checkin'], $booking_info['checkout'], $companyId);
         $booked_roomplan['Price'] = $price_result['Price'];
         $booked_roomplan['PriceString'] = $price_result['PriceString'];
         $total_price += $booked_roomplan['Price'];
         $booked_roomplan['Check_0'] = $price_result['check_0'];
         $booked_roomplan['OrgPrice'] = $price_result['OrgPrice'];
         $org_total_price += $booked_roomplan['OrgPrice'];
         $booked_roomplan_list[] = $booked_roomplan;
     }
     $booking_info['TotalPrice'] = $total_price;
     $booking_info['TotalPriceString'] = Tools::money($total_price);
     $booking_info['booked_roomplan_list'] = $booked_roomplan_list;
     $booking_info['OrgTotalPrice'] = $org_total_price;
     //由于此处只有初次下订单时才经过,所以otherPrice必定为0
     $booking_info['otherPrice'] = 0;
     $booking_info['PaidIn'] = Tools::money($booking_info['otherPrice']);
     $booking_info['money'] = $booking_info['TotalPrice'] - $booking_info['otherPrice'];
     $booking_info['UnPaid'] = Tools::money($booking_info['money']);
     $booking_info['org_money'] = $booking_info['OrgTotalPrice'] - $booking_info['otherPrice'];
     return $booking_info;
 }