

<!-- Aplikasi Persediaan-->

<!-- Content Header (Page header) -->
<section class="content-header">
  <h1>
    <i class="fa fa-folder-o icon-title"></i> PENERIMAAN - PENGELUARAN melalui :
    <a class="btn btn-success btn-social pull-right" href="?module=laporan_kas_dr_tgl_ke" title="Lhat Transaksi Kas" data-toggle="tooltip">
      <i class="fa fa-table"></i> Lihat Transaksi Tanggal s/d Tanggal
    </a>
    <a class="btn btn-primary btn-social pull-right" href="?module=laporan_kas" title="Lhat Transaksi Kas" data-toggle="tooltip">
      <i class="fa fa-table"></i> Lihat Transaksi Hari ini
    </a>    
  </h1>

</section>

<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-md-12">

    <?php  
    // fungsi untuk menampilkan pesan
    // jika alert = "" (kosong)
    // tampilkan pesan "" (kosong)
    if (empty($_GET['alert'])) {
      echo "";
    } 
    // jika alert = 1
    // tampilkan pesan Sukses "Data obat baru berhasil disimpan"
    elseif ($_GET['alert'] == 1) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Sukses!</h4>
              Data Transaksi Kas baru berhasil disimpan.
            </div>";
    }
    // jika alert = 2
    // tampilkan pesan Sukses "Data obat berhasil diubah"
    elseif ($_GET['alert'] == 2) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Sukses!</h4>
              Data Penerimaan Kas berhasil diubah.
            </div>";
    }
    // jika alert = 3
    // tampilkan pesan Sukses "Data obat berhasil dihapus"
    elseif ($_GET['alert'] == 3) {
      echo "<div class='alert alert-success alert-dismissable'>
              <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
              <h4>  <i class='icon fa fa-check-circle'></i> Sukses!</h4>
              Data Penerimaan Kas berhasil dihapus.
            </div>";
    }
    ?>
    <form action="aksi.php" method="post">
    
      <div class="box box-primary">
        <div class="box-body">
          <!-- tampilan tabel produk -->
          <table id="dataTables3" class="table table-bordered table-striped table-hover">
            <!-- tampilan tabel header -->
            <thead>
              <tr>
                <th class="center">Kd</th>
                <th class="center">xx</th>
                <th class="center">Nama</th>
                <th class="center">Awal D</th>
                <th class="center">Mutasi D</th>
                <th class="center">Mutasi K</th>
                <th class="center">Akhir D</th>
                <th class="center">Aksi</th>
                <th></th>
              </tr>
            </thead>
            <!-- tampilan tabel body -->
            <tbody>
            <?php  
            $no = 1;
            // fungsi query untuk menampilkan data dari tabel obat
            $query = mysqli_query($mysqli, "SELECT * FROM nawal WHERE noperk<'111999' GROUP BY noperk ORDER BY noperk ASC limit 50")
                                            or die('Ada kesalahan pada query tampil Data Kas: '.mysqli_error($mysqli));

            // tampilkan data
            while ($data = mysqli_fetch_assoc($query)) { 
                
                $sql = mysqli_query($koneksi, "SELECT sum(mutasid) AS jmut_d,sum(mutasik) AS jmut_k FROM jor WHERE noperk='$data[noperk]'");
                list($jmut_d,$jmut_k) = mysqli_fetch_array($sql);
                
              $tanggal         = $data['tglkas'];
              $exp             = explode('-',$tanggal);
              $tanggal_masuk   = $exp[2]."-".$exp[1]."-".$exp[0];
              $awald    = format_rupiah($data['awald']);
              $awalk    = format_rupiah($data['awalk']);
              $mutasid  = format_rupiah($jmut_d);
              $mutasik  = format_rupiah($jmut_k);
              $kelompok = ($data['kelompok']);
              $kel      = substr($kelompok, 0, 2);              
              $qq       = substr($noperk, 0, 1);
              
              if ($data[noperk]<'500000') {
                    $takhird=($data['awald']+$jmut_d)-$jmut_k ;
                    $takhirk=0 ;
              } else {
                    $takhird=0 ;
                    $takhirk=($data['awalk']+$jmut_k)-$jmut_d ;
              }     
             $akhird = format_rupiah($takhird);
             $akhirk = format_rupiah($takhirk);
             
              echo "<tr>
                      <td class='center'>$data[noperk]</td>
                      <td class='left'>$data[unit]</td>
                      <td class='left'>$data[perk]</td>
                      <td align='right'>$awald</td>
                      <td align='right'>$mutasid</td>
                      <td align='right'>$mutasik</td>
                      <td align='right'>$akhird</td>
                      <td class='center' width='250'>
                        <div>
                          <a data-toggle='tooltip' data-placement='top' title='Tambah Transaksi Penerimaan' style='margin-right:5px' class='btn btn-success btn-sm' href='?module=kas_masuk&form=add&id=$data[noperk]'>
                              <i style='color:#fff' class='fa fa-plus'></i>
                          </a>";
                        ?>
                        <!--
                          <a data-toggle="tooltip" data-placement="top" title="Tambah Transaksi Penerimaan dg 2 Akunt" style="margin-right:5px" class="btn btn-primary btn-sm" href="?module=kas_m_2akunt&form=add&id=<?php echo $data[noperk]; ?>">
                              <i style="color:#fff" class="fa fa-plus"></i>
                        -->      
                          <a data-toggle='tooltip' data-placement='top' title="Tambah Transaksi Pengeluaran" style="margin-right:5px" class="btn btn-warning btn-sm" href="?module=kas_keluar&form=add&id=<?php echo $data[noperk]; ?>">
                             <i style='color:#fff' class='fa fa-minus'></i>
                        <!--  
                          <a data-toggle="tooltip" data-placement="top" title="Tambah Transaksi Pengeluaran dg 2 Akunt" style="margin-right:5px" class="btn btn-danger btn-sm" href="?module=kas_k_2akunt&form=add&id=<?php echo $data[noperk]; ?>">
                              <i style="color:#fff" class="fa fa-minus"></i>
                        -->      
                          <a data-toggle="tooltip" data-placement="top" title="Lihat Transaksi Akunt ini" style="margin-right:5px" class="btn btn-info btn-sm" href="?module=cetak_kas&id=<?php echo $data[noperk]; ?>">
                              <i style="color:#000" class="fa fa-list"></i>
                              
                          </a>                          
                        <?php                        
              echo "    </div>
                      </td>
                    </tr>";
              $no++;
            }
            ?>

<?php
if ($_POST['submit3'])
{
 
 

 
}
?>            
            </tbody>
          </table>
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!--/.col -->
  </div>   <!-- /.row -->
</section><!-- /.content