<link href="css/form.css" type="text/css" rel="stylesheet" />


<?php
  //$tahun1=date("Y");
  //$tahun2=$tahun1+1;
	//$tahun_anggaran=$tahun1 . "/" . $tahun2;

  //mengambil data tahun anggaran aktif untuk user yang sedang aktif
  $username=$_SESSION["ses_admin_id"];
  $qryy=mysqli_query($mysqli,"SELECT * FROM settings WHERE username='$username'");

  if(mysqli_num_rows($qryy)>0){
    $datay=mysqli_fetch_array($qryy);
    $tahun_anggaran=$datay["tahun_anggaran"];
  }else{
    msgbox("Tahun Anggaran belum diatur di halaman pengaturan!");
    lempar("admin.php?page=settings&page_desc=Pengaturan Tahun Anggaran Aktif");
    die();
  }

  if(isset($_GET[kode_rekening])){
    $vkode=explode(".", $_GET[kode_rekening]);
    $kode1=$vkode[0];
    $kode2=$vkode[1];
    $kode3=$vkode[2];
    $kode4=$vkode[3];

    /*
    $kode1=substr($_GET[kode_rekening], 0,1);
    $kode2=substr($_GET[kode_rekening], 1,1);
    $kode3=substr($_GET[kode_rekening], 2,1);
    $kode4=substr($_GET[kode_rekening], 3,1);
  */
  }

	echo "<h3>MENAMBAHKAN DATA ANGGARAN</h3>";
	echo "<h3 align=\"right\"><a href=\"?page=ls_anggaran&page_desc=Daftar Mata Anggaran\" style=\"color:#FF0066\">Lihat Semua Mata Anggaran</a></h3>";

?>

<form name="form1" method="post" action="_save_anggaran.php">
  <table width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="204">&nbsp;</td>
      <td width="396">&nbsp;</td>
    </tr>
    
    <tr>
      <td valign="top">Tahun Anggaran</td>
      <td valign="top"><input type="text" name="txtTahunAnggaran" id="txtTahunAnggaran" value="<?php echo $tahun_anggaran ?>" class="kotak" size="20" maxlength="10" required></td>
    </tr>
    <tr>      
      <td valign="top">Kode Rekening</td>
      <td valign="top">
        <select name="txtKodeRekening01" id="txtKodeRekening01" class="kotak">
          <?php
              for($i=0;$i<=99;$i++){
                $s="";
                if($i==$kode1){
                 
                  $s="selected";
                }
                echo "<option value='$i' $s>$i</option>";
              }

              if(!empty($kode1)){
                echo "<option value='' >&nbsp;</option>";
              }else{
                echo "<option value='' selected>&nbsp;</option>"; 
              }

          ?>
        </select>&nbsp;
        <select name="txtKodeRekening02" id="txtKodeRekening02" class="kotak">
          <?php
              
              
              for($i=0;$i<=99;$i++){
                $s="";
                if($i==$kode2){
                  $s="selected";
                }
                echo "<option value='$i' $s>$i</option>";
              }

              if(!empty($kode2)){
                echo "<option value='' >&nbsp;</option>";
              }else{
                echo "<option value='' selected>&nbsp;</option>"; 
              }
          ?>
        </select>&nbsp;
        <select name="txtKodeRekening03" id="txtKodeRekening03" class="kotak">
          <?php
              //echo "<option value='' selected>&nbsp;</option>";
              for($i=0;$i<=99;$i++){
                $s="";
                if($i==$kode3){
                  $s="selected";
                }
                echo "<option value='$i' $s>$i</option>";
              }

              if(!empty($kode3)){
                echo "<option value='' >&nbsp;</option>";
              }else{
                echo "<option value='' selected>&nbsp;</option>"; 
              }
          ?>
        </select>&nbsp;

        <select name="txtKodeRekening04" id="txtKodeRekening04" class="kotak">
          <?php
              //echo "<option value='' selected>&nbsp;</option>";
              for($i=0;$i<=99;$i++){
                $s="";
                if($i==$kode4){
                  $s="selected";
                }
                echo "<option value='$i' $s>$i</option>";
              }
              if(!empty($kode4)){
                echo "<option value='' >&nbsp;</option>";
              }else{
                echo "<option value='' selected>&nbsp;</option>"; 
              }
          ?>
        </select>&nbsp;
        <!--
        <select name="txtKodeRekening05" id="txtKodeRekening05" class="kotak">
          <?php
            /*
              echo "<option value='' selected>&nbsp;</option>";
              for($i=0;$i<=9;$i++){
                echo "<option value='$i'>$i</option>";
              }
            */
          ?>
        </select>&nbsp;

        <select name="txtKodeRekening06" id="txtKodeRekening06" class="kotak">
          <?php
            /*
              echo "<option value='' selected>&nbsp;</option>";
              for($i=0;$i<=9;$i++){
                echo "<option value='$i'>$i</option>";
              }
            */
          ?>
        </select>&nbsp;
        -->
      </td>
    </tr>

    <tr>
      <td valign="top">Jenis Kode</td>
      <td valign="top">
          <select name="txtJenisKode" id="txtJenisKode" class="kotak">
            <option value="" selected>&nbsp;</option>
            <option value="H">Heading/Sub Header</option>
            <option value="D">Detail/Rincian</option>
          </select>
    </tr>



    <tr>
      <td valign="top">Uraian</td>
      <td valign="top"><input type="text" name="txtUraian" id="txtUraian" class="kotak" size="60" required></td>
    </tr>

    <!--<tr>
      <td valign="top">Anggaran</td>
      <td valign="top"><input type="text" name="txtAnggaran" id="txtAnggaran" class="kotak" size="30" ></td>
    </tr>

    <tr>
      <td valign="top">Keterangan</td>
      <td valign="top">
          <select name="txtKeterangan" id="txtKeterangan" class="kotak">
            <option value="" selected="">&nbsp;</option>
            <option value="PENYEDIA">1. PENYEDIA</option>
            <option value="SWAKELOLA">2. SWAKELOLA</option>

          </select>
    </tr>
    
    <tr>
      <td valign="top">Kode</td>
      <td valign="top">
          <select name="txtKode" id="txtKode" class="kotak">
            <option value="" selected>&nbsp;</option>
            <option value="0">0</option>
            <option value="1">1</option>
            <option value="2">2</option>

          </select>
    </tr>-->

    



    <tr>
      <td width="204">&nbsp;</td>
      <td width="396">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="hidden" name="txtKodeRekeningAbs" id="txtKodeRekeningAbs" value="<?php echo $_GET[kode_rekening] ?>"/> <input type="submit" name="button" id="button" value="Simpan" class="tombol"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>

