-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbestelgeschiedenis.php
98 lines (98 loc) · 3.36 KB
/
bestelgeschiedenis.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
<div class="centered-container">
<div class="bestellingenlijst">
<?php
if (!isset($_SESSION['gebruiker-id']))
{
echo 'Je moet ingelogd zijn om je bestellingen te bekijken.';
}
else
{
require_once 'totaalbedrag.php';
?>
<h1><b>Bestellingen</b></h1>
<?php
$db = connect_to_db();
$aantal_bestellingen = 0;
$lopende_bestellingen = $db->prepare("SELECT id, timestamp, betaalstatus, verzendstatus FROM Bestellingen WHERE gebruiker_id = ? AND verzendstatus != 'Verzonden' ORDER BY timestamp DESC");
$lopende_bestellingen->bind_param('i', $_SESSION['gebruiker-id']);
$lopende_bestellingen->bind_result($bestelling_id, $timestamp, $betaalstatus, $verzendstatus);
$lopende_bestellingen->execute();
$lopende_bestellingen->store_result();
$aantal_bestellingen += $lopende_bestellingen->affected_rows;
if ($lopende_bestellingen->affected_rows > 0)
{
?>
<hr width="100%">
<b>Lopende bestellingen</b><br/>
<table>
<tr>
<th></th>
<th>Totaalbedrag</th>
<th>Datum</th>
<th>Betaalstatus</th>
<th>Verzendstatus</th>
</tr>
<?php
}
while ($lopende_bestellingen->fetch())
{
$totaalbedrag = totaalbedrag($bestelling_id);
?>
<tr class="clickable-item" onclick="window.location = 'bestelling.php?id=<?php echo $bestelling_id; ?>';">
<td>Bestelling #<?php echo $bestelling_id; ?></td>
<td>€<?php echo prijs_opmaak($totaalbedrag); ?></td>
<td><?php echo date('d-m-Y', strtotime($timestamp)); ?></td>
<td><?php echo $betaalstatus; ?></td>
<td><?php echo $verzendstatus; ?></td>
</tr>
<?php
}
$lopende_bestellingen->free_result();
?>
</table>
<?php
$bestellingen = $db->prepare("SELECT id, timestamp, betaalstatus, verzendstatus FROM Bestellingen WHERE gebruiker_id = ? AND verzendstatus = 'Verzonden' ORDER BY timestamp DESC");
$bestellingen->bind_param('i', $_SESSION['gebruiker-id']);
$bestellingen->bind_result($bestelling_id, $timestamp, $betaalstatus, $verzendstatus);
$bestellingen->execute();
$bestellingen->store_result();
$aantal_bestellingen += $bestellingen->affected_rows;
if ($bestellingen->affected_rows > 0)
{
?>
<hr width="100%">
<b>Oude bestellingen</b><br/>
<table>
<tr>
<th></th>
<th>Totaalbedrag</th>
<th>Datum</th>
<th>Betaalstatus</th>
<th>Verzendstatus</th>
</tr>
<?php
}
while ($bestellingen->fetch())
{
$totaalbedrag = totaalbedrag($bestelling_id);
?>
<tr class="clickable-item" onclick="window.location = 'bestelling.php?id=<?php echo $bestelling_id; ?>';">
<td>Bestelling #<?php echo $bestelling_id; ?></td>
<td>€<?php echo prijs_opmaak($totaalbedrag); ?></td>
<td><?php echo date('d-m-Y', strtotime($timestamp)); ?></td>
<td><?php echo $betaalstatus; ?></td>
<td><?php echo $verzendstatus; ?></td>
</tr>
<?php
}
$bestellingen->free_result();
$db->close();
?>
</table>
<?php
if ($aantal_bestellingen == 0)
echo 'Je hebt nog geen bestellingen geplaatst.';
}
?>
</div>
</div>