127 lines
5.0 KiB
PHP
127 lines
5.0 KiB
PHP
<?php
|
|
include('app/koneksi.php');
|
|
$thn=$_POST['thn'];
|
|
?>
|
|
|
|
<style>
|
|
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
|
background-color: #F4EEEE;
|
|
color: black;
|
|
}
|
|
</style>
|
|
|
|
<div class="alert alert-icon alert-info alert-dismissible fade in" role="alert" id="info_setor">
|
|
<i class="mdi mdi-information" style="color:green"></i>
|
|
<span style="font-family:InterSB;font-size:13px;color:green">PERHATIAN!</span><br>
|
|
<span style="font-family:Inter;font-size:14px;color:green">Sebelum input data SPPD, Mohon diperiksa apakah Nomor SPT nya sudah pernah di-input, dengan cara melakukan pencarian di bawah ini.</span><br>
|
|
<span style="font-family:Inter;font-size:14px;color:green">Bila tidak ada, silakan klik tombol SPT Baru </span>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<form role="form">
|
|
<div class="row">
|
|
<div class="col-lg-3">
|
|
<label for="exampleInputEmail1">Tahun SPT</label>
|
|
<select class="form-control" id="thnspt">
|
|
<?php
|
|
$thn_skrg=date('Y');
|
|
$c=pg_query("SELECT MAX(CAST(EXTRACT(YEAR FROM DATE(tgl_berangkat)) AS INTEGER)) FROM sp_spt");
|
|
while($s=pg_fetch_array($c)) {$maxthn=$s[0];}
|
|
if ($thn_skrg==$maxthn) {} else {?> <option value="<?php $thn_skrg;?>"><?php echo $thn_skrg;?></option> <?php }
|
|
$d=pg_query("SELECT DISTINCT(CAST(EXTRACT(YEAR FROM DATE(tgl_berangkat)) AS INTEGER)) FROM sp_spt
|
|
WHERE CAST(EXTRACT(YEAR FROM DATE(tgl_berangkat)) AS INTEGER) <> 1970
|
|
ORDER BY CAST(EXTRACT(YEAR FROM DATE(tgl_berangkat)) AS INTEGER) DESC");
|
|
while($r=pg_fetch_array($d)) {
|
|
?>
|
|
<option <?php if ($thn_skrg==$r[0]) {echo "selected";} else {}?> value="<?php echo $r[0];?>"><?php echo $r[0];?></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
|
|
</div>
|
|
<div class="col-lg-9">
|
|
<label for="exampleInputEmail1">Cari No SPT</label>
|
|
<select class="form-control" id="nospt">
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
<!--
|
|
<div class="form-group">
|
|
<label for="exampleInputEmail1">Cari No SPT</label>
|
|
<select class="form-control" id="nospt">
|
|
<?php
|
|
$d=pg_query("SELECT sp_kwi_id,no_surat,instansi_tujuan,untuk FROM sp_spt ORDER BY id DESC");
|
|
while($r=pg_fetch_array($d)) {
|
|
?>
|
|
<option value="<?php echo $r[0];?>"><span style="font-family:InterSB"><?php echo $r[1].'|'.$r[2].'|'.$r[3];?></span></option>
|
|
<?php
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
-->
|
|
|
|
<script>
|
|
document.getElementById("nospt").selectedIndex = -1;
|
|
function formatSearch3(item) {
|
|
var selectionText = item.text.split("|");
|
|
var $returnString = $('<span style="font-family:InterSB;color:black">' + selectionText[0] + '</span><br><span style="font-family:InterSB;color:blue"><i class="mdi mdi-dialpad mdi-rotate-270 m-r-5 m-l-5 ic_info_menu"></i>' + selectionText[1] + '</span><br><span style="font-family:Inter;color:black">' + selectionText[2] + '</span>');
|
|
return $returnString;
|
|
};
|
|
function formatSelected3(item) {
|
|
var selectionText = item.text.split("|");
|
|
var $returnString = $('<span>' + selectionText[0].substring(0, 500) +'</span>');
|
|
return $returnString;
|
|
};
|
|
$('#nospt').select2({
|
|
templateResult: formatSearch3,
|
|
templateSelection: formatSelected3
|
|
});
|
|
|
|
|
|
$('#nospt').change(function(){
|
|
var sp_kwi_id=$('#nospt').val();
|
|
$.post('app/sppd/main.php',{sp_kwi_id:sp_kwi_id},function(html){
|
|
$("#main_tag").html(html);
|
|
$('#modal_cekspt').modal('hide');
|
|
$('body').removeClass('modal-open');
|
|
$('.modal-backdrop').remove();
|
|
});
|
|
});
|
|
|
|
var thn = $('#thnspt').val();
|
|
var key = 'viund';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "crud.php",
|
|
data: 'thn='+thn
|
|
+'&key='+key,
|
|
success: function(data){
|
|
$('#nospt').html(data);
|
|
document.getElementById("nospt").selectedIndex = -1;
|
|
}
|
|
});
|
|
|
|
$('#thnspt').change(function(){
|
|
var thn = $('#thnspt').val();
|
|
var key = 'viund';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "crud.php",
|
|
data: 'thn='+thn
|
|
+'&key='+key,
|
|
success: function(data){
|
|
$('#nospt').html(data);
|
|
document.getElementById("nospt").selectedIndex = -1;
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|