forked from onetwothreeneth/HospitalManagementSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtransaction_details.php
More file actions
340 lines (334 loc) · 20.8 KB
/
transaction_details.php
File metadata and controls
340 lines (334 loc) · 20.8 KB
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<?php
require_once 'bones/a_assets.php';
require_once 'bones/a_header.php';
?>
<div id="page-content-wrapper">
<div id="page-content">
<div class="container">
<div class="row">
<div class="col-md-12">
<script>function printInvoice(){ window.print(); }</script>
<div class="content-box pad25A">
<div class="row">
<?php
$transaction_id = $_GET['transaction_id'];
$patient_id = get("patient_id","$s transactions where transaction_id='$transaction_id'");
$status = get("status","$s transactions where transaction_id='$transaction_id'");
$transaction_date = get("date","$s transactions where transaction_id='$transaction_id'");
$totals = get("total","$s transactions where transaction_id='$transaction_id'");
$patient_name = get("name","$s patients where patient_id='$patient_id'");
$patient_address = get("address","$s patients where patient_id='$patient_id'");
$physician_id = get("physician_id","$s transactions where transaction_id='$transaction_id'");
$physician_name = get("name","$s physician where physician_id='$physician_id'");
if($status<='0'){
echo "<script>document.location.href = 'error.php';</script>";
}
?>
<div class="col-sm-3">
<div class="dummy-logo">
Hospital Logo Here
</div>
<address class="invoice-address">
Marcelo Medical Center
<br />
2160 South 1st Avenue
<br />
Baliwuag Bulacan
</address>
</div>
<div class="col-sm-6 float-right text-right">
<h4 class="invoice-title">Receipt</h4>
No. <b>#<?php echo '00000'.$transaction_id; ?></b>
<div class="divider"></div>
<a target='_blank' href="print.php?transaction_id=<?php echo $transaction_id; ?>">
<button class="print btn btn-alt btn-hover btn-info">
<span>Print</span>
<i class="glyph-icon icon-print"></i>
</button>
</a>
<button class="print removes btn btn-alt btn-hover btn-danger">
<span>Cancel</span>
<i class="glyph-icon icon-trash"></i>
</button>
<script type="text/javascript">
$('.removes').click(function(){
if(window.confirm("Are you sure you want to remove this transaction?")){
document.location.href = 'php/controller.php?transaction_idS=<?php echo $transaction_id; ?>';
}
});
</script>
</div>
</div>
<div class="divider"></div>
<div class="row">
<div class="col-md-4">
<h2 class="invoice-client mrg10T">Client information:</h2>
<h5><?php echo $patient_name; ?></h5>
<address class="invoice-address">
<?php echo $patient_address; ?>
</address>
</div>
<div class="col-md-4">
<h2 class="invoice-client mrg10T">Order Info:</h2>
<ul class="reset-ul">
<li><b>Date:</b> <?php echo $transaction_date; ?></li>
<li><b>Id:</b> #<?php echo '00000'.$transaction_id; ?></li>
<li><b>Physician:</b> <?php echo $physician_name; ?></li>
</ul>
</div>
<div class="col-md-4">
<h2 class="invoice-client mrg10T">Remarks:</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.</p>
<br />
<p>Honoring this receipt means you agreed on our terms and condition.</p>
</div>
</div>
<table class="table mrg20T table-hover">
<thead>
<tr>
<th></th>
<th>Service/Transaction</th>
<th>Category</th>
<th>Description</th>
<th>Price</th>
<th>Qty</th>
<th>Subtotal</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
$orders = fetch("$s orders $j services on orders.services_id=services.services_id and transaction_id='$transaction_id'");
$orders_discount = fetch("$s orders_discount $j discounts on orders_discount.discount_id=discounts.discount_id and transaction_id='$transaction_id'");
$orders_c = counts("$s orders $j services on orders.services_id=services.services_id and transaction_id='$transaction_id'");
if($orders_c>='1'){
foreach ($orders as $o){
$total = $o->qty * $o->price;
echo "<tr>
<td>$o->orders_id</td>
<td>$o->name</td>
<td>$o->category</td>
<td>$o->description</td>
<td>P $o->price</td>
<td>$o->qty</td>
<td>P $total</td>
<td>
<form method='post' action='transaction_details.php?1&transaction_id=$transaction_id'>
<input type='hidden' name='orders_id' value='$o->orders_id'>
<button name='remove_servicetransaction' class='btn btn-danger'>Remove</button>
</form>
</td>
</tr> ";
}
} else {
echo "<td colspan='7'><center>No Transactions/Results yet !</td>";
}
if($orders_discount<=0){}
else {
echo "<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td>Discounts</td>
<td></td>
<td></td>
<td></td>
</tr>";
foreach ($orders_discount as $z) {
echo "<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class='text-right'>$z->name</td>
<td>$z->discount%</td>
<td>
<form method='post' action='transaction_details.php?1&transaction_id=$transaction_id'>
<input type='hidden' name='orders_discount_id' value='$z->orders_discount_id'>
<button name='remove_orderdiscount' class='btn btn-danger'>Remove</button>
</form>
</td>
</tr> ";
}
}
?>
<tr <?php if($orders_c<='0'){ echo 'style="display:none;"'; }?>>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="text-right"><b><h4>TOTAL :</h4></b></td>
<td style="color:red;">
<h5>P
<?php
$total = get("total","SELECT sum(orders.qty*services.price) as total FROM orders INNER JOIN services on orders.services_id=services.services_id and transaction_id='$transaction_id'");
$discounted = get("less","SELECT sum(discounts.discount) as less from orders_discount $j discounts on orders_discount.discount_id=discounts.discount_id and transaction_id='$transaction_id'");
$dis_a = $discounted/100;
$dis_b = $dis_a * $total;
$dis_c = $total - $dis_b;
udi("$u transactions set total='$dis_c' where transaction_id='$transaction_id'");
echo $dis_c;
?>
</h5>
</td>
<td></td>
</tr>
</tbody>
</table>
<div class="col-sm-6 float-right text-right">
<button data-toggle="modal" data-target="#newservices" class="print btn btn-alt btn-hover btn-success">
<span>Add</span>
<i class="glyph-icon icon-plus"></i>
</button>
<button data-toggle="modal" data-target="#discount" class="print btn btn-alt btn-hover btn-warning">
<span>Discount</span>
<i class="glyph-icon icon-plus"></i>
</button>
</div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<?php require_once "bones/a_footer.php"; ?>
<!-- SERVICES MODAL -->
<div class="modal fade in" id="newservices" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; padding-right: 17px; margin-top:0%;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add Transaction</h4>
</div>
<div class="modal-body">
<p>
<table class="table mrg20T table-hover">
<thead>
<tr>
<th style='width:16.66%;'>Name</th>
<th style='width:16.66%;'>Category</th>
<th style='width:27%;'>Description</th>
<th style='width:16.66%;'>Price</th>
<th style='width:16.66%;'>Qty</th>
<th style='width:16.66%;'></th>
</tr>
</thead>
<tbody>
<?php
$services = fetch("$s services $w status='1'");
$d = fetch("$s discounts $w status='1'");
foreach ($services as $s){
echo "<tr>
<td style='width:16.66%;'>$s->name</td>
<td style='width:16.66%;'>$s->category</td>
<td style='width:27%;'>$s->description</td>
<td style='width:10%;'>P$s->price</td>
<td style='width:26.66%;'>
<form method='post' action='transaction_details.php?1&transaction_id=$transaction_id'>
<input type='hidden' name='transaction_id' value='".$_GET['transaction_id']."'>
<input type='hidden' name='services_id' value='$s->services_id'>
<input type='number' name='qty' placeholder='Qty' class='form-control' required>
</td>
<td style='width:16.66%;'>
<button name='add_servicetransaction' class='btn btn-success'>Add</button>
</form>
</td>
</tr>";
}
?>
</tbody>
</table>
<!--<div class="form-group">
<label class="col-sm-3 control-label">Physician</label>
<div class="col-sm-9">
<form method="post" action="transaction_details.php?1&transaction_id=<?php //echo $_GET['transaction_id']; ?>">
<input type="hidden" name="transaction_id" value="<?php //echo $_GET['transaction_id']; ?>">
<select class="form-control" name="physician_id" required>
<?php
//$physician = fetch("$s physician where status='1'");
//foreach ($physician as $p){
//
?>
</select>
</div>
</div> -->
<br>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- DISCOUNT MODAL -->
<div class="modal fade in" id="discount" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none; padding-right: 17px; margin-top:0%;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add Discounts</h4>
</div>
<div class="modal-body">
<p>
<table class="table mrg20T table-hover">
<thead>
<tr>
<th style='width:16.66%;'></th>
<th style='width:16.66%;'>Name</th>
<th style='width:27%;'>Discount</th>
<th style='width:16.66%;'></th>
</tr>
<?php
foreach ($d as $d){
echo "<tr>
<td style='width:25%;'>$d->discount_id</td>
<td style='width:35%;'>$d->name</td>
<td style='width:25%;'>$d->discount</td>
<td style='width:15%;'>
<form method='post' action='transaction_details.php?1&transaction_id=$transaction_id'>
<input type='hidden' name='transaction_id' value='".$_GET['transaction_id']."'>
<input type='hidden' name='discount_id' value='$d->discount_id'>
<button name='add_discount' class='btn btn-success'>Add</button>
</form>
</td>
</tr>";
}
?>
</thead>
<tbody>
</tbody>
</table>
<!--<div class="form-group">
<label class="col-sm-3 control-label">Physician</label>
<div class="col-sm-9">
<form method="post" action="transaction_details.php?1&transaction_id=<?php //echo $_GET['transaction_id']; ?>">
<input type="hidden" name="transaction_id" value="<?php //echo $_GET['transaction_id']; ?>">
<select class="form-control" name="physician_id" required>
<?php
//$physician = fetch("$s physician where status='1'");
//foreach ($physician as $p){
//
?>
</select>
</div>
</div> -->
<br>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<style type="text/css">
@media print {
.print{
display: none !important;
}
</style>