-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtimeline_ex.php
87 lines (83 loc) · 2.65 KB
/
timeline_ex.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
$conn=mysqli_connect("localhost","root","");
$db=mysqli_select_db($conn,"hotel_db");
//echo $_GET['date1'];
$i=0;
$print=0;
if($_GET['room_type']>-1)
$tm="where type='$_GET[room_type]'";
else
$tm="";
// $dt=strtotime("+1 day", strtotime($_GET['date1']));
//echo "<br>".date("Y-m-d",$dt);
$dt=strtotime($_GET['date1']);
$tdt=strtotime($_GET['date1']);
$dt2=strtotime($_GET['date2']);
?>
<table cellspacing="2px" cellpadding="2px" class="tab"><tr><td>
<?php
while($tdt<=$dt2)
{
?>
<td bgcolor="#CCCCCC">
<?php
// $main_col++;
echo "<p class='text'>".date("d-m-Y",$tdt)."</p></td>";
$tdt=strtotime("+1 day", $tdt);
}
$query="select * from room_info $tm";
$res=mysqli_query($conn,$query);
while($data=mysqli_fetch_assoc($res))
{
echo "</tr><tr><td width='100px' bgcolor='#CCCCCC'>$data[c_room_no]</td>";
$room_id=$data['room_id'];
$i=0;
$dt=strtotime($_GET['date1']);
while($dt<=$dt2)
{
$print=0;
$room_q="select * from booking_detail where room_id='$room_id'";
$room_r=mysqli_query($conn,$room_q);
while($room_d=mysqli_fetch_assoc($room_r))
{
$print=1;
$q="select * from booking_master,booking_detail where booking_master.booking_id=booking_detail.booking_id and booking_detail.room_id='$data[room_id]' and booking_detail.checkout_status<>1";//last line added
$r=mysqli_query($conn,$q);
$flag=0;
while($d=mysqli_fetch_assoc($r))
{
$checkin=strtotime($d['checkin_date']);
$checkout=strtotime($d['checkout_date']);
if($dt>=$checkin && $dt<=$checkout)
{
//echo "<br> Booking ID= ".$d['booking_id']."Dates".date("Y-m-d",$checkin)." ".date("Y-m-d",$dt)." ".date("Y-m-d",$checkout);
//echo "<br>room id".$data['room_id']."room no =".$data['c_room_no']." booked on ".date("Y-m-d",$dt);
?>
<td bgcolor="#f44336" width="140px"><?php echo $d['accompany_name'];?></td>
<?php
$flag=1;
}
}
if($flag==0)
{
//echo "<br> Dates".date("Y-m-d",$checkin)." ".date("Y-m-d",$dt)." ".date("Y-m-d",$checkout);
//echo "<br>room id".$data['room_id']."room no =".$data['c_room_no']." not booked on ".date("Y-m-d",$dt);
//?>
<td bgcolor="#4caf50" ></td>
<?php
$flag=1;
$print=1;
}
break;
}
$dt=strtotime("+1 day", $dt);
if($print==0)
{
?>
<td bgcolor="#4caf50" ></td>
<?php
}
}
}
echo "</table>";
?>