<?php
error_reporting(E_ALL^(E_NOTICE|E_WARNING));
ini_set('display_errors',1);
error_reporting(0);
include 'koneksi.php';
?>
<!-- Content Header (Page header) -->
<div class="content-header">
  <div class="container-fluid">
    <div class="row mb-2">
      <div class="col-sm-12">
        <h1 class="m-0 text-dark"></h1>
      </div><!-- /.col -->
    </div><!-- /.row -->
  </div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->

<!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <!-- Default box -->
            <div class="card">
              <div class="card-header bg-info">
                <h3 class="card-title "> Daftar Kode Akun</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                  <button type="button" class="btn btn-tool" data-card-widget="remove" title="Remove">
                    <i class="fas fa-times"></i>
                  </button>
                </div>
              </div>
              <!-- /.card-header -->
        <div class="card-body">
          <?php
          
          
         
          if(isset($_POST['k_kode'])){
            $k_kode = $_POST['k_kode'];


            if($_POST['k_kode']=='')
              $where="where k_akun !='' ";
            else
              $where=" where k_akun='$k_kode' OR n_akun='$k_kode' ";

          }else{
            
            $k_kode="";

            $where="where k_akun='$k_kode' OR n_akun='$k_kode' ";
           
          }
          ?>
          <form role="form" id="quickForm" action="home.php?home=<?php echo md5("lapkodeakun");?>" method="post">
            <div class="form-group row">
              <label for="nama" class="col-2 m-3">Cari Akun</label>
              <input type="text" name="k_kode" id="k_kode"  class="form-control col-sm-5" placeholder="ketik Kode Akun/Nama Akun">
              <div class="form-group row">
                <button type="submit" class="  btn btn-info"  ><i class="fas fa-search"></i></button>
               </div>
              
                 </div>    
          </form>                   
          <hr>
        

          <!-- <table id="example3" class="table table-bordered table-hover">
           -->
           <table id="sortTable" class="table table-bordered table-hover" width="100%">
            <thead>
              <tr>
                
                <th width="7%">No </th>
                <th width="30%">Kode Akun</th>                
                <th >Nama</th>
                
                
              </tr>
            </thead>
            <tbody>
              <?php
              $saldo=0;
              $queryak      = "SELECT * from kode_akun $where ";
              $result = mysqli_query($koneksi, $queryak);
              $num_result = mysqli_num_rows($result);
              //$result     = $mysqli->query($queryak);
              //$num_result = $result->num_rows;
              if ($num_result > 0) {
                $no = 0;
                while ($data = mysqli_fetch_assoc($result)) {
                  extract($data);
                  $no++;
                  ?>
                  <tr>
                    
                    <td><?php echo $no; ?></td>
                  
                    <td align="left"><?php echo $k_akun; ?></td>
                    
                    <td><?php echo $n_akun; ?></td>
                  </tr>
                <?php }}?>
              </table>
              </tbody>

              <script type="text/javascript" charset="utf8" src="./assets/jquery.dataTables.js"></script>
              <!-- <script type="text/javascript" charset="utf8" src="./assets/jquery-1.11.0.min"></script> -->
              <link rel="stylesheet" type="text/css" href="./assets/jquery.dataTables.css">
                  <script>
              $('#sortTable').DataTable(); //https://www.sahretech.com/2020/04/cara-membuat-pencarian-sorting-dan.html?m=1/ cara buat sorter table
              </script>
              <?php if(isset($_POST['par1'])){
                                
                $_SESSION['kode_akun']['kantor']=$_SESSION['kantor'];
                $_SESSION['kode_akun']['kode']['sqlj']=$queryj;
          
                
               /* if($_POST['id_kegiatan']=='Pilih')
                  $_SESSION['laporan']['usaha']='Semua Unit';
                else*/
                /*  $_SESSION['laporan']['usaha']=caridata($mysqli,"select nama_kegiatan from tb_kegiatan where id_kegiatan='".$_POST['id_kegiatan']."'");*/

                  ?>
                <a href="laporan/lap_jurnal_umum_pdf.php" target="_blank" style="float: right;margin-top: 10px;" class="btn btn-success"><i class="fa fa-print"></i> Cetak PDF</a>

              <?php } ?>
            </div>
            <!-- /.card-body -->
          </div>
          <!-- /.card -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->

