<script type="text/javascript" src="../jquery.js"></script>
<!-- untuk simpan tanpa relod ajax -->  
 <!--  <link href="desain/desainmodal.css" rel="stylesheet"/> -->
 <link href="desain/desainhalaman.css" rel="stylesheet"/>



<table>
 <div id="data_Modaljurnal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
 <div class="modal-dialog ">
  <div class="modal-content">
   <div class="modal-header bg-info">

    <h4 class="modal-title">Jurnal Transaksi</h4>
    <button type="button" class="close" data-dismiss="modal">&times;</button>
   </div>
   <div class="modal-body">
    <div class="col-sm-15 ">
    <form class="form-updatejurnal" id="form-updatejurnal">

     <!-- <label>No.Bukti</label> -->
     <input type="text" name="j_faktur" id="j_faktur" class="form-control inputAngka" onkeypress="nextfield('j_tgl')" placeholder="No.Bukti" autofocus/>
     
     <!-- <label>Tanggal</label> -->
     <input type="date" name="j_tgl" id="j_tgl" class="form-control inputAngka" onkeypress="nextfield('j_debet')"placeholder="Tanggal" 
    onkeypress="return blockNonNumbers(this, event, true, true);"/>

    <!-- <label>Akun Debet</label> -->
     <input type="text" name="j_debet" id="j_debet" class="form-control inputAngka" onkeypress="nextfield('j_kredit')"placeholder="Akun Debet" 
    onkeypress="return blockNonNumbers(this, event, true, true);"/>

       <!--  <label>Akun Kredit</label> -->
     <input type="text" name="j_kredit" id="j_kredit" class="form-control inputAngka" onkeypress="nextfield('j_nominal')" placeholder="Akun Kredit"
    onkeypress="return blockNonNumbers(this, event, true, true);"/>
    
     <!-- <label>Nominal</label> -->
     <input type="text" name="j_nominal" id="j_nominal" class="form-control inputAngka" onkeypress="nextfield('j_keterangan')" placeholder="Nominal"
     onkeypress="return blockNonNumbers(this, event, true, true);"/>
  
     <!-- <label>Keterangan</label> -->
     <input type="text" name="j_keterangan" id="j_keterangan" class="form-control inputAngka" onkeypress="nextfield('updatejurnal')" placeholder="Keterangan" required=""
    />
    
     <!-- <div class="modal-footer">
     <input type="button" name=" tambahjurnal" id="tambahjurnal" value="Tambah">Close</button>
    </div> -->

</div>
  </div>
<div>
  


</div>
        
    <div class="modal-footer bg-info">
     <input type="button" name=" updatejurnal" id="updatejurnal" value="Simpan" class=" btn btn-warning" onkeypress="nextfield('close')"/>
      <button type="button" name="close" class=" btn btn-danger" data-dismiss="modal">Close</button>
    </div>
    </form>

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



<script type="text/javascript">

 $(document).ready(function(){
    $("#updatejurnal").click(function(){
      var data = $('#form-updatejurnal').serialize();
      var j_faktur= $('#j_faktur').val();
      var j_tgl= $('#j_tgl').val();
      var j_debet= $('#j_debet').val();
      var j_kredit= $('#j_kredit').val();
      var j_nominal= $('#j_nominal').val();
      var j_keterangan= $('#j_keterangan').val();
      

      if(j_faktur== "0"|| j_tgl=="0" || j_debet=="0" ||j_kredit=="0"||j_nominal=="0"){ 
        alert ("Data Masih ada yang kosong 1");
        //window.location.href='/rakerugt/home.php?page=cap_realita';
      
    } else if(j_faktur== ""|| j_tgl=="" || j_debet=="" ||j_kredit==""||j_nominal==""){ 
        alert ("Data Masih ada yang kosong 2");
       
    }else{

      $.ajax({
        type: 'POST',
        url: 'simpan/simpan_jurnal2.php',
        data: data,
        success: function(data) {
         console.log(data)
         alert("Data Sukses Disimpan");
         window.location.href='/neraca/home.php';  
        },
        error: function(error){
          console.log(`error ${error}`)
          
        }
      });
    }
    });
  });
  
  

</script>




