133 lines
6.3 KiB
PHP
133 lines
6.3 KiB
PHP
<?php
|
|
include('../koneksi.php');
|
|
$surat_id=$_POST['id'];
|
|
$d=pg_query("SELECT id,(SELECT kode FROM kode WHERE id=kode_id),
|
|
(SELECT keterangan FROM kode WHERE id=kode_id),no_surat,surat_dari,perihal,tgl_surat_masuk,tgl_diterima,
|
|
no_agenda FROM surat WHERE id=(SELECT disposisi FROM surat WHERE id='$surat_id')");
|
|
while($r=pg_fetch_array($d)) {
|
|
$id=$r[0];$kode=$r[1];$keterangan=$r[2];$no_surat=$r[3];$surat_dari=$r[4];$perihal=$r[5];
|
|
$tgl_surat_masuk=date('d/m/Y',strtotime($r[6]));$tgl_diterima=date('d/m/Y',strtotime($r[7]));$no_agenda2=$r[8];$thn=date('Y',strtotime($r[7]));
|
|
}
|
|
$no_pinjam=(int) substr($no_agenda2,0,5);
|
|
$no_agenda3=sprintf("%05s",$no_pinjam);
|
|
|
|
$disposisi=$id;
|
|
if (($disposisi==null) || ($disposisi=='')) {} else {
|
|
$kode_id=$kode.' / '.$keterangan;
|
|
$no_agenda=$kode.'/'.$no_agenda3.'/302/'.$thn;}
|
|
?>
|
|
<form role="form">
|
|
<div class="form-group">
|
|
<label>Tahun</label>
|
|
<input type="text" class="form-control" id="thn_dis" value="<?php echo $thn; ?>">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>No Agenda</label>
|
|
<input type="text" class="form-control" id="no_agenda" value="<?php echo $no_agenda; ?>">
|
|
</div>
|
|
|
|
<input type="hidden" id="ff">
|
|
<input type="hidden" id="gg" value="<?php echo $surat_id; ?>">
|
|
<div class="form-group">
|
|
<label>Kode Surat</label>
|
|
<input type="text" class="form-control" list="browsers" name="browser" id="kode_id" value="<?php echo $kode_id; ?>" disabled>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>No Surat</label>
|
|
<input type="text" class="form-control" id="no_surat" value="<?php echo $no_surat; ?>" disabled>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Surat Dari</label>
|
|
<input type="text" class="form-control" id="surat_dari" value="<?php echo $surat_dari; ?>" disabled>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label>Perihal</label>
|
|
<textarea class="form-control" rows="4" id="perihal" disabled><?php echo $perihal; ?></textarea>
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
<label for="exampleInputEmail1">Tgl Surat</label>
|
|
<input type="text" class="date form-control" id="tgl_surat_masuk" placeholder="dd/mm/yyyy" disabled
|
|
onkeyup="
|
|
var v = this.value;
|
|
if (v.match(/^\d{2}$/) !== null) {
|
|
this.value = v + '/';
|
|
} else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
|
|
this.value = v + '/';
|
|
}
|
|
"
|
|
value="<?php
|
|
$tk=$tgl_surat_masuk;
|
|
if (($tk=="01-01-1970") || ($tk==NULL) || ($tk=="")) {
|
|
echo "";
|
|
} else {
|
|
echo $tk;
|
|
}
|
|
?>"
|
|
>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="exampleInputEmail1">Tgl Diterima</label>
|
|
<input type="text" class="date form-control" id="tgl_diterima" placeholder="dd/mm/yyyy" disabled
|
|
onkeyup="
|
|
var v = this.value;
|
|
if (v.match(/^\d{2}$/) !== null) {
|
|
this.value = v + '/';
|
|
} else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
|
|
this.value = v + '/';
|
|
}
|
|
"
|
|
value="<?php
|
|
$tpk=$tgl_surat_masuk;
|
|
if (($tpk=="01-01-1970") || ($tpk==NULL) || ($tpk=="")) {
|
|
echo "";
|
|
} else {
|
|
echo $tpk;
|
|
}
|
|
?>"
|
|
>
|
|
</div>
|
|
</form>
|
|
|
|
|
|
<script>
|
|
$('#no_agenda').focusout(function(){
|
|
var thn=$('#thn_dis').val();
|
|
var no_agenda=$('#no_agenda').val();
|
|
var key='cari_disposisi';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/skeluar/crud.php",
|
|
data: 'thn='+thn
|
|
+'&no_agenda='+no_agenda
|
|
+'&key='+key,
|
|
success: function(data){
|
|
if (data=='kosong') {
|
|
$('#ff').val('');
|
|
$('#kode_id').val('');
|
|
$('#no_surat').val('');
|
|
$('#surat_dari').val('');
|
|
$('#perihal').val('');
|
|
$('#tgl_surat_masuk').val('');
|
|
$('#tgl_diterima').val('');
|
|
// $('#no_agenda').first().focus().selected();
|
|
} else {
|
|
var inp=data.split('^#*');
|
|
$('#ff').val(inp[0]);
|
|
$('#kode_id').val(inp[1]);
|
|
$('#no_surat').val(inp[2]);
|
|
$('#surat_dari').val(inp[3]);
|
|
$('#perihal').val(inp[4]);
|
|
$('#tgl_surat_masuk').val(inp[5]);
|
|
$('#tgl_diterima').val(inp[6]);
|
|
$('#no_agenda').val(inp[7]);
|
|
}
|
|
|
|
}
|
|
});
|
|
});
|
|
</script>
|