File "booking.php"
Full path: /home/sokha/public_html/bokormarathon.com.kh/bk_v1_18082023/booking.php
File
size: 44.19 B (44.19 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
require_once('skh.php');
$skh = new SKH();
$year_of_event = 2022;
$ref = getReferenceNumber($skh);
if(!empty($_POST['data'])){
$data = $_POST['data'];
$s_data = [];
$s_data['marathon']['ref_number'] = $ref;
// personal info
$s_data['marathon']['first_name'] = $data['marathon']['first_name'];
$s_data['marathon']['last_name'] = $data['marathon']['last_name'];
$s_data['marathon']['nationality'] = $data['marathon']['nationality'];
$s_data['marathon']['age'] = $data['marathon']['age'];
$s_data['marathon']['gender'] = $data['marathon']['gender'];
$s_data['marathon']['date_of_birth'] = $data['marathon']['date_of_birth'];
$s_data['marathon']['email'] = $data['marathon']['email'];
$s_data['marathon']['contact_number'] = $data['marathon']['contact_number'];
$s_data['marathon']['address'] = $data['marathon']['province'];
$s_data['marathon']['know_event_by'] = $data['marathon']['know_event_by'];
$s_data['marathon']['declaration'] = $data['marathon']['declaration'];
// race section data
$s_data['marathon']['joiner_type'] = $data['marathon']['joiner_type'];
if(isset($data['marathon']['biking_race_type'])){
$s_data['marathon']['biking_race_type'] = $data['marathon']['biking_race_type'];
$s_data['marathon']['biking_price'] = $data['marathon']['biking_price'];
}
if(isset($data['marathon']['running_race_type'])){
$s_data['marathon']['running_race_type'] = $data['marathon']['running_race_type'];
$s_data['marathon']['running_price'] = $data['marathon']['running_price'];
$s_data['marathon']['t_shirt_size'] = $data['marathon']['t_shirt_size'];
}
// accommodation info
if(!empty($data['booking_room'])){
if($data['booking_room']['room_option'] == 175){
$s_data['marathon']['room_type'] = 'Thansur room at US$175.00net include breakfast (2pax)';
}elseif($data['booking_room']['room_option'] == 225){
$s_data['marathon']['room_type'] = 'Bokor Suite at US$225.00net include breakfast (2pax)';
}elseif($data['booking_room']['room_option'] == 65){
$s_data['marathon']['room_type'] = 'Champei room at US$65.00net include breakfast (2pax)';
}elseif($data['booking_room']['room_option'] == 135){
$s_data['marathon']['room_type'] = 'Rumdul Suite at US$135.00net include breakfast (2pax)';
}elseif($data['booking_room']['room_option'] == 25){
$s_data['marathon']['room_type'] = 'Bokor Inn room at US$25.00net for Twin room excluding breakfast';
}elseif($data['booking_room']['room_option'] == 35){
$s_data['marathon']['room_type'] = 'Bokor Inn room at US$35.00net for triple room excluding breakfast';
}
$s_data['marathon']['room_option'] = $data['booking_room']['room_option'];
$s_data['marathon']['room_number_of_night'] = $data['booking_room']['num_of_night'];
$s_data['marathon']['checkin_date'] = $data['booking_room']['chk_in'].'-Oct-2022';
$s_data['marathon']['checkout_date'] = $data['booking_room']['chk_out'].'-Oct-2022';
$s_data['marathon']['room_price'] = $data['booking_room']['room_option'];
}
// camping info
if(!empty($data['camping'])){
$s_data['marathon']['book_camping'] = $data['camping']['camping_type'];
$s_data['marathon']['camping_type'] = $data['camping']['camping_type'];
$s_data['marathon']['number_of_tent'] = $data['camping']['n_tent'];
}
// transport info
if(!empty($data['transport'])){
$s_data['marathon']['book_transport'] = 1;
if(isset($data['transport']['dep_pp'])){
$s_data['marathon']['dep_pp'] = $data['transport']['dep_pp'];
$s_data['marathon']['dep_pp_date'] = $data['transport']['s-pp-date'].'-Oct-2022';
$s_data['marathon']['dep_pp_seat'] = $data['transport']['s-pp-seat'];
}
if(isset($data['transport']['dep_bk'])){
$s_data['marathon']['dep_bk'] = $data['transport']['dep_bk'];
$s_data['marathon']['dep_bk_date'] = $data['transport']['s-bk-date'].'-Oct-2022';
$s_data['marathon']['dep_bk_seat'] = $data['transport']['s-bk-seat'];
}
}
// upload bank transaction
$bank = uploadFile();
//print_r($bank); die();
if($bank['img_url'] != ''){
$s_data['marathon']['bank_transaction'] = $bank['img_url'];
$data['upload_bank'] = $bank['img_url'];
}
//save data & send email to reservation
send_booking($data, $s_data, $skh, $ref);
//$skh->pr($s_data); die();
}else{
echo 'empty pos';
}
// upload bank transaction
function uploadFile(){
$data = array();
if(isset($_FILES['upload_bank'])){
$http = @$_SERVER["HTTPS"] == "on"? "https://": "http://";
$base_url = $http . $_SERVER['HTTP_HOST'] . (rtrim($_SERVER['SCRIPT_NAME'],basename($_SERVER['PHP_SELF'])));
$uploaddir = 'img/bank_transaction/';
//$uploaddir = 'https://sokhahotels.com.kh/kampot/webroot/img/marathons/bank_transaction';
//$uploadfile = $uploaddir . basename($_FILES['upload_bank']['name']);
$errors= array();
$file_name = $_FILES['upload_bank']['name'];
$file_size = $_FILES['upload_bank']['size'];
$file_tmp = $_FILES['upload_bank']['tmp_name'];
$file_type = $_FILES['upload_bank']['type'];
$value = explode(".", $_FILES['upload_bank']['name']);
$file_ext = strtolower(array_pop($value));
$extensions = array("jpeg","jpg","png","bmp");
$filename = uniqid() . "_" . time(); // 5dab1961e93a7-1571494241
$extension = pathinfo( $_FILES["upload_bank"]["name"], PATHINFO_EXTENSION ); // jpg
$basename = $filename . "." . $extension; // 5dab1961e93a7_1571494241.jpg
if(in_array($file_ext, $extensions) === false){
$errors[] = "extension not allowed, please choose a JPEG or PNG file.";
}
if(empty($errors) == true){
move_uploaded_file($file_tmp, $uploaddir.$basename);
$data['img_url'] = $uploaddir.$basename;
}else{
$data['err'] = $errors;
}
}
return $data;
}
function getReferenceNumber($skh){
$pre = "SOL";
$order_number = 1;
$sql = "SELECT `ref_number` FROM `marathon` WHERE `year_of_event` = '2022' ORDER BY `id` DESC LIMIT 1";
$result = $skh->query($sql);
if(!empty($result)){
$ref = $result[0]->ref_number;
//$order_number = substr(strstr($ref,"-"),1);
$order_number = substr($ref,3);
//die($order_number);
if($order_number < 9999){
$order_number +=1;
}else{
$order_number = 1;
}
}
return $pre .sprintf("%04d",$order_number);
}
function send_booking($data,$s_data,$skh,$ref){
$html_header ='<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><div style="width:910px;padding:0;border:2px solid #555;background: none repeat scroll 0 0 transparent;font-size: 12px;margin: auto;font-family:Arial,Segoe,Segoe UI,Candara,Calibri,sans-serif">';
$html_body_to_guest = get_register_form($data, $ref) . get_receipt($data, $ref);
$html_body_to_reservation = get_register_form($data, $ref).bank_transaction($data);
$html_footer = '</div></body></html>';
//---------------------
// Send Mail |
//---------------------
$to_reservation = 'dos.corp@sokhahotels.com' . ', ';
//$to_reservation= 'wd2@sokhahotels.com' . ', ';
//$to_guest = @$_SESSION['data']['marathon']['email'];
//------------
// subject |
//------------
$subject = "Marathon Booking - Thansur Sokha Hotel";
//------------
// Body |
//------------
$html_body_to_guest = $html_header . $html_body_to_guest . $html_footer;
$html_body_to_reservation = $html_header . $html_body_to_reservation . $html_footer;
//die($html_body_to_guest. "<br>" . $html_body_to_reservation);// . "<br>" . $html_body_to_reservation
//---------------------------------------------------------
// To send HTML mail, the Content-type header must be set |
//---------------------------------------------------------
$header = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=utf-8' . "\r\n";
//---------------------
// Additional headers |
//---------------------
$name = $data['marathon']['first_name'] . " " . $data['marathon']['last_name'];
$header_to_reservation = $header . 'From: Reservation From: ' . $name . ' <' .$data['marathon']['email']. ">\r\n";
//$header_to_reservation .= 'Cc: nun.sida@thansurbokor.com,chea.malis@thansurbokor.com' . "\r\n";
//$header_to_reservation .= 'Bcc: web@sokhahotels.com'. "\r\n";
$header_to_reservation .= 'Bcc: dos.corp@sokhahotels.com'. "\r\n";
$to_guest = $data['marathon']['email'];
//if(isset($_SERVER['HTTP_REFERER'])) hostTracking("Marathon - Booking Successful (2019)");// insert into database to tracking from any host promotion supplier
if(mail($to_reservation, $subject, $html_body_to_reservation, $header_to_reservation)){
$email_reply = "dos.corp@sokhahotels.com";
$header_to_guest = $header . 'From: Thansur Sokha Hotel < ' . $email_reply . "> \r\n";
//$header_to_guest .= "Cc: sales1@sokhahotels.com,salespp3@sokhahotels.com,nun.sida@thansurbokor.com,chea.malis@thansurbokor.com". "\r\n";
//$header_to_guest .= 'Bcc: web@sokhahotels.com'. "\r\n";
$header_to_guest .= 'Bcc: wd1@sokhahotels.com,wd2@sokhahotels.com'. "\r\n";
mail($to_guest, $subject, $html_body_to_guest, $header_to_guest);
$m_id = saveMe($s_data, $skh);
header('location: /booking-sent.php', true, 301);
}else{
header('location: /booking-failed.php', true, 301);
}
}
function saveMe($data = array(),$skh){
$sql = "INSERT INTO ";
$main_id = 0;
//$ref_number = getReferenceNumber($skh);
$property = "SOL";
foreach($data as $table => $fields){
$sql .= "`" . $table . "` SET ";
$f = "";
foreach($fields as $field_name => $field_value){
$f .= "`" . $field_name . "` = '" . $field_value . "',";
}
//echo $sql.$f." `year_of_event` = '2022', `user_agent` = '" . $_SERVER['HTTP_USER_AGENT'] . "', `ref_number` = '" . $ref_number . "', `created` = NOW(), `modified` = NOW()"; die();
$main_id = $skh->query($sql . $f . " `year_of_event` = '2022', `user_agent` = '" . $_SERVER['HTTP_USER_AGENT'] . "', `created` = NOW(), `modified` = NOW()");
return $main_id;
}
}
function get_register_form($data, $ref = 0){
$html = '
<table style="width:100%;margin-top:10px">
<tbody>
<tr>
<td colspan="2" style="padding:5px">
<img src="https://www.sokhahotels.com.kh/kampot/img/marathons/Marathon-7-logo.jpg" width="178px" style="width:178px">
<p style="float:right">
<label style="display:block;font-size:24px;color:#aaa">The 7th Preah Monivong Bokor International Half Marathon</label>
<label style="display:block;margin-top:10px;font-size:18px;text-align:right;color:#aaa">on Saturday & Sunday November 05-06, 2022 | on Bokor Mountain</label>
</p>
</td>
</tr>
<tr>
<td colspan="2" style="padding:3px;background:#eee;border-bottom:2px solid #555">
<label style="display:inline-block;padding:0 0 0 3px;font-size:26px;line-height:26px">Registration Form</label>
<label style="float:right;padding:6px 10px 0;font-size:16px">Official Code: <span style="width:130px;display:inline-block"> ' . $ref . '</span></label>
</td>
</tr>
<tr>
<td style="width:15%;padding:10px 8px 5px 20px">First Name</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
' . $data['marathon']['first_name'] . '
<label style="padding:5px 100px 5px 198px">Last Name: ' . $data['marathon']['last_name'] . '</label>
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Nationality</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
<span style="">' . $data['marathon']['nationality'] . '</span>
<span style="padding:5px 30px 5px 50px">Age: ' . $data['marathon']['age'] . '</span>
<span style="padding:5px 20px 5px 50px">Gender: ' . $data['marathon']['gender'] . '</span>
<span style="padding:5px 50px 5px 20px">Date Of Birth: ' . $data['marathon']['date_of_birth'] . '</span>
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Contact No </td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
' . $data['marathon']['contact_number'] . '
<span style="padding:5px 100px 5px 198px">Email: ' . $data['marathon']['email'] . '</span>
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Address </td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
' . $data['marathon']['province'] . '
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">T-shirt size </td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
' . $data['marathon']['t_shirt_size'] . '
</td>
</tr>
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">
<p style="margin:5px 0 0 0;padding:0;">
** How did you know Thansur Bokor Half Marathon event?: <span style="display:inline-block;width:45%;border-bottom:1px dotted #ccc">' . $data['marathon']['know_event_by'] . '</span>
</p>
</td>
</tr>
<tr>
<td colspan="2" style="padding:5px 0px 5px 0px;line-height:0;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<td colspan="2" style="padding:10px 5px 5px 20px">
<table style="width:100%;margin:0">
<thead>
<tr>
<th align="left">Biking Race - November 06, 2019</th>
<th></th>
<th></th>
<th>
<input type="radio" ' . ($data['marathon']['joiner_type'] == "Foreigner"? " checked='checked'":"") . ' value="Foreigner" id="r-foreigner" disabled="disabled" class="amount-joiner-type">
<label for="r-foreigner">International</label>
</th>
<th>
<input type="radio" ' . ($data['marathon']['joiner_type'] == "Cambodian"? " checked='checked'":"") . ' value="Cambodian" id="r-cambodian" disabled="disabled" class="amount-joiner-type">
<label for="r-cambodian">Cambodian Participaint</label>
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 1"? " checked='checked'":"") . ' disabled="disabled" value="Biking 1" alt="" title="" id="r-biking1" class="">
<label for="r-biking1"' . ($data['marathon']['biking_race_type'] == "Biking 1"? " style='font-weight:bold'":"") . '>51km (3Laps×17km)</label>
</td>
<td' . ($data['marathon']['biking_race_type'] == "Biking 1"? " style='font-weight:bold'":"") . '>A-Elite-Road Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 1"? " style='font-weight:bold'":"") . '>18years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 1"? " style='font-weight:bold'":"") . '>US$ 30</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 1"? " style='font-weight:bold'":"") . '>US$ 20</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " checked='checked'":"") . ' disabled="disabled" value="Biking 2" alt="" title="" id="r-biking2" class="">
<label for="r-biking1"' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " style='font-weight:bold'":"") . '>51km (3Laps×17km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " style='font-weight:bold'":"") . '>B-Sport-Road Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " style='font-weight:bold'":"") . '>18years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " style='font-weight:bold'":"") . '>US$ 30</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 2"? " style='font-weight:bold'":"") . '>US$ 20</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " checked='checked'":"") . ' disabled="disabled" value="Biking 3" alt="" title="" id="r-biking3" class="">
<label for="r-biking2"' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>34km (2Laps×17km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>C-Open-Mountain bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>14years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>US$ 25</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>US$ 15</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 4"? " checked='checked'":"") . ' disabled="disabled" value="Biking 4" alt="" title="" id="r-biking4" class="">
<label for="r-biking2"' . (@$data['marathon']['biking_race_type'] == "Biking 4"? " style='font-weight:bold'":"") . '>34km (2Laps×17km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>D-VIP-Road Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 3"? " style='font-weight:bold'":"") . '>40years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 4"? " style='font-weight:bold'":"") . '>US$ 25</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 4"? " style='font-weight:bold'":"") . '>US$ 15</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " checked='checked'":"") . ' disabled="disabled" value="Biking 5" alt="" title="" id="r-biking5" class="">
<label for="r-biking2"' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>17km (1Lap×17km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>E-Novice-Mountain Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>14years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>US$ 20</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>US$ 10</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 6"? " checked='checked'":"") . ' disabled="disabled" value="Biking 6" alt="" title="" id="r-biking6" class="">
<label for="r-biking2"' . (@$data['marathon']['biking_race_type'] == "Biking 6"? " style='font-weight:bold'":"") . '>17km (1Lap×17km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>E-Women-Any Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 5"? " style='font-weight:bold'":"") . '>14years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 6"? " style='font-weight:bold'":"") . '>US$ 20</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 6"? " style='font-weight:bold'":"") . '>US$ 10</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " checked='checked'":"") . ' disabled="disabled" value="Biking 7" alt="" title="" id="r-biking7" class="">
<label for="r-biking2"' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " style='font-weight:bold'":"") . '>10km (4Laps×2.5km)</label>
</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " style='font-weight:bold'":"") . '>Kids-Any Bike</td>
<td' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " style='font-weight:bold'":"") . '>9-13years Up</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " style='font-weight:bold'":"") . '>US$ 12</td>
<td align="center"' . (@$data['marathon']['biking_race_type'] == "Biking 7"? " style='font-weight:bold'":"") . '>US$ 7</td>
</tr>
</tbody>
<thead>
<tr>
<th align="left">Running Race - November 05, 2022</th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['running_race_type'] == "Running 1"? " checked='checked'":"") . ' disabled="disabled" value="Running 1" alt="" title="" id="r-running1" class="">
<label for="r-running1"' . (@$data['marathon']['running_race_type'] == "Running 1"? " style='font-weight:bold'":"") . '>Half Marathon (21km)</label>
</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 1"? " style='font-weight:bold'":"") . '>Men/Women</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 1"? " style='font-weight:bold'":"") . '>16years Up</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 1"? " style='font-weight:bold'":"") . '>US$ 30</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 1"? " style='font-weight:bold'":"") . '>US$ 20</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['running_race_type'] == "Running 2"? " checked='checked'":"") . ' disabled="disabled" value="Running 2" alt="" title="" id="r-running2" class="">
<label for="r-running2"' . (@$data['marathon']['running_race_type'] == "Running 2"? " style='font-weight:bold'":"") . '>10km Race</label>
</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 2"? " style='font-weight:bold'":"") . '>Men/Women</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 2"? " style='font-weight:bold'":"") . '>13years Up</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 2"? " style='font-weight:bold'":"") . '>US$ 25</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 2"? " style='font-weight:bold'":"") . '>US$ 15</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['running_race_type'] == "Running 3"? " checked='checked'":"") . ' disabled="disabled" value="Running 3" alt="" title="" id="r-running3" class="">
<label for="r-running3"' . (@$data['marathon']['running_race_type'] == "Running 3"? " style='font-weight:bold'":"") . '>05km Race</label>
</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 3"? " style='font-weight:bold'":"") . '>Open</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 3"? " style='font-weight:bold'":"") . '>Adult & Kid</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 3"? " style='font-weight:bold'":"") . '>US$ 15</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 3"? " style='font-weight:bold'":"") . '>US$ 10</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 80px">
<input type="checkbox" ' . (@$data['marathon']['running_race_type'] == "Running 4"? " checked='checked'":"") . ' disabled="disabled" value="Running 4" alt="" title="" id="r-running4" class="">
<label for="r-running4"' . (@$data['marathon']['running_race_type'] == "Running 4"? " style='font-weight:bold'":"") . '>03km Fun Run</label>
</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 4"? " style='font-weight:bold'":"") . '>Open</td>
<td' . (@$data['marathon']['running_race_type'] == "Running 4"? " style='font-weight:bold'":"") . '>Adult & Kid</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 4"? " style='font-weight:bold'":"") . '>US$ 12</td>
<td align="center"' . (@$data['marathon']['running_race_type'] == "Running 4"? " style='font-weight:bold'":"") . '>US$ 7</td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="4" style="border-top:1px dotted #ccc;text-align:right;padding:10px 15px 0 0;font-weight:bold">
Amount charged US$: ' . (@$data['marathon']['running_price'] + @$data['marathon']['biking_price']) . '
</td>
</tr>
</tbody>
</table>
</td>
</tr>
';
$transport_fee = 0;
$t_pp = 0;
$t_bk = 0;
$transport_type1 = "";
$transport_type2 = "";
$t_dep_pp_fee = 0;
$t_dep_pp_seat = 0;
$t_dep_pp_date = "";
$t_dep_bk_fee = 0;
$t_dep_bk_seat = 0;
$t_dep_bk_date = "";
if(isset($data['transport'])){
if(isset($data['transport']['dep_pp'])){
$t_pp = 1;
$t_dep_pp_fee = "15";
$t_dep_pp_seat = $data['transport']['s-pp-seat'];
$t_dep_pp_date = $data['transport']['s-pp-date'].'-Nov-2022';
}
if(isset($data['transport']['dep_bk'])){
$t_bk = 1;
$t_dep_bk_fee = "15";
$t_dep_bk_seat = $data['transport']['s-bk-seat'];
$t_dep_bk_date = $data['transport']['s-bk-date'].'-Nov-2022';
}
//$transport_price = $data['marathon']['book_transport'];
$transport_fee = ($t_dep_pp_seat * $t_dep_pp_fee) + ($t_dep_bk_seat * $t_dep_bk_fee);
$html .= '
<tr>
<td colspan="2" style="padding:0px 0px 0px 0px;line-height:0;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<th align="left" colspan="2" style="padding:10px 5px 5px 20px">Transportation Booking</th>
</tr>
<tr>
<td colspan="2" style="padding:10px 5px 5px 20px">
<table style="width:100%">
';
if($t_pp == 1){
$transport_type1 = "Departure from Phnom Penh to Bokor Mountain";
$html .= '
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">+ ' . $transport_type1 . ' on ' . $t_dep_pp_date . ':</td>
</tr>
<tr>
<td style="width:15%;padding:5px 5px 5px 20px">Number of Seat</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $t_dep_pp_seat . ' x US$ ' . $t_dep_pp_fee . '</td>
</tr>
';
}
if($t_bk == 1){
$transport_type2 = "Departure from Bokor Mountain to Phnom Penh";
$html .= '
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">+ ' . $transport_type2 . ' on ' . $t_dep_bk_date . ':</td>
</tr>
<tr>
<td style="width:15%;padding:5px 5px 5px 20px">Number of Seat</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $t_dep_bk_seat . ' x US$ ' . $t_dep_bk_fee . '</td>
</tr>
';
}
$html .= '<tr>
<td colspan="2" style="padding:10px 15px 5px 20px;text-align:right"><b><b>Amount charged</b> US$: ' . $transport_fee . '</b></td>
</tr>
</table>
</td>
</tr>';
}
$dinner_amount = 0;
if(isset($data['marathon']['book_welcome_dinner'])){
$adult = $data['marathon']['dinner_number_of_adult'];
$adult_price = 19;
$kid = $data['marathon']['dinner_number_of_kid'];
$kid_price = 10;
$dinner_amount = ($adult * $adult_price) + ($kid * $kid_price);
$html .= '
<tr>
<td colspan="2" style="padding:0px 0px 0px 0px;line-height:0;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<th align="left" colspan="2" style="padding:10px 5px 5px 20px">Dinner Booking</th>
</tr>
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">
<table style="width:100%">
<tr>
<td style="width:15%;padding:5px 5px 5px 20px">Number of adult</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $adult . ' x US$ ' . $adult_price . ' </td>
</tr>';
if($kid > 0){
$html .= '<tr>
<td style="padding:5px 5px 5px 20px">Number of kid</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $kid . ' x US$ ' . $kid_price . ' </td>
</tr>';
}
$html .= '<tr>
<td colspan="2" style="padding:10px 15px 5px 20px;text-align:right"><b><b>Amount charged</b> US$: ' . $dinner_amount . '</b></td>
</tr>
</table>
</td>
</tr>';
}
$camping_fee = 0;
if(!empty($data['camping'])){
$camping_price = $data['camping']['camping_type'];
$number_of_tent = $data['camping']['n_tent'];
$camping_fee = $camping_price * $number_of_tent;
$html .= '
<tr>
<td colspan="2" style="padding:0px 0px 0px 0px;line-height:0;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<th align="left" colspan="2" style="padding:10px 5px 5px 20px">Camping Booking</th>
</tr>
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">
<table style="width:100%">
<tr>
<td style="width:15%;padding:5px 5px 5px 20px">Number of tent</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $number_of_tent . ' x US$ ' . $camping_price . ' </td>
</tr>';
$html .= '<tr>
<td colspan="2" style="padding:10px 15px 5px 20px;text-align:right"><b><b>Amount charged</b> US$: ' . $camping_fee . '</b></td>
</tr>
</table>
</td>
</tr>';
}
$marathon_price = (@$data['marathon']['running_price'] + @$data['marathon']['biking_price']);
$total = $transport_fee + $dinner_amount + $marathon_price + $camping_fee;
if(isset($data['booking_room'])){
$room_option = $data['booking_room']['room_option'];
if($room_option == 175){
$room_type = 'Thansur room at US$175.00net include breakfast (2pax)';
}elseif($room_option == 225){
$room_type = 'Bokor Suite at US$225.00net include breakfast (2pax)';
}elseif($room_option == 65){
$room_type = 'Champei room at US$65.00net include breakfast (2pax)';
}elseif($room_option == 135){
$room_type = 'Rumdul Suite at US$135.00net include breakfast (2pax)';
}elseif($room_option == 25){
$room_type = 'Bokor Inn room at US$25.00net for Twin room excluding breakfast';
}elseif($room_option == 35){
$room_type = 'Bokor Inn room at US$35.00net for triple room excluding breakfast';
}
$number_of_night = $data['booking_room']['num_of_night'];
//$number_of_night = $number_of_night < 10? ("0" . $number_of_night):$number_of_night;
$price = 0;
$price = $room_option;
$amount = $number_of_night * $price;
$total += $amount;
//$_SESSION['data']['marathon']['room_price'] = $price;
//$_SESSION['data']['marathon']['total_price'] = $total;
$checkin = $data['booking_room']['chk_in'].'-Nov-2022';
$checkout = $data['booking_room']['chk_out'].'-Nov-2022';
$html .= '
<tr>
<td colspan="2" style="padding:0px 0px 0px 0px;line-height:0;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<th align="left" colspan="2" style="padding:10px 5px 5px 20px">Room Booking</th>
</tr>
<tr>
<td colspan="2" style="padding:5px 5px 5px 20px">
<table style="width:100%">
<tr>
<td style="width:15%;padding:5px 5px 5px 20px">Room Type</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $room_type . '</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Number of Night</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">' . $number_of_night . ' night(s)</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Price</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">US$ ' . $price . '</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Checkin</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc"> ' . $checkin . '</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Checkout</td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc"> ' . $checkout . '</td>
</tr>
<tr>
<td colspan="2" style="padding:10px 15px 5px 20px;text-align:right"><b><b>Amount charged</b> US$: ' . $amount . '</b></td>
</tr>
</table>
</td>
</tr>
';
}
$html .= '
<tr>
<td colspan="2" style="line-height:0;padding:0 5px 0 20px;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<td colspan="2" style="padding:5px 15px 5px 20px;background:#eee;font-size:18px;text-align:right"><b><b>Total amount charged</b> US$: ' . $total . '</b></td>
</tr>
</tbody>
</table>
';
return $html;
}
function get_receipt($data, $ref = 0){
$html = '
</div>
<div style="width:910px;padding:0;background: none repeat scroll 0 0 transparent;font-size: 12px;margin: auto;font-family:Arial,Segoe,Segoe UI,Candara,Calibri,sans-serif">
<span class="note" style="display:block;margin-top:10px"><b>Note:</b> Please print and keep this ticket and bring during the event</span>
<img class="note" src="https://www.sokhahotels.com.kh/kampot/img/cut.png" width="16" height="16" style="width:16px;background:none">
<table class="receipt" style="border-color: #555555;border-image: none;border-style: dashed solid solid;border-width: 2px;margin:0;width: 100%;border-collapse:inherit;border-spacing:inherit">
<tbody>
<tr>
<td colspan="2" style="padding:5px">
<img src="https://www.sokhahotels.com.kh/kampot/img/marathons/Marathon-7-logo.jpg" width="178px" height="" style="width:178px">
<p style="float:right">
<label style="display:block;font-size:24px;color:#aaa">The 7th Preah Monivong Bokor International Half Marathon</label>
<label style="display:block;margin-top:10px;font-size:18px;text-align:right;color:#aaa">on Saturday & Sunday November 05-06, 2022 | on Bokor Mountain</label>
</p>
</td>
</tr>
<tr>
<td colspan="2" style="padding:3px;background:#eee">
<label style="display:inline-block;padding:8px 10px 3px;font-size:26px">Acknowledgement Receipt</label>
<label style="float:right;padding:6px 10px 0;font-size:16px">Official Code: <span style="display:inline-block;width:120px;padding-bottom:2px;border-bottom:1px solid #555;"> ' . @$ref . '</span></label>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:97.5%;">
<tbody>
<tr>
<td colspan="2">
<p style="margin:0;padding:10px 5px 5px 20px">
Please kindly present this confirmation to our staffs to collect you race kit at Expo Site as below mentioned:<br>
<b style="text-decoration:underline">Expo Site/Final Confirmation Site</b>
</p>
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Location <span style="float:right">:</span></td>
<td style="padding:5px 5px 5px 20px"><b>Thansur Sokha Hotel/Bokor Mountain, Kampot Province, Cambodia</b></td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Date & Time <span style="float:right">:</span></td>
<td style="padding:5px 5px 5px 20px">November 05 - 06, 2022 at 0900am - 1800pm</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Contact No <span style="float:right">:</span></td>
<td style="padding:5px 5px 5px 20px">(855)16 616126 | 975 616 116</td>
</tr>
<tr>
<td colspan="2"><span style="display:block;margin-left:20px;border-bottom:2px solid #555"></span></td>
</tr>
<tr>
<td style="padding:5px 5px 0 20px">Runner Name <span style="float:right">:</span></td>
<td style="padding:5px 5px 0 20px;border-bottom:1px dotted #ccc">' . ($data['marathon']['first_name'] . " " . $data['marathon']['last_name']) . '</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Nationality <span style="float:right">:</span></td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
<span style="">' . $data['marathon']['nationality'] . '</span>
<span style="padding:5px 50px">Age: ' . $data['marathon']['age'] . '</span>
<span style="padding:5px 50px">Gender: ' . $data['marathon']['gender'] . '</span>
<span style="padding:5px 50px">T-shirt size: ' . $data['marathon']['t_shirt_size'] . '</span>
</td>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px">Approved by <span style="float:right">:</span></td>
<td style="padding:5px 5px 5px 20px;border-bottom:1px dotted #ccc">
<span style=""><?php echo ""; ?></span>
<span style="padding:5px 100px 5px 102px">Date: <?php echo ""; ?></span>
<span style="padding:5px 50px 5px 75px">Payment Status: <?php echo ""; ?></span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td colspan="2" style="padding:0;text-align:center">
<p style="margin:5px 1px 0 0;padding:0;background:#eee;text-align:center">
** All entry fee can not refund, change race category and transfer to other runner **
</p>
</td>
</tr>
</tbody>
</table>
';
return $html;
}
function bank_transaction($data){
$html = '
<table style="width:100%;margin-top:0">
<tbody>
<tr>
<td style="line-height:0;padding:0 5px 0 20px;border-bottom:2px solid #555"> </td>
</tr>
<tr>
<th style="padding:10px 5px 5px 20px; text-align:left">Bank Information:</th>
</tr>
<tr>
<td style="padding:5px 5px 5px 20px"><img src="http://bokormarathon.com.kh/' . $data['upload_bank'] . '" style="width: 100%"/></td>
</tr>
</tbody>
</table>
';
return $html;
}
function check_code($code = 0){
$sql = "SELECT `id` FROM `marathon` WHERE `ref_number` = '" . $code . "'";
$result = $skh->query($sql);
return $result;
}
?>