-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathriwayat.php
More file actions
121 lines (121 loc) · 4.95 KB
/
riwayat.php
File metadata and controls
121 lines (121 loc) · 4.95 KB
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
112
113
114
115
116
117
118
119
120
121
<?php
session_start();
include 'koneksi.php';
if (!isset($_SESSION["pengguna"])) {
echo "<script> alert('Anda belum login');</script>";
echo "<script> location ='login.php';</script>";
}
?>
<?php include 'header.php'; ?>
<div class="kontainer">
<div class="row mb-3 mt-5 pb-3">
<div class="kolom-md-12 judulsection animasikontainer">
<h3 class="mb-4 text-tengah">Riwayat Transaksi</h3>
</div>
</div>
</div>
<div class="kontainer">
<div class="row">
<div class="kolom-md-12 animasikontainer">
<div class="cart-list">
<table class="tabel">
<thead class="thead-white">
<tr class="text-tengah">
<th>No</th>
<th>Tanggal</th>
<th>Berat</th>
<th>Total</th>
<th>Opsi</th>
<th>Bukti Pembayaran</th>
<th>Nota</th>
</tr>
</thead>
<tbody>
<?php $nomor = 1;
$id = $_SESSION["pengguna"]['id'];
$ambil = $koneksi->query("SELECT *, pembelian.idbeli as idbelireal FROM pembelian left join pembayaran on pembelian.idbeli = pembayaran.idbeli WHERE pembelian.id='$id' order by pembelian.tanggalbeli desc, pembelian.idbeli desc");
while ($pecah = $ambil->fetch_assoc()) { ?>
<tr>
<td><?php echo $nomor; ?></td>
<td><?php echo tanggal($pecah['tanggalbeli']) ?></td>
<td><?php echo $pecah["totalberat"] ?> KG</td>
<td>Rp. <?php echo number_format($pecah["totalbeli"] + $pecah["ongkir"] + $pecah["hargapemasangan"]); ?></td>
<td>
<?php if ($pecah['statusbeli'] == "Belum Bayar") {
$deadline = date('Y-m-d H:i', strtotime($pecah['waktu'] . ' +1 day'));
$harideadline = date('Y-m-d', strtotime($pecah['waktu'] . ' +1 day'));
$jamdeadline = date('H:i', strtotime($pecah['waktu'] . ' +1 day'));
if (date('Y-m-d H:i') >= $deadline) {
echo 'Waktu pembayaran<br>telah habis';
} else { ?>
<a href="pembayaran.php?id=<?php echo $pecah["idbelireal"] ?>" class="tombolkecil">Upload Bukti Pembayaran Sebelum <?= tanggal($harideadline) . ' - Jam ' . $jamdeadline ?></a>
<?php }
} elseif ($pecah['statusbeli'] == "Sudah Upload Bukti Pembayaran") { ?>
<a class="tombolkecil text-putih">Menunggu Konfirmasi Admin</a>
<?php } elseif ($pecah['statusbeli'] == "Barang Di Kirim") { ?>
<a class="tombolkecil text-putih">Barang Anda Sedang Di Kirim, Mohon Di Tungggu</a>
<br><br>
<p><a target="_blank" href="https://cekresi.com">No Resi : <?= $pecah['resipengiriman'] ?></a></p>
<?php } elseif ($pecah['statusbeli'] == "Barang Telah Sampai ke Pemesan") { ?>
<a data-toggle="modal" data-target="#selesai<?= $nomor ?>" class="tombolkecil text-putih">Konfirmasi Selesai</a>
<?php } elseif ($pecah['statusbeli'] == "Selesai") { ?>
<a class="tombolkecil text-putih">Transaksi Selesai</a>
<?php } elseif ($pecah['statusbeli'] == "Pesanan Di Tolak") { ?>
<a class="tombolkecil text-putih">Pesanan Anda Di Tolak</a>
<?php } ?>
</td>
<td><img width="150px" src="foto/<?= $pecah['bukti'] ?>" alt=""></td>
<td>
<a class="tombolkecil" target="_blank" href="notacetak.php?id=<?= $pecah['idbelireal'] ?>">Nota</a>
</td>
</tr>
<?php $nomor++; ?>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
$no = 1;
$id = $_SESSION["pengguna"]['id'];
$ambil = $koneksi->query("SELECT *, pembelian.idbeli as idbelireal FROM pembelian left join pembayaran on pembelian.idbeli = pembayaran.idbeli WHERE pembelian.id='$id' order by pembelian.tanggalbeli desc, pembelian.idbeli desc");
while ($pecah = $ambil->fetch_assoc()) { ?>
<div class="modal fade" id="selesai<?= $no ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Konfirmasi Pesanan Selesai</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="post">
<div class="modal-body">
<h5>Apakah anda yakin ingin mengkonfirmasi pesanan telah selesai ?</h5>
</div>
<div class="modal-footer">
<input type="hidden" class="form-contol" value="<?= $pecah['idbeli'] ?>" name="idbeli">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" name="selesai" value="selesai" class="btn btn-biru">Konfirmasi</button>
</div>
</form>
</div>
</div>
</div>
<?php
$no++;
} ?>
<?php
if (isset($_POST["selesai"])) {
$koneksi->query("UPDATE pembelian SET statusbeli='Selesai'
WHERE idbeli='$_POST[idbeli]'");
echo "<script>alert('Pesanan berhasil di konfirmasi selesai')</script>";
echo "<script>location='riwayat.php';</script>";
}
?>
<div style="padding-top: 150px"></div>
<?php
include 'footer.php';
?>