/** * Mail cancel booking to customer * Type = 0: Cancel o list don dat moi * Type = 1: Cancel o list da thanh cong */ function mail_cancel_booking($booking_id) { global $footer_of_email; $email_reply = "*****@*****.**"; global $table_hotel_description; global $var_domain; global $fs_path_domain; $lang_time_format = "d/m/Y"; $db_select = new db_query("SELECT booking_hotel.*, hot_name, hot_email, hot_address, hot_phone\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM booking_hotel\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t STRAIGHT_JOIN hotels ON(boo_hotel = hot_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t STRAIGHT_JOIN " . $table_hotel_description . " ON(boo_hotel = hot_hotel_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE boo_id = " . $booking_id); if ($booking_info = mysqli_fetch_assoc($db_select->result)) { //Thong tin dat phong $content_booking = '<table width="100%" cellspacing="0" cellpadding="1" style="border: 2px solid #C8D6FF; padding: 10px;" border="0">'; $content_booking .= '<tr>'; $content_booking .= '<td colspan="2"><h3 style="color: #FD7000; margin-top: 5px; border-bottom: 2px solid #C8D6FF; padding-bottom: 5px;">' . translate("Thông tin đặt phòng") . '</h3></td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Họ tên") . ':</td>'; $content_booking .= '<td><b>' . $booking_info["boo_customer_name"] . '</b></td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Địa chỉ") . ':</td>'; $content_booking .= '<td>' . $booking_info["boo_customer_address"] . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Điện thoại") . ':</td>'; $content_booking .= '<td>' . $booking_info["boo_customer_phone"] . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Email") . ':</td>'; $content_booking .= '<td>' . $booking_info["boo_customer_email"] . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Khách sạn") . ':</td>'; $content_booking .= '<td><a style="font-weight: bold;" href="' . $fs_path_domain . url_hotel_detail(array('hot_id' => $booking_info['boo_hotel'], 'hot_name' => $booking_info['hot_name'])) . '">' . $booking_info["hot_name"] . '</a></td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Địa chỉ") . ':</td>'; $content_booking .= '<td>' . $booking_info["hot_address"] . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Thông tin phòng") . ':</td>'; $content_booking .= '<td>'; //decode thong tin dat phong $array_room = json_decode($booking_info['boo_book_info'], true); if (count($array_room) > 0) { $style = ' style="border-color: #AAAAAA;"'; $content_booking .= '<table border="1" cellpadding="3" cellspacing="2" bordercolor="#E2E2E2" style="border-collapse: collapse; margin: 10px 0px; border-color: #AAAAAA;">'; foreach ($array_room as $rom_id => $info) { if (isset($info['numroom']) && isset($info['adults']) && isset($info['children']) && isset($info['money']) && isset($info['extra'])) { $db_select = new db_query("SELECT rom_id, rom_name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM rooms\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE rom_id = " . intval($rom_id)); if ($row = mysqli_fetch_assoc($db_select->result)) { $content_booking .= '<tr> <td rowspan="4" width="120" align="center"' . $style . '><b>' . $row['rom_name'] . '</b></td> <td' . $style . '>' . translate("Số lượng") . '</td> <td' . $style . '><b>' . $info['numroom'] . '</b></td> </tr> <tr> <td' . $style . '>' . translate("Số người") . '</td> <td' . $style . '><b>' . $info['adults'] . '</b> ' . translate("người lớn") . ', <b>' . $info['children'] . '</b> ' . translate("trẻ em") . '</td> </tr> <tr> <td' . $style . '>' . translate("Số tiền") . '</td> <td' . $style . '><b style="color: #FF0000;">' . format_number($info['money']) . ' VNĐ</b></td> </tr> <tr> <td' . $style . '>' . translate("Thêm giường") . '</td> <td' . $style . '> <p style="margin: 0;">' . ($info['extra'] == 0 ? '<b>' . translate("Không") . '</b>' : '<b>' . $info['extra'] . '</b> ' . translate("giường") . '') . '</p> </td> </tr>'; } unset($db_select); } } $content_booking .= '</table>'; } $content_booking .= '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Ngày nhận phòng") . ':</td>'; $content_booking .= '<td>' . date($lang_time_format, $booking_info["boo_time_start"]) . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Ngày trả phòng") . ':</td>'; $content_booking .= '<td>' . date($lang_time_format, $booking_info["boo_time_finish"]) . '</td>'; $content_booking .= '</tr>'; $content_booking .= '<tr>'; $content_booking .= '<td>' . translate("Yêu cầu riêng") . ':</td>'; $content_booking .= '<td>' . $booking_info["boo_customer_comment"] . '</td>'; $content_booking .= '</tr>'; $content_booking .= '</table>'; //Gui cho KH $content = '<div style="border:3px double #94C7FF; padding: 10px; line-height: 19px; color: #444444"> <p>Thân gửi Quý khách ' . $booking_info['boo_customer_name'] . ',</p> <p>Cảm ơn Quý khách đã đặt phòng trên website Mytour</p>'; //Noi dung gui Mail cho KS $content_hotel = '<div style="border:3px double #94C7FF; padding: 10px; line-height: 19px; color: #444444"> <p>Thân gửi Quý khách sạn ' . $booking_info['hot_name'] . ',</p>'; //Neu don phongn chua duco duyet if ($booking_info['boo_view'] != 3) { $content .= '<p> Chúng tôi rất tiếc phải thông báo rằng thời gian từ ' . date("d/m/Y", $booking_info['boo_time_start']) . ' đến ' . date("d/m/Y", $booking_info['boo_time_finish']) . ' không còn phòng trống nào tại khách sạn ' . $booking_info['hot_name'] . '. </p>'; } else { //Neu don phong da duoc check thanh cong $content .= '<p> Mytour xin thông báo đơn phòng mã ' . $booking_info['boo_bill_code'] . ' có các thông tin đặt phòng như dưới đây đã bị hủy. Voucher Mytour đã gửi cho Khách hàng và Khách sạn hiện không còn giá trị sử dụng. </p>'; $content_hotel .= '<p> Mytour xin thông báo khách hàng đã hủy đơn phòng có mã ' . $booking_info['boo_bill_code'] . ' với các thông tin đặt phòng chi tiết dưới đây. Voucher Mytour đã gửi cho Khách hàng và Khách sạn hiện không còn giá trị sử dụng. </p>'; $content .= $content_booking; $content_hotel .= $content_booking; } $content .= '<p> Hi vọng rằng Mytour có thể hỗ trợ Quý khách vào một dịp khác trong tương lai. </p> <p>Chân thành cảm ơn Quý khách!</p> ' . $footer_of_email . ' </div>'; $content_hotel .= $footer_of_email . ' </div>'; if ($booking_info['boo_view'] != 3) { if (send_mailer($booking_info['boo_customer_email'], "Thông báo hết phòng tại " . $booking_info['hot_name'] . " từ Mytour", $content, $email_reply, "Đặt phòng Mytour")) { return true; } } else { $check = 0; if (send_mailer($booking_info['boo_customer_email'], "Thông báo hủy đơn phòng tại " . $booking_info['hot_name'] . " từ Mytour", $content, $email_reply, "Đặt phòng Mytour")) { $check++; } if ($booking_info['hot_email'] != "" && send_mailer($booking_info['hot_email'], "Thông báo hủy đơn phòng từ Mytour", $content_hotel, $email_reply, "Đặt phòng Mytour")) { $check++; } if ($check > 0) { return true; } } } return false; }
function mail_cancel_booking($kk) { global $ll; $bbb = "*****@*****.**"; global $oo; global $pp; global $zz; $mm = "d/m/Y"; $yy = new db_query("SELECT booking_hotel.*, hot_name, hot_email, hot_address, hot_phone\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM booking_hotel\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t STRAIGHT_JOIN hotels ON(boo_hotel = hot_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t STRAIGHT_JOIN " . $oo . " ON(boo_hotel = hot_hotel_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE boo_id = " . $kk); if ($rr = mysqli_fetch_assoc($yy->result)) { $jjj = '<table width="100%" cellspacing="0" cellpadding="1" style="border: 2px solid #C8D6FF; padding: 10px;" border="0">'; $jjj .= '<tr>'; $jjj .= '<td colspan="2"><h3 style="color: #FD7000; margin-top: 5px; border-bottom: 2px solid #C8D6FF; padding-bottom: 5px;">' . translate("Thông tin đặt phòng") . '</h3></td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Họ tên") . ':</td>'; $jjj .= '<td><b>' . $rr["boo_customer_name"] . '</b></td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Địa chỉ") . ':</td>'; $jjj .= '<td>' . $rr["boo_customer_address"] . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Điện thoại") . ':</td>'; $jjj .= '<td>' . $rr["boo_customer_phone"] . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Email") . ':</td>'; $jjj .= '<td>' . $rr["boo_customer_email"] . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Khách sạn") . ':</td>'; $jjj .= '<td><a style="font-weight: bold;" href="' . $zz . url_hotel_detail(array('hot_id' => $rr['boo_hotel'], 'hot_name' => $rr['hot_name'])) . '">' . $rr["hot_name"] . '</a></td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Địa chỉ") . ':</td>'; $jjj .= '<td>' . $rr["hot_address"] . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Thông tin phòng") . ':</td>'; $jjj .= '<td>'; $uu = json_decode($rr['boo_book_info'], true); if (count($uu) > 0) { $vv = ' style="border-color: #AAAAAA;"'; $jjj .= '<table border="1" cellpadding="3" cellspacing="2" bordercolor="#E2E2E2" style="border-collapse: collapse; margin: 10px 0px; border-color: #AAAAAA;">'; foreach ($uu as $ww => $xx) { if (isset($xx['numroom']) && isset($xx['adults']) && isset($xx['children']) && isset($xx['money']) && isset($xx['extra'])) { $yy = new db_query("SELECT rom_id, rom_name\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t FROM rooms\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE rom_id = " . intval($ww)); if ($tt = mysqli_fetch_assoc($yy->result)) { $jjj .= '<tr> <td rowspan="4" width="120" align="center"' . $vv . '><b>' . $tt['rom_name'] . '</b></td> <td' . $vv . '>' . translate("Số lượng") . '</td> <td' . $vv . '><b>' . $xx['numroom'] . '</b></td> </tr> <tr> <td' . $vv . '>' . translate("Số người") . '</td> <td' . $vv . '><b>' . $xx['adults'] . '</b> ' . translate("người lớn") . ', <b>' . $xx['children'] . '</b> ' . translate("trẻ em") . '</td> </tr> <tr> <td' . $vv . '>' . translate("Số tiền") . '</td> <td' . $vv . '><b style="color: #FF0000;">' . format_number($xx['money']) . ' VNĐ</b></td> </tr> <tr> <td' . $vv . '>' . translate("Thêm giường") . '</td> <td' . $vv . '> <p style="margin: 0;">' . ($xx['extra'] == 0 ? '<b>' . translate("Không") . '</b>' : '<b>' . $xx['extra'] . '</b> ' . translate("giường") . '') . '</p> </td> </tr>'; } unset($yy); } } $jjj .= '</table>'; } $jjj .= '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Ngày nhận phòng") . ':</td>'; $jjj .= '<td>' . date($mm, $rr["boo_time_start"]) . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Ngày trả phòng") . ':</td>'; $jjj .= '<td>' . date($mm, $rr["boo_time_finish"]) . '</td>'; $jjj .= '</tr>'; $jjj .= '<tr>'; $jjj .= '<td>' . translate("Yêu cầu riêng") . ':</td>'; $jjj .= '<td>' . $rr["boo_customer_comment"] . '</td>'; $jjj .= '</tr>'; $jjj .= '</table>'; $c = '<div style="border:3px double #94C7FF; padding: 10px; line-height: 19px; color: #444444"> <p>Thân gửi Quý khách ' . $rr['boo_customer_name'] . ',</p> <p>Cảm ơn Quý khách đã đặt phòng trên website Mytour</p>'; $kkk = '<div style="border:3px double #94C7FF; padding: 10px; line-height: 19px; color: #444444"> <p>Thân gửi Quý khách sạn ' . $rr['hot_name'] . ',</p>'; if ($rr['boo_view'] != 3) { $c .= '<p> Chúng tôi rất tiếc phải thông báo rằng thời gian từ ' . date("d/m/Y", $rr['boo_time_start']) . ' đến ' . date("d/m/Y", $rr['boo_time_finish']) . ' không còn phòng trống nào tại khách sạn ' . $rr['hot_name'] . '. </p>'; } else { $c .= '<p> Mytour xin thông báo đơn phòng mã ' . $rr['boo_bill_code'] . ' có các thông tin đặt phòng như dưới đây đã bị hủy. Voucher Mytour đã gửi cho Khách hàng và Khách sạn hiện không còn giá trị sử dụng. </p>'; $kkk .= '<p> Mytour xin thông báo khách hàng đã hủy đơn phòng có mã ' . $rr['boo_bill_code'] . ' với các thông tin đặt phòng chi tiết dưới đây. Voucher Mytour đã gửi cho Khách hàng và Khách sạn hiện không còn giá trị sử dụng. </p>'; $c .= $jjj; $kkk .= $jjj; } $c .= '<p> Hi vọng rằng Mytour có thể hỗ trợ Quý khách vào một dịp khác trong tương lai. </p> <p>Chân thành cảm ơn Quý khách!</p> ' . $ll . ' </div>'; $kkk .= $ll . ' </div>'; if ($rr['boo_view'] != 3) { if (send_mailer($rr['boo_customer_email'], "Thông báo hết phòng tại " . $rr['hot_name'] . " từ Mytour", $c, $bbb, "Đặt phòng Mytour")) { return true; } } else { $lll = 0; if (send_mailer($rr['boo_customer_email'], "Thông báo hủy đơn phòng tại " . $rr['hot_name'] . " từ Mytour", $c, $bbb, "Đặt phòng Mytour")) { $lll++; } if ($rr['hot_email'] != "" && send_mailer($rr['hot_email'], "Thông báo hủy đơn phòng từ Mytour", $kkk, $bbb, "Đặt phòng Mytour")) { $lll++; } if ($lll > 0) { return true; } } } return false; }