Commit 21b8f4b9 authored by Mihiranga G.L.V - IT18500790's avatar Mihiranga G.L.V - IT18500790

Merge branch 'IT18500790' into 'master'

Create trip plan

See merge request !5
parents ecf03282 404d5c56
......@@ -175,7 +175,7 @@
// print_r($select_full_array);
$sql11 = "SELECT MAX(train_no) AS firstStop FROM final_railway_station WHERE line = '$get_line_no' ";
$sql11 = "SELECT MAX(train_no) AS firstStop FROM final_railway_station WHERE `line` = '$get_line_no' ";
$result11 = mysqli_query($con,$sql11) or die(mysqli_error($con));
$row11 = mysqli_fetch_assoc($result11);
......@@ -193,6 +193,24 @@
$end_date = $ini_end_date;
$start_time = '05:00:00';
$start_date_time = $ini_start_date ." ". $start_time;
$main_start_time = "";
?>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th scope="col">Start Location</th>
<th scope="col">Places</th>
<th scope="col">Train Name</th>
<th scope="col">Arrival Time</th>
<th scope="col"> End Location </th>
<th scope="col"> Departure Time </th>
</tr>
</thead>
<tbody>
<?php
for($c = $start_location; $c >= $last_railway_stop; $c--) {
......@@ -203,13 +221,72 @@
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'));
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+15 hour'));
$sql13 = "SELECT * FROM final_railway_station WHERE `line` = $now_line_no AND `train_no` = $start_location ";
$result13 = mysqli_query($con,$sql13) or die(mysqli_error($con));
$row13 = mysqli_fetch_assoc($result13);
$colombo_train_id_list = array();
$sql14 = "SELECT * FROM train_times WHERE `lineno` = $now_line_no AND `trainno` = $start_location AND `dirId` = 'f' ORDER BY `arrival` ASC ";
$result14 = mysqli_query($con,$sql14) or die(mysqli_error($con));
while($row14 = mysqli_fetch_array($result14)){
$colombo_start_time = $row14['arrival'];
$colombo_train_id = $row14['id'];
$str_start_time = strtotime($start_time);
$str_colombo_start_time = strtotime($colombo_start_time);
if($str_start_time < $str_colombo_start_time) {
array_push($colombo_train_id_list,$colombo_train_id);
}
}
$colombo_first_train = $colombo_train_id_list[0];
$sql16 = "SELECT * FROM train_times WHERE `id` = $colombo_first_train ";
$result16 = mysqli_query($con,$sql16) or die(mysqli_error($con));
$row16 = mysqli_fetch_assoc($result16);
$sql17 = "SELECT MAX(placeTrainNo) AS colombo_to_next FROM visitplacetemp WHERE logUserid = $logUserid AND placeLineNo = $now_line_no ";
$result17 = mysqli_query($con,$sql17) or die(mysqli_error($con));
$row17 = mysqli_fetch_assoc($result17);
$colombo_train_arrival_time = $row16['arrival'];
$colombo_train_dep_time = $row16['dep'];
$colombo_train_name = $row16['trainname']; //Train name
$colombo_name = "Colombo Fort"; // Start name;
$colombo_train_arrival_date_time = $start_date ." ".$colombo_train_arrival_time; // Arrival
$colombo_train_dep_date_time = $start_date ." ".$colombo_train_dep_time; //Departure
$main_start_time = $colombo_train_dep_date_time;
$colombo_to_next_station = $row17['colombo_to_next'];
$sql18 = "SELECT * FROM final_railway_station WHERE train_no = $colombo_to_next_station AND `line` = $now_line_no ";
$result18 = mysqli_query($con,$sql18) or die(mysqli_error($con));
$row18 = mysqli_fetch_assoc($result18);
$colombo_to_next_station_name = $row18['name']; //Colombo to next station
?>
<tr>
<td> <?php echo $colombo_name ?> </td>
<td></td>
<td> <?php echo $colombo_train_name ?> </td>
<td> <?php echo str_replace(' ', '<br>', $colombo_train_arrival_date_time) ?> </td>
<td> <?php echo $colombo_to_next_station_name ?> </td>
<td> <?php echo str_replace(' ', '<br>', $colombo_train_dep_date_time) ?> </td>
</tr>
<?php
} 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'));
// echo $start_date_time ."<br>";
// $start_date_time = date('Y-m-d H:i:s', strtotime($start_date_time.'+12 hour'));
echo $main_start_time ."<br>";
}else {
continue;
......
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