-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory_pembayaran.php
103 lines (86 loc) · 2.84 KB
/
history_pembayaran.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
<?php
$sql = "SELECT * FROM pembayaran as p JOIN petugas as pe
ON pe.id_petugas=p.id_petugas JOIN spp ON spp.id_spp = p.id_spp
";
if($tampil = $crud->tampilAll($sql)):
$tampil = $crud->tampilAll($sql);
$nisn = $tampil[0]["nisn"];
$sql2 = "SELECT * FROM siswa WHERE nisn=$nisn";
$siswa = $crud->tampilAll($sql2);
endif;
?>
<div class="container">
<h2 class="text-center mb-5">History pembayaran</h2>
<?php crud::flashdata(); ?>
<?php
if(!$_SESSION['user']['level'] == 'siswa' ):
?>
<a href="index.php?menu=entri" class="btn btn-info mb-3">Tambah Data Pembayaran</a>
<?php endif;?>
<table class="table table-sm table-responsive">
<thead>
<tr>
<th>No</th>
<th>Nisn</th>
<th>Nama siswa</th>
<th>Tanggal Bayar</th>
<th>Bulan Bayar</th>
<th>Tahun Bayar</th>
<th>Nominal SPP</th>
<th>jumlah Bayar</th>
<th>Nama Petugas</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
foreach ($tampil as $t ) {
?>
<tr>
<td><?= $no++ ?></td>
<td><?= $t['nisn']; ?></td>
<td><?= $siswa[0]['nama']; ?></td>
<td><?= $t['tgl_bayar']; ?></td>
<td><?= $t['bulan_bayar']; ?></td>
<td><?= $t['tahun_bayar']; ?></td>
<td><?= $t['nominal']; ?></td>
<td><?= $t['jumlah_bayar']; ?></td>
<td><?= $t['nama_petugas']; ?></td>
<?php
if($tampil[0]['jumlah_bayar'] == $tampil[0]['nominal']):
echo '<td>Lunas</td>';
else:
echo '<td>Belum lunas</td>';
endif;
?>
<?php if ($_SESSION['user']['level'] != 'siswa') {
?>
<td>
<a href="edit_pembayaran.php?edit=<?= $t['id_pembayaran'] ?>" class="btn btn-primary btn-sm" >Edit</a>
<a onclick="confirm('Yakin ingin menghapus?');" href="?menu=history_pembayaran&hapus=<?=$t['id_pembayaran'] ?>" class="btn btn-danger btn-sm" >Hapus</a>
</td>
<?php } ?>
<td>
</td>
</tr>
<?php } ?>
<?php
if (isset($_GET['hapus'])) {
$id = $_GET['hapus'];
$hapus =$crud->hapus("pembayaran", 'id_pembayaran', $id );
print_r($id);
if ($hapus) {
$crud::set_flashdata("success","Data berhasil dihapus");
echo "<script>location='index.php?menu=siswa'</script>";
}
else
{
$crud::set_flashdata("danger","Data tidak berhasil dihapus");
echo "<script>location='index.php?menu=siswa'</script>";
}
}
?>
</tbody>
</table>
</div>