
<?php 
    include 'header.php';
    $id = $_GET['id'];   
?>

<div class="container">

  <div class="my-4 border-bottom">
    <h4 class="fw-semibold fs-3"></h4>
  </div>

  <section class="content">
    <div class="row justify-content-center">
      <section class="col-lg-5">       
        <div class="card card-info">

          <div class="card-header justify-content-between d-flex">
            <span class="card-title fw-semibold">Lengkapi Data Akunt</span>
            <a href="kode_akunt_new.php" class="btn btn-primary btn-sm pull-right"><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="kode_akunt_new_edit_act.php" method="post" enctype="multipart/form-data">

          <?php 
          $data = mysqli_query($koneksi, "select * from nawal where id='$id'");
          while($d = mysqli_fetch_array($data)){
                        
            ?>

                <div class="form-group">
                  <label>Nama Akunt </label>
                  <input type="hidden" name="oleh" value="<?php echo $oleh ?>" readonly="readonly" class="form-control" >
                  <input type="hidden" name="kdc" value="<?php echo $kdc ?>" readonly="readonly" class="form-control" >
                  <input type="hidden" name="id" value="<?php echo $id ?>" readonly="readonly" class="form-control" >
                  <input type="text" name="nama" required="required" class="form-control" value="<?php echo $d['perk'] ?>">
                </div>
                        	<div class="form-group">
                                <label class="form-label">Kelompok <font color='#ff0000'><i>(pilih kelompok)</i></font color></label>
                                <select class="form-control" name="kelompok" required="required" value="<?php echo $d['kelompok'] ;?>" >
                                  <option value="">- Pilih kelompok -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal GROUP BY KELOMPOK order by kelompok ASC");
                                  while($n = mysqli_fetch_array($nawal)){
                                    ?>
                                    <option value="<?php echo $n['kelompok'] ?>"<?php if($n['kelompok'] == $d['kelompok']) echo 'selected="selected"'; ?>><?php echo $n['kelompok'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>         
                        	<div class="form-group">
                                <label class="form-label">Sub Kode Kelompok <font color='#ff0000'><i>(pilih kelompokE)</i></font color></label>
                                <select class="form-control" name="klp" required="required" value="<?php echo $d['klp'] ;?>" >
                                  <option value="">- Pilih Sub Kode kelompok -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal GROUP BY klp order by klp ASC");
                                  while($n = mysqli_fetch_array($nawal)){
                                    ?>
                                    <option value="<?php echo $n['klp'] ?>"<?php if($n['klp'] == $d['klp']) echo 'selected="selected"'; ?>><?php echo $n['klp'] ?> - <?php echo $n['sub'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>                
                        	<div class="form-group">
                                <label class="form-label">Sub Sub Kelompok <font color='#ff0000'><i>(pilih kelompok)</i></font color></label>
                                <select class="form-control" name="nosub" required="required" value="<?php echo $d['nosub'] ;?>" >
                                  <option value="">- Pilih Sub Sub kelompok -</option>
                                  <?php 
                                  $nawal = mysqli_query($koneksi,"select * from nawal GROUP BY sub order by nosub ASC");
                                  while($n = mysqli_fetch_array($nawal)){
                                    ?>
                                    <option value="<?php echo $n['nosub'] ?>"<?php if($n['nosub'] == $d['nosub']) echo 'selected="selected"'; ?>><?php echo $n['nosub'] ?> - <?php echo $n['sub'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>                                   	
                        	<div class="form-group">
                                <label class="form-label">Unit <font color='#ff0000'><i>(pilih Unit)</i></font color></label>
                                <select class="form-control" name="kdu" required="required" value="<?php echo $d['kdu'] ;?>" >
                                  <option value="">- Pilih Unit -</option>
                                  <?php 
                                  $unit = mysqli_query($koneksi,"select * from kdunit order by KD ASC");
                                  while($u = mysqli_fetch_array($unit)){
                                    ?>
                                    <option value="<?php echo $u['KD'] ?>"<?php if($u['KD'] == $d['kdu']) echo 'selected="selected"'; ?>><?php echo $u['KD'] ?> - <?php echo $u['UNIT'] ?></option>
                                    <?php 
                                  }
                                  ?>
                                </select>
                        	</div>         
                <div class="form-group">
                  <label>Jumlah Saldo Awal (Debet) </label>
                  <input type="text" class="form-control nilai rupiah" id="nilai" name="tawald" required="required" value="<?php echo "" . number_format("$d[awald]", 0, ",", "."); ?>">
                </div>
                <div class="form-group">
                  <label>Jumlah Saldo Awal (Kredit) </label>
                  <input type="text" class="form-control nilai rupiah" id="nilai" name="tawalk" required="required" value="<?php echo "" . number_format("$d[awalk]", 0, ",", "."); ?>">
                </div>                
              </div>
                <div class="form-group mb-2">
                  <input type="submit" class="btn btn-primary" value="Simpan">
                </div>
                <?php
              }

              ?>
              
            </form>
          </div>

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

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