You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
1.8 KiB

<?php
namespace App\Models;
use CodeIgniter\Model;
class Mpemby extends Model
{
function getPenn($param)
{
$tahun = $param['tahun'];
$bln = date('m');
$query = $this->db->query("SELECT NM_KANWIL, TARGET, SUM(PENERIMAAN_BERJALAN) PENB, SUM(PENERIMAAN_LALU) PENL,
(SUM(PENERIMAAN_BERJALAN)/TARGET)*100 PENCAPAIAN, ((SUM(PENERIMAAN_BERJALAN)-SUM(PENERIMAAN_LALU))/SUM(PENERIMAAN_LALU))*100 PERTUMBUHAN
FROM KINERJA_PENERIMAAN
WHERE THN_KINERJA = '" . $tahun . "' AND TO_NUMBER(BLN_KINERJA)
BETWEEN TO_NUMBER('01') AND TO_NUMBER('" . $bln . "') GROUP BY NM_KANWIL, TARGET");
return $query;
}
function getUpd()
{
$query = $this->db->query("SELECT LAST_DDL_TIME UPD
FROM DBA_OBJECTS
WHERE owner = 'GENAPP'
AND object_name = 'KINERJA_PENERIMAAN'");
return $query;
}
function getKat($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
$bln = date('m');
$query = $this->db->query("SELECT CASE WHEN KD_KATEGORI IS NULL THEN '-' ELSE KD_KATEGORI END KODE,
CASE WHEN KD_KATEGORI IS NULL THEN 'UNKNOWN' ELSE NM_KATEGORI END NMKAT,
SUM(CASE WHEN THNBYR = '" . $tahun . "' AND BLNBYR = '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) KPENN,
SUM(CASE WHEN THNBYR = '" . $tahunl . "' AND BLNBYR = '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) KPENP
FROM PERKATEGORI_MV
GROUP BY KD_KATEGORI,NM_KATEGORI
ORDER BY KD_KATEGORI ASC
");
return $query;
}
}