
<?php 
    include 'header.php'; 

    $kdk  = $_GET['kdk'];
    $kab  = $_GET['kab'];
    $kdc  = $_GET['kdc'];   

    $tgl_ini=date('d-m-Y') ;
    $tgl_ini2=date('Y-m-d') ; 
    
    $oleh   =$_SESSION['id_kar'];
    $kdc    =$_SESSION['kdc'];
    $level    =$_SESSION['level'];
    echo $kdc ; 
?>              


<div class="container">
 <div class="my-2 border-bottom">
   <h5 class="fw-semibold fs-3"></h5>
 </div>
  <div class="row justify-content-center">
    <div class="col-lg-12">
       <div class="card">
    <div class="card-header d-flex justify-content-between">
      <span class="card-title fw-semibold align-self-start mb">Daftar Pembatalan Transaksi </span>
      <button type="button" class="btn btn-primary btn-sm align-self-end" data-bs-toggle="modal" data-bs-target="#exampleModal">
       <a href="index.php" class="btn btn-primary btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembali</a> 
      </button>
    </div>
    <div class="card-body">
      <div class="table-responsive">

        <table class="table table-bordered table-striped" id="table-datatable">
          <thead>
              
            <tr>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">No</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Nomor</th>
              <th width="4%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Tanggal</th>
              <th width="20%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Uraian</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Oleh</th>
              <th width="10%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Tanggal Jam</th>
              <th width="1%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Nilai</th>
              <th width="4%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Opsi</th>
            </tr>
          </thead>
          <tbody>
            <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM kas WHERE hapus='HAPUS' ORDER by ID DESC ");
            while($d = mysqli_fetch_array($data)){
                
                $sql1 = mysqli_query($koneksi, "SELECT nama AS tperk FROM karyawan WHERE id='$d[hpsoleh]' ");
                list($tperk) = mysqli_fetch_array($sql1);
                

              ?>
              <tr>
                <td><?php echo $no++; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $d['notrans'] ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $d['tanggal']; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $d['keterangan']; ?></td>
                
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $tperk; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $d['hpsjam']; ?></td>
                <td style="text-align:right; font-size: 10pt; font-weight:normal;"><?php echo "" . number_format("$d[jumlah]", 0, ",", "."); ?></td>
                
                <td>    
                    <a data-toggle='tooltip' data-placement='top' title='Buka Jornal Trans <?php echo $d['notrans'] ?>' class="btn btn-primary btn-sm" href="!!_kas_jor_view.php?id=<?php echo $d['notrans'] ?>"><i class="bi bi-layer-backward"></i></a>                                
                    <?php if ($level=='TOP') { ?>
                          <a onclick="return confirm('Yakin ingin hapus PERMANEN transaksi : <?php echo $d['keterangan'] ?>.....?')" class="btn btn-danger btn-sm" href="!!_trans_hapus_hapus.php?id=<?php echo $d['notrans'] ?>&oleh=<?php echo $oleh ?>&noperk=<?php echo $id ?>">
                            <i class="bi bi-trash"></i>
                          </a>
                    <?php } ?>
                    
                  <form action="!!_memmo_tambah_act.php" method="post">
                    <div class="modal fade" id="trans_memmo<?php echo $kdc ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <h1 class="modal-title fs-5" id="exampleModalLabel">Tambah Trans Memorial</h1>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                          </div>
                          <div class="modal-body">
                          <div class="form-group mb-2">
                            <label class="form-label"><font color="#000fff">Keterangan (Maks 150 karakter)</font></label>
                              <input type="hidden" name="toleh" readonly="readonly" class="form-control" value="<?php echo $oleh; ?>" style="width:100%">
                              <input type="hidden" name="tkdc" readonly="readonly" class="form-control" value="<?php echo $kdc; ?>" style="width:100%">
                            <textarea class="form-control" rows="2" name="tket"> </textarea> 
                          </div>    

                            <div class="form-group">
                              <label>Jumlah </label>
                              <input type="text" class="form-control nilai rupiah" id="nilai" name="tjumlah" required="required" placeholder="Masukkan nominal ..">
                            </div>         
                        	<div class="form-group">
                                <label class="form-label">Akunt Debet <font color='#ff0000'><i>(pilih akunt)</i></font color></label>
                                <select class="form-control" name="takunt_d" required="required">
                                  <option value="">- Pilih Akunt Lawan -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal Where noperk<>'$d[noperk]' order by perk ASC");
                                  while($rx = mysqli_fetch_array($nawal)){
                                    ?>
                                    <option value="<?php echo $rx['noperk'] ?>"><?php echo $rx['noperk'] ?> - <?php echo $rx['perk'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>         
                        	<div class="form-group">
                                <label class="form-label">Akunt Kredit <font color='#ff0000'><i>(pilih akunt)</i></font color></label>
                                <select class="form-control" name="takunt_k" required="required">
                                  <option value="">- Pilih Akunt Lawan -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal Where noperk<>'$d[noperk]' order by perk ASC");
                                  while($rx = mysqli_fetch_array($nawal)){
                                    ?>
                                    <option value="<?php echo $rx['noperk'] ?>"><?php echo $rx['noperk'] ?> - <?php echo $rx['perk'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>                                 	
                          <div class="form-group mb-2">
                            <label class="form-label">Tanggal Transaksi</label> 
                            <input type="date" class="form-control" name="ttgl" required="required" value="<?php echo date('d/m/Y', strtotime($d['tglmasuk'])); ?>">
                          </div>                
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
                            <button type="submit" class="btn btn-primary">Simpan</button>
                          </div>
                        </div>
                      </div>
                    </div>
                  </form>

                    </td>
                    </tr>                  
            <?php };?>  
          </tbody>
        </table>

      </div>
    </div>

  </div>
    </div>
  </div>
</div>

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