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,35 +192,41 @@ ...@@ -192,35 +192,41 @@
$start_date = $ini_start_date; $start_date = $ini_start_date;
$end_date = $ini_end_date; $end_date = $ini_end_date;
$start_time = '05:00:00'; $start_time = '05:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
for($c = $start_location; $c >= $last_railway_stop; $c--) { 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);
}
}
$get_best_train_id = $all_times[0]; $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);
$sql14 = "SELECT * FROM `train_times` WHERE id = '$get_best_train_id' "; if($c == $start_location){
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con)); //Colombo fort to relevent Location
$row14 = mysqli_fetch_assoc($result14); echo $start_date_time ."<br>";
$start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
echo $tra_train_name = $row14['trainname']; } else if($rowcount15 > 0) {
$tra_train_arrival = $row14['arrival']; // Place to place
$tra_train_dep = $row14['dep']; echo $start_date_time ."<br>";
$start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
$start_time = $tra_train_dep; }else {
continue;
}
} }
?>
</tbody>
</table>
</div>
<?php
......
...@@ -123,8 +123,9 @@ ...@@ -123,8 +123,9 @@
req.onreadystatechange = function() { req.onreadystatechange = function() {
if (req.readyState == 4) { if (req.readyState == 4) {
if (req.status == 200) { if (req.status == 200) {
alert(req.responseText); // alert(req.responseText);
console.log(req.responseText); console.log(req.responseText);
document.getElementById(`collapseOne`).innerHTML = req.responseText;
} }
} }
} }
...@@ -505,7 +506,7 @@ ...@@ -505,7 +506,7 @@
</div> </div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample"> <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"> <table class="table table-bordered">
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
...@@ -530,93 +531,52 @@ ...@@ -530,93 +531,52 @@
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Locations Locations
</button> </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-dialog modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Location List</h5> <h5 class="modal-title" id="exampleModalLabel">Location List</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-bordered"> <table class="table table-bordered">
<thead class="thead-light"> <thead class="thead-light">
<tr> <tr>
<th>Location</th> <th>Location</th>
<th scope="col">Category</th> <th scope="col">Category</th>
<th scope="col">Estimate Time</th> <th scope="col">Estimate Time</th>
<th scope="col">Google Map</th> <th scope="col">Google Map</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> Adisham Bungalow </td> <td> Adisham Bungalow </td>
<td>Mountain</td> <td>Mountain</td>
<td>2 hour</td> <td>2 hour</td>
<td><button class="btn btn-primary"> Map <i class="fa fa-map-marker" style="font-size:18px; margin-left: 3%;"></i></button></td> <td><button class="btn btn-primary"> Map <i class="fa fa-map-marker" style="font-size:18px; margin-left: 3%;"></i></button></td>
</tr> </tr>
<tr> <tr>
<td> Lipton's Seat </td> <td> Lipton's Seat </td>
<td>Mountain</td> <td>Mountain</td>
<td>2 hour</td> <td>2 hour</td>
<td><button class="btn btn-primary"> Map <i class="fa fa-map-marker" style="font-size:18px; margin-left: 3%;"></i></button></td> <td><button class="btn btn-primary"> Map <i class="fa fa-map-marker" style="font-size:18px; margin-left: 3%;"></i></button></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
</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>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div> -->
</div> </div>
</div> </div>
<div class="card"> <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