|
|
|
<?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 WPBAYAR ELSE 0 END)WPBYRN,
|
|
|
|
SUM(CASE WHEN THNBYR = '" . $tahunl . "' AND BLNBYR = '" . $bln . "' THEN WPBAYAR ELSE 0 END)WPBYRP,
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getPiePen($param)
|
|
|
|
{
|
|
|
|
$tahun = $param['tahun'];
|
|
|
|
$tahunl = $tahun - 1;
|
|
|
|
$bln = date('m');
|
|
|
|
$query = $this->db->query("SELECT NM_PAJAK,TOTALN PENERIMAAN,
|
|
|
|
(SELECT ROUND(SUM(TOTAL)) FROM PERJENIS_MV) PENERIMAAN_TOT
|
|
|
|
FROM (
|
|
|
|
SELECT NM_PAJAK,ROUND(SUM(CASE WHEN THNBYR= '" . $tahun . "' THEN TOTAL ELSE 0 END)) TOTALN,
|
|
|
|
ROUND(SUM(CASE WHEN THNBYR= '" . $tahunl . "' THEN TOTAL ELSE 0 END)) TOTALP
|
|
|
|
FROM PERJENIS_MV
|
|
|
|
GROUP BY NM_PAJAK ORDER BY TOTALN DESC)
|
|
|
|
");
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
}
|