forked from Anderson-Juhasc/bitcoin-point-of-sale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
invoices.php
66 lines (59 loc) · 2.27 KB
/
invoices.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
<?php include 'partials/header.php'; ?>
<?php
if ($_SESSION['auth'] != 1) {
unset($_SESSION['auth']);
header('Location: index.php');
exit();
}
$db = new Db();
if ($_SESSION['user_type'] == "admin") {
$invoices = $db->query("SELECT * FROM invoices ORDER BY invoice_id DESC");
} else {
$invoices = $db->query("SELECT * FROM invoices WHERE invoice_user_id = :id ORDER BY invoice_id DESC", array("id"=>$_SESSION['user_id']));
}
?>
<!-- .wrapper -->
<div class="wrapper">
<!-- .page -->
<div class="page">
<!-- .page__head -->
<header class="page__head">
<h2 class="page__title">Invoices</h2>
</header>
<!-- /.page__head -->
<!-- .page__body -->
<div class="page__body">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Data</th>
<th>Value in BTC</th>
<th>Value in Fiat</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<?php foreach ($invoices as $key) : ?>
<?php
$invoice_date = strtotime($key["invoice_date"]);
?>
<tr>
<td><?php echo $key["invoice_id"]; ?></td>
<td><?php echo date('Y-m-d', $invoice_date); ?></td>
<td><?php echo $key["invoice_btc_value"]; ?> BTC</td>
<td><?php echo $key["invoice_fiat"]; ?> <?php echo $key["invoice_fiat_value"]; ?></td>
<td>
<a href="invoice.php?id=<?php echo $key["invoice_id"]; ?>"><?php echo $key["invoice_address"]; ?></a>
</td>
</tr>
<?php endForeach; ?>
</tbody>
</table>
</div>
<!-- /.page__body -->
</div>
<!-- /.page -->
</div>
<!-- /.wrapper -->
<?php include 'partials/footer.php'; ?>