    <?php 
        session_start();
        include 'header.php'; 
     $kdc=$_SESSION['kdc'];

        $sql2 = mysqli_query($koneksi, "SELECT kanca,alamat,gambar,foto_bag FROM kdkanca WHERE kd='$kdc'");
        list($kanca,$alamat,$gambar,$foto_bag) = mysqli_fetch_array($sql2);      
    ?> 
            <?php if(isset($_GET['alert'])){ 
                if($_GET['alert'] == "ganti_pasword_opr_sukses"){ 
                    echo "<div class='alert alert-success'>Password berhasil diganti!</div>"; 
                } else { 
                    echo "<div class='alert alert-danger'>Password belum berhasil diganti...!</div>"; 
                } 
            } ?>    
<!DOCTYPE html>
<html>
    
<?php if ($_SESSION['level']<>'LAP') { ;?>

<head>

    <style>
        /*untuk teks heading di tag <body>*/
        h2
        {
            background-color: lightgreen;
            color: crimson;
            font-family: sans-serif;
            text-align: center;
            width: 45%;
            margin:auto;
            padding: 20px;
        }
 
        body
        {
            background-image: url('../gambar/<?php echo $foto_bag ; ?>');
            background-repeat: no-repeat;
            background-size: 100% auto;
            background-position: top center;
        }

img {
    width: 100%;
    height: 100vh;
    object-fit: cover;
}
}
     </style>
</head>
    <div class="container">
        
    </div>

<?php     
        $sql2 = mysqli_query($koneksi, "SELECT kota,keuangan,gambar FROM kdkanca WHERE kd='$kdc'");
        list($kota,$keuangan,$gambar) = mysqli_fetch_array($sql2);
?> 





<div>
  <img src="../gambar/<?php echo $gambar ?>" style="width: 600px; height: auto;">
</div>


<div class="table-responsive" style="width: 600px;">
  <table class="table table-bordered table-striped" id="table-datatable1" style="background-color: transparent;">
    <thead>
      <tr>
        <th width="5%" class="text-center" style="text-align:left; font-size: 12pt; font-weight:normal; background-color: transparent;">No</th>
        <th width="60%" class="text-center" style="text-align:left; font-size: 12pt; font-weight:normal; background-color: transparent;">N a m a</th>
        <th width="30%" class="text-center" style="text-align:left; font-size: 12pt; font-weight:normal; background-color: transparent;">Saldo (Rp.)</th>
        <th width="5%" class="text-center" style="text-align:left; font-size: 12pt; font-weight:normal; background-color: transparent;"></th>
      </tr>
    </thead>
    <tbody>
      <?php 
      $no = 1; 
      $awal = 0; 
      $debet = 0; 
      $kredit = 0; 
      $naw = mysqli_query($koneksi,"SELECT * FROM nawal WHERE nosub='111' ORDER BY noperk ASC"); 
      while($n = mysqli_fetch_array($naw)){ 
        $noperk=$n['noperk'] ; 
        $so_awal=$n['awald'] ;
        $jor = mysqli_query($koneksi,"select sum(debet-kredit) AS tsaldo from jor where noperk='$noperk'"); 
        $j = mysqli_fetch_assoc($jor); 
        $so_akhir=$j[tsaldo]+$so_awal ;
      ?>
      <tr style="background-color: transparent;">
        <td style="text-align:center; font-size: 16pt; font-weight:bold; background-color: transparent;"><?php echo $no++; ?></td>
        <td style="text-align:left; font-size: 18pt; font-weight:bold; background-color: transparent;"><?php echo $n['perk'] ?></td>
        <td style="text-align:right; font-size: 18pt; font-weight:bold; background-color: transparent;"><?php echo "  " . number_format("$so_akhir", 0, ",", ".").",-"; ?></td>
        <td>
            <a data-toggle='tooltip' data-placement='top' title='Buka Data Trans <?php echo $d['perk'] ?> Semua ' class="btn btn-primary btn-sm" href="!!_view_trans_per_akunt.php?id=<?php echo $n['noperk'] ?>&unit=03"><i class="bi bi-eye"></i></a>
        </td>
      </tr>
      <?php } ?>
    </tbody>
  </table>
</div>
<?php } else { ;?>


<head>

    <style>

     </style>
</head>
    <div class="container">
        
    </div>

<?php     
    $sql2 = mysqli_query($koneksi, "SELECT kota,keuangan,gambar FROM kdkanca WHERE kd='$kdc'");
    list($kota,$keuangan,$gambar) = mysqli_fetch_array($sql2);
        
    $tgl_ini=date('d-m-Y') ;
    $tgl_ini2=date('Y-m-d') ;    
    
    $tgl_sekarang=date('Y-m-d') ;
    
    $tgl_ini = date('d-m-Y');
    $tgl_sebelum = date('d-m-Y', strtotime($tgl_ini . ' -1 day'));
    $tgl_sesudah = date('d-m-Y', strtotime($tgl_ini . ' +1 day'));
    
?> 

<div>
<center>
  <img src="../gambar/<?php echo $gambar ?>" style="width: 350px; height: auto;">
</center>     
</div>

<div>
<center>
  <h5 class="fw-semibold my-3">TUGAS <?php echo $tgl_ini; ?></h5>
</center>     
</div>

<center>
<div class="table-responsive" style="width: 350px;">
  <table class="table table-bordered table-striped" id="table-datatable1" style="background-color: transparent;">
    <thead>
      <tr>
        <th width="5%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal; background-color: transparent;">No</th>
        <th width="60%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal; background-color: transparent;">Jenis</th>
        <th width="30%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal; background-color: transparent;">Jumlah</th>
        <th width="5%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal; background-color: transparent;">Opsi</th>
      </tr>
    </thead>
    <tbody>
      <?php 
      $ao=$_SESSION['id_kar'] ;
      $no = 1; 
      $naw = mysqli_query($koneksi,"SELECT * FROM nawal WHERE kt='D' ORDER BY noperk ASC"); 
      while($n = mysqli_fetch_array($naw)){ 
        $noperk=$n['noperk'] ; 
        
        $perk = str_replace('Pend. ', '', $n['perk']);
        $perk = htmlspecialchars($perk, ENT_QUOTES);
        
        $jor = mysqli_query($koneksi,"select sum(masuk-keluar) AS tsaldo from anggota_trans_ao where kdj='$noperk' and tanggal='$tgl_ini2' and ao='$ao' and hapus<>'HAPUS' "); 
        $j = mysqli_fetch_assoc($jor); 
      ?>
      <tr style="background-color: transparent;">
        <td style="text-align:center; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo $no++; ?></td>
        <td style="text-align:left; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo $perk; ?></td>
        <td style="text-align:right; font-size: 10pt; font-weight:bold; background-color: transparent;"><?php echo "  " . number_format("$j[tsaldo]", 0, ",", "."); ?></td>
        <td>
            <a data-toggle='tooltip' data-placement='top' title='Tambah Trans <?php echo $perk; ?> ' class="btn btn-success btn-sm" href="tugas_trans_jenis_tgl_sd_tgl.php?kdj=<?php echo $n['noperk'] ?>"><i class="bi bi-plus-lg"></i></a>
        </td>
      </tr>
      <?php } ?>
    </tbody>
                        <?php 
                $sql2 = mysqli_query($koneksi, "SELECT sum(masuk-keluar) AS tjumlah FROM anggota_trans_ao where ao='$ao' and tanggal='$tgl_ini2' and hapus<>'HAPUS' ");
                list($tjumlah) = mysqli_fetch_array($sql2);

            	        ?>						
							<tr>
        <td>
            <a data-toggle='tooltip' data-placement='top' title='Buka Data Trans <?php echo $tgl_sebelum ?> ' class="btn btn-warning btn-sm" href="index_tanggal.php?tgl=<?php echo $tgl_sebelum ?>"><i class="bi bi-arrow-left"></i></a>
        </td>							    
						    	<td colspan="1" style="font-weight: bold;text-align: center;">Total </td>																																									
								<td align='right'><style="font-weight: bold;">
								    <?php echo "" . number_format("$tjumlah", 0, ",", "."); ?>
								</td>    
        <td>
            <?php if ($tgl_sekarang==$tgl_ini2) { ;?>
                <a data-toggle='tooltip' data-placement='top' title='Buka Data Trans Hari Ini All ' class="btn btn-secondary btn-sm" href="tugas_trans_jenis_tgl_sd_tgl.php?kdj=ALL"><i class="bi bi-eye"></i></a>
            <?php } else { ;?>
                <a data-toggle='tooltip' data-placement='top' title='Buka Data Trans <?php echo $tgl_sesudah ?> ' class="btn btn-danger btn-sm" href="index_tanggal.php?tgl=<?php echo $tgl_sesudah ?>"><i class="bi bi-arrow-right"></i></a>
            <?php } ;?>
        </td>
							</tr>                 
  </table>
</div>
</center>
<center>
                      <td>
                          <a href="tugas_donatur.php" class="btn btn-primary btn-sm pull-right"><i class="bi bi-plus"></i> &nbsp; DONATUR</a> 
                                                        
                          <a href="logout_tugas.php" class="btn btn-secondary btn-sm pull-right"><i class="bi bi-reply"></i> &nbsp; Log Out</a> 
                      </td>
</center>  
<?php }  ;?>


        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>
        </br>        
      
            <?php 
            $id_user = $_SESSION['id'];
            $data = mysqli_query($koneksi,"select * from user where user_id='$id_user'");
            $p = mysqli_fetch_assoc($data);
            
            // menghapus file error_log
                unlink('error_log');
            //echo “error_log sudah dihapus”;
    
            ?>    

    <?php include 'footer.php'; ?>



