-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcetak_struk.php
162 lines (143 loc) · 5.76 KB
/
cetak_struk.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
include 'function.php';
include 'koneksi.php';
$menu = 'status';
?>
<!DOCTYPE html>
<html lang="id">
<?php include 'head.php'; ?>
<body>
<br><br><br><br>
<div class="container">
<h1 class="display-5">Detail Pesanan</h1>
<hr>
<p>Berikut adalah detail pesanan Anda.</p>
<?php
$id_pesanan = strtoupper($_GET['id']);
$query = mysqli_query($koneksi, "SELECT * FROM tb_pesanan WHERE id_pesanan = '$id_pesanan'");
$data = mysqli_fetch_array($query);
?>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Status Pesanan</b></label>
<div class="col-sm-10">
<b>
<?= $data['jenis_pembayaran'] == "COD" && $data['status_pesanan'] == "Menunggu Pembayaran" ? "Menunggu Konfirmasi" : $data['status_pesanan']; ?>
</b>
</div>
</div>
<hr>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Tanggal Pemesanan</b></label>
<div class="col-sm-10">
<b>
<?php echo $data['tanggal_pesanan']; ?>
</b>
</div>
</div>
<hr>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Kode Pesanan</b></label>
<div class="col-sm-10">
<b>
<?php echo $data['id_pesanan']; ?>
</b>
</div>
</div>
<hr>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Daftar Produk</b></label>
<div class="col-sm-10">
<table class="table table-borderless">
<tr>
<th class="text-center">
Produk
</th>
<th class="text-center">
Harga
</th>
<th class="text-center">
Jumlah pesanan
</th>
<th class="text-center">
Subtotal
</th>
</tr>
<?php
$query_keranjang = mysqli_query($koneksi, "SELECT * FROM tb_detail_pesanan LEFT JOIN tb_barang ON tb_barang.id_barang = tb_detail_pesanan.id_barang WHERE id_pesanan = '$id_pesanan' ORDER BY id_detail DESC");
while ($keranjang = mysqli_fetch_array($query_keranjang)) { ?>
<tr>
<td class="text-center">
<?php echo $keranjang['nama_barang']; ?>
</td>
<td class="text-center">
Rp.
<?php echo number_format($keranjang['harga_barang']); ?>
</td>
<td class="text-center">
<?php echo $keranjang['jumlah_pesanan']; ?>
</td>
<td class="text-center">
Rp.
<?php echo number_format($keranjang['subtotal_harga']); ?>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Total Harga</b></label>
<div class="col-sm-10">
<?php
$total_belanja = mysqli_query($koneksi, "SELECT SUM(subtotal_harga) AS total from tb_detail_pesanan where id_pesanan = '$id_pesanan' ");
$total_harga = mysqli_fetch_array($total_belanja);
?>
Rp.
<?php echo number_format($total_harga['total']); ?>
</div>
</div>
<hr>
<hr>
<div class="form-group">
<label for="exampleInputEmail1"><b>Informasi Pembayaran</b></label>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label">Total Harga</label>
<div class="col-sm-10">
Rp.
<?php echo number_format($total_harga['total']); ?>
</div>
</div>
</div>
<hr>
<br><br>
<div class="form-group">
<label for="exampleInputEmail1"><b>Pembayaran</b></label>
<div class="form-group row">
<label for="inputEmail3" class="col-sm-2 col-form-label"><b>Status Pembayaran</b></label>
<div class="col-sm-10">
<?php
$query_bukti = mysqli_query($koneksi, "SELECT * FROM tb_bukti WHERE id_pesanan = '$id_pesanan' ");
$bukti = mysqli_fetch_array($query_bukti);
if ($data['jenis_pembayaran'] == 'COD') {
echo "COD";
} else if ($bukti == null) {
echo "Belum Dibayar";
} else if ($data['status_pesanan'] == 'Menunggu Pembayaran' && $bukti != null) {
echo "Sudah Dibayar (menunggu konfirmasi)";
} else if ($bukti != null) {
echo "Sudah Dibayar (terkonfirmasi)";
} else {
echo "-";
} ?>
</div>
</div>
</div>
<br><br>
<p>@ Edot gypsum </p>
<br><br>
</div>
</body>
</html>
<script>
window.print();
</script>