<?php 
    include 'header.php'; 
    $kdc    = $_SESSION['kdc'];
    $oleh   = $_SESSION['id_kar'];
?>              
<div class="container">

  <div class="my-2 border-bottom">
    <h3 class="fw-semibold fs-3">Hutang Baru Kanca <?php echo  $kdc; ?></h3>
  </div>
              <?php  
              // fungsi untuk membuat kode transaksi
                $sql1 = mysqli_query($koneksi, "SELECT right(norek,6) as kode3 FROM hutang ORDER BY id DESC LIMIT 1");
                list($kode3) = mysqli_fetch_array($sql1);
              $count3 = mysqli_num_rows($sql1);

              if ($count3 <> 0) {
                  // mengambil data kode transaksi
                  $data_id3 = mysqli_fetch_assoc($sql1);
                  $kode3    = $kode3+1;
                  $no_hutang  = $kode3 ;
              } else {
                  $no_hutang = '100001';
              } 
              ?>
  <section class="content">
    <div class="row justify-content-center">
      <div class="col-lg-6">    
        <div class="card card-info">
          <div class="card-header justify-content-between d-flex">
            <span class="card-title fw-semibold"><font color='#ff0000'  style="text-align:left; font-size: 11pt; font-weight:normal;"><i>Penerimaan pokok 100% dan Biaya Hutang dibukukan terpisah </i></font><br></span>
            <a href="@_hutang_trans.php" class="btn btn-secondary btn-sm"><i class="bi bi-reply"></i> &nbsp Kembali</a> 
          </div>
          <div class="card-body">
<div style="background-color: <?php echo$_SESSION['warna_bag']; ?>; padding: 15px; border-radius: 15px; box-shadow: 0 0 15px <?php echo$_SESSION['warna_bag']; ?>;">              
            <form action="@_hutang_tambah_act.php" method="post">
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Nomor Hutang</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%">
                <input type="text" name="tnomor" class="form-control" value=<?php echo $no_hutang; ?> readonly required >
              </div>                
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Nama</font></label>
                <input type="text" class="form-control" name="tnama" required="required" placeholder="Masukkan nama bank ..">
              </div>
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Alamat</font></label>
                <input type="text" class="form-control" name="talamat" required="required" placeholder="Masukkan alamat bank ..">
              </div>              
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Jumlah Pokok Hutang</font></label>
                <input type="text" class="form-control nilai rupiah" id="nilai" name="tpokok" required="required" placeholder="Masukkan pokok hutang ..">
              </div>
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Jumlah Angsuran yg harus dibayar (per Bln)</font></label>
                <input type="text" class="form-control nilai rupiah" id="nilai" name="tangs" required="required" placeholder="Masukkan Angsuran yg harus dibayar ..">
              </div>              
              <div class="form-group mb-2">
                <label class="form-label"><font color="#000fff">Jangka Waktu Angsuran (bln)</font></label>
                <input type="text" class="form-control" name="tjkw" required="required" placeholder="Masukkan satuan Bulan kewajiban angsuran..">
              </div>

              <div class="form-group mb-2">
                   <label class="form-label"><font color="#000fff">Tanggal</font></label>
                   <input type="date" class="form-control" name="ttgl" required="required" placeholder="Masukkan Tanggal hutang ..">
              </div>         
              <div class="form-group mb-2">
                                <label class="form-label">Akunt Debet <font color='#ff0000'><i>(pilih akunt)</i></font color></label>
                                <select class="form-control" name="takunt" required="required">
                                  <option value="">- Pilih Akunt Lawan -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal Where nosub<'113' 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>                       
              <div class="form-group mb-2">
                <input type="submit" class="btn btn-primary" value="Simpan">
              </div>
            
            </form>
          </div>
        </div>
      </div>
      
      
      

      
      

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

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