-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprescription.php
240 lines (199 loc) · 8.19 KB
/
prescription.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
<?php
session_start();
include_once('connect_db.php');
if(isset($_SESSION['username'])){
$id=$_SESSION['pharmacist_id'];
$fname=$_SESSION['first_name'];
$lname=$_SESSION['last_name'];
$sid=$_SESSION['staff_id'];
$user=$_SESSION['username'];
}else{
header("location:http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/index.php");
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $user;?> -Pharmacy Sys</title>
<link rel="stylesheet" type="text/css" href="style/2.css">
<link rel="stylesheet" href="style/1.css" type="text/css" media="screen" />
<link rel="stylesheet" href="style/3.css" type="text/css" media="screen" />
<script src="js/function.js" type="text/javascript"></script>
<script type="text/javascript" SRC="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" SRC="js/superfish/hoverIntent.js"></script>
<script type="text/javascript" SRC="js/superfish/superfish.js"></script>
<script type="text/javascript" SRC="js/superfish/supersubs.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("ul.sf-menu").supersubs({
minWidth: 12,
maxWidth: 27,
extraWidth: 1
}).superfish();
});
</script>
<script SRC="js/cufon-yui.js" type="text/javascript"></script>
<script SRC="js/Liberation_Sans_font.js" type="text/javascript"></script>
<script SRC="js/jquery.pngFix.pack.js"></script>
<script type="text/javascript">
Cufon.replace('h1,h2,h3,h4,h5,h6');
Cufon.replace('.logo', { color: '-linear-gradient(0.5=#FFF, 0.7=#DDD)' });
</script>
<style>
</style>
</head>
<body style="background-image:url(images/m.jpg);" >
<div id="content" style="background-image:url(images/c.jpg);">
<div id="header" >
<h1> Pharmacy System</h1></div>
<div id="left_column" >
<div id="button" >
<ul>
<li><a href="pharmacist.php">Dashboard</a></li>
<li><a href="prescription.php">Prescription</a></li>
<li><a href="stock_pharmacist.php">Stock</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
</div>
<div id="main" style="background-image:url(images/c.jpg);">
<div id="tabbed_box" class="tabbed_box">
<h4>Prescription</h4>
<div class="tabbed_area">
<ul class="tabs">
<li><a href="javascript:tabSwitch('tab_1', 'content_1');" id="tab_1" class="active">View </a></li>
<li><a href="javascript:tabSwitch('tab_2', 'content_2');" id="tab_2">Create New</a></li>
</ul>
<div id="content_1" class="content">
<?php
/*
View
Displays all data from 'Pharmacist' table
*/
// connect to the database
include_once('connect_db.php');
// get results from database
$result = mysqli_query($con,"SELECT * FROM prescription")or die(mysql_error());
// display data in table
echo "<table border='1' cellpadding='5'align='center'>";
echo "<tr> <th>Customer</th><th>Prescription N<sup>o</sup></th> <th>Invoice N<sup>o</sup></th><th>Date </th><th>Delete</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysqli_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['customer_name'] . '</td>';
echo '<td>' . $row['prescription_id'] . '</td>';
echo '<td>' . $row['invoice_id'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
?>
<td><a href="delete_prescription.php?prescription_id=<?php echo $row['prescription_id']?>">
<img src="images/delete-icon.jpg" width="35" height="35" border="0" /></a></td>
<?php
}
// close table>
echo "</table>";
?>
</div>
<div id="content_2" class="content">
<script>
$(document).ready(function()
{
$("#drug_name,#strength,#dose,#quantity").change(function()
{
var drug_name=$("#drug_name").val();
var strength=$("#strength").val();
var dose=$("#dose").val();
var quantity=$("#quantity").val();
if(drug_name.length && strength.length && dose.length && quantity.length>0 )
{
$.ajax(
{
type: "POST", url: "check.php", data: 'drug_name='+drug_name +'&strength='+strength+'&dose='+dose +'&quantity='+quantity, success: function(msg)
{
$("#viewer2").ajaxComplete(function(event, request, settings)
{
if(msg != '')
{
$(this).html(msg);
$('#strength, #dose, #quantity').val('');
document.getElementById('drug_name').selectedIndex = 0;
}
});
}
});
}
});
$("#customer_id,#customer_name,#age,#sex,#postal_address,#phone").change(function()
{
var customer_id=$("#customer_id").val();
var customer_name=$("#customer_name").val();
var age=$("#age").val();
var sex=$("#sex").val();
var postal_address=$("#postal_address").val();
var phone=$("#phone").val();
if(customer_id.length && customer_name.length && age.length && sex.length && postal_address.length && phone.length >0)
{
$.ajax(
{
type: "POST", url: "check.php", data: 'customer_id='+customer_id +'&customer_name='+customer_name +'&age='+age +'&sex='+sex +'&postal_address='+postal_address +'&phone='+phone, success: function(msg)
{
$("#viewer2").ajaxComplete(function(event, request, settings)
{
if(msg != '')
{
}
});
}
});
}
});
});
</script>
<div id="viewer"><span id="viewer2"></span></div>
<?php
$invNum= mysqli_query ($con,"SELECT 1+MAX(invoice_id) FROM invoice");
$invoice=mysqli_fetch_array($invNum);
if($invoice[0]=='')
{$invoiceNo=10; }
else{$invoiceNo=$invoice[0];}
$_SESSION['invoice']=$invoiceNo;
?>
<div id="table_1">
<!--Pharmacist-->
<?php
?>
<form name="myform" onsubmit="return validateForm();" action="invoice.php" method="post" >
<table width="200" height="106" border="0" >
<tr><td align="left"><input name="customer_name" placeholder="Customer ID" id="customer_id"type="text" style="width:170px" required="required" /></td></tr>
<tr><td align="left"><input name="customer_name" placeholder="Customer Name" id="customer_name"type="text" style="width:170px" required="required" /></td></tr>
<tr><td align="left"><input name="age" type="text" style="width:170px" id="age" placeholder="Age"required="required" /></td></tr>
<tr><td align="left"><input name="sex" type="text" style="width:170px" id="sex" required="required" placeholder="Gender"/></td></tr>
<tr><td align="left"><input name="postal_address" type="text" style="width:170px" id="postal_address"placeholder="Address"required="required" /></td></tr>
<tr><td align="left"><input name="phone" type="text"placeholder="Phone" id="phone" style="width:170px" required="required" /></td></tr>
<tr><td><?php
echo"<select class=\"input-small\" name=\"drug_name\" style=\"width:170px\" id=\"drug_name\">";
$getpayType=mysqli_query($con,"SELECT drug_name FROM stock");
echo"<option>Select Drug</option>";
while($pType=mysqli_fetch_array($getpayType))
{
echo"<option>".$pType['drug_name']."</option>";
}
echo"</select>";?> </td></tr>
<tr><td align="left"><input name="strength" type="text" style="width:170px" id="strength"placeholder="Strength" /></td></tr>
<tr><td align="left"><input name="dose" type="text" style="width:170px" id="dose" placeholder="Dose" /></td></tr>
<tr><td align="left"><input name="quantity" type="text" style="width:170px" id="quantity"placeholder="Quantity"/></td></tr>
<tr><td><input name="submit" type="submit" value="Submit"/></td></tr>
</table>
</form>
<script>
document.getElementById('drug_name').selectedIndex = 0;
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>