<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$bulan = date('m');
$bl = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM bulan WHERE bln='$bulan'"));
?>           

                   <div class="row">
                          <div class="col-md-8">
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="card-title">REKAP HONOR NON PNS BULAN <?= strtoupper($bl['ket']) ?></h5>
												
                                    </div>
                                    <div class="card-body">
									
									<div class="card-box table-responsive">
                                        <table id="datatable1" class="table table-bordered table-hover" style="width:100%;font-size:12px">
                                            <thead>
                                                <tr>
                                                    <th width="5%">NO</th> 
													<th>NAMA GURU</th>													                                                  
                                                    <th>HADIR</th>
													 <th>JJM</th>
													  <th>TOTAL</th>
													
                                                </tr>
                                            </thead>
                                            <tbody>
											<?php
											$no=0;							
											$query = mysqli_query($koneksi, "SELECT * FROM absensi WHERE level='pegawai' and ket='H' and bulan='$bulan' GROUP BY idpeg"); 											
											  while ($data = mysqli_fetch_array($query)) :	
											 $hadir = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM absensi WHERE bulan='$bulan' AND ket='H' AND idpeg='$data[idpeg]'"));
										     $jjm = mysqli_fetch_array(mysqli_query($koneksi, "SELECT SUM(jjm)AS jjjm,bulan,idpeg FROM absensi WHERE bulan='$bulan'  AND idpeg='$data[idpeg]'"));
										
											  $peg = fetch($koneksi,'users',['id_user'=>$data['idpeg']]);
											   $no++;
											   ?>
											  
                                                <tr>
                                                    <td><?= $no; ?></td>
                                                     <td><?= $peg['nama'] ?></td>
                                                       <td><?= $hadir ?> X</td>
													   <td><?= $jjm['jjjm'] ?></td>
													   <td><?= number_format($jjm['jjjm']*$data['honor']); ?></td>
                                                </tr>
												
												<?php endwhile; ?>
												</tbody>
                                                </table>
												 </div>
											</div>
										</div>
										
									</div>
									
					       <div class="col-md-4">
                     
                                <div class="card widget widget-payment-request">
                                    <div class="card-header">
                                  
                                    </div>
                                    <div class="card-body">
                                        <div class="widget-payment-request-container">
                                            <div class="widget-payment-request-author">
                                                <div class="avatar m-r-sm">
                                                    <img src="../images/user.png" alt="">
                                                </div>
                                                <div class="widget-payment-request-author-info">
                                                    <span class="widget-payment-request-author-name"><?= strtoupper($user['nama']) ?></span>
                                                    <span class="widget-payment-request-author-about"><?= $setting['sekolah'] ?></span>
                                               
											   </div>
                                            </div>
											
									<div class="widget-payment-request-info m-t-md">
									 <div class="d-grid gap-2">
									<button class="btn btn-dark" type="button" disabled>
										<span class="spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
										 CETAK HONOR NON PNS
									</button>
											</div>
											 <p>
									  <form id='menu' action="cbtserver_ptm/cetakhonor.php" target="_blank" method="POST" class="form-horizontal" >                        
                               						 
							<div class="col-md-12">
								<label class="form-label bold">Bulan</label>
								<select name="bulan" class='form-select' required='true' style="width: 100%">
										<?php													
										$kls = mysqli_query($koneksi, "SELECT * FROM bulan");
										while ($kelas = mysqli_fetch_array($kls)) {										
										echo "<option value='$kelas[bln]'>$kelas[ket]</option>";
													}
													?>				
									 </select>
							     </div>	            
								
									  <p>
									  
								           <div class="d-grid gap-2">
                                       <button id="blockui-3" class="btn btn-primary">SIMPAN</button>
                           
                                            </div>
									    </form>
										</div>
									 </div>
					            </div>
								</div>
							</div>
						</div>
					</div>
				
				