File: /home/cafsindia/allyindian_com/backend/customers/bend/sbltt_callback.php
<?php
require_once('../sbltt_lib/sblttObject.php');
$sbltt_session = sblttObject::newObject('sbltt_session');
$sbltt_session->startSession();
$libObject = $sbltt_session->is_session_exist();
if(!$libObject){
echo json_encode(array('sts' => false, 'info' =>"Required Login"));
exit(0);
}
$is_customer = $libObject->is_customer();
if(!$is_customer){
$dbObject = $libObject->getDBObject();
$package_id = $sbltt_session->get_value('package_id');
$package_date = $sbltt_session->get_value('package_date');
$trip_id = $sbltt_session->get_value('trip_id');
}else{
$dbObject = $libObject->getDBObject();
$real_db = $libObject->get_db();
}
$admin_email = "admin.tours@sblt.co.in";
$frm = "";
if(isset($_POST['frm'])){
$frm = $_POST['frm'];
}
if($frm === "login"){
$fdata = "";
if(isset($_POST['fdata'])){
$fdata = $_POST['fdata'];
$fdata = json_decode($fdata);
}
$login_id = "";
$login_pwd = "";
foreach($fdata as $form_data){
$name = $dbObject->real_escape_string($form_data->name);
$value = $dbObject->real_escape_string($form_data->value);
if($name === "login_id"){
$login_id = $value;
}
if($name === "login_pwd"){
$login_pwd = $value;
}
}
$is_exist = $libObject->is_email_exist($login_id);
$is_exist = json_decode($is_exist);
if($is_exist->mode === "sign_in"){
$login_pwd = base64_encode($login_pwd);
echo $libObject->core_login($login_id,$login_pwd);
}else
if($is_exist->mode === "multiple"){
echo json_encode(array('sts' => false, 'info' =>"Please Contact SBLT Support"));
}else{
echo json_encode(array('sts' => false, 'info' =>"Please Sign up"));
}
}else
if($frm === "check_loginid_exist"){
if(isset($_POST['custloginid'])){
$custloginid = $_POST['custloginid'];
}
$loginid = $sbltt_session->get_value('custloginid');
$cust_info = $dbObject->runQuery("SELECT * from sblttweb_customers where custloginid = '$custloginid' and custloginid != '$loginid'");
$cust_rows = $dbObject->num_rows($cust_info);
if($cust_rows === 0){
echo json_encode(array('sts' => TRUE, 'mode' =>"not_exist"));
}else{
echo json_encode(array('sts' => TRUE, 'mode' =>"exist"));
}
}else
if($frm === "change_password"){
$user_name = "";
if(isset($_POST['user_name'])){
$user_name = $_POST['user_name'];
}
$log_data = $libObject->login_exist($user_name);
$log_data = json_decode($log_data);
if($log_data->status){
$cust_email = $log_data->cust_email;
$info = $log_data->info;
$email_to = $user_name;
if($cust_email){
$email_to = $cust_email;
}
$email_content = "<div style='width: 750px; margin-left: auto; margin-right: auto; padding: 15px; background-color: #EEEEEE; border-radius: 3px; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);'>
<h1 style='text-align: center;color:#D8343F;'>Forgot Password</h1>
<p style='text-align:left;'>
Dear ,<br/>
It seems like you’ve requested for a new password.<br/>
If that was you, please click the link to enter a new password.<br/>
Please click below link to reset Sri Bhakiyalakshimi Tours and Travels login password
</p>
<div style='text-align:center;'>
<a style='background-color: #D8343F; color: #ffffff; border: none; padding: 8px 16px; border-radius: 3px; margin: 8px;box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);' href='$info'>Reset Password</a>
</div>
<p>
This link will be valid for next 30 minutes.<br/>
If you need help or assistance or any queries, feel free to email us at tours@sblt.co.in or call us at our customer service number 98416 98503.<br/><br/>
Regards,<br/>
Sri Bhagiyalakshmi Tours and Travels
</p>
</div>";
$email_data = array(
'to_email' => $email_to,
'subject' => "SBLTT Change Password",
'email_content' => $email_content,
);
$email_status = $libObject->send_mail($email_data,"customer");
if($email_status){
echo json_encode(array('status' => TRUE, 'msg' =>"email sent successfully to register email id "));
}else{
echo json_encode(array('status' => TRUE, 'msg' =>"Please contact admin team"));
}
}else{
echo json_encode(array('status' => False, 'msg' =>$log_data->info));
}
}else
if($frm === "signin"){
$fdata = "";
if(isset($_POST['fdata'])){
$fdata = $_POST['fdata'];
$fdata = json_decode($fdata);
}
$custfname = "";
$custlname = "";
$custemail = "";
$custphone = "";
$custpassword = "";
foreach($fdata as $form_data){
$name = $dbObject->real_escape_string($form_data->name);
$value = $dbObject->real_escape_string($form_data->value);
if($name === "custfname"){
$custfname = $value;
}
if($name === "custlname"){
$custlname = $value;
}
if($name === "custemail"){
$custemail = $value;
}
if($name === "custphone"){
$custphone = $value;
}
if($name === "custpassword"){
$custpassword = $value;
}
}
echo $libObject->create_account($custfname,$custlname,$custemail,$custphone,$custpassword);
}else
if($frm === "update_password"){
$fdata = "";
if(isset($_POST['cust_id'])){
$cust_id = base64_decode($_POST['cust_id']);
}
if(isset($_POST['pass'])){
$pass = $_POST['pass'];
}
$fdata = "";
if(isset($_POST['fdata'])){
$fdata = $_POST['fdata'];
$fdata = json_decode($fdata);
}
foreach($fdata as $form_data){
$name = $dbObject->real_escape_string($form_data->name);
$value = $dbObject->real_escape_string($form_data->value);
if($name === "new_password"){
$new_password = base64_encode($value);
}
if($name === "renew_password"){
$renew_password = base64_encode($value);
}
}
if($new_password === $renew_password){
echo $libObject->update_password($cust_id,$new_password,$pass);
}else{
echo json_encode(array('sts' => FALSE,'info'=>'Passwords Should Be Same'));
}
}else
if($frm === "get_date_difference"){
if(isset($_POST['from_date'])){
$from_date = date("Y-m-d", strtotime($_POST['from_date']));
}
if(isset($_POST['to_date'])){
$to_date = date("Y-m-d", strtotime($_POST['to_date']));
}
$date1 = new DateTime($from_date);
$date2 = new DateTime($to_date);
$diff = $date2->diff($date1)->format("%a");
$days = $diff + 1;
$from_date =strtotime($_POST['from_date']);
$to_date =strtotime($_POST['to_date']);
if($from_date > $to_date){
$days = 0;
echo $days;
}else{
echo $days;
}
}else
if($frm === "enquiry_form"){
$fdata = "";
if(isset($_POST['source'])){
$source_text = $_POST['source'];
}
if(isset($_POST['dest'])){
$dest = $_POST['dest'];
}
if(isset($_POST['fdata'])){
$fdata = $_POST['fdata'];
$fdata = json_decode($fdata);
}
$cust_id = $sbltt_session->get_value('cust_id');
$qry_key = "";
$qry_value = "";
$enqoptions = "";
$veh_name = "";
$count = 0;
$dbObject = sblttObject::newObject('sbltt_db');
$obj = sblttObject::newObject('sbltt_customer');
$real_db = $obj->get_db();
foreach($fdata as $form_data){
$name = $real_db->real_escape_string($form_data->name);
$value = $real_db->real_escape_string($form_data->value);
if($name === "mobile"){
$mobile = $value;
}
if($name === "custname"){
$custname = $value;
}
if($name === "enqdate"){
$value = date("Y-m-d", strtotime($value));
}
if($name === "datefrom"){
$from_date = date("d-m-Y", strtotime($value));
$value = date("Y-m-d", strtotime($value));
}
if($name === "dateto"){
$to_date = date("d-m-Y", strtotime($value));
$value = date("Y-m-d", strtotime($value));
}
if($name === "source"){
$source = $value;
}
if($name === "destination"){
$destination = $value;
}
if($name === "enqfordetail"){
$enqfordetail = $value;
}
if($name === "enqother"){
$comments = $value;
}
if($name === "enqoptions[]"){
if((int)$count === 1){
$enqoptions .= "$value,";
}else{
$enqoptions .= "$value,";
}
$count++;
}
if($value){
if($name !== "enqoptions[]"){
$qry_key .= "$name,";
$qry_value .= "'$value',";
}
}
}
$qry_key = rtrim($qry_key,',');
$qry_value = rtrim($qry_value,',');
$enqoptions = rtrim($enqoptions,',');
$query = "insert into sblttweb_enquirybasic ($qry_key,enqdate,enqoptions,cust_id) values ($qry_value,'".date("Y-m-d")."','$enqoptions','$cust_id')";
$insert_enquiry_info = $dbObject->runQuery($query);
$type = "";
if(($enqfordetail === "1") || ($enqfordetail === "4")){
$qry = $dbObject->runQuery("SELECT GROUP_CONCAT(veh_type SEPARATOR ',') as veh_type from sblttweb_veh_type where veh_type_id in($enqoptions)");
$veh_data = $dbObject->result($qry);
$type = $veh_data[0]->veh_type;
}else{
$type = $enqoptions;
}
if($insert_enquiry_info){
$sbltt_db = sblttObject::newObject('sbltt_db');
$sbltt_db->send_enquirymail($cust_id,$custname,$mobile,$enqfordetail,$comments,$type,$from_date,$to_date,$source_text,$dest);
echo json_encode(array('sts' => TRUE,'info'=>'Enquiry Submitted Successfully','mobile'=>$mobile,'veh_type'=>$type));
}else{
echo json_encode(array('sts' => FALSE,'info'=>'Please Try After Sometime'));
}
}else
if($frm === "feedback_form"){
if(isset($_POST['custname'])){
$custname = $_POST['custname'];
}
if(isset($_POST['emailid'])){
$emailid = $_POST['emailid'];
}
if(isset($_POST['mobile'])){
$mobile = $_POST['mobile'];
}
if(isset($_POST['comments'])){
$comments = $_POST['comments'];
}
$email_content = "<div style='width: 750px; margin-left: auto; margin-right: auto; padding: 15px; background-color: #EEEEEE; border-radius: 3px; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);'>
<h1 style='text-align: center;color:#D8343F;'>Website Feedback</h1>
<table><tbody>
<tr><td>Name</td><td>$custname</td></tr>
<tr><td>Mobile</td><td>$mobile</td></tr>
<tr><td>Email</td><td>$emailid</td></tr>
<tr><td>Details</td><td> $comments</td></tr>
</tbody></table>
</div>";
$email_data = array(
'admin_email' => "",
'to_email' => $admin_email,
'subject' => "Customer Feedback",
'email_content' => $email_content,
);
$sbltt_db = sblttObject::newObject('sbltt_db');
$email_status = $sbltt_db->send_mail($email_data,"customer");
if($email_status){
echo json_encode(array('status' => TRUE, 'msg' =>"Your Feedback Submitted Successfully"));
}else{
echo json_encode(array('status' => FALSE, 'msg' =>"Please contact Support Team"));
}
}else
if($frm === "cust_update"){
$cust_id = $libObject->cust_id;
$fdata = "";
if(isset($_POST['fdata'])){
$fdata = $_POST['fdata'];
$fdata = json_decode($fdata);
}
$qry_key = "cust_id,";
$qry_value = "'$cust_id',";
$upd_query = "";
foreach($fdata as $form_data){
$name = $real_db->real_escape_string($form_data->name);
$value = $real_db->real_escape_string($form_data->value);
if($name === "custdob"){
$value = new DateTime($value);
$value = $value->format("Y-m-d");
}
if($value){
$qry_key .= "$name,";
$qry_value .= "'$value',";
$upd_query .= "$name = '$value',";
}
}
$created_on = date("Y-m-d h:i:s");
$upd_query .= "doc = '$created_on',";
$upd_query = rtrim($upd_query,',');
$update_query = "UPDATE sblttweb_customers SET $upd_query WHERE custid = '$cust_id'";
$update_customer_info = $dbObject->runQuery($update_query);
$libObject->get_cust_info($cust_id);
$sbltt_session = sblttObject::newObject('sbltt_session');
$sbltt_session->save_session($cust_id);
if($update_customer_info){
echo json_encode(array('sts' => TRUE,'info'=>'Profile Updated Successfully'));
}else{
echo json_encode(array('sts' => FALSE,'info'=>'Please Try After Sometime'));
}
}else
if($frm === "get_package_date"){
$package_id = "";
if(isset($_POST['package_id'])){
$package_id = $_POST['package_id'];
}
$date_info = $dbObject->query("package","package_id='$package_id'","dep_date");
$date_rslt = $dbObject->result($date_info);
echo json_encode(array('sts' => TRUE, 'result' =>$date_rslt));
}else
if($frm === "get_package_data"){
if(isset($_POST['package_id'])){
$package_id = $_POST['package_id'];
if(isset($_SESSION['package_id'])){
$sbltt_session->set_value("package_id",$package_id);
}else{
$sbltt_session->add_value("package_id",$package_id);
}
}
if(isset($_POST['package_date'])){
$package_date = $_POST['package_date'];
$package_date = date("d-M-Y",strtotime($package_date));
$s_date = date("Y-m-d",strtotime($package_date));
if(isset($_SESSION['package_date'])){
$sbltt_session->set_value("package_date",$s_date);
}else{
$sbltt_session->add_value("package_date",$s_date);
}
}
$db = $dbObject->get_db();
$pack_qry = "SELECT * FROM sblttweb_vehicletrips inner join sblttweb_package on sblttweb_package.package_id = sblttweb_vehicletrips.trippackid inner join sblttweb_vehicle on sblttweb_vehicle.vehicle_id = sblttweb_vehicletrips.vehicleid
left join sblttweb_veh_type on sblttweb_veh_type.veh_type_id = sblttweb_vehicle. vehicle_type where sblttweb_package.package_id = '$package_id' and sblttweb_package.status = '1' and sblttweb_vehicletrips.status='1' ";
$result_qry = mysqli_query($db,$pack_qry);
$tr_line = "";
$seat = "";
$seatnocol_low = "";
$i = 1;
$sno = 1;
while($value = mysqli_fetch_assoc($result_qry)){
$date = $package_date;
$tripid = $value['tripid'];
if(isset($_SESSION['trip_id'])){
unset($_SESSION['trip_id']);
}
$sbltt_session->add_value("trip_id",$tripid);
$tripcode = $value['tripcode'];
$seat_capacity = $value['seat_capacity'];
$package_id = $value['package_id'];
$package_title = $value['package_title'];
$package_title2 = $value['package_title2'];
$veh_type = $value['veh_type'];
$vehicle_id = $value['vehicle_id'];
$discount = $value['discount'];
$vehiclemodel = $value['vehiclemodel'];
$discountdetail = 0;
if($discount){
$discountdetail = $value['discountdetail'];
}
if(isset($_SESSION['discount'])){
unset($_SESSION['discount']);
}
$sbltt_session->add_value("discount",$discountdetail);
//Get Booked and blocked Seats
$blocked_qry = $dbObject->runQuery("SELECT count(*) as blocked FROM sblttweb_seatquotanew where qutripid = '$tripid' and qupackdate = '$s_date' and quseatstat = '2'");
$blocked_rslt = $dbObject->result($blocked_qry);
$blocked = $blocked_rslt[0]->blocked;
$booked_qry = $dbObject->runQuery("SELECT count(sblttweb_passlist.passid) as booked FROM sblttweb_passlist inner join sblttweb_ticketorder on sblttweb_ticketorder.orderid = sblttweb_passlist.ticketorderid where passtripid = '$tripid' and doj = '$s_date' and (passstatus = '0' or passstatus = '2') and sblttweb_passlist.pnrno > 0 and orderstat IN (1,2,4)");
$booked_rslt = $dbObject->result($booked_qry);
$booked = (int)$booked_rslt[0]->booked + (int)$blocked;
$available = (int)$seat_capacity - (int)$booked;
//Get Boarding Details Session
$board_qry = "SELECT * FROM sblttweb_boarding inner join sblttweb_boarding_point on sblttweb_boarding_point.board_point_id = sblttweb_boarding.board_point_id where sblttweb_boarding.package_id = '$package_id' and sblttweb_boarding.status = '1' order by sblttweb_boarding.dep_time ASC";
$result = mysqli_query($db,$board_qry);
$option = "<option value =''>--- Select Boarding ---</option>";
$count = 0;
while($rslt = mysqli_fetch_assoc($result)){
if($count === 0){
$start = $rslt['boarding_name'];
}
$board_id = $rslt['boarding_id'];
$board_name = $rslt['boarding_name'];
$dep_time = $rslt['dep_time'];
$option .= "<option value ='$board_id'>$dep_time - $board_name</option>";
$count++;
}
//Package Tariff Cost Session
$tariff_qry = "SELECT * FROM sblttweb_packcost inner join sblttweb_package_type on sblttweb_package_type.package_type_id = sblttweb_packcost.packtypeid where sblttweb_packcost.packid = '$package_id' and pcoststatus = '1'";
$tariff_result = mysqli_query($db,$tariff_qry);
$option_t = "<option value =''>--- Select Tariff ---</option>";
while($t_rslt = mysqli_fetch_assoc($tariff_result)){
$pcostid = $t_rslt['pcostid'];
$packtype_name = $t_rslt['package_type'];
$pamount = $t_rslt['pamount'];
$option_t .= "<option value ='$pamount|$pcostid'>$pamount - $packtype_name</option>";
}
$view_btn = "<a role='button' data-toggle='collapse' data-parent='#accordion' href='#pack$tripid' class='btn btn-outline-danger btn-sm 'style='border: 1px solid #d8343f; color: #d8343f;font-weight:bold;' id='$tripid' onclick=get_seat_layout('$vehicle_id','$tripid')> View Seat </a>";
if((int)$available === 0){
$view_btn = "";
}//$('#'+holder_id).hasClass("selected_sl")
if($discount === "1"){
$discount_tr = "<tr><td class='sb_bold sb_nowrap'>Discount</td>
<td class='sb_bold sb_color sb_right' id='discount$tripid'>0</td>
</tr>";
}else{
$discount_tr = "";
}
$tr_line .= "
<div class='panel panel-default'>
<div class='panel-heading' role='tab' style='background-color:#FFFFFF;border-radius: 4px; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);'>
<table>
<tr>
<td class='sb_left'>
<span class='sb_cl_gray'>Journey Date</span><span class='sb_bold sb_color'> $date</span>
</td>
<td class='sb_center'>
<span class='sb_bold'>$tripcode - $package_title $package_title2</span>
</td>
<td class='sb_right'>
<span class='sb_cl_gray'>Booked</span><span class='sb_bold'> $booked</span>
</td>
<td class='sb_right'>
<a class='sb_color' onclick=pack_info() style='cursor: pointer;'> Pack Info <i class='fa fa-info-circle fa-1x' aria-hidden='true'></i></a>
</td>
</tr>
<tr>
<td class='sb_bold sb_left'>
<span class='sb_cl_gray'>Boarding Start</span> $start
</td>
<td class='sb_bold sb_center'><span class='sb_cl_gray'>Vehicle</span> $veh_type $vehiclemodel</td>
<td class='sb_right'>
<span class='sb_cl_gray'>Available</span><span class='sb_bold'> $available</span>
</td>
<td class='sb_right'> $view_btn </td>
</tr>
</table>
</div>
<div id='pack$tripid' class='panel-collapse collapse' role='tabpanel'>
<div class='row' style='margin:0px;padding:8px;'>
<div class='col-md-8' style='background-color:#FFFFFF;'>
<div class='row' style='margin:0px;'>
<div class='col-md-12' style='margin-left: -20px;'>
<table style='font-size: 12px;'>
<tr>
<td class='sb_bold sb_right'>Available</td>
<td>
<img style='padding:2px;height:20px;width:20px;' src='./asset/images/seats/available_seat.png'>
<img style='padding: 0px;height:20px;width:20px;' src='./asset/images/seats/available_sl.png'>
</td>
<td class='sb_bold sb_right'>Selected By You</td>
<td>
<img style='padding:2px;height:20px;width:20px;' src='./asset/images/seats/selected.png'>
<img style='padding: 0px;height:20px;width:20px;' src='./asset/images/seats/selected_sl.png'>
</td>
<td class='sb_bold sb_right'>Selected By Others</td>
<td>
<img style='padding: 2px;height:20px;width:20px;' src='./asset/images/seats/blocked_seat.png'>
<img style='padding: 0px;height:20px;width:20px;' src='./asset/images/seats/blocked_sl.png'>
</td>
<td class='sb_bold sb_right'>Booked Seats</td>
<td>
<img style='padding: 2px;height:20px;width:20px;' src='./asset/images/seats/cus_booked_seat.png'>
<img style='padding: 0px;height:20px;width:20px;' src='./asset/images/seats/cus_booked_sl.png'>
</td>
</tr>
</table>
</div>
<div class='col-md-12 seat_arrage' style='overflow:auto;margin-left: -20px;' id='seat_layout$tripid'>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='row cancel_bg' style='padding: 8px; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);margin: 8px 0px;'>
<h5 style='text-align:center;color:#D8343F;font-weight:bold;'> Booking Details</h5>
<div class='form-group' style='width:100% !important;margin:0px !important;margin-bottom:12px !important;'>
<select id='boarding$tripid' class='form-control boarding'>
$option
</select>
</div>
<div class='form-group' style='width:100% !important;margin:0px !important;margin-bottom:12px !important;'>
<select id='tariff$tripid' class='form-control tariff'>
$option_t
</select>
</div>
<div class='col-md-12 tickets_holder' style='margin:0px !important;border-radius:2px;'>
<table>
<tr>
<td class='sb_bold sb_nowrap'>Seat Number</td>
<td class='sb_bold sb_color sb_right sb_line_brake' id='seats$tripid'>0</td>
</tr>
<tr>
<td class='sb_bold sb_nowrap'>Tariff</td>
<td class='sb_bold sb_color sb_right' id='tariff_amt$tripid'>0.00</td>
</tr>
$discount_tr
<tr>
<td class='sb_bold sb_nowrap'>Fares</th>
<td class='sb_bold sb_color sb_right' id='fares$tripid'></span>0.00</td>
</tr>
</table>
</div>
<div class='col-md-12 split' style='margin-bottom:15px;'></div>
<button type='button' class='btn btn-danger btn-block' data-toggle='modal' id='passenger_form'>Proceed</button>
</div>
</div>
</div>
</div>";
}
echo "<div class='panel-group' id='accordion' role='tablist' aria-multiselectable='true'>$tr_line</div>";
}else
if($frm === "get_seat_layout"){
if(isset($_POST['vehicle_id'])){
$vehicle_id = $_POST['vehicle_id'];
}
if(isset($_POST['trip_id'])){
$trip_id = $_POST['trip_id'];
}
$seat_layout_qry = "SELECT * FROM sblttweb_vehicle where sblttweb_vehicle.vehicle_id = '$vehicle_id'";
$db = $dbObject->get_db();
$result_qry = mysqli_query($db,$seat_layout_qry);
$seat = "";
$seatnocol_low = "";
$i = 1;
$sno = 1;
$seat_array = "";
while($value = mysqli_fetch_assoc($result_qry)){
$seat_capacity = $value['seat_capacity'];
//Vehicle Data for Seat Allocation
$vehicle_id = $value['vehicle_id'];
$seat_type = $value['seat_type'];
$multi_type = $value['multi_type'];
//Upper seat data
$no_of_seats_up = $value['no_of_seats_up'];
$seats_per_row_up = $value['seats_per_row_up'];
$seats_in_last_row_up = $value['seats_in_last_row_up'];
//Lower seats data
$no_of_seats_low = $value['no_of_seats_low'];
$seats_per_row_low = $value['seats_per_row_low'];
$seats_in_last_row_low = $value['seats_in_last_row_low'];
$lower = $value['vehicle_lower'];
$upper = $value['vehicle_upper'];
if($seat_type === "1"){
$class = "available click";
}else
if($seat_type === "2"){
$class = "available_sl click";
}else
if($seat_type === "3"){
$class = "seater_sl click";
}
$seat_array = "seat_no_".$trip_id."[]";
if($multi_type === "1"){
//Lower
$low_nos = $no_of_seats_low;
$nospr_low = $seats_per_row_low;
$noslr_low = $seats_in_last_row_low;
$seatnocol_low = "";
$fseat_low = $low_nos - $noslr_low;
$totrows_low = $nospr_low+1;
$coldiv_low = ceil($fseat_low / $nospr_low);
$colms_low = $coldiv_low + 1;
$pathrow_low = ceil($nospr_low/2)+1;
if($nospr_low === $noslr_low){
$nocolumn_low = $colms_low * $nospr_low;
}else{
$nocolumn_low = ($colms_low * $nospr_low) + ($noslr_low - $nospr_low);
}
//Upper seats
$nos_up = $no_of_seats_up;
$nospr_up = $seats_per_row_up;
$noslr_up = $seats_in_last_row_up;
$seatnocol = "";
$fseat_up = $nos_up - $noslr_up;
$totrows_up = $nospr_up + 1;
$coldiv_up = ceil($fseat_up / $nospr_up);
$colms_up = $coldiv_up + 1;
$pathrow_up = ceil($nospr_up / 2)+1;
if($nospr_up == $noslr_up){
$nocolumn_up = $colms_up * $nospr_up;
}else{
$nocolumn_up = ($colms_up * $nospr_up) + ($noslr_up - $nospr_up);
}
$seat .= "<table class='table'>
<tr style='background-color: #D8343F;color: #FFFFFF;font-weight:bold;'>
<td style='padding:2px 10px;' class='sb_left'>Your Booking Screen Closes in Next</td>
<td style='padding:2px 10px;' class='sb_right'><span id='showtime$trip_id'>00:00</span> Minutes <span style='display:none' id='timeridold$trip_id'></span></td>
</tr>
</table>
<table cellpadding='2' cellspacing='2'>";
$seat .= "<h5 style='text-align:center;color:#D8343F;font-weight:bold;'>Lower Desk</h5>
<table cellpadding='2' cellspacing='2'>"; ?>
<?php
//$sno = 1;
$nobox = 0;
for($i=1;$i<=$totrows_low;$i++){
if($i == 1){ ?>
<?php $seat .="<tr>
<td style='padding: 2px 0px;' rowspan='$totrows_low' valign='top'><img src='./asset/images/driver.png' width='35' height='35' /></td>"; ?>
<?php for($j=1;$j<=$colms_low;$j++){ ?>
<?php $seat .="<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
}
?>
<?php $seat .="</tr>"; ?>
<?php }
elseif($i == $pathrow_low){
if($nospr_low == $noslr_low){
$colsp = $colms_low;
?>
<?php $seat .="<tr><td colspan='$colsp'>Path Way</td></tr>"; ?>
<?php }else{
$colsp = $colms_low-1;
?>
<?php $seat .="<tr>
<td colspan='$colsp'>Path Way</td>
<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>
</tr>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
}
}else{ ?>
<?php $seat .="<tr>"; ?>
<?php for($j=1;$j<=$colms_low;$j++){ ?>
<?php $seat .="<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
} ?>
<?php $seat .="</tr>"; ?>
<?php }
}
?>
<?php $seat .="</table>
<h5 style='text-align: center; color: #D8343F; font-weight: bold; border-top: 1px dashed #D8343F; margin-top: 15px; padding: 8px;'>Upper Desk</h5>
<table style='margin-left: 8%;width: 92%;' cellpadding='2' cellspacing='2'>"; ?>
<?php
$sno = 1;
$nobox = 0;
for($k=1;$k<=$totrows_up;$k++){
if($k == 1){ ?>
<?php $seat .="<tr>
<td style='padding: 2px;' rowspan='$totrows_up' valign='top'></td>"; ?>
<?php for($l=1;$l<=$colms_up;$l++){ ?>
<?php $seat .="<td><img id='seatno_upper$trip_id' name='seatno_upper[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
}
?>
<?php $seat .="</tr>"; ?>
<?php }
else if($k == $pathrow_up){
if($nospr_up == $noslr_up){
$colsp = $colms_up;
?>
<?php $seat .="<tr><td colspan='$colsp'>Path Way</td></tr>"; ?>
<?php }else{
$colsp = $colms_up - 1;
?>
<?php $seat .="<tr>
<td colspan='<?php echo $colsp?>'>Path Way</td>
<td><img id='seatno_upper$trip_id' name='seatno_upper[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>
</tr>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
}
}else{ ?>
<?php $seat .="<tr>"; ?>
<?php for($l=1;$l<=$colms_up;$l++){ ?>
<?php $seat .="<td><img id='seatno_upper$trip_id' name='seatno_upper[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
} ?>
<?php $seat .="</tr>"; ?>
<?php }
}
?>
<?php $seat .="</table>"; ?>
<?php
}else
if($multi_type === "2"){
$low_nos = $no_of_seats_low;
$nospr_low = $seats_per_row_low;
$noslr_low = $seats_in_last_row_low;
$fseat_low = $low_nos - $noslr_low;
$totrows_low = $nospr_low+1;
$coldiv_low = ceil($fseat_low / $nospr_low);
$colms_low = $coldiv_low + 1;
$pathrow_low = ceil($nospr_low/2)+1;
if($nospr_low === $noslr_low){
$nocolumn = $colms_low * $nospr_low;
}else{
$nocolumn = ($colms_low * $nospr_low) + ($noslr_low - $nospr_low);
}
$seat .= "<table class='table'>
<tr style='background-color: #D8343F;color: #FFFFFF;font-weight:bold;'>
<td style='padding:2px 10px;' class='sb_left'>Your Booking Screen Closes in Next</td>
<td style='padding:2px 10px;' class='sb_right'><span id='showtime$trip_id'>00:00</span> Minutes <span style='display:none' id='timeridold$trip_id'></span></td>
</tr>
</table>
<table cellpadding='2' cellspacing='2'>";
?>
<?php
$nobox = 0;
for($i=1;$i<=$totrows_low;$i++){
if($i == 1){ ?>
<?php
$seat .="<tr>
<td style='padding: 2px 0px;' rowspan='$totrows_low' valign='top'><img src='./asset/images/driver.png' width='35' height='35' /></td>"; ?>
<?php for($j=1;$j<=$colms_low;$j++){ ?>
<?php
$seat .="<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>";
?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
}
?>
<?php $seat .="</tr>"; ?>
<?php }
elseif($i == $pathrow_low){
if($nospr_low == $noslr_low){
$colsp = $colms_low;
?>
<?php $seat .="<tr><td colspan='$colsp'>Path Way</td></tr>"; ?>
<?php }else{
$colsp = $colms_low - 1;
?>
<?php
$seat .="<tr>
<td colspan='$colsp'>Path Way</td>
<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' class='removeseat' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>
</tr>"; ?>
<?php $sno = $sno + 1;
$nobox = $nobox + 1;
}
}else{
$seat .="<tr>"; ?>
<?php for($j=1;$j<=$colms_low;$j++){ ?>
<?php
$seat .="<td><img id='seatno_lower$trip_id' name='seatno_lower[]' class='$class' /><input type='checkbox' name='$seat_array' id='seat_no$trip_id' value='' hidden><span name='seat[]' id='seat$trip_id' style='display: none;'></span></td>"; ?>
<?php $sno = $sno+1;
$nobox = $nobox+1;
} ?>
<?php $seat .="</tr>" ?>
<?php }
}
?>
<?php $seat .="</table>"; ?>
<?php } ?>
<?php
}
echo $seat;
}else
if($frm === "get_vehicle_data"){
if(isset($_POST['vehicle_id'])){
$vehicle_id = $_POST['vehicle_id'];
}
$package_id = $sbltt_session->get_value('package_id');
$package_date = $sbltt_session->get_value('package_date');
if(isset($_POST['trip_id'])){
$trip_id = $_POST['trip_id'];
}
$emp_id = 1;
$seat_qry = "SELECT *,(SELECT GROUP_CONCAT(quseat SEPARATOR ',') from sblttweb_seatquotanew where qupackid ='$package_id' and qupackdate = '$package_date' and quseatstat = '2' and qutripid = '$trip_id') as blocked,(SELECT GROUP_CONCAT(quseat SEPARATOR ',') from sblttweb_seatquotanew where qupackid ='$package_id' and qupackdate = '$package_date' and (quseatstat = '1' or quseatstat = '0') and qutripid = '$trip_id') as active,(SELECT GROUP_CONCAT(quseat SEPARATOR ',') from sblttweb_seatquotanew where qupackid ='$package_id' and qupackdate = '$package_date' and quseatstat = '2' and qutripid = '$trip_id' and qublockuserid = '$emp_id') as b_by_u,(SELECT GROUP_CONCAT(seatno SEPARATOR ',') from sblttweb_passlist inner join sblttweb_ticketorder on sblttweb_ticketorder.orderid = sblttweb_passlist.ticketorderid inner join sblttweb_package on sblttweb_package.package_id = sblttweb_ticketorder.packid where doj = '$package_date' and (passstatus = '0' or passstatus = '2') and sblttweb_passlist.pnrno > 0 and orderstat IN (1,2,4) and otripid = '$trip_id') as booked from sblttweb_vehicle where vehicle_id = '$vehicle_id' and status = '1'";
$db = $dbObject->get_db();
$result_qry = mysqli_query($db,$seat_qry);
$seat_data = $dbObject->result($result_qry);
echo json_encode(array('sts' => TRUE, 'seat_data' =>$seat_data));
}else
if($frm === "save_booked_seat_temp"){
$cust_id = $sbltt_session->get_value('cust_id');
$package_id = $sbltt_session->get_value('package_id');
$package_date = $sbltt_session->get_value('package_date');
if(isset($_POST['trip_id'])){
$trip_id = $_POST['trip_id'];
}
if(isset($_POST['seat_no'])){
$seat_no = $_POST['seat_no'];
}
if(isset($_POST['status'])){
$status = $_POST['status'];
}
if($status === "1"){
$admin_row_qry = $dbObject->query("seatquotanew","qupackid = '$package_id' and qupackdate = '$package_date' and quseat = '$seat_no' and qutripid = '$trip_id' and quseatstat = '2'");
$admin_rows = $dbObject->num_rows($admin_row_qry);
if((int)$admin_rows === 0){
$temp_qry = "INSERT into sblttweb_seattemp(packid,packdate,tseatno,custid,ttim,ttripid) values ('$package_id','$package_date','$seat_no','$cust_id','".date('Y-m-d h:i:s')."','$trip_id')";
$insert_temp = $dbObject->runQuery($temp_qry);
echo json_encode(array('success' => 'unblocked'));
}else{
$row_qry = $dbObject->query("seattemp","packid = '$package_id' and packdate = '$package_date' and tseatno = '$seat_no' and ttripid = '$trip_id'");
$rows = $dbObject->num_rows($row_qry);
if(((int)$admin_rows === 0) && ((int)$rows === 0)){
$temp_qry = "INSERT into sblttweb_seattemp(packid,packdate,tseatno,custid,ttim,ttripid) values ('$package_id','$package_date','$seat_no','$cust_id','".date('Y-m-d h:i:s')."','$trip_id')";
$insert_temp = $dbObject->runQuery($temp_qry);
echo json_encode(array('success' => 'unblocked'));
}else{
echo json_encode(array('success' => 'blocked'));
}
}
}else{
$temp_qry = "DELETE from sblttweb_seattemp where packid = '$package_id' and packdate = '$package_date' and ttripid = '$trip_id' and tseatno in($seat_no)";
$delete_temp = $dbObject->runQuery($temp_qry);
if($delete_temp){
echo json_encode(array('success' => true));
}else{
echo json_encode(array('success' => false));
}
}
}else
if($frm === "get_enqtype_info"){
$dbObject = sblttObject::newObject('sbltt_db');
$engtype_qry = $dbObject->runQuery("select enqcatid,enqcatdetail,enqsubcatdetail from sblttweb_enqcategory where enqcatstatus = 1");
$engtype_rslt = $dbObject->result($engtype_qry);
echo json_encode(array('sts' => TRUE, 'info' =>$engtype_rslt));
}else
if($frm === "save_booking_details"){
$db = $dbObject->get_db();
$cust_id = $sbltt_session->get_value('cust_id');
$package_id = $sbltt_session->get_value('package_id');
$package_date = $sbltt_session->get_value('package_date');
$tariff_calc = $sbltt_session->get_value('tariff_calc');
$tariff = $tariff_calc['tariff'];
$total_tariff = $tariff_calc['total_tariff'];
$total_amt = $tariff_calc['total_tariff'];
$discount = $tariff_calc['disc'];
$discount_per = $tariff_calc['discount'];
if(isset($_POST['trip_id'])){
$trip_id = $_POST['trip_id'];
}
if(isset($_POST['seat_nos'])){
$seat_nos = $_POST['seat_nos'];
}
if(isset($_POST['boarding'])){
$boarding = $_POST['boarding'];
}
if(isset($_POST['pass_name'])){
$pass_name = $_POST['pass_name'];
}
if(isset($_POST['pass_mobile'])){
$pass_mobile = $_POST['pass_mobile'];
}
if(isset($_POST['pass_gender'])){
$pass_gender = $_POST['pass_gender'];
}
if(isset($_POST['pass_age'])){
$pass_age = $_POST['pass_age'];
}
$tariff_type = 0;
if(isset($_POST['tariff_type'])){
$tariff_type = explode("|",$_POST['tariff_type']);
$tariff_type = $tariff_type[1];
}
$nopass = count($seat_nos);
$order_qry = "INSERT into sblttweb_ticketorder(orderdate,packid,doj,custid,nopass,tariff_type,tariffamt,ticketamt,orderstat,discountamt,finalamt,boarding,otripid,paytype,bookedby)values('".date('Y-m-d h:i:s')."','$package_id','$package_date','$cust_id','$nopass','$tariff_type','$tariff','$total_tariff','0','$discount','$total_amt','$boarding','$trip_id','CC','0')";
$insert_order = $dbObject->runQuery($order_qry);
$order_id = mysqli_insert_id($db);
$disc_amt = 0;
$final_tariff = $tariff;
if($discount_per !== "0"){
$disc_amt = ($tariff *($discount_per / 100));
$final_tariff = $tariff - $disc_amt;
}
if($order_id){
$pnr_qry = "INSERT into sblttweb_pnrnogen(pnrdate,custid,packid,orderid)values('".date('Y-m-d h:i:s')."','$cust_id','$package_id','$order_id')";
$insert_pnr = $dbObject->runQuery($pnr_qry);
$pnr = mysqli_insert_id($db);
if($pnr){
$pnr_update_qry = "UPDATE sblttweb_ticketorder SET pnrno = '$pnr' WHERE orderid = '$order_id'";
$update_pnr = $dbObject->runQuery($pnr_update_qry);
}
if($update_pnr){
for($i=0,$j=1; $i<$nopass; $i++,$j++){
$pass_seat = $seat_nos[$i];
$name = $pass_name[$i];
$mobile = $pass_mobile[$i];
$gender = $pass_gender[$i];
$age = $pass_age[$i];
$seatquata_qry = "UPDATE sblttweb_seatquotanew SET orderid = '$order_id',paystatus='2',quseatstat = '4' WHERE qupackid = '$package_id' and qupackdate = '$package_date' and qutripid = '$trip_id' and quseat = '$pass_seat'";
$update_seatquata = $dbObject->runQuery($seatquata_qry);
$pass_qry = "INSERT into sblttweb_passlist(passdate,ticketorderid,pnrno,pslno,passname,passgender,passage,tariffid,tariffamt,discount,discountamt,ticketamt,cashpaid,passstatus,seatno,passmobile,passtripid)values('".date('Y-m-d h:i:s')."','$order_id','$pnr','$j','$name','$gender','$age','$tariff_type','$tariff','$discount_per','$disc_amt','$final_tariff','$final_tariff','0','$pass_seat','$mobile','$trip_id')";
$insert_pass = $dbObject->runQuery($pass_qry);
}
$val_qry = $dbObject->runQuery("SELECT * FROM sblttweb_passlist where pnrno = '$pnr' and ticketorderid = '$order_id'");
$val_count = $dbObject->num_rows($val_qry);
if((int)$val_count === (int)$nopass){
if(isset($_SESSION['orderid'])){
$sbltt_session->set_value("orderid",$order_id);
}else{
$sbltt_session->add_value("orderid",$order_id);
}
if(isset($_SESSION['pnr'])){
$sbltt_session->set_value("pnr",$pnr);
}else{
$sbltt_session->add_value("pnr",$pnr);
}
echo json_encode(array('success' => true,'message'=>'Success','orderid'=>$order_id,'pnr'=>$pnr));
}else{
echo json_encode(array('success' => false,'message'=>'Unable to place your order... Please retry'));
}
}else{
echo json_encode(array('success' => false,'message'=>'Something went wrong... Please retry'));
}
}else{
echo json_encode(array('success' => false,'message'=>'Unable to place your order... Please retry'));
}
}else
if($frm === "clear_booked_seat_temp"){
$cust_id = $sbltt_session->get_value('cust_id');
$delete_qry = "DELETE from sblttweb_seattemp where custid = '$cust_id'";
$db = $dbObject->get_db();
$delete_temp = mysqli_query($db,$delete_qry);
if($delete_temp){
echo json_encode(array('success' => true));
}else{
echo json_encode(array('success' => false));
}
}else
if($frm === "get_package_details"){
if(isset($_POST['package_id'])){
$package_id = $_POST['package_id'];
}
$pack_qry = $dbObject->runQuery("SELECT * from sblttweb_vehicletrips inner join sblttweb_package on sblttweb_vehicletrips.trippackid = package_id inner join sblttweb_vehicle on sblttweb_vehicle.vehicle_id = sblttweb_vehicletrips.vehicleid inner join sblttweb_veh_type on veh_type_id = vehicle_type where package_id = '$package_id'");
$pack_data = $dbObject->result($pack_qry);
$packcount = count((array)$pack_data);
$trip_line = "";
for($i=0; $i< $packcount; $i++){
$package_title = $pack_data[$i]->package_title;
$package_title2 = $pack_data[$i]->package_title2;
$duration = $pack_data[$i]->duration;
$tripcode = $pack_data[$i]->tripcode;
$veh_type = $pack_data[$i]->veh_type;
$vehiclemodel = $pack_data[$i]->vehiclemodel;
$trip_line .= "<tr><td>$package_title $package_title2</td><td>$tripcode</td><td>$duration</td><td>$veh_type $vehiclemodel</td></tr>";
}
$board_qry = $dbObject->runQuery("SELECT * FROM sblttweb_boarding inner join sblttweb_boarding_point on sblttweb_boarding_point.board_point_id = sblttweb_boarding.board_point_id where sblttweb_boarding.package_id = '$package_id' and sblttweb_boarding.status = '1' order by sblttweb_boarding.dep_time ASC");
$board_data = $dbObject->result($board_qry);
$boardcount = count((array)$board_data);
$board_line = "";
for($i=0; $i< $boardcount; $i++){
$board_name = $board_data[$i]->boarding_name;
$dep_time = $board_data[$i]->dep_time;
$board_line .= "<tr><td>$board_name</td><td>$dep_time</td></tr>";
}
$tariff_qry = $dbObject->runQuery("SELECT * FROM sblttweb_packcost inner join sblttweb_package_type on sblttweb_package_type.package_type_id = sblttweb_packcost.packtypeid where sblttweb_packcost.packid = '$package_id' and pcoststatus = '1'");
$tariff_data = $dbObject->result($tariff_qry);
$tariffcount = count((array)$tariff_data);
$tariff_line = "";
for($i=0; $i< $tariffcount; $i++){
$package_type = $tariff_data[$i]->package_type;
$pamount = $tariff_data[$i]->pamount;
$tariff_line .= "<tr><td>$package_type</td><td>$pamount</td></tr>";
}
$details_qry = $dbObject->runQuery("SELECT * from sblttweb_package inner join sblttweb_itinerary on itpackid = package_id where package_id = '$package_id'");
$it_data = $dbObject->result($details_qry);
$count = count((array)$it_data);
$tr_line = "";
$j=1;
for($i=0; $i< $count; $i++){
$itday = $it_data[$i]->itday;
$itdaydetail = $it_data[$i]->itdaydetail;
$itnight = $it_data[$i]->itnight;
$tr_line .= "<tr><td>$j</td><td>$itday</td><td>$itdaydetail</td><td>$itnight</td></tr>";
$j++;
}
$package_qry = $dbObject->runQuery("SELECT cancelfee from sblttweb_package where package_id = '$package_id'");
$result = $dbObject->result($package_qry);
$cancelfee = $result[0]->cancelfee;
$cancel_qry = $dbObject->runQuery("SELECT * from sblttweb_cancelfee where FIND_IN_SET(cancelfeeid, '$cancelfee')");
$cancelfee_data = $dbObject->result($cancel_qry);
$count = count((array)$cancelfee_data);
$fee_line = "";
for($i=0; $i< $count; $i++){
$cancelfeedetail = $cancelfee_data[$i]->cancelfeedetail;
$cancelfees = $cancelfee_data[$i]->cancelfees;
$fee_line .= "<tr><td>$cancelfeedetail</td><td>$cancelfees %</td></tr>";
}
echo "<div class='pack_info_class'>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<h3 style='font-weight:bold';>Trip Details</h3>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>Package Name</th>
<th class='sb_center'>Trip Code</th>
<th class='sb_center'>Duration</th>
<th class='sb_center'>Vehicle Type</th>
</tr>
</thead>
<tbody>
$trip_line
</tbody>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<h3>Itinerary Details</h3>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>SNo</th>
<th class='sb_center'>Day</th>
<th class='sb_center'>Details</th>
<th class='sb_center'>Night</th>
</tr>
</thead>
<tbody>
$tr_line
</tbody>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<h3>Boarding Details</h3>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>Boarding Name</th>
<th class='sb_center'>Departure Time</th>
</tr>
</thead>
<tbody>
$board_line
</tbody>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<h3>Tariff Details</h3>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>Tariff</th>
<th class='sb_center'>Cost</th>
</tr>
</thead>
<tbody>
$tariff_line
</tbody>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<h3>Cancellation Charges</h3>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>Detail</th>
<th class='sb_center'>Fees</th>
</tr>
</thead>
<tbody>
$fee_line
</tbody>
</table>
<p style='font-weight:bold;margin-top: 10px;font-size: 12px;'> Terms & Conditions of E-Ticketing services </p>
<ul style='line-height: 22px;font-size: 12px;'>
<li> The tickets booked are cancelable. Kindly note that once cancelled the money is transferred back to the respective credit/debit card. </li>
<li> The cancellation fee: Between 24 hours to 14 days before journey the cancellation charge is 50%. </li>
<li> After 14 days before journey the cancellation charge is 10%.Please note that the cancellation fee and cancellation period may differ from one package to another.</li>
<li> Please contact any of our executives for complete details or enter your ticket number on the print ticket tab to read the cancellation policy for your ticket.</li>
<li> The transaction charges or the home/courier delivery charges will not be refunded in the event of ticket cancellation. </li>
<li> In case a booking confirmation e-mail and sms gets delayed or fails because of technical reasons or as a result of incorrect e-mail ID / phone number provided by the user etc, a ticket will be considered 'booked' as long as the ticket shows up on the confirmation page of www.sblt.co.in </li>
<li> In case of any clarifications, please write to tours@sblt.co.in </li>
</ul>
</div>";
}else
if($frm === "get_tickets"){
if(isset($_POST['orderid'])){
$orderid = $_POST['orderid'];
}
$ticket_qry = $dbObject->runQuery("SELECT sblttweb_passlist.passid,sblttweb_passlist.pnrno,sblttweb_ticketorder.orderid,sblttweb_ticketorder.orderdate,sblttweb_ticketorder.doj,sblttweb_ticketorder.nopass,sblttweb_boarding_point.boarding_name,sblttweb_boarding.dep_time,sblttweb_ticketorder.custid,sblttweb_package.package_title,sblttweb_package.package_title2,sblttweb_package.package_title3,sblttweb_passlist.passname,sblttweb_passlist.passgender,sblttweb_passlist.passage,sblttweb_passlist.seatno,sblttweb_passlist.passtripid,sblttweb_passlist.passstatus,sblttweb_ticketorder.packid,sblttweb_passlist.cashpaid,sblttweb_passlist.discount,sblttweb_passlist.tariffamt,sblttweb_passlist.ticketamt,sblttweb_package.cancelfee,sblttweb_passlist.discount AS discount FROM sblttweb_passlist INNER JOIN sblttweb_ticketorder ON sblttweb_ticketorder.orderid = sblttweb_passlist.ticketorderid INNER JOIN sblttweb_package ON sblttweb_package.package_id = sblttweb_ticketorder.packid INNER JOIN sblttweb_boarding ON boarding_id = sblttweb_ticketorder.boarding INNER JOIN sblttweb_boarding_point ON sblttweb_boarding_point.board_point_id = sblttweb_boarding.board_point_id WHERE ticketorderid = '$orderid' group by sblttweb_passlist.passid");
$i = 1;
$cancelfees = 0;
$tr_line = "";
$ticket_rslt = $dbObject->result($ticket_qry);
foreach($ticket_rslt as $rslt){
$passid = $rslt->passid;
$pnrno = $rslt->pnrno;
$orderid = $rslt->orderid;
$order_date = date("d-M-Y",strtotime($rslt->orderdate));
$pack_date = date("d-M-Y",strtotime($rslt->doj));
$order = $rslt->orderdate;
$package_date = $rslt->doj;
$nopass = $rslt->nopass;
$boarding = $rslt->boarding_name;
$dep_time = $rslt->dep_time;
$custid = $rslt->custid;
$package_title = $rslt->package_title;
$package_title2 = $rslt->package_title2;
$package_title3 = $rslt->package_title3;
$passname = $rslt->passname;
$passgender = $rslt->passgender;
$passage = $rslt->passage;
$seatno = $rslt->seatno;
$passtripid = $rslt->passtripid;
$passstatus = $rslt->passstatus;
$packid = $rslt->packid;
if(isset($_SESSION['package_id'])){
$sbltt_session->set_value("package_id",$packid);
}else{
$sbltt_session->add_value("package_id",$packid);
}
$cashpaid = $rslt->cashpaid;
$discount = $rslt->discount;
$tariffamt = $rslt->tariffamt;
$ticketamt = $rslt->ticketamt;
$cancelfee = $rslt->cancelfee;
$pack_name = $package_title." ".$package_title2." ".$package_title3;
// if($discount !== "0"){
// $disc = ($tariffamt * ($discount / 100));
// $tariffamt = $tariffamt - $disc;
// }
//Cancel Fees Calculation
$today = date('Y-m-d');
$day_diff = strtotime($pack_date) - strtotime($today);
$days = floor($day_diff / 86400);
$cancel_qry = $dbObject->runQuery("SELECT cancelfees from sblttweb_cancelfee where cancelmindays <= ".$days." and cancelmaxdays >= ".$days." and cancelfeeid in (".$cancelfee.")");
$can_rslt = $dbObject->result($cancel_qry);
if($can_rslt){
$cancelfees = $can_rslt[0]->cancelfees;
}
$fees = ($ticketamt * ($cancelfees / 100));
if($cancelfees === 0){
$fees = 0;
}
$refund = $cashpaid - $fees;
if($days < 0){
$btn = "<span style='color:green;'>Journey Day Completed</span>";
}else{
$btn = "<button class='btn btn-danger btn-sm' id='cancelbtn$passid' onclick=cancel_ticket($passid,$orderid,$seatno,$passtripid,$cancelfees,$fees,$refund,'$order',$pnrno,$custid,$tariffamt,$cashpaid);>Cancel Ticket</button>";
}
$cancel_text = "-";
if($passstatus === "1"){
$btn = "<span style='color:red;'>Ticket Cancelled</span>";
$cancel_info = $dbObject->runQuery("SELECT * FROM `sblttweb_cancelorder` inner join sblttweb_passlist on ticketorderid = bookorderid where passid = '$passid' and bookorderid = '$orderid'");
$cancel_rslt = $dbObject->result($cancel_info);
$cancel_id = $cancel_rslt[0]->orderid;
$refund_sts = $cancel_rslt[0]->refundstatus;
$refund_text = "On process";
if((int)$refund_sts === 1){
$refund_text = "Refunded";
}
$cancel_text = "$cancel_id / $refund_text";
}else{
if($package_date > $today){
$btn = "<button class='btn btn-danger btn-sm' id='cancelbtn$passid' onclick=cancel_ticket($passid,$orderid,$seatno,$passtripid,$cancelfees,$fees,$refund,'$order',$pnrno,$custid,$tariffamt,$cashpaid);>Cancel Ticket</button>";
}else{
$btn = "<span style='color:red;'>Journey Day Completed</span>";
}
}
$tr_line .= "<tr>
<td class='sb_center'>$i</td>
<td class='sb_center'>$passname</td>
<td class='sb_center'>$passgender</td>
<td class='sb_center'>$passage</td>
<td class='sb_center'>$seatno</td>
<td class='sb_center'>$ticketamt</td>
<td class='sb_center'>$cashpaid</td>
<td style='text-align:center;color:red;'>$fees</td>
<td class='sb_center' id='refund'>$refund</td>
<td class='sb_center'>$cancel_text</td>
<td class='sb_center'>$btn</td>
</tr>";
$i++;
}
if($tr_line){
echo "<div class='col-md-12 cancel_bg' style='padding:8px;'>
<div class='row'>
<div class='col-md-12 cancel_book_info'>
<h5> Booked Ticket Information</h5>
<table class='table table-bordered'>
<tr>
<td class='sb_nowrap'>Package Name</td>
<td class='sb_bold' colspan='3'>$pack_name</td>
<td class='sb_nowrap'>Boarding Point</td>
<td class='sb_bold'>$boarding</td>
</tr>
<tr>
<td>PNR No</td>
<td class='sb_bold'>$pnrno</td>
<td>Date of Journey</td>
<td class='sb_bold'>$pack_date</td>
<td>Date of Booking</td>
<td class='sb_bold'>$order_date</td>
</tr>
</tr>
<td>Ticket No</td>
<td class='sb_bold'>$orderid</td>
<td>No of Passengers</td>
<td class='sb_bold'>$nopass</td>
<td>Departure Time</td>
<td class='sb_bold'>$dep_time</td>
</tr>
<tr><td colspan='6' class='sb_bold sb_color sb_center'>Cancel Charges : $cancelfees % of Ticket Amount</td></tr>
</table>
<div class='col-md-12 split mgb15'></div>
<table id='detail_list' class='table table-hover table-striped col-style'>
<thead>
<tr class='th_background'>
<th class='sb_center'>SNo</th>
<th class='sb_center'>Passenger Name</th>
<th class='sb_center'>Gender</th>
<th class='sb_center'>Age</th>
<th class='sb_center'>Seat No</th>
<th class='sb_center'>Ticket Amount </th>
<th class='sb_center'>Cash Paid</th>
<th class='sb_center'>Cancelation Fees </th>
<th class='sb_center'>Refund Amount </th>
<th class='sb_center'>Cancel Id / Refund Status</th>
<th class='sb_center'>Operations</th>
</tr>
</thead>
<tbody>
$tr_line
</tbody>
</table>
</div>
</div>
</div>";
}else{
echo"<tr><td> No Data Available</td></tr>";
}
}else
if($frm === "cancel_ticket"){
if(isset($_POST['passid'])){
$passid = $_POST['passid'];
}
if(isset($_POST['orderid'])){
$orderid = $_POST['orderid'];
}
if(isset($_POST['seatno'])){
$seatno = $_POST['seatno'];
}
if(isset($_POST['passtripid'])){
$passtripid = $_POST['passtripid'];
}
if(isset($_POST['can'])){
$can = $_POST['can'];
}
if(isset($_POST['fees'])){
$fees = $_POST['fees'];
}
if(isset($_POST['refund'])){
$refund = $_POST['refund'];
}
if(isset($_POST['orderdate'])){
$orderdate = date("Y-m-d",strtotime($_POST['orderdate']));
}
if(isset($_POST['pnrno'])){
$pnrno = $_POST['pnrno'];
}
if(isset($_POST['custid'])){
$custid = $_POST['custid'];
}
if(isset($_POST['tariff'])){
$tariff = $_POST['tariff'];
}
if(isset($_POST['paid'])){
$paid = $_POST['paid'];
}
$package_id = $sbltt_session->get_value('package_id');
$package_date = $sbltt_session->get_value('package_date');
$db = $dbObject->get_db();
$cancel_order_qry = $dbObject->runQuery("INSERT into sblttweb_cancelorder(pass_id,bookorderid,orderdate,cancel_date,pnrno,packid,doj,custid,nopass,ticketamt,cancelfee,cancelamt,refundamt,cashpaid)values('$passid','$orderid','$orderdate','".date("Y-m-d h:i:s")."','$pnrno','$package_id','$package_date','$custid','1','$tariff','$can','$fees','$refund','$paid')");
$can_order_id = mysqli_insert_id($db);
if($can_order_id){
$pass_qry = $dbObject->runQuery("UPDATE sblttweb_passlist SET passstatus = '1',cancelfee='$can',cancelamt = '$fees',ticketrefundamt='$refund',cashcancelamt='$fees',cashrefundamt='$refund',fincashrefundamt='$refund',cancelorderid='$can_order_id' WHERE passid = '$passid'");
}
if($pass_qry){
$cust_info = $dbObject->query("customers","custid='$custid'","custphone");
$cust_rslt = $dbObject->result($cust_info);
$mobile = $cust_rslt[0]->custphone;
if($mobile){
$sbltt_sms = sblttObject::newObject('sbltt_sms');
$sbltt_sms->send_sms($mobile,$can_order_id,"cancelled");
}
echo json_encode(array('status' => TRUE, 'success' =>"Ticket Cancelled Successfully"));
}else{
echo json_encode(array('status' => FALSE, 'success' =>"Try After Sometime..."));
}
}else
if($frm === "print_ticket"){
if(isset($_POST['orderid'])){
$orderid = $_POST['orderid'];
}
if(isset($_POST['misc'])){
$misc = $_POST['misc'];
}
$ticket_qry = $dbObject->runQuery("SELECT *,sblttweb_passlist.discount as discount,sblttweb_passlist.tariffamt as tariffamt,sblttweb_passlist.ticketamt as ticketamt,sblttweb_passlist.discountamt as discountamt,sblttweb_passlist.admin_discount as admin_discount,sblttweb_passlist.admin_discountamt as admin_discountamt,sblttweb_passlist.cashpaid as cashpaid,sblttweb_passlist.cashdue as cashdue from sblttweb_passlist inner join sblttweb_ticketorder on sblttweb_ticketorder.orderid = sblttweb_passlist.ticketorderid inner join sblttweb_package on sblttweb_package.package_id = sblttweb_ticketorder.packid inner join sblttweb_boarding on boarding_id = sblttweb_ticketorder.boarding inner join sblttweb_boarding_point on sblttweb_boarding_point.board_point_id = sblttweb_boarding.board_point_id inner join sblttweb_customers on sblttweb_customers.custid = sblttweb_ticketorder.custid where ticketorderid = '$orderid' and (sblttweb_passlist.passstatus = '0' or sblttweb_passlist.passstatus = '2')");
$i = 1;
$j=0;
$tr_line = "";
$cashpaid = 0;
$tariffamt = 0;
$discountamt = 0;
$ticketamt = 0;
$admin_discountamt = 0;
$cashdue = 0;
$admin_tr = "";
$disc_tr = "";
while($rslt = mysqli_fetch_array($ticket_qry)){
$passid = $rslt['passid'];
$pnrno = $rslt['pnrno'];
$orderid = $rslt['orderid'];
$order_date = date("d-M-Y",strtotime($rslt['orderdate']));
$pack_date = date("d-M-Y",strtotime($rslt['doj']));
$order = $rslt['orderdate'];
$package_date = $rslt['doj'];
$nopass = $rslt['nopass'];
$boarding = $rslt['boarding_name'];
$dep_time = $rslt['dep_time'];
$custid = $rslt['custid'];
$custemail = $rslt['custemail'];
$package_title = $rslt['package_title'];
$package_title2 = $rslt['package_title2'];
$package_title3 = $rslt['package_title3'];
$cancelfee = $rslt['cancelfee'];
$servicetax = $rslt['servicetax'];
$passname = $rslt['passname'];
$passgender = $rslt['passgender'];
$passage = $rslt['passage'];
$seatno = $rslt['seatno'];
$passtripid = $rslt['passtripid'];
$packid = $rslt['packid'];
$cashpaid += $rslt['cashpaid'];
$cashdue += $rslt['cashdue'];
$discount = $rslt['discount'];
$admin_discount = $rslt['admin_discount'];
//$tariffamt += $rslt['tariffamt'];
$discountamt += $rslt['discountamt'];
$tariffamt += $rslt['tariffamt'];
$admin_discountamt += $rslt['admin_discountamt'];
$ticketamt += $rslt['ticketamt'];
$passmobile = $rslt['passmobile'];
$pack_name = $package_title." ".$package_title2." ".$package_title3;
$tr_line .= "<tr>
<td>$i</td>
<td>$passname</td>
<td>$passgender</td>
<td>$passmobile</td>
<td>$passage</td>
<td>$seatno</td>
</tr>";
$i++;
$j++;
}
//$ticketamt = round(($ticketamt - $admin_discountamt),0);
//GST Calculations
if((int)$servicetax < 10){
$servicetax = "0".$servicetax;
}
$gst = "1.".$servicetax;
$act_amt = round(($ticketamt / $gst));
$tot_gst = round(($ticketamt - $act_amt));
$gst_split = ($tot_gst / 2);
$servicetax = (int)$servicetax;
//echo "act_amt : $act_amt :: tot_gst : $tot_gst :: gst_split :: $gst_split";
//Get Cancel Fees Details
$cancel_qry = $dbObject->runQuery("SELECT * from sblttweb_cancelfee where FIND_IN_SET(cancelfeeid, '$cancelfee')");
$cancelfee_data = $dbObject->result($cancel_qry);
$count = count((array)$cancelfee_data);
$fee_line = "";
for($i=0; $i< $count; $i++){
$cancelfeedetail = $cancelfee_data[$i]->cancelfeedetail;
$cancelfees = $cancelfee_data[$i]->cancelfees;
$fee_line .= "<li>If the Ticket is Cancelled $cancelfeedetail then the Cancel Fees will be $cancelfees % From the Ticket Amount</li>";
}
if((int)$admin_discount > 0){
$admin_tr = "<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Company Discount Total</td>
<td style='text-align:right;font-weight:bold;'>$admin_discountamt</td>
</tr>";
}
if((int)$discountamt > 0){
$disc_tr = "<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Package Discount</td>
<td style='text-align:right;font-weight:bold;'>$discount%</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Discount Total</td>
<td style='text-align:right;font-weight:bold;'>$discountamt</td>
</tr>";
}
$details = "<div style='width:750px; margin-left: auto; margin-right: auto; padding: 15px; background-color: #EEEEEE; border-radius: 3px;border:1px solid #CCCCCC;'>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<tr>
<td style='border-bottom:0px;border-right: 0px;'>
<img src='./asset/images/sbltt_batch.png' alt='sbltt'>
</td>
<td style='border-bottom:0px;border-left: 0px;'>
<table style='text-align: center; width: 100%;'>
<tr>
<td>
<h3 style='color:#d3434d;margin:10px;font-size:17px;font-weight:bold;'>Sri Bhagiyalakshmi Tours and Travels</h3>
</td>
</tr>
<tr>
<td>
Plot No.1310, 13th Main Road, Anna Nagar,
</td>
</tr>
<tr>
<td>
Opp : Anna Nagar West Depot, Chennai - 600040.
</td>
</tr>
<tr>
<td>
Phone : 044 - 4666 4666 / Mobile : 98416 99966
</td>
</tr>
<tr>
<td>
Website : www.sblt.co.in / E-mail : tours@sblt.co.in
</td>
</tr>
</table>
</td>
</tr>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;font-size: 12px;background-color:#FFFFFF;' border='1' cellspacing='0' cellpadding='4' >
<tr>
<td style='white-space: nowrap;'>Package Name</td>
<td style='font-weight: bold;' colspan='3'>$pack_name</td>
<td style='white-space: nowrap;'>Boarding Point </td>
<td style='font-weight: bold;'>$boarding</td>
</tr>
<tr>
<td style='white-space: nowrap;'>PNR No</td>
<td style='font-weight: bold;'>$pnrno</td>
<td style='white-space: nowrap;'>Date of Journey</td>
<td style='font-weight: bold;'>$pack_date</td>
<td style='white-space: nowrap;'>Date of Booking</td>
<td style='font-weight: bold;'>$order_date</td>
</tr>
<tr>
<td style='white-space: nowrap;border-bottom:0px;'>Ticket No</td>
<td style='border-bottom:0px;font-weight: bold;'>$orderid</td>
<td style='white-space: nowrap;border-bottom:0px;'>No of Passengers</td>
<td style='border-bottom:0px;font-weight: bold;'>$j</td>
<td style='white-space: nowrap;border-bottom:0px;'>Departure Time</td>
<td style='border-bottom:0px;font-weight: bold;'>$dep_time</td>
</tr>
</table>
<table style='width:100%;border-collapse: collapse;border-spacing: 0;border-color: #CCCCCC !important;border: 0px;text-align: center;font-size: 12px; background-color: #FFFFFF;' border='1' cellspacing='0' cellpadding='4'>
<thead>
<tr style='background-color:#d3434d;color:#FFFFFF;'>
<th class='sb_center'>SNo</th>
<th class='sb_center'>Passenger Name</th>
<th class='sb_center'>Gender</th>
<th class='sb_center'>Mobile</th>
<th class='sb_center'>Age</th>
<th class='sb_center'>Seat No</th>
</tr>
</thead>
<tbody>
$tr_line
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Total Package Amount</td>
<td style='text-align:right;font-weight:bold;'>$tariffamt</td>
</tr>
$disc_tr
$admin_tr
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Actual Ticket Amount</td>
<td style='text-align:right;font-weight:bold;'>$act_amt</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Total GST(%)</td>
<td style='text-align:right;font-weight:bold;'>$servicetax(%)</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>CGST</td>
<td style='text-align:right;font-weight:bold;'>$gst_split</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>SGST</td>
<td style='text-align:right;font-weight:bold;'>$gst_split</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Ticket Amount</td>
<td style='text-align:right;font-weight:bold;'>$ticketamt</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Amount Paid</td>
<td style='text-align:right;font-weight:bold;'>$cashpaid</td>
</tr>
<tr>
<td style='text-align:right;font-weight:bold;' colspan='5'>Balance Amount</td>
<td style='text-align:right;font-weight:bold;'>$cashdue</td>
</tr>
</tbody>
</table>
<p style='margin-top: 10px;font-size: 12px;'> For details, rules and terms & conditions of E-Ticketing services, please visit www.sblt.co.in
</p>
<h5 style='font-weight:bold;''>Cancellation Policy:</h5>
<ul style='line-height: 30px;font-size: 12px;'>
<li> The tickets booked are cancelable. Kindly note that once cancelled the money is transferred back to the respective credit/debit card. </li>
$fee_line
<li> Please contact any of our executives for complete details or enter your ticket number on the print ticket tab to read the cancellation policy for your ticket.</li>
<li> The transaction charges or the home/courier delivery charges will not be refunded in the event of ticket cancellation. </li>
<li> In case a booking confirmation e-mail and sms gets delayed or fails because of technical reasons or as a result of incorrect e-mail ID / phone number provided by the user etc, a ticket will be considered 'booked' as long as the ticket shows up on the confirmation page of www.sblt.co.in </li>
<li> In case of any clarifications, please write to tours@sblt.co.in </li>
</ul>
</div>";
if($misc === "email"){
//Send mail to customer
if(!empty($custemail)){
require('../phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com"; // Your SMTP PArameter
$mail->Port = 587; // Your Outgoing Port
$mail->SMTPAuth = true; // This Must Be True
$mail->Username = "webadmin@sblt.co.in"; // Your Email Address
$mail->Password = "webadmin123"; // Your Password
$mail->SMTPSecure = 'tls'; // Check Your Server's Connections for TLS or SSL
$mail->From = 'tours@sblt.co.in';
$mail->FromName = 'tours@sblt.co.in';
$mail->AddAddress($custemail);
$mail->IsHTML(true);
$mail->Subject="Ticket Details for Order No $orderid";
$mail->Body=$details;
$mail=$mail->Send();
//End Send mail to customer
echo json_encode(array('status' => TRUE, 'success' =>"Mail sent Successfully"));
}else{
echo json_encode(array('status' => False, 'success' =>"Server Error!"));
}
}else{
echo $details;
}
}else
if($frm === "get_calculation"){
$discount = $sbltt_session->get_value('discount');
$amt = 0;
$disc = 0;
if(isset($_POST['tariff'])){
$tariff = $_POST['tariff'];
}
if(isset($_POST['trip_id'])){
$trip_id = $_POST['trip_id'];
}
if(isset($_POST['tickets'])){
$tickets = $_POST['tickets'];
}
if($tariff){
$tariff_amt = explode('|', $tariff);
$amt = $tariff_amt[0];
}
$total_tariff = $tickets * $amt;
if($discount !== 0){
$disc = ($total_tariff * ($discount/100));
$total_tariff = $total_tariff - $disc;
}
$ticket_array = array('discount'=>$discount,'total_tariff'=> $total_tariff,'tariff' =>$amt,'disc'=>$disc);
if(isset($_SESSION['tariff_calc'])){
unset($_SESSION['tariff_calc']);
}
$sbltt_session->add_value("tariff_calc",$ticket_array);
if($ticket_array){
echo json_encode(array('status' => TRUE, 'ticket_array' =>$ticket_array));
}
}else
if($frm === "save_feedback_info"){
$feed_info = $dbObject->runQuery("SELECT * from sblttweb_feedback where enteredbyid = '".$_POST['custid']."' and packageid = '".$_POST['packid']."' and tourdate = '".date("Y-m-d",strtotime($_POST['trip_date']))."'");
$feed_rows = $dbObject->num_rows($feed_info);
if($feed_rows === 0){
$qry = "INSERT into sblttweb_feedback(feedbackdate,custname,mobile,email,packageid,tourdate,driver,vehicle,food,accom,overall,other,enteredby,enteredbyid) values ('".date('Y-m-d h:i:s')."','".$_POST['custname']."','".$_POST['custmobile']."','".$_POST['custemail']."','".$_POST['packid']."','".date("Y-m-d",strtotime($_POST['trip_date']))."','".$_POST['driver']."','".$_POST['vehicle']."','".$_POST['food']."','".$_POST['accomodation']."','".$_POST['overall']."','".$_POST['comments']."',0,'".$_POST['custid']."')";
$insert_qry = $dbObject->runQuery($qry);
if($insert_qry){
$email_content = "<div style='width: 750px; margin-left: auto; margin-right: auto; padding: 15px; background-color: #EEEEEE; border-radius: 3px; box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);'>
<h1 style='text-align: center;color:#D8343F;'>Feedback</h1>
<p style='text-align:left;'>
Feedback Received from '".$_POST['custname']."'
</p>
<table><tbody>
<tr><td>Comments</td><td>: '".$_POST['comments']."'</td></tr>
</tbody></table>
</div>";
//Email Send to Admin
$email_data = array(
'to_email' => '',
'admin_email' => $admin_email,
'subject' => "Customer Feedback",
'email_content' => $email_content,
);
$libObject = sblttObject::newObject('sbltt_db');
$libObject->send_mail($email_data,"customer");
if($_POST['custmobile']){
$sbltt_sms = sblttObject::newObject('sbltt_sms');
$sbltt_sms->send_sms($_POST['custmobile'],'feedback',"feedback");
}
echo json_encode(array('status' => TRUE, 'message' =>'Feedback Saved Successfully'));
}else{
echo json_encode(array('status' => FALSE, 'message' =>'Please Try after Sometime...'));
}
}else{
echo json_encode(array('status' => TRUE, 'message' =>"You Already Submit the Feedback for this Trip"));
}
}else{
echo json_encode(array('sts' => FALSE, 'info' =>"Invalid Request"));
}
?>