-
Notifications
You must be signed in to change notification settings - Fork 0
/
transaction_list.php
executable file
·111 lines (86 loc) · 2.96 KB
/
transaction_list.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
<?php
include('header.php');
//including the database connection file
include_once("config/connection.php");
$login_id = $_SESSION['id'];
//fetching data in descending order (lastest entry first)
$result = mysqli_query($mysqli, "
SELECT t.*,u.name as user_name FROM
transactions AS t
LEFT JOIN users AS u
ON u.id = t.login_id
WHERE t.login_id = '$login_id'
ORDER BY t.id DESC
");
?>
<div class="jumbotron text-center">
<h3>Transactions</h3>
</div>
<div class="container">
<!-- for validation error show case -->
<?php
if (isset($_SESSION['messages']) && $_SESSION['messages'] != "") { ?>
<div class="row">
<div class="col-sm-12 border border-primary">
<?php
echo $_SESSION['messages'];
$_SESSION['messages'] = "";
?>
</div>
</div>
<br /><br />
<?php } ?>
<!-- for validation error show case -->
<div class="row">
<div class="col-sm-12">
<table id="my_table" class="display table" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Customer Name</th>
<th>Status</th>
<th>Date</th>
<th>Subtotal</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
while ($res = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">" . $res['id'] . "</a></td>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">" . $res['user_name'] . "</a></td>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">";
echo $status_transaction[$res['status']];
echo "</a></td>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">" . $res['date'] . "</a></td>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">" . $res['subtotal'] . "</a></td>";
echo "<td><a href=\"transaction_show.php?id=$res[id]\">View</a></td>";
}
?>
</tbody>
<tfoot>
<tr>
<th>ID</th>
<th>Customer Name</th>
<th>Status</th>
<th>Date</th>
<th>Subtotal</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
</div>
<?php
include('footer.php');
?>
<script>
$(document).ready(function() {
$('#my_table').DataTable({
"order": [
[0, "desc"]
]
});
});
</script>