first commit
This commit is contained in:
40
app/laporan/crud.php
Normal file
40
app/laporan/crud.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
include('../koneksi.php');
|
||||
$key=$_POST['key'];
|
||||
$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));
|
||||
|
||||
if ($key=='sm') {
|
||||
$q=pg_query("SELECT COUNT(*) FROM surat s LEFT OUTER JOIN arsip a ON (s.id=a.surat_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'");
|
||||
while($r=pg_fetch_array($q)) {$j=$r[0];}
|
||||
} else
|
||||
if ($key=='sk') {
|
||||
$q=pg_query("SELECT COUNT(no_urut) FROM surat WHERE tgl_surat_keluar::DATE BETWEEN '$tt1-$bb1-$hh1' AND '$tt2-$bb2-$hh2'");
|
||||
while($r=pg_fetch_array($q)) {$j=$r[0];}
|
||||
} else
|
||||
if ($key=='ar') {
|
||||
$q=pg_query("SELECT COUNT(*)
|
||||
FROM surat s
|
||||
LEFT OUTER JOIN kirim k ON (s.id=k.surat_id)
|
||||
INNER JOIN arsip a ON (a.surat_id=s.id)
|
||||
WHERE s.jenis_disposisi_id='1'
|
||||
AND a.tgl_arsip::DATE BETWEEN '$tt1-$bb1-$hh1' AND '$tt2-$bb2-$hh2'
|
||||
GROUP BY a.tgl_arsip
|
||||
ORDER BY a.tgl_arsip DESC");
|
||||
while($r=pg_fetch_array($q)) {$j=$r[0];}
|
||||
}
|
||||
|
||||
if ($j==0) {echo "0";} else {echo "1";}
|
||||
?>
|
||||
Reference in New Issue
Block a user