Recorrect trip plan

parent da55e731
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -192,34 +192,40 @@
$start_date = $ini_start_date;
$end_date = $ini_end_date;
$start_time = '05:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
for($c = $start_location; $c >= $last_railway_stop; $c--) {
$sql13 = "SELECT * FROM `train_times` WHERE `lineno` = '$now_line_no' AND `trainno` = '$c' AND dirId ='f' ORDER BY `arrival` ASC";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$all_times = array();
while($row13 = mysqli_fetch_array($result13)) {
$time_arrival = $row13['arrival'];
$train_id = $row13['id'];
$time_arrival = strtotime($time_arrival);
$start_time = strtotime($start_time);
if($time_arrival > $start_time){
array_push($all_times,$train_id);
$sql15 = "SELECT * FROM visitplacetemp WHERE placeTrainNo = '$c' AND logUserid = $logUserid ";
$result15 = mysqli_query($con,$sql15) or die(mysqli_error($con));
$rowcount15 = mysqli_num_rows($result15);
$row15 = mysqli_fetch_assoc($result15);
if($c == $start_location){
//Colombo fort to relevent Location
echo $start_date_time ."<br>";
$start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
} else if($rowcount15 > 0) {
// Place to place
echo $start_date_time ."<br>";
$start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
}else {
continue;
}
}
$get_best_train_id = $all_times[0];
?>
$sql14 = "SELECT * FROM `train_times` WHERE id = '$get_best_train_id' ";
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con));
$row14 = mysqli_fetch_assoc($result14);
echo $tra_train_name = $row14['trainname'];
$tra_train_arrival = $row14['arrival'];
$tra_train_dep = $row14['dep'];
</tbody>
</table>
</div>
$start_time = $tra_train_dep;
}
<?php
......
......@@ -123,8 +123,9 @@
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
alert(req.responseText);
// alert(req.responseText);
console.log(req.responseText);
document.getElementById(`collapseOne`).innerHTML = req.responseText;
}
}
}
......@@ -505,7 +506,7 @@
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
<!-- <div class="card-body">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
......@@ -530,7 +531,7 @@
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Locations
</button>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
......@@ -570,53 +571,12 @@
</div>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td> Night Mail </td>
<td>Haputhale</td>
<td>08/26/2021 <br> 06:10</td>
<td>Ellass</td>
<td>08/26/2021 <br> 07:10</td>
<td>08/26/2021 <br> 15:00</td>
<td>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Locations
</button>
</td>
</tr>
<tr>
<td> Podi Manike </td>
<td>Ella</td>
<td>08/26/2021 <br> 16:00</td>
<td>Badulla</td>
<td>08/26/2021 <br> 17:00</td>
<td>08/26/2021 <br> 18:00</td>
<td>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Locations
</button>
</td>
</tr>
<tr>
<td> Night Mail </td>
<td>Badulla</td>
<td>08/26/2021 <br> 18:00</td>
<td>Colombo Fort</td>
<td>08/27/2021 <br> 05:00</td>
<td>08/27/2021 <br> 05:00</td>
<td>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Locations
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div> -->
</div>
</div>
<div class="card">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment