-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisitingtime.php
281 lines (251 loc) · 10.9 KB
/
Visitingtime.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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<?php include ('docHeader.php');
?>
<link rel="stylesheet" type="text/css" href="assets/css/extrastyle.css">
<style type="text/css">
table, th, td {
border: 1px solid blue;
border-collapse: collapse;
}
</style>
<link rel="stylesheet" type="text/css" href="assets/css/extrastyle.css">
<div class="form-group" >
<form action="" method="post" ><fieldset>
<div class="form-group">
<select class="custom-select" id="getapid" name="getapid" style="width: 480px;" required>
<?php
$now = time() + 7200;
$username = $_SESSION['username'];
$query1 = "SELECT * FROM `docappointment` WHERE `username` = '$username' and `appointmentto` > '$now' ORDER BY appointmentfrom ASC";
$results1 = $mysqli->query($query1);
if ($results1 and mysqli_num_rows($results1)>0){
while ($obj = $results1->fetch_object()) {
if(!isset($_GET['phpapidp'])){ $_GET['phpapidp'] = $apid;}
$apid = $obj->appointmentid;
$apfrom = $obj->appointmentfrom;
$apto = $obj->appointmentto;
$maxpet = $obj->maxnoofpatient;
$regpet = $obj->noofregisteredpatients;
$date = date("F j, Y", $apfrom);
$stime = date("g:i A", $apfrom);
$etime = date("g:i A", $apto);
$week = date("l", $apfrom);
?>
<option value="<?php echo $apid ?>" <?php if(isset($_GET['phpapidp']) and $_GET['phpapidp']==$apid){ echo "selected";} ?> ><?php echo $date.' : '.$stime.' - '.$etime." ( ".$regpet." / ".$maxpet." )"." ID - ".$apid; ?></option>
<?php } } ?>
</select>
</div>
<label class="col-form-label" for="inputDefault">Enter Patient Username From Receipt<br></label>
<div class="row">
<select class="custom-select" id="username" placeholder="Patient Username" name="username" style="width: 250px; margin: 5px;" required title="No body Reserved">
<?php
$appointid = $_GET['phpapidp'];
$query1 = "SELECT * FROM `patientreservationdetails` WHERE `appointmentId` = '$appointid' and completeReservation = 0 ORDER BY chanelNo ASC";
$results1 = $mysqli->query($query1);
if ($results1 and mysqli_num_rows($results1)>0){
while ($obj = $results1->fetch_object()) {
$patuname = $obj->patientUsername;
$chanalNo = $obj->chanelNo;
$resID = $obj->ReservationID;
?>
<option value="<?php echo $patuname ?>" ><?php echo $chanalNo.' : '.$patuname.' - ( '.$resID.' )'; ?></option>
<?php } } ?>
</select>
<button type="submit" class="btn btn-outline-info" style="margin: 5px 20px;">Visit Patient</button>
</div>
</fieldset>
</form>
</div>
<?php
if(isset($_POST['username'])){
$username = $_POST['username'];
$query = "SELECT * FROM basicdetailpatient WHERE `username`= '$username'";
$results = $mysqli->query($query);
if (mysqli_num_rows($results)==1 and $results){
$bdp = $results->fetch_object();
$Name = $bdp->title.". ".$bdp->firstname." ".$bdp->lastname;
$gender = $bdp->gender==1?"Male":"Female";
$address = $bdp->address;
$dob = $bdp->dob;
$age = floor((time() - strtotime($dob))/31556926);
$bloodgroup = $bdp->bloodgroup;
$email = $bdp->email;
$contactno = $bdp->contactno;
$healthissue = $bdp->healthissue;
$queryvisit = "SELECT * FROM visitingdata WHERE `patusername`= '$username' ORDER BY `submittime` DESC";
$resultsvisit = $mysqli->query($queryvisit);
?>
<div class="row">
<div class="card bg-light mb-3" style="width: 60%; margin: 0 25px 0 0">
<div class="card-header">Visiting Time</div>
<div class="card-body">
<form action="bookvisitdatafunc.php" method="post"><fieldset>
<h4 class="card-title">Doctor Note</h4>
<div class="form-group">
<label for="exampleTextarea">Visiting details</label>
<textarea class="form-control" name="doctornote" rows="3" spellcheck="true" style="z-index: auto; position: relative; line-height: 22.5px; font-size: 15px; transition: none; background: none 0% 0% / auto repeat scroll padding-box padding-box rgb(255, 255, 255);" required></textarea>
</div>
<div class="toggle-component">
<h4 class="card-title">Next Visiting</h4>
<label class="toggle">
<input type="checkbox" name="nvCheck" id="nvCheck" onclick="visitclick()"/>
<div data-off="No." data-on="Yes.">Next Visiting</div>
</label>
<input type="number" name="numofrows" value=2 id="numofrows" hidden>
<input type="text" name="patusername" value="<?php echo $username; ?>" hidden>
<input type="text" name="resverid" value="<?php echo $resID; ?>" hidden>
<input type="text" name="apoid" value="<?php echo $appointid; ?>" hidden>
<div class="row" >       After  
<input name="inputdays" id="idinputdays" disabled = true class="form-control" placeholder="" min=1 max=31 style="width:70px; height: 25px; margin: 0px; " required>   Days </div>
</div>
<h4 class="card-title">Prescription</h4>
<table id="myTable">
<col width=40%>
<col width=10%>
<col width=10%>
<col width=10%>
<col width=30%>
<tr>
<th>Medicines</th>
<th>Quantity</th>
<th>Frequency</th>
<th>Consumption period</th>
<th>Note</th>
</tr>
<tr>
<td><input type="text" class="form-control" name="ptme1"></td>
<td><input type="text" class="form-control" name="ptqu1"></td>
<td><input type="text" class="form-control" name="ptfr1"></td>
<td><input type="text" class="form-control" name="ptcp1"></td>
<td><input type="text" class="form-control" name="ptnt1"></td>
</tr>
</table>
<div>
<center>
<button type="button" class="btn btn-rowadddel" style="margin: 20px; color: lightblue" onclick="addrow()"><img src="assets/image/addrowicon.png" style="height: 40.4px; width: 53.2px;" /></button>
<button type="button" class="btn btn-rowadddel" style="margin: 20px; color: lightblue" onclick="deleterow()" ><img src="assets/image/delrowicon.png" style="height: 40.4px; width: 53.2px;" /></button>
</center>
</div>
<center> <button type="submit" name="submitvisit" style="width: 300px; height: 50px; font-size: 20px;" class="btn btn-outline-primary">Submit</button> </center>
</fieldset></form>
</div>
</div>
<div class="card border-secondary mb-3" style="width: 35%;">
<div class="card-header">Patient - Username</div>
<div class="card-body">
<h4 class="card-title"><?php echo $Name; ?></h4>
<p class="card-text">
<b>Age : </b> <?php echo $age." (".$dob.")"; ?> <br />
<b>Gender : </b> <?php echo $gender; ?> <br />
<b>Blood Group : </b> <?php echo $bloodgroup; ?> <br />
<b>E-mail : </b> <?php echo $email; ?><br />
<b>Contact No : </b> <?php echo $contactno; ?><br />
<b>Address : </b> <?php echo $address; ?><br />
<?php if (is_null($healthissue)) { ?>
<b>Health Issue : </b><?php echo $healthissue; ?><br />
<?php } ?>
</p>
<?php if (mysqli_num_rows($resultsvisit)>=1 and $resultsvisit){
while ($obj = $resultsvisit->fetch_object()) {
$visit_on = $obj->submittime;
$visiton = date("F j, Y - g:i A", $visit_on);
$docusname = $obj->docusername;
$queryd = "SELECT * FROM basicdetaildoctor WHERE `username`= '$docusname'";
$resultsd = $mysqli->query($queryd);
if (mysqli_num_rows($resultsd)==1 and $resultsd){
$bdd = $resultsd->fetch_object();
$dName = " ".$bdd->title." ".$bdd->firstname." ".$bdd->lastname;
}
$docnotes = $obj->doctornote;
$Prescriptionid = $obj->prescriptionid;
?>
<button class="accordion"><?php echo $visiton." (".$dName.")"; ?></button>
<div class="panel">
<b>Doctor Note : </b> <?php echo " ".$docnotes; ?> <br /><br />
<?php if ($obj->nextvisiting != 0) { ?>
<b>Next Visit : </b> <?php echo date("F j, Y",$obj->nextvisiting); ?> <br /><br />
<?php } ?>
<b>Priscription : </b><br />
<?php
$queryp = "SELECT * FROM prescriptiondata WHERE `Prescriptionid`= '$Prescriptionid' ORDER BY row_no ASC";
$resultsp = $mysqli->query($queryp);
if (mysqli_num_rows($resultsp)>0 and $resultsp){
while ($obj = $resultsp->fetch_object()) {
echo $obj->Medicines.' => '.$obj->Quantity.' # '.$obj->Frequency.' @ '.$obj->Consumption_period.' ( '.$obj->Note.' ) '.'<br>';
}
}
?>
</div>
<?php } } ?>
</div>
</div>
</div>
<?php
}
else{
?>
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">×</button>
<?php echo "Username Error OR Not Registered" ?>
</div>
<?php
}
}
?>
<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.display === "block") {
panel.style.display = "none";
} else {
panel.style.display = "block";
}
});
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function addrow() {
var table = document.getElementById("myTable");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
var cell5 = row.insertCell(4);
cell1.innerHTML = '<input type="text" class="form-control" name="ptme'+(table.rows.length-1)+'">';
cell2.innerHTML = '<input type="text" class="form-control" name="ptqu'+(table.rows.length-1)+'">';
cell3.innerHTML = '<input type="text" class="form-control" name="ptfr'+(table.rows.length-1)+'">';
cell4.innerHTML = '<input type="text" class="form-control" name="ptcp'+(table.rows.length-1)+'">';
cell5.innerHTML = '<input type="text" class="form-control" name="ptnt'+(table.rows.length-1)+'">';
document.getElementById("numofrows").value = table.rows.length-1;
}
function deleterow(){
var table = document.getElementById("myTable");
if (table.rows.length >1 ) {
table.deleteRow(-1);
}
document.getElementById("numofrows").value = table.rows.length-1;
}
function visitclick(){
if(document.getElementById("nvCheck").checked == true){
document.getElementById("idinputdays").disabled = false;
}else{
document.getElementById("idinputdays").disabled = true;
}
}
function optionselect(){
var apidp = document.getElementById("getapid").value;
window.location.href = "Visitingtime.php?phpapidp=" + apidp;
}
$(function(){
$('#getapid').on('change', function(){
var apidp = document.getElementById("getapid").value;
window.location.href = "Visitingtime.php?phpapidp=" + apidp;
})
})
</script>
<?php include 'docFooter.php'; ?>