-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbalik.php
More file actions
67 lines (67 loc) · 3.44 KB
/
balik.php
File metadata and controls
67 lines (67 loc) · 3.44 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
<?php
include "koneksi.php";
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$qry = mysql_query("SELECT * FROM pinjam WHERE id='$id'") or die(mysql_error());
$tampil = mysql_fetch_assoc($qry);
$max = $tampil['durasi'];
$pinjam = date("d-m-Y", strtotime("$tampil[tgl_pinjam]"));
$batas = date("d-m-Y", strtotime("$pinjam +$max day"));
$pengembalian = date("d-m-Y", time());
$lamapi = $pengembalian - $pinjam;
?>
<h3>Informasi Peminjaman</h3><br>
<?php if ($pengembalian > $batas) { ?>
<div class="w3-panel w3-red w3-display-container">
<span onclick="this.parentElement.style.display='none'" class="w3-button w3-large w3-display-topright">×</span>
<h3>Peringatan!</h3>
<p>Anda melewati batas maksimal pengembalian buku, anda akan dikenakan denda sebesar Rp.1000 per hari keterlambatan!</p>
</div>
<?php } ?>
<form <?php echo "action=proses_balik.php?id=$tampil[id]" ?> method="post">
<table width="50%" cellpadding="3" border="0">
<tr>
<td><b>Nama Peminjam</b></td>
<td><b>:</b></td>
<td><input type="text" name="npi" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?= $tampil['nama_peminjam']; ?>" autocomplete="off"></td>
</tr>
<tr>
<td><b>Nama Petugas</b></td>
<td><b>:</b></td>
<td><input type="text" name="npet" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?= $tampil['nama_petugas']; ?>" autocomplete="off"></td>
</tr>
<tr>
<td><b>Tanggal Pinjam</b></td>
<td><b>:</b></td>
<td><input type="text" name="tgl" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?= $tampil['tgl_pinjam']; ?>" autocomplete="off"></td>
</tr>
<tr>
<td><b>Lama Pinjam</b></td>
<td><b>:</b></td>
<td><input type="text" name="durasi" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?= $lamapi; ?> Hari" autocomplete="off"></td>
</tr>
<tr>
<td><b>Judul Buku</b></td>
<td><b>:</b></td>
<td><input type="text" name="judul" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?= $tampil['judul_buku']; ?>" autocomplete="off"></td>
</tr>
<tr>
<td><b>Denda</b></td>
<td><b>:</b></td>
<td>
<input type="text" name="denda" class="w3-input w3-border w3-light-grey w3-animate-input" value="<?php if ($pengembalian > $batas) {
$denda = $lamapi * 1000;
echo "Rp. " . $denda;
} else {
echo "Rp. 0";
} ?>">
</td>
</tr>
<tr>
<td></td>
<td></td>
<td colspan="3" align="center">
<button type="submit" class="w3-button w3-blue" style="width:50%" name="kembali">Kembalikan</button>
</td>
</tr>
</table>
</form>