     <?php
	 $bl=date('m');
	 $thn=date('Y');
	 $bulane=fetch($koneksi,'bulan',['bln' =>$bl]);
	 ?>
	 <div class='row'>
        <div class='col-md-12'>
             <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                    <div class='box-tools pull-right '>
					 
                    </div>
					<h4 class='box-title'><i class="fas fa-graduation-cap"></i> Pembayaran</h4>
                </div>
				
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >Pembayaran</a></li>
                    </ul>
					<div class="tab-content">
                    <div class="tab-pane active" id="tab_1" >
					<br>
				<div class="panel panel-default">
				 <div class='box-body'>
           <div class="box-solid">
                <div class="box-header" > 
                    <h4 class='box-title'><i class="fas fa-bars"></i> Data Pembayaran Bulan <?= $bulane['ket'] ?> <?= date('Y') ?></h4>
                    <div class='box-tools pull-right'>
				     
		  </div>
         </div>
           
           <div class='box-body'>
                    <div class='table-responsive'>
                        <table style="font-size: 11px" id='example1' class='table table-bordered table-hover'>
                            <thead>
                            <tr>
                               
                                    <th width='5%'>#</th>
                                    <th width='10%'>Tanggal</th>
                                    <th>Nama Siswa</th>
                                   <th width='10%'>Kelas</th>
								   <th>No Reff</th>
								    <th width='10%'>Pembayaran</th>
									<th width='10%'>Untuk Bulan</th>
									<th width='5%'></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
							include"fungsi.php";
							$no=0;
                            $data = mysqli_query ($koneksi, " select * FROM trx WHERE bulan='$bl' AND tahun='$thn' ORDER BY idt DESC");
						while ($row = mysqli_fetch_array ($data)){
							$siswa=fetch($koneksi,'siswa',['id_siswa'=>$row['idsiswa']]);
							$bulane=fetch($koneksi,'bulan',['bln'=>$row['untuk']]);
                                $no++;
                              
                            ?>
                                <tr>
                                  
					<td>
						<?php echo $no++; ?>
					</td>
					<td>
						<?php echo $row['tanggal']; ?>
					</td>
					<td>
						<?php echo $siswa['nama']; ?>
					</td>
					<td>
						<?php echo $siswa['id_kelas']; ?>
					</td>
					<td>
						<?php echo $row['bukti']; ?>
					</td>
					<td>
						<?php echo $row['kode']; ?>
					</td>
					<td>
						<?php echo $bulane['ket']; ?>
					</td>
					<td>
					<button data-id='<?= $row['idt'] ?>' class="hapus btn btn-danger btn-sm" title="Hapus"><i class="fas fa-trash-alt"></i></button>
					</td>		  
									  </tr>
                            <?php }
                            ?>


                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
 
	
	 $('#example1').on('click', '.hapus', function() {
        var id = $(this).data('id');
        console.log(id);
        swal({
            title: 'Are you sure?',
            text: 'Akan menghapus data ini!',
			type:'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: 'iya, hapus'
        }).then((result) => {
            if (result.value) {
                $.ajax({
                    url: 'sandik_bayar/crud_bayar.php?pg=hapus',
                    method: "POST",
                    data: 'id=' + id,
                    success: function(data) {
                       iziToast.info(
									{
										title: 'Sukses!',
										message: 'Data berhasil dihapus',
										titleColor: '#FFFF00',
										messageColor: '#fff',
										backgroundColor: 'rgba(0, 0, 0, 0.5)',
										 progressBarColor: '#FFFF00',
										  position: 'topRight'					  
						});
                        setTimeout(function() {
                            window.location.reload();
                        }, 2000);
                    }
                });
            }
            return false;
        })

    });
	</script>