Files
eletter-backup/dev/app/pencarian/tabel_tb3.php
2024-05-31 14:18:00 +07:00

217 lines
13 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
include("../koneksi.php");
$tm3=$_POST['tm3'];
$ts3=$_POST['ts3'];
$w3=$_POST['w3'];
$p3=strtolower($_POST['p3']);
$k3=$_POST['k3'];
$thn=$_POST['thn'];
$tm3=$_POST['tm3'];
$tm3=str_replace('/','-',$tm3);
$tt1=date('Y',strtotime($tm3));
$bb1=date('m',strtotime($tm3));
$hh1=date('d',strtotime($tm3));
$ts3=$_POST['ts3'];
$ts3=str_replace('/','-',$ts3);
$tt2=date('Y',strtotime($ts3));
$bb2=date('m',strtotime($ts3));
$hh2=date('d',strtotime($ts3));
?>
<script type="text/javascript">$("#tabel_data_tb3").DataTable({"paging": true,"lengthChange": false,"searching": false,"ordering": false,"info": true,"autoWidth": false});</script>
<input type="hidden" id="jenis" value="<?php echo $jenis_user; ?>">
<table id="tabel_data_tb3" class="table table-striped table-condensed" cellpadding="1">
<thead>
<tr>
<td width="60px;"><b>No Urut</b></td>
<td width="60px;"><b>No Kode</b></td>
<!--<td><b>Kepada</b></td>-->
<td><b>Perihal</b></td>
<td><b>Pengolah</b></td>
<td><b>Tgl Surat</b></td>
<td><b>Tujuan</b></td>
<td><b>Balasan</b></td>
<td><b>Kepada</b></td>
<td width="80px;"><b>Tools</b></td>
</tr>
</thead>
<tbody style="color:black">
<?php
$data=pg_query("SELECT s.no_urut,
k.kode,
k.keterangan,
s.kepada,
CASE WHEN s.satuan_kerja_dari IS NULL THEN t.nama
ELSE
(SELECT t2.nama FROM satuan_kerja t2 WHERE t2.id=s.satuan_kerja_dari)
END,
CASE WHEN s.satuan_kerja_dari IS NULL THEN t.kode_satker
ELSE
(SELECT k2.kode_satker FROM satuan_kerja k2 WHERE k2.id=s.satuan_kerja_dari)
END,
s.id,
s.perihal
,
s.id,s.balasan,s.jam_kirim,s.tgl_kirim,
s.tgl_surat_keluar,
n.tujuan,p.kepada
FROM surat s
INNER JOIN kode k ON (k.id=s.kode_id)
INNER JOIN satuan_kerja t ON (t.id=s.satuan_kerja_id)
INNER JOIN tujuan n ON (n.id=s.tujuan_id)
LEFT OUTER JOIN kepada p ON (s.id=p.surat_id)
WHERE s.kepada IS NOT NULL
".($tm3 == null ? "" : "AND s.tgl_surat_keluar::DATE BETWEEN '$tt1-$bb1-$hh1' AND '$tt2-$bb2-$hh2'")."
".($p3 == null ? "" : " AND EXTRACT('YEAR' FROM s.tgl_surat_keluar)='$thn' AND LOWER(s.perihal) LIKE '%$p3%'")."
".($k3 == null ? "" : " AND EXTRACT('YEAR' FROM s.tgl_surat_keluar)='$thn' AND s.no_kendali='$k3'")."
".($w3 == null ? "" : " AND EXTRACT('YEAR' FROM s.tgl_surat_keluar)='$thn' AND s.no_urut='$w3'")."
ORDER BY s.tgl_surat_keluar DESC,s.no_urut DESC
");
while($r=pg_fetch_array($data)) {
?>
<tr>
<!--<td class="kiri" align="right"><b><?php echo $r['no_urut']; ?></b></td>-->
<td class="kiri"><b><?php
if (($r['no_urut']=='') || ($r['no_urut']==NULL)) {} else {
$no_pinjam=(int) substr($r['no_urut'],0,5);
$no_urut=sprintf("%05s",$no_pinjam);
echo $no_urut;
}
?></b></td>
<td><b><?php echo $r['kode']; ?></b></td>
<!--<td><b><?php echo $r['kepada']; ?></b></td>-->
<td style="word-wrap: break-word;min-width: 160px;max-width: 160px;"><b><?php echo $r[7]; ?></b></td>
<td><b><?php echo $r[4].' - '.$r[5]; ?></b></td>
<td><b><?php echo date('d-m-Y',strtotime($r['tgl_surat_keluar'])); ?></b></td>
<td><b><?php echo $r['tujuan']; ?></b></td>
<td><b><?php if ($r['balasan']=='f') {echo "TIDAK";} else {echo "YA";} ?></b></td>
<td><b><?php echo $r[14]; ?></b></td>
<td class="kanan">
<button type="button" name="kepada_skeluar" style="height:22px;"class="btn btn-teal btn-xs kepada_skeluar" id="<?php echo $r['id'];?>" data-content="Kepada" rel="popover" data-placement="top" data-trigger="hover"
>
<i class="fa fa-user"></i>
</button>
<button type="button" name="edit_tb3" style="height:22px;"class="btn btn-primary btn-xs edit_tb3" id="<?php echo $r['id'];?>" data-content="Detail" rel="popover" data-placement="top" data-trigger="hover"
>
<i class="fa fa-pencil"></i>
</button>
<?php
if ($r['balasan']=='f') {} else {
?>
<button type="button" name="proses_disposisi" style="height:22px;"class="btn btn-danger btn-xs proses_disposisi" id="<?php echo $r['id'];?>" data-content="Disposisi" rel="popover" data-placement="top" data-trigger="hover"
>
<i class="fa fa-arrow-right"></i>
</button>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<div id="modal_skeluar" 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 no-border">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Detail Surat Keluar</h4>
</div>
<div class="modal-body" id="modal_body_skeluar"></div>
<!--<div class="modal-footer no-border">
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal" id="keluar_skeluar">Keluar</button>
<button type="button" class="btn btn-primary waves-effect waves-light" id="simpan_skeluar">Simpan</button>
</div> -->
</div>
</div>
</div>
<div id="modal_sdisposisi" 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 no-border">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Data Disposisi</h4>
</div>
<div class="modal-body" id="modal_body_sdisposisi"></div>
<!-- <div class="modal-footer no-border">
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal" id="keluar_sdisposisi">Keluar</button>
<button type="button" class="btn btn-primary waves-effect waves-light" id="simpan_sdisposisi">Simpan</button>
</div> -->
</div>
</div>
</div>
<div id="modal_skepada" 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 no-border">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Data Kepada</h4>
</div>
<div class="modal-body" id="modal_body_skepada"></div>
</div>
</div>
</div>
<script type="text/javascript">
$('button[name="edit_tb3"]').popover();
$('button[name="proses_disposisi"]').popover();
$('button[name="kepada_skeluar"]').popover();
$("#tabel_data_tb3").on('click','.edit_tb3',function(){
var id = $(this).attr('id');
$('#modal_skeluar').modal('show');
$('#modal_body_skeluar').html("");
$.ajax({
type: "POST",
url: "app/skeluar/modal.php",
data: 'id='+id,
success: function(data){
$('#modal_body_skeluar').html(data);
$("#modal_body_skeluar :input").attr("disabled", true);
}
});
});
$("#tabel_data_tb3").on('click','.proses_disposisi',function(){
var id = $(this).attr('id');
$('#modal_sdisposisi').modal('show');
$('#modal_body_sdisposisi').html("");
$.ajax({
type: "POST",
url: "app/skeluar/modal_dis.php",
data: 'id='+id,
success: function(data){
$('#modal_body_sdisposisi').html(data);
$("#modal_body_sdisposisi :input").attr("disabled", true);
}
});
});
$("#tabel_data_tb3").on('click','.kepada_skeluar',function(){
var id = $(this).attr('id');
$('#modal_skepada').modal('show');
$('#modal_body_skepada').html("");
$.ajax({
type: "POST",
url: "app/skeluar/modal_kepada.php",
data: 'id='+id,
success: function(data){
$('#modal_body_skepada').html(data);
$("#modal_body_skepada :input").attr("disabled", true);
$('.md_kpd').hide();
$('.delete_kepada_k').hide();
}
});
});
</script>