-
Notifications
You must be signed in to change notification settings - Fork 1
/
biaya.php
81 lines (70 loc) · 2.02 KB
/
biaya.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
<?php
if( empty( $_SESSION['id_user'] ) ){
$_SESSION['err'] = '<strong>ERROR!</strong> Anda harus login terlebih dahulu.';
header('Location: ./');
die();
} else {
if( isset( $_REQUEST['aksi'] )){
$aksi = $_REQUEST['aksi'];
switch($aksi){
case 'baru':
include 'biaya_baru.php';
break;
case 'edit':
include 'biaya_edit.php';
break;
case 'hapus':
include 'biaya_hapus.php';
break;
}
} else {
echo '
<div class="container">
<div class="col-md-8">
<h3 style="margin-bottom: -20px;">Data Master Biaya Voucher</h3>
<a href="./admin.php?hlm=biaya&aksi=baru" class="btn btn-success btn-s pull-right">Tambah Data</a>
<br/><hr/>
<table class="table table-bordered">
<thead>
<tr class="info">
<th width="10%">No</th>
<th width="35%">Jenis Voucher</th>
<th width="35%">Biaya</th>
<th width="20%">Tindakan</th>
</tr>
</thead>
<tbody>';
//skrip untuk menampilkan data dari database
$sql = mysqli_query($koneksi, "SELECT * FROM biaya");
if(mysqli_num_rows($sql) > 0){
$no = 0;
while($row = mysqli_fetch_array($sql)){
$no++;
echo '
<tr>
<td>'.$no.'</td>
<td>'.$row['jenis'].'</td>
<td>'.$row['biaya'].'</td>
<td>
<script type="text/javascript" language="JavaScript">
function konfirmasi(){
tanya = confirm("Anda yakin akan menghapus user ini?");
if (tanya == true) return true;
else return false;
}
</script>
<a href="?hlm=biaya&aksi=edit&id_biaya='.$row['id_biaya'].'" class="btn btn-warning btn-s">Edit</a>
<a href="?hlm=biaya&aksi=hapus&submit=yes&id_biaya='.$row['id_biaya'].'" onclick="return konfirmasi()" class="btn btn-danger btn-s">Hapus</a>
</td>';
}
} else {
echo '<td colspan="8"><center><p class="add">Tidak ada data untuk ditampilkan. <u><a href="?hlm=biaya&aksi=baru">Tambah data baru</a></u> </p></center></td></tr>';
}
echo '
</tbody>
</table>
</div>
</div>';
}
}
?>