206 lines
11 KiB
Plaintext
206 lines
11 KiB
Plaintext
<?php
|
|
include("../koneksi.php");
|
|
$satuan_kerja_id=$_POST['satker'];
|
|
$jenis_user=$_POST['jenis'];
|
|
$sess_nama=$_POST['sess_nama'];
|
|
|
|
$bln2=$_POST['bln2'];
|
|
$thn2=$_POST['thn2'];
|
|
|
|
?>
|
|
|
|
<script type="text/javascript">$("#tabel_data_kirim").DataTable({"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});</script>
|
|
|
|
|
|
<input type="hidden" id="jenis" value="<?php echo $jenis_user; ?>">
|
|
<input type="hidden" id="sess_nama" value="<?php echo $sess_nama; ?>">
|
|
<input type="hidden" id="satuan_kerja_id" value="<?php echo $satuan_kerja_id; ?>">
|
|
|
|
<input type="hidden" id="disp_bln" value="<?php echo $bln2; ?>">
|
|
<input type="hidden" id="disp_thn" value="<?php echo $thn2; ?>">
|
|
|
|
<table id="tabel_data_kirim" class="table table-striped table-condensed" cellpadding="1">
|
|
<thead>
|
|
<tr>
|
|
<td width="120px;"><b>Tanggal</b></td>
|
|
<td><b>Perihal</b></td>
|
|
<td width="120px;"><b>Tgl Kirim</b></td>
|
|
<td width="120px;"><b>No Surat</b></td>
|
|
<td width="450px;"><b>Tools</b></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody style="color:black">
|
|
<?php
|
|
$data=pg_query("SELECT tgl_surat_keluar,perihal,satuan_kerja_id,id,tgl_kirim,no_surat FROM surat WHERE satuan_kerja_id='$satuan_kerja_id'
|
|
AND jenis_surat_id='3' AND jenis_disposisi_id='3'
|
|
".($thn2 == '' ? "" : "AND EXTRACT(YEAR FROM DATE(tgl_surat_keluar))='$thn2'")."
|
|
".($bln2 == '0' ? "" : "AND EXTRACT(MONTH FROM DATE(tgl_surat_keluar))='$bln2'")."
|
|
ORDER BY tgl_surat_keluar DESC
|
|
");
|
|
while($r=pg_fetch_array($data)) {
|
|
|
|
$surat_id=$r[3];
|
|
$k=pg_query("SELECT COUNT(*)
|
|
FROM kirim k INNER JOIN surat s ON (k.surat_id=s.id)
|
|
WHERE k.kepada IS NOT NULL AND k.surat_id='$surat_id'");
|
|
while($rk=pg_fetch_array($k)) {$kpd=$rk[0];}
|
|
|
|
$l=pg_query("SELECT COUNT(*)
|
|
FROM scan k INNER JOIN surat s ON (k.surat_id=s.id)
|
|
WHERE k.surat_id='$surat_id' AND LOWER(k.file) LIKE '%jpg' AND k.file NOT IN ('')");
|
|
while($rl=pg_fetch_array($l)) {$tj=$rl[0];}
|
|
|
|
$m=pg_query("SELECT COUNT(*)
|
|
FROM scan k INNER JOIN surat s ON (k.surat_id=s.id)
|
|
WHERE k.surat_id='$surat_id' AND LOWER(k.file) NOT LIKE '%jpg' AND k.file NOT IN ('')");
|
|
while($rm=pg_fetch_array($m)) {$tm=$rm[0];}
|
|
?>
|
|
|
|
<tr>
|
|
<td class="kiri"><b><?php echo date('d-m-Y H:i',strtotime($r['tgl_surat_keluar'])); ?></b></td>
|
|
<td><b><?php echo strtoupper($r['perihal']); ?></b></td>
|
|
<td><b><?php if ($r['tgl_kirim']==NULL) {} else {echo date('d-m-Y H:i',strtotime($r['tgl_kirim']));} ?></b></td>
|
|
<td><b><?php echo $r['no_surat']; ?></b></td>
|
|
<td class="kanan">
|
|
|
|
<button type="button" name="jpg_kirim" style="height:22px;"class="btn btn-default btn-xs jpg_kirim" id="<?php echo $r[3];?>" data-content="File" rel="popover" data-placement="top" data-trigger="hover"
|
|
>
|
|
<i class="fa fa-file-picture-o m-r-5"></i>Scan Surat<span class="sq<?php echo $r[3];?>" idne="jpg<?php echo $r[3];?>"> <?php echo '('.$tj.')'?></span>
|
|
</button>
|
|
<button type="button" name="file_kirim" style="height:22px;"class="btn btn-default btn-xs file_kirim" id="<?php echo $r[3];?>" data-content="File" rel="popover" data-placement="top" data-trigger="hover"
|
|
>
|
|
<i class="fa fa-file m-r-5"></i>Lampiran<span class="sr<?php echo $r[3];?>" idne="pdf<?php echo $r[3];?>"> <?php echo '('.$tm.')'?></span>
|
|
</button>
|
|
<button type="button" name="kepada_kirim" style="height:22px;"class="btn btn-default btn-xs kepada_kirim" id="<?php echo $r[3];?>" data-content="Kepada" rel="popover" data-placement="top" data-trigger="hover"
|
|
>
|
|
<i class="fa fa-user m-r-5"></i>Kepada<span class="sp<?php echo $r[3];?>" idne="kpd<?php echo $r[3];?>"> <?php echo '('.$kpd.')'?></span>
|
|
</button>
|
|
<button type="button" name="edit_kirim" style="height:22px;"class="btn btn-primary btn-xs edit_kirim" id="<?php echo $r[3];?>" data-content="Edit" rel="popover" data-placement="top" data-trigger="hover"
|
|
>
|
|
<i class="fa fa-pencil"></i>
|
|
</button>
|
|
<button type="button" name="hapus_kirim" style="height:22px;"class="btn btn-danger btn-xs hapus_kirim" id="<?php echo $r[3];?>" data-content="Hapus" rel="popover" data-placement="top" data-trigger="hover"
|
|
>
|
|
<i class="fa fa-remove"></i>
|
|
</button>
|
|
<button type="button" name="start_kirim" style="height:22px;"class="btn btn-inverse btn-xs start_kirim" id="<?php echo $r[3];?>" data-content="File" rel="popover" data-placement="top" data-trigger="hover"
|
|
><i class="fa fa-arrow-right m-r-5"></i>KIRIM
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
/*$('button[name="file_kirim"]').popover();
|
|
$('button[name="kepada_kirim"]').popover();*/
|
|
$('button[name="edit_kirim"]').popover();
|
|
$('button[name="hapus_kirim"]').popover();
|
|
|
|
|
|
$("#tabel_data_kirim").on('click','.edit_kirim',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_kirim').modal('show');
|
|
$('#modal_body_kirim').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/modal.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_kirim').html(data);
|
|
$('#perihal').first().focus().selected();
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_kirim").on('click','.kepada_kirim',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_kepada').modal('show');
|
|
$('#modal_body_kepada').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/modal_kepada.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_kepada').html(data);
|
|
$('#kepada_k').first().focus().selected();
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_kirim").on('click','.jpg_kirim',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_pic').modal('show');
|
|
$('#modal_body_pic').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/modal_dok.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_pic').html(data);
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_kirim").on('click','.file_kirim',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_file').modal('show');
|
|
$('#modal_body_file').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/upd_file.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_file').html(data);
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_kirim").on('click','.hapus_kirim',function(){
|
|
var x = confirm("Anda yakin ingin menghapus ?");
|
|
if (x) {
|
|
var key = "hapus_kirim";
|
|
var id = $(this).attr('id');
|
|
var rowElement = $(this).parent().parent();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/crud.php",
|
|
data: 'id='+id
|
|
+'&key='+key,
|
|
success: function(data){
|
|
rowElement.fadeOut(500).remove();
|
|
}
|
|
});
|
|
} else {}
|
|
});
|
|
|
|
$("#tabel_data_kirim").on('click','.start_kirim',function(){
|
|
var x = confirm("Anda yakin ingin mengirim ?");
|
|
if (x) {
|
|
var key = "start_kirim";
|
|
var id = $(this).attr('id');
|
|
var thn2 = $('#thn').val();
|
|
var bln2 = $('#bln').val();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/kirim/crud.php",
|
|
data: 'id='+id
|
|
+'&key='+key,
|
|
success: function(data){
|
|
alert('Surat terkirim ke tujuan..');
|
|
var sat = $('#satuan_kerja_id').val();
|
|
if (sat=='3') {
|
|
$('#tabel_kirim').load("app/kirim/tabel.php",{satker:sat,jenis:sess_jenis,sess_nama:sess_nama,thn2:thn2,bln2:bln2});
|
|
} else {
|
|
$('#tabel_kirim').load("app/kirim/tabel.php",{satker:sess_satker,jenis:sess_jenis,sess_nama:sess_nama,thn2:thn2,bln2:bln2});
|
|
}
|
|
}
|
|
});
|
|
} else {}
|
|
});
|
|
</script> |