-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeReservation1.php
193 lines (155 loc) · 6.55 KB
/
MakeReservation1.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
include('config.php');
include('loginfirst.php');
include ('sqlphpfunctions.php');
if (!array_key_exists("reslertmsg",$_SESSION)) {
$_SESSION['reslertmsg'] = '';
}
$currentdate = date("Y/m/d")
?>
<?php
//Check wheather All details were entered
if (isset($_POST['docUsername']) ) {
$docUsername = $_POST['docUsername'];
}else{
$_SESSION['reslertmsg'] = "Enter complete Details";
header("Location: MakeReservation.php"); die();
}
?>
<?php
$username = $docUsername;
$query = "SELECT specializationin FROM basicdetaildoctor WHERE username='$username';";
$results = $mysqli->query($query);
if ($results){
while ($obj = $results->fetch_object()) {
$splidstr = $obj->specializationin;
break;
}
$splstr = allsplidtospl($splidstr);
$dsplarray = explode(',', $splstr);
}
$query1 = "SELECT * FROM basicdetaildoctor WHERE username='$docUsername'";
$result1 = $mysqli->query($query1);
$resultSet1 = mysqli_fetch_assoc($result1);
$docName =$resultSet1['title'] . " " . ucfirst($resultSet1['firstname']) . " " .ucfirst($resultSet1['lastname']);
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="assets/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Search for Doctors</title>
<style type="text/css">
</style>
</head>
<body>
<!--main navigation bar !-->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="collapse navbar-collapse" id="navbarColor02">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="Home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Log Out</a>
</li>
</ul>
</div>
</nav>
<!--Patient navigation bar !-->
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link" href="PatientProfile.php">Profile</a>
</li>
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href=PatientReservationDetails.php>Reservation Details</a>
</li>
<li class="nav-item">
<a class="nav-link" href="AboutDoctors.php">About Doctors</a>
</li>
<li class="nav-item">
<a class="nav-link" href="SearchForDoctors.php">Search for Doctor</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="MakeReservation.php">Make a Reservation</a>
</li>
</ul>
<?php
echo "<br>";
echo '<b>'.'Username : '.'</b>' . $_SESSION['username'];
echo "<br>";
?>
<!--form for make appointment !-->
<div align="center" >
<div class="container" style="max-width: 40rem; margin: 0">
<hr>
<?php
$now = time();
$query = "SELECT * FROM `docappointment` WHERE `username` = '$docUsername' and `appointmentto` > '$now' ORDER BY appointmentfrom ASC";
$results = $mysqli->query($query);
if ($results and mysqli_num_rows($results)>0){
?>
<div class="jumbotron" align="center">
<p class="lead">
<a class="btn btn-primary btn-lg" href="MakeReservation.php" role="button">Search For Another DOCTOR</a>
</p>
<hr class="my-4">
<p class="lead">Available Dates of <?php echo $docName ?> </p>
</div>
<?php
$count = 0;
while ($obj = $results->fetch_object()) {
$apid = $obj->appointmentid;
$apfrom = $obj->appointmentfrom;
$apto = $obj->appointmentto;
$maxpet = $obj->maxnoofpatient;
$regpet = $obj->noofregisteredpatients;
$apsplid = $obj->appointmentspecialization;
$createdon = $obj->createdon;
$percentage = $regpet*100 / $maxpet;
$creat = date("F j, Y - g:i A", $createdon);
$date = date("F j, Y", $apfrom);
$stime = date("g:i A", $apfrom);
$etime = date("g:i A", $apto);
$week = date("l", $apfrom);
$apspl = str_replace(',',',  ',allsplidtospl($apsplid)); ?>
<div class="card">
<div class="card-body">
<h3 class="card-title"><?php echo $date; ?><tagname style="font-size: 16px;"><?php echo '   ('.$week.' )'; ?></tagname></h3>
<h5 class="card-subtitle mb-2 text-muted"><?php echo $stime.' - '.$etime; ?></h5>
<h5 class="card-text"><?php echo 'Appointment Id : '.$apid; ?></h5><p></p>
<h5>Specialization in :</h5>
<p class="card-text"><?php echo $apspl; ?></p>
<h5 class="card-text"><?php echo 'Registered Patients : '.$regpet.' / '.$maxpet; ?></h5>
<div class="progress">
<div class="progress-bar progress-bar-striped bg-info progress-bar-animated" role="progressbar" aria-valuenow="<?php echo $percentage; ?>" aria-valuemin="0" aria-valuemax="100" style="<?php echo 'width: '.$percentage.'%'; ?>"></div>
</div>
<p></p>
<a class="card-link" style="top: 40px;"><?php echo 'Created on '.$creat; ?></a>
<form action="ReserveBySearch.php" method="post" ><fieldset>
<input name="entryid" value="<?php echo $apid ?>" hidden >
<?php if ($regpet<$maxpet) { ?>
<br>
<br>
<button type="submit" name="submit" class="btn btn-info" >Reserve </button>
<?php } ?>
</fieldset></form>
</div>
</div>
<hr>
<?php $count++; }
}else{
?>
<div class="jumbotron" align="center">
<p class="lead">
<p class="lead"><?php echo $docName ?> is Not Available For Future Dates Yet </p>
<hr class="my-4">
<a class="btn btn-primary btn-lg" href="MakeReservation.php" role="button">Search For Another DOCTOR</a>
</p>
</div>
<?php } ?>
</body>
</html>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>