aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarf20 <aruizfernandez05@gmail.com>2024-03-24 17:13:39 +0100
committerarf20 <aruizfernandez05@gmail.com>2024-03-24 17:13:39 +0100
commitc4018e9cec9662a8828ec2184e0830624ff413a4 (patch)
treeee228cc29f56fb1d5067d81a1c2a81199f1c7d86
parent94b5e9d37cbc5e030f9fbba865b7205b872be365 (diff)
downloadarfnet2-cstims-c4018e9cec9662a8828ec2184e0830624ff413a4.tar.gz
arfnet2-cstims-c4018e9cec9662a8828ec2184e0830624ff413a4.zip
Show invoices in admin dashboard
-rw-r--r--admin.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/admin.php b/admin.php
index f70ed7b..eaa0f62 100644
--- a/admin.php
+++ b/admin.php
@@ -42,6 +42,13 @@ mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$tickets = $result->fetch_all(MYSQLI_ASSOC);
+// Get invoices
+$sql = "SELECT id, client, `desc`, amount, date, status FROM invoices";
+$stmt = mysqli_prepare($link, $sql);
+mysqli_stmt_execute($stmt);
+$result = mysqli_stmt_get_result($stmt);
+$invoices = $result->fetch_all(MYSQLI_ASSOC);
+
function getservicebyid($id) {
global $services;
foreach ($services as $service) {
@@ -135,7 +142,14 @@ function getorderbyid($id) {
</div>
<div class="col2">
<h3>Invoices</h3>
- <!-- TODO PHP list of services -->
+ <table>
+ <tr><th>client</th><th>amount</th></tr>
+ <?php
+ foreach ($invoices as $invoice) {
+ echo "<tr><td>".getclientbyid($invoice["client"])["username"]."</td><td>".number_format($invoice["amount"], 2, '.', '')."€</tr>\n";
+ }
+ ?>
+ </table>
</div>
</div>
</div>