-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaksi-selesai.php
184 lines (176 loc) · 4.97 KB
/
transaksi-selesai.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<?php
session_start();
require __DIR__ . '/function.php';
if ($status == true && $id_role != 1 && $id_role != 2) {
header('Location: ' . BASEURL . '/auth/login');
}
if (!isset($_GET['idtrx']) || $_GET['idtrx'] == "") {
http_response_code(400);
echo "<h1><center>idtrx is Required</center></h1>";
exit();
} else {
$id_trx = $_GET['idtrx'];
if (is_numeric($id_trx)) {
$data = mysqli_query($conn, "SELECT * FROM transaksi WHERE id_transaksi='$id_trx'");
$trx = mysqli_fetch_assoc($data);
$detail = mysqli_query($conn, "SELECT * FROM transaksi_detail INNER JOIN barang ON transaksi_detail.id_barang = barang.id_barang WHERE transaksi_detail.id_transaksi = '$id_trx'");
$p = "SELECT * FROM profil";
$result = mysqli_query($conn, $p);
$q = mysqli_fetch_assoc($result);
if (!is_array($trx)) {
http_response_code(404);
include('404.php');
exit();
}
} else {
http_response_code(400);
echo "<h1><center>idtrx isn't numeric</center></h1>";
exit();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Kasir Selesai</title>
<style type="text/css">
body {
color: #a7a7a7;
}
@media print {
#printPageButton,
#back {
display: none;
}
}
div {
font-size: 19px;
}
</style>
</head>
<body>
<button id="back" type="button" onclick="window.location.href='<?php echo BASEURL; ?>/laporan-penjualan'">Kembali</button>
<button id="printPageButton" type="button" onclick="window.print();">Cetak</button>
<div align="center">
<header>
<h3>Warung
<?php echo htmlentities($q['nama_warung']); ?> <br>
<?php echo htmlentities($q['alamat']); ?><br>
</h3>
</header>
<table width="500" border="0" cellpadding="1" cellspacing="0">
<tr align="center">
<td>
<hr>
</td>
</tr>
<?php
$idusr = $trx['id_user'];
$sql = "SELECT * FROM users WHERE id_user= $idusr";
$petugas = mysqli_query($conn, $sql);
$ptg = mysqli_fetch_assoc($petugas);
?>
<tr>
<td>Tanggal dan Waktu :
<?php echo htmlentities($trx['tgl_wkt']); ?>
</td>
</tr>
<tr>
<td>ID Transaksi :
<?php echo htmlentities($trx['id_transaksi']); ?>
</td>
</tr>
<tr>
<td>Nama Petugas :
<?php echo htmlentities($ptg['username']); ?>
</td>
</tr>
<tr>
<?php
$id_pelanggan = $trx['id_pelanggan'];
$cst = "SELECT * FROM pelanggan where id_pelanggan = $id_pelanggan";
$p = mysqli_query($conn, $cst);
$pg = mysqli_fetch_assoc($p);
?>
<tr>
<td>Nama Pelangggan :
<?php echo htmlentities($pg['nama']); ?>
</td>
</tr>
<td>
<hr>
</td>
</tr>
</table>
<table width="500" border="0" cellpadding="3" cellspacing="0">
<tr>
<td valign="top" align="left">Nama</td>
<td valign="top" align="left">Jumlah</td>
<td valign="top" align="left">Harga</td>
<td valign="top" align="right">Sub Total</td>
</tr>
<?php while ($row = mysqli_fetch_array($detail)) { ?>
<tr>
<td valign="top" align="left">
<?php echo htmlentities($row['nama']); ?>
<?php if ($row['diskon'] > 0) { ?>
<br>
<small align>Diskon</small>
<?php } ?>
</td>
<td valign="top" align="left">
<?php echo htmlentities($row['qty']); ?>
</td>
<td valign="top" align="left">
<?php echo htmlentities("Rp " . number_format($row['harga_barang'], 2, ',', '.')); ?>
</td>
<td valign="top" align="right">
<?php echo htmlentities("Rp " . number_format($row['total'], 2, ',', '.')); ?>
<?php if ($row['diskon'] > 0) { ?>
<br>
<small>-
<?php echo htmlentities("Rp " . number_format($row['diskon'], 2, ',', '.')); ?>
</small>
<?php } ?>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="4">
<hr>
</td>
</tr>
<tr>
<td align="right" colspan="3">Total</td>
<td align="right">
<?php echo htmlentities("Rp " . number_format($trx['total'], 2, ',', '.')); ?>
</td>
</tr>
<tr>
<td align="right" colspan="3">Bayar</td>
<td align="right">
<?php echo htmlentities("Rp " . number_format($trx['bayar'], 2, ',', '.')); ?>
</td>
</tr>
<tr>
<td align="right" colspan="3">Kembali</td>
<td align="right">
<?php echo htmlentities("Rp " . number_format($trx['kembali'], 2, ',', '.')); ?>
</td>
</tr>
</table>
<br><br>
<footer>
<div>
Terima Kasih Selamat Berbelanja
</div>
<div>
Info dan Layanan Konsumen
</div>
<div>
<?php echo htmlentities($q['kontak']); ?>
</div>
</footer>
</div>
</body>
</html>