-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistori.php
77 lines (75 loc) · 3.59 KB
/
histori.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
<?php
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' LIMIT 100 ORDER BY `Hari` DESC";
if (isset($_GET['pinjam'])) {
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' AND `Keterangan`='Pinjam' LIMIT 100 ORDER BY `Hari` DESC";
} else if (isset($_GET['hutang'])) {
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' AND `Keterangan`='Hutang' LIMIT 100 ORDER BY `Hari` DESC";
} else if (isset($_GET['uangkecil'])) {
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' AND (`Uang`-`Kembalian`)<100000 LIMIT 100 ORDER BY `Hari` DESC";
} else if (isset($_GET['uangbesar'])) {
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' AND (`Uang`-`Kembalian`)>=100000 LIMIT 100 ORDER BY `Hari` DESC";
} else if (isset($_GET['kas'])) {
$sql = "SELECT * FROM `laporan` WHERE `Accept`='True' AND `Keterangan`='Kas' LIMIT 100 ORDER BY `Hari` DESC";
}
$result = $conn->query($sql);
?>
<body>
<?php include "nav.php"; ?>
<div class="card m-3">
<div class="card-body m-3">
<h4 class="card-title" style="color:#0891C0">Histori</h4>
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">Filter</button>
<div id="myDropdown" class="dropdown-content">
<a href="./?menu=histori">All</a>
<a href="./?menu=histori&pinjam">Pinjam</a>
<a href="./?menu=histori&hutang">Hutang</a>
<a href="./?menu=histori&uangkecil">Uang Kecil</a>
<a href="./?menu=histori&uangbesar">Uang Besar</a>
<a href="./?menu=histori&kas" style="background-color:#99ff99">Kas</a>
</div>
</div>
<hr>
<p class="card-text" style="text-align: justify;">
<?php if (mysqli_num_rows($result) > 0) {
while ($row = $result->fetch_assoc()) {
?>
<div class="mt-2"><?php
if ($row["Keterangan"] == "Kas") {
echo $row["Hari"] . " ⠀ " . $row["Jam"] . "<br>";
echo $row["Keterangan"] . " ⠀ ";
echo "<b>+" . $row["Uang"] . "</b><br>";
} else if ($row["Kembalian"] != 0) {
echo $row["Hari"] . " ⠀ " . $row["Jam"] . "<br>";
echo $row["Nama"] . " " . $row["Keterangan"] . " - " . $row["Tujuan"] . "<br>";
echo "<b>" . ($row["Uang"] - $row["Kembalian"]) . " <a style='color:darkblue'>(" . $row["Uang"] . "-" . $row["Kembalian"] . ")</a></b><br>";
} else {
echo $row["Hari"] . " ⠀ " . $row["Jam"] . "<br>";
echo $row["Nama"] . " " . $row["Keterangan"] . " - " . $row["Tujuan"] . "<br>";
echo "<b>" . $row["Uang"] . "</b><br>";
}
}
} ?>
</p>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script>
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
</body>
</html>