







          <div class="d-sm-flex align-items-center justify-content-between mb-4">



            <h1 class="h3 mb-0 text-gray-800">FORM PKA </h1>



            <input type="hidden" name="kode_pka" value="<?=$id_row?>">



            <!-- <a href="javascript:void(0)"  class="d-none d-sm-inline-block btn btn-sm btn-warning shadow-sm"><i class="fas fa-save fa-sm text-white-50"></i> Simpan Data Sementara</a> -->







            <!-- <div class="btn-group" role="group" aria-label="Basic example">



              <button type="button" id="hapus_file" class="btn btn-danger"><i class="fas fa-trash-alt fa-sm text-white-50"></i> Hapus File</button>



              <button type="button" id="update_file" class="btn btn-warning"><i class="fas fa-save fa-sm text-white-50"></i> Update File</button>



            </div> -->



          </div>







          <div class="row">







            <!-- Area Chart -->



            <div class="col-xl-12 col-lg-12" id="parent">



              <!-- Collapsable Card Example -->



            <div id="insert_page"></div>



            <input type="hidden" id="jumlah_page" name="jumlah_page" value="">



            



            <div class="modal-footer mt-2">



              <div class="h4 mb-0 font-weight-bold text-primary" id="tot_all"></div>



            </div>



            <div class="modal-footer mt-2">



              <!-- <a href='javascript:void(0)' class="btn btn-primary btn-icon-split" id="btn-tambah-page">



                <span class="icon text-white-50">



                  <i class="fas fa-plus"></i>



                </span>



                <span class="text"> Tambah Kegiatan</span>



              </a> -->



              <button type="button" id="cetak_exel" class="btn btn-success btn-icon-split">



                <span class="icon text-white-50">



                  <i class="fas fa-file-excel"></i>



                </span>



                <span class="text"> Cetak Exel</span>



              </button>



            </div>







          </div>



<script type="text/javascript">



  $(document).ready(function(){



    var base_url = "<?=base_url()?>";



    var no_pka = "<?=$id_row?>";







    var time = function(){



      // var options = { 



      //   // now: "12:35", //hh:mm 24 hour format only, defaults to current time



      //   twentyFour: true, //Display 24 hour format, defaults to false



      //   // upArrow: 'wickedpicker__controls__control-up', //The up arrow class selector to use, for custom CSS



      //   // downArrow: 'wickedpicker__controls__control-down', //The down arrow class selector to use, for custom CSS



      //   // close: 'wickedpicker__close', //The close class selector to use, for custom CSS



      //   // hoverState: 'hover-state', //The hover state class to use, for custom CSS



      //   title: 'Ganti Waktu', //The Wickedpicker's title,



      //   showSeconds: true, //Whether or not to show seconds,



      //   secondsInterval: 15, //Change interval for seconds, defaults to 1



      //   minutesInterval: 10, //Change interval for minutes, defaults to 1



      //   // beforeShow: null, //A function to be called before the Wickedpicker is shown



      //   // show: null, //A function to be called when the Wickedpicker is shown



      //   // clearable: true, //Make the picker's input clearable (has clickable "x")



      // }; 



      // $('.timepicker').wickedpicker(options); 



      $('.timepicker').datepicker({



          format: 'dd MM yyyy',



          todayHighlight:true,



          toggleActive:true,



          daysOfWeekDisabled:'0',



          autoclose:true,



          language:'id'



      });



    }



    time();



    







    var file = function(){



      $.ajax({



                url             : base_url + 'pka/data_detail_pka/'+no_pka, 



                type            : "POST",



                dataType        : 'json',



                mimeType        : 'multipart/form-data',



                // data            : form_data,



                contentType     : false,



                cache           : false,



                processData     : false,



                success         : function(result){



                  // alert(JSON.stringify(result))



                  $("#jumlah_page").val(result.length);



                  var data = [];



                  var ttt_peng = 0;



                    var ttt_pen = 0;



                  for ( var i=0 ; i<result.length ; i++ ) {



                    // alert(JSON.stringify(result[i].save_pengeluaran))



                    var nextpage = i+1; 



                    var ka = "-0<?=date("m-y")?>";







                    unit_misioner('unit_misioner_'+nextpage,result[i].unit_misioner);



                    jenis_kegiatan('jenis_kegiatan_'+nextpage,result[i].jenis_kegiatan);



                    bidang('bidang_'+nextpage,result[i].bidang);



                    prioritas_kegiatan('prioritas_kegiatan_'+nextpage,result[i].prioritas_kegiatan);



                    nomor_strategi('nomor_strategi_'+nextpage,result[i].nomor_strategi);







                    



                    var card = "";



                    card +=`<div class="card shadow mb-4" id="card_`+nextpage+`">



                <!-- Card Header - Accordion -->







                <a href="#page_`+nextpage+`" class="d-block card-header py-3" id="page_1" style="background-color: #`+randomColor()+`;"  data-toggle="collapse" role="button" aria-expanded="true" aria-controls="page_`+nextpage+`">



                  <h6 class="m-0 text-light">FORM PKA | Page #`+nextpage+` </h6>







                </a>







                <!-- Card Content - Collapse -->



                <div class="collapse show" id="page_`+nextpage+`">



                  <div class="card-body">



                  <div class="row">



                    <input type="hidden" name="no_page[]" value="`+nextpage+`">



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Kode Mata Anggaran</label>



                      <input type="text" value="`+result[i].kma+`" class="form-control" id="kma_`+nextpage+`" name="kma[]" aria-describedby="emailHelp" placeholder="Kode Mata Anggaran" readonly>



                      <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Unit Misioner</label>



                      <select class="form-control" id="unit_misioner_`+nextpage+`" name="unit_misioner[]" onchange="kode_mata_anggaran(1)" required disabled>



                      </select>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Jenis kegiatan</label>



                      <select class="form-control" id="jenis_kegiatan_`+nextpage+`" name="jenis_kegiatan[]" onchange="kode_mata_anggaran(1)" required disabled>



                      </select>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Bidang </label>



                      <select class="form-control" id="bidang_`+nextpage+`" name="bidang[]" onchange="kode_mata_anggaran(1)" required disabled>



                      </select>



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Nama Kegiatan</label>



                      <input type="text" value="`+result[i].nama_kegiatan+`" class="form-control" id="nama_kegiatan_`+nextpage+`" name="nama_kegiatan[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Nomor Strategi</label>



                      <select class="form-control" id="nomor_strategi_`+nextpage+`" name="nomor_strategi[]" required  disabled>



                      </select>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlTextarea1">Tujuan Kegiatan </label>



                      <textarea class="form-control" id="tujuan_kegiatan_`+nextpage+`" name="tujuan_kegiatan[]" rows="3" required  disabled>`+result[i].tujuan_kegiatan+`</textarea>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlTextarea1">Lokasi Pelaksanaan Program </label>



                      <textarea class="form-control" id="lokasi_pp_`+nextpage+`" name="lokasi_pp[]" rows="3" required  disabled>`+result[i].lokasi_pp+`</textarea>



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Pendukung Program </label>



                      <input type="text" value="`+result[i].pendukung_program+`" class="form-control" id="pendukung_program_`+nextpage+`" name="pendukung_program[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Penanggung jawab program </label>



                      <input type="text" value="`+result[i].pen_jawab_program+`" class="form-control" id="pen_jawab_program_`+nextpage+`" name="pen_jawab_program[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Waktu Awal Pelaksanan Program </label>



                      <input type="text" value="`+result[i].w_akhir_pp_case+`" class="form-control  timepicker"  id="w_awal_pp_`+nextpage+`" name="w_awal_pp[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Waktu Akhir Pelaksanaan program</label>



                      <input type="text" value="`+result[i].w_akhir_pp_case+`" class="form-control timepicker" id="w_akhir_pp_`+nextpage+`" name="w_akhir_pp[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="col-md-12">



                      <label for="exampleInputEmail1">Jenis pengeluaran </label>`;



                      







                  var res = result[i].data_pengeluaran;



                  var tot_pengeluaran = 0;



                    var b=0;



                    for ( var u=0 ; u<res.length ; u++ ) {



                      b++;



                      // alert(result[i].kode_pka +"======="+res[u].jumlah_satuan)



                      card += `



                      <div class="card  shadow mb-2" id="card_jp_1" style="border-left: 5px solid #`+randomColor()+`">



                        <div class="card-body">



                          <div class="row">



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Jenis Pengeluaran </label>



                              <input type="text" value="`+res[u].jenis_pengeluaran+`" class="form-control" id="jp_`+nextpage+`" name="jp_`+nextpage+`[]" aria-describedby="emailHelp" placeholder="Jenis Pengeluaran" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Jumlah Satuan  </label>



                              <input type="text" value="`+res[u].jumlah_satuan+`" class="form-control" id="js_`+nextpage+`" name="js_`+nextpage+`[]" placeholder="Jumlah Satuan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Bulanan</label>



                              <input type="text" value="`+res[u].bulanan+`" class="form-control" id="bl_`+nextpage+`" name="bl_`+nextpage+`[]" placeholder="Bulanan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Tahunan</label>



                              <input type="text" value="`+res[u].tahunan+`" class="form-control" id="th_`+nextpage+`" name="th_`+nextpage+`[]" placeholder="Tahunan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Nilai Satuan </label>



                              <div class="input-group mb-3">



                                <div class="input-group-prepend">



                                  <span class="input-group-text" id="basic-addon1">Rp.</span>



                                </div>



                                <input type="text" value="`+formatRupiah(res[u].nilai_satuan,'')+`" class="form-control" onkeyup="formatRp('ns_`+nextpage+`_`+b+`')" id="ns_`+nextpage+`_`+b+`" name="ns_`+nextpage+`[]" placeholder="Nilai Satuan" aria-label="Nilai Satuan" aria-describedby="basic-addon1" required  disabled>



                              </div>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Pengeluaran</label>



                              <div class="input-group mb-3">



                                <div class="input-group-prepend">



                                  <span class="input-group-text" id="basic-addon1">Rp.</span>



                                </div>



                                <input type="text" value="`+formatRupiah(res[u].pengeluaran,'')+`" class="form-control dengan-rupiah" onkeyup="formatRp('pn_`+nextpage+`_`+b+`')" id="pn_`+nextpage+`_`+b+`" name="pn_`+nextpage+`[]" placeholder="Pengeluaran" aria-label="Pengeluaran" aria-describedby="basic-addon1" required  disabled>



                              </div>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                          </div>



                        </div>



                      </div>



                      `;



                      tot_pengeluaran += parseInt(res[u].pengeluaran);



                    }







                    ttt_peng += tot_pengeluaran;







                      card +=`



                      <div class="modal-footer mt-2">



                        <div class="h5 mb-0 font-weight-bold text-danger"> Rp. `+formatRupiah(tot_pengeluaran.toString())+`</div>  



                      </div>  



                    </div>`;







                    



                    card +=`<div class="col-md-12">



                      <label for="exampleInputEmail1">Jenis Penerimaan </label>`;



                    var resu = result[i].data_penerimaan;



                    var tot_penerimaan = 0;



                    var b=0;



                    for ( var u=0 ; u<resu.length ; u++ ) {



                      b++;



                      // alert(result[i].kode_pka +"======="+res[u].jumlah_satuan)



                      card += `



                      <div class="card  shadow mb-2" id="card_jp_1" style="border-left: 5px solid #`+randomColor()+`">



                        <div class="card-body">



                          <div class="row">



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Jenis Penerimaan </label>



                              <input type="text" value="`+resu[u].jenis_penerimaan+`" class="form-control" id="jpn_`+nextpage+`" name="jpn_`+nextpage+`[]" aria-describedby="emailHelp" placeholder="Jenis Pengeluaran" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Jumlah Satuan  </label>



                              <input type="text" value="`+resu[u].jumlah_satuan+`" class="form-control" id="jspn_`+nextpage+`" name="jspn_`+nextpage+`[]" placeholder="Jumlah Satuan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Bulanan</label>



                              <input type="text" value="`+resu[u].bulanan+`" class="form-control" id="blpn_`+nextpage+`" name="blpn_`+nextpage+`[]" placeholder="Bulanan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Tahunan</label>



                              <input type="text" value="`+resu[u].tahunan+`" class="form-control" id="thpn_`+nextpage+`" name="thpn_`+nextpage+`[]" placeholder="Tahunan" required  disabled>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Nilai Satuan </label>



                              <div class="input-group mb-3">



                                <div class="input-group-prepend">



                                  <span class="input-group-text" id="basic-addon1">Rp.</span>



                                </div>



                                <input type="text" value="`+formatRupiah(resu[u].nilai_satuan,'')+`" class="form-control" onkeyup="formatRp('ns_`+nextpage+`_`+b+`')" id="nspn_`+nextpage+`_`+b+`" name="nspn_`+nextpage+`[]" placeholder="Nilai Satuan" aria-label="Nilai Satuan" aria-describedby="basic-addon1" required  disabled>



                              </div>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                            <div class="form-group col-md-4">



                              <label for="exampleInputEmail1">Pengeluaran</label>



                              <div class="input-group mb-3">



                                <div class="input-group-prepend">



                                  <span class="input-group-text" id="basic-addon1">Rp.</span>



                                </div>



                                <input type="text" value="`+formatRupiah(resu[u].penerimaan,'')+`" class="form-control dengan-rupiah" onkeyup="formatRp('pn_`+nextpage+`_`+b+`')" id="pnpn_`+nextpage+`_`+b+`" name="pnpn_`+nextpage+`[]" placeholder="Pengeluaran" aria-label="Pengeluaran" aria-describedby="basic-addon1" required  disabled>



                              </div>



                              <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                            </div>



                          </div>



                        </div>



                      </div>



                      `;



                      tot_penerimaan += parseInt(resu[u].penerimaan);



                    }



                    ttt_pen += tot_penerimaan;



                    card +=`



                        <div class="modal-footer mt-2">



                          <div class="h5 mb-0 font-weight-bold text-success"> Rp. `+formatRupiah(tot_penerimaan.toString())+`</div>  



                        </div>  



                      </div>



                    `;







                    var satu = checkValue("1",JSON.parse(result[i].triwulan));



                    var dua = checkValue("2",JSON.parse(result[i].triwulan));



                    var tiga= checkValue("3",JSON.parse(result[i].triwulan));



                    var empat = checkValue("4",JSON.parse(result[i].triwulan));



                    card +=`



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Indikator Kuantitatif</label>



                      <input type="text" value="`+result[i].indikator_kuantitatif+`" class="form-control" id="indikator_kuantitatif_`+nextpage+`" name="indikator_kuantitatif[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group col-md-6">



                      <label for="exampleInputEmail1">Indikator Kualitatif </label>



                      <input type="text" value="`+result[i].indikator_kualitatif+`" class="form-control" id="indikator_kuantitatif_`+nextpage+`" name="indikator_kualitatif[]" aria-describedby="emailHelp" placeholder="Isi Nama Kegiatan Disini" required  disabled>



                      <!-- <small id="emailHelp" class="form-text text-muted">Data Akan terisi Otomatis.</small> -->



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Prioritas kegiatan</label>



                      <select class="form-control" id="prioritas_kegiatan_`+nextpage+`" name="prioritas_kegiatan[]" required disabled>



                      </select>



                    </div>



                    <div class="form-group  col-md-6">



                      <label for="exampleFormControlSelect1">Triwulan Kegiatan </label>



                      <select class="form-control" id="triwulan_`+nextpage+`" name="triwulan_`+nextpage+`[]" multiple="multiple" required  disabled>



                        <option value="">- Pilih Triwulan Kegiatan -</option>



                        <option value="1" `+satu+`>Triwulan 1</option>



                        <option value="2" `+dua+`>Triwulan 2</option>



                        <option value="3" `+tiga+`>Triwulan 3</option>



                        <option value="4" `+empat+`>Triwulan 4</option>



                      </select>



                    </div>



                    <div class="form-group  col-md-12">



                      <label for="exampleFormControlTextarea1">Keterangan</label>



                      <textarea class="form-control" id="keterangan_`+nextpage+`" name="keterangan[]" rows="3" required disabled>`+result[i].keterangan+`</textarea>



                    </div>



                  </div>



                </div>



              </div>



            </div>



            `;



                    



                    $("#insert_page").append(card);



                    time();



                    triwulan(nextpage)



                  }



                  var tot_all = ttt_pen - ttt_peng;



                    $("#tot_all").html("Total : Rp. "+formatRupiah(tot_all.toString()));



                  $("#insert_page").append(`



                    <div class="modal-footer mt-2">



                      <div class="h4 mb-0 font-weight-bold text-danger">Total Pengeluaran : Rp. `+formatRupiah(ttt_peng.toString())+`</div>



                    </div>



                    <div class="modal-footer mt-2">



                      <div class="h4 mb-0 font-weight-bold text-success">Total Penerimaan : Rp. `+formatRupiah(ttt_pen.toString())+`</div>



                    </div>



                    `);



                },



                error: function(jqXHR, textStatus, errorThrown) {



                    Command: toastr["error"](errorThrown, "Error");



                }



          });



    }



    file();



    // kma(1);



    /////////////////////////////////////////////////



    unit_misioner = function(param,param2){



      jQuery.ajax({



        url: base_url+"unit_misioner/data_unit_misioner",



        dataType:'json',



        success:function(response){



          var data = response;



          var $id = $('#'+param);



          $id.empty();



          $id.append('<option value="">- Pilih Unit Misioner -</option>');



          for (var i = 0; i < data.length; i++) {



            if(param2 == data[i].id_unit_misioner){



              var selected = "selected";



            }else{



              var selected = "";



            }



            $id.append('<option value="'+data[i].id_unit_misioner+','+data[i].kode+'" '+selected+'>' + data[i].nama +'</option>');



          }        



        }            



      });



    }



    



    ////////////////////////////////////////////////



    ///////////////////////////////////////////////



    jenis_kegiatan = function(param,param2){



      jQuery.ajax({



        url: base_url+"Jenis_kegiatan/data_jenis_kegiatan",



        dataType:'json',



        success:function(response){



          var data = response;



          var $id = $('#'+param);



          $id.empty();



          // $id.append('<option value=0>- Pilih Jenis Kegiatan -</option>');



          for (var i = 0; i < data.length; i++) {



            if(param2 == data[i].id_jenis_kegiatan){



              var selected = "selected";



            }else{



              var selected = "";



            }



            $id.append('<option value="'+data[i].id_jenis_kegiatan+','+data[i].kode+'" '+selected+'>' + data[i].nama + '</option>');



          }        



        }            



      });



    }



    



    /////////////////////////////////////////////////



    ////////////////////////////////////////////////



    bidang = function(param,param2){



      jQuery.ajax({



        url: base_url+"Bidang/data_bidang",



        dataType:'json',



        success:function(response){



          var data = response;



          var $id = $('#'+param);



          $id.empty();



          $id.append('<option value="">- Pilih Bidang -</option>');



          for (var i = 0; i < data.length; i++) {



            if(param2 == data[i].id_bidang){



              var selected = "selected";



            }else{



              var selected = "";



            }



            $id.append('<option value="'+data[i].id_bidang+','+data[i].kode+'" '+selected+'>' + data[i].nama + '</option>');



          }        



        }            



      });



    }



    



    ///////////////////////////////////////////////



    //////////////////////////////////////////////



    prioritas_kegiatan = function(param,param2){



      jQuery.ajax({



        url: base_url+"Prioritas_kegiatan/data_Prioritas_kegiatan",



        dataType:'json',



        success:function(response){



          var data = response;



          var $id = $('#'+param);



          $id.empty();



          $id.append('<option value=0>- Pilih Prioritas Kegiatan -</option>');



          for (var i = 0; i < data.length; i++) {



            if(param2 == data[i].id_prioritas_kegiatan){



              var selected = "selected";



            }else{



              var selected = "";



            }



            $id.append('<option value="'+data[i].id_prioritas_kegiatan+'" '+selected+'>' + data[i].nama + '</option>');



          }        



        }            



      });



    }



    



    //////////////////////////////////////////////



    nomor_strategi = function(param,param2){



      jQuery.ajax({



        url: base_url+"Strategi/data_strategi",



        dataType:'json',



        success:function(response){



          var data = response;



          var $id = $('#'+param);



          $id.empty();



          $id.append('<option value=0>- Pilih Nomor Strategi -</option>');



          for (var i = 0; i < data.length; i++) {



            if(param2 == data[i].id_strategi){



              var selected = "selected";



            }else{



              var selected = "";



            }



            $id.append('<option value="'+data[i].id_strategi+'" '+selected+'>('+data[i].head+') ' + data[i].kode_strategi + '</option>');



          }        



        }            



      });



    }



    



    //////////////////////////////////////







    $( "#page_1" ).css( "background-color", "#"+randomColor());



    $( "#card_jp_1" ).css( "border-left","5px solid #"+randomColor());







    $("#cetak_exel").click(function(){



      // window.open("http://www.dumetschool.com", "DUMET School", "height=700, width=500, scrollbars=yes");



      window.location = base_url+"Laporan_excel/cetak_excel/"+no_pka;



    });







    



    // $("#hapus_file").click(function(){







    //   var kode_save = "<?=$id_row?>";



    //   bootbox.confirm("Apakah Anda Yakin Akan Menghapus Data?", function(result){ 



    //     if (result==true) {



    //     $.ajax({



    //             url             : base_url + 'Save_pka/delete_save_pka/'+kode_save, 



    //             type            : "POST",



    //             dataType        : 'json',



    //             mimeType        : 'multipart/form-data',



    //             // data            : form_data,



    //             contentType     : false,



    //             cache           : false,



    //             processData     : false,



    //             success         : function(response){



    //                 if(response == true){



    //                     // $('#'+id_modal).modal('hide'); 



    //                     Command: toastr["success"]("Data Berhasil Dihapus", "Berhasil");



    //                     getcontens('page/file_pka');



    //                 }else{



    //                     Command: toastr["error"]("Simpan error, data tidak berhasil disimpan", "Error");



    //                 }



    //             },



    //             error: function(jqXHR, textStatus, errorThrown) {



    //               $('#loading').modal('show');



    //                     Command: toastr["error"](errorThrown, "Error");



    //             },



    //             beforeSend: function () {



    //               $('#loading').modal('show');



    //             },



    //             complete: function () {



    //                 $('#loading').modal('hide');



    //             }



    //     }); 



    //   }



    //   });



        



    // });    



    triwulan = function(no_page){



      $("#triwulan_"+no_page).select2({



        placeholder: "Silahkan Pilih Triwulan"



      });



    }



    checkValue = function(value,arr){



      var status = '';







      for(var i=0; i<arr.length; i++){



        var name = arr[i];



        if(name == value){



          status = 'selected';



          break;



        }



      }







      return status;



    }          



    formatRp = function(bbb){



      var ggg = $("#"+bbb).val(); 



      $("#"+bbb).val(formatRupiah(ggg, ''));



    }



    /* Fungsi */



    function formatRupiah(angka, prefix)



    {



        var number_string = angka.replace(/[^,\d]/g, '').toString(),



            split    = number_string.split(','),



            sisa     = split[0].length % 3,



            rupiah     = split[0].substr(0, sisa),



            ribuan     = split[0].substr(sisa).match(/\d{3}/gi);



            



        if (ribuan) {



            separator = sisa ? '.' : '';



            rupiah += separator + ribuan.join('.');



        }



        



        rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah;



        return prefix == undefined ? rupiah : (rupiah ? '' + rupiah : '');



    }



























  });



</script>



