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

62 lines
3.2 KiB
PHP

<?php
include("../koneksi.php");
$thn=$_POST['thn'];
$tm1=$_POST['tm1'];
$tm1=str_replace('/','-',$tm1);
$tt1=date('Y',strtotime($tm1));
$bb1=date('m',strtotime($tm1));
$hh1=date('d',strtotime($tm1));
$ts1=$_POST['ts1'];
$ts1=str_replace('/','-',$ts1);
$tt2=date('Y',strtotime($ts1));
$bb2=date('m',strtotime($ts1));
$hh2=date('d',strtotime($ts1));
?>
<script type="text/javascript">$("#tabel_data_tb1").DataTable({"paging": true,"lengthChange": false,"searching": false,"ordering": false,"info": true,"autoWidth": false});</script>
<table id="tabel_data_tb1" class="table table-striped table-condensed" cellpadding="1">
<thead>
<tr>
<td width="40px;"><b>No</b></td>
<td width="60px;"><b>No Kode</b></td>
<td width="200px;"><b>Asal Surat</b></td>
<td width="100px;"><b>Tgl Diterima</b></td>
<td><b>Perihal</b></td>
<!--<td width="150px;"><b>Pemroses</b></td>-->
</tr>
</thead>
<tbody style="color:black">
<?php
$data=pg_query("SELECT s.no_urut,(SELECT s1.kode FROM kode s1 WHERE s1.id=s.kode_id),
s.surat_dari,COALESCE(a.tgl_arsip,s.tgl_diterima),s.perihal,
(SELECT k.nama FROM satuan_kerja k WHERE k.id=s.satuan_kerja_id)
FROM surat s
LEFT OUTER JOIN arsip a ON (a.surat_id=s.id)
WHERE s.tgl_surat_masuk IS NOT NULL
AND COALESCE(a.tgl_arsip,s.tgl_diterima)::DATE BETWEEN '$tt1-$bb1-$hh1' AND '$tt2-$bb2-$hh2'
ORDER BY COALESCE(a.tgl_arsip,s.tgl_diterima) ASC, s.no_urut ASC");
while($r=pg_fetch_array($data)) {
?>
<tr>
<td class="kiri"><b><?php
$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[1]; ?></b></td>
<td style="word-wrap: break-word;min-width: 160px;max-width: 160px;"><b><?php echo $r[2]; ?></b></td>
<td><b><?php echo date('d-m-Y',strtotime($r[3])); ?></b></td>
<td class="kanan" style="word-wrap: break-word;min-width: 160px;max-width: 160px;"><b><?php echo $r[4]; ?></b></td>
<!--<td class="kanan"><b><?php echo $r[5]; ?></b></td>-->
</tr>
<?php
}
?>
</tbody>
</table>