-
Notifications
You must be signed in to change notification settings - Fork 0
/
riwayat.php
66 lines (59 loc) · 2.26 KB
/
riwayat.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
session_start();
include 'koneksi.php';
include 'Navbar/navbar.php';
if(!isset($_SESSION["pelanggan"]) OR empty($_SESSION["pelanggan"]))
{
echo "<script>alert('Silahkan Login !!!');</script>";
echo "<script>location='login.php';</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
<!--<pre><?php print_r($_SESSION["pelanggan"])?></pre>-->
<section class="riwayat">
<div class="container">
<h3> Riwayat Belanja Anda </h3>
<table class="table table-bordered">
<thead>
<tr>
<th>No</th>
<th>Tanggal</th>
<th>Status</th>
<th>Total</th>
<th>Opsi</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
//Mendapatkan id_pelanggan yang login dari sesion
$id_pelanggan = $_SESSION["pelanggan"]['id_pelanggan'];
$ambil = $koneksi->query("SELECT * FROM pembelian WHERE id_pelanggan='$id_pelanggan'");
while($pecah = $ambil->fetch_assoc()){?>
<tr>
<td><?php echo $no;?></td>
<td><?php echo $pecah["tanggal_pembelian"];?></td>
<td><span style="font-weight:bold;"><?php echo $pecah['status_pembelian'];?></span></td>
<td>Rp. <?php echo number_format( $pecah["total_pembelian"]);?></td>
<td>
<a href="nota.php?id=<?php echo $pecah['id_pembelian'];?> " class="btn btn-info">Nota</a>
<?php if ($pecah['status_pembelian']=="PENDING"):?>
<a href="pembayaran.php?id=<?php echo $pecah['id_pembelian'];?>" class="btn btn-success">Pembayaran</a>
<?php else :?>
<a href="lihat_pembayaran.php?id=<?php echo $pecah['id_pembelian'];?>" class="btn btn-warning">Lihat Pembayaran</a>
<?php endif ?>
</td>
</tr>
<?php $no++;?>
<?php } ?>
</tbody>
</table>
</div>
</section>
</body>
</html>