/
laporan-penjualan.php
155 lines (148 loc) · 6.06 KB
/
laporan-penjualan.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
<?php
session_start();
require 'function.php';
if ($status == true && $id_role != 1 && $id_role != 2) {
header('Location: ' . BASEURL . '/auth/login');
}
if (isset($_POST["delete"])) {
if (hapusTransaksi($_POST) > 0) {
setFlash('berhasil', 'dihapus', 'success');
header('Location: ' . BASEURL . '/laporan-penjualan');
exit;
} else {
setFlash('gagal', 'dihapus', 'danger');
header('Location: ' . BASEURL . '/laporan-penjualan');
exit;
}
}
$transaksi = query("SELECT * FROM transaksi
inner join users ON transaksi.id_user=users.id_user
inner join pelanggan ON transaksi.id_pelanggan=pelanggan.id_pelanggan
ORDER BY id_transaksi ASC
");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Aplikasi Kasir">
<meta name="author" content="Daniel Fransiscus">
<title>Laporan Penjualan</title>
<link rel="stylesheet" type="text/css" href="<?php echo BASEURL; ?>/assets/css/datatables.css">
<link rel="stylesheet" type="text/css" href="<?php echo BASEURL; ?>/assets/css/styles.css">
</head>
<body class="sb-nav-fixed">
<?php include 'partials/top_nav.php'; ?>
<div id="layoutSidenav">
<div id="layoutSidenav_nav">
<?php include 'partials/sidebar.php'; ?>
</div>
<div id="layoutSidenav_content">
<div class="container-fluid px-4">
<h1 class="mt-4">Laporan Penjualan</h1>
<?php flash(); ?>
<div class="card mb-4">
<div class="card-header">
<form action="<?php echo BASEURL; ?>/list-transaksi" method="post">
<input placeholder="Masukkan tanggal awal" type="date" name="tgl_awal">
<input placeholder="Masukkan tanggal akhir" type="date" name="tgl_akhir">
<button type="submit" name="submit">Export</button>
</form>
</div>
<div class="card-body">
<table id="datatablesSimple">
<thead>
<tr>
<th>No</th>
<th>ID</th>
<th>Petugas</th>
<th>Pelanggan</th>
<th>Tanggal dan Waktu</th>
<th>Bayar</th>
<th>Total</th>
<th>Kembali</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach ($transaksi as $b) { ?>
<tr>
<td>
<?php echo $i; ?>
</td>
<td>
<?php echo htmlentities($b['id_transaksi']); ?>
</td>
<td>
<?php echo htmlentities($b['username']); ?>
</td>
<td>
<?php echo htmlentities($b['nama']); ?>
</td>
<td>
<?php echo htmlentities($b['tgl_wkt']); ?>
</td>
<td>
<?php echo htmlentities('Rp ' . number_format($b['bayar'], 2, ',', '.')); ?>
</td>
<td>
<?php echo htmlentities('Rp ' . number_format($b['total'], 2, ',', '.')); ?>
</td>
<td>
<?php echo htmlentities('Rp ' . number_format($b['kembali'], 2, ',', '.')); ?>
</td>
<td>
<button type="button" class="btn btn-danger" data-bs-toggle="modal"
data-bs-target="#delete<?php echo htmlentities($b['id_transaksi']); ?>">Hapus</button>
<a class="btn btn-secondary"
href="<?php echo BASEURL; ?>/transaksi-selesai?idtrx=<?php echo htmlentities($b['id_transaksi']); ?>">Lihat</a>
</td>
</tr>
<?php $i++; ?>
<div class="modal fade" id="delete<?php echo htmlentities($b["id_transaksi"]); ?>">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Hapus</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="<?php echo BASEURL; ?>/laporan-penjualan" method="post">
<div class="modal-body">
<p>Apakah anda yakin menghapus transaksi ini ?</p>
<input type="hidden" name="id_transaksi"
value="<?php echo htmlentities($b['id_transaksi']); ?>">
</div>
<div class="modal-footer">
<button type="submit" name="delete" class="btn btn-danger">Hapus</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal">Batal</button>
</div>
</form>
</div>
</div>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="<?php echo BASEURL; ?>/assets/js/jquery-3.4.1.js"></script>
<script src="<?php echo BASEURL; ?>/assets/js/fontawesome.js"></script>
<script src="<?php echo BASEURL; ?>/assets/js/bootstrap.bundle.min.js"></script>
<script src="<?php echo BASEURL; ?>/assets/js/scripts.js"></script>
<script src="<?php echo BASEURL; ?>/assets/js/datatables.js"></script>
<script src="<?php echo BASEURL; ?>/assets/js/datatables-simple-demo.js"></script>
<script>
window.setTimeout(function () {
$(".alert").fadeTo(300, 0).slideUp(500, function () {
$(this).remove();
});
}, 2000);
</script>
</body>
<?php ob_end_flush(); ?>
</html>