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.

155 lines
7.2 KiB

<?php
namespace App\Models;
use CodeIgniter\Model;
class Mpemby extends Model
{
function getPenn($param)
{
$tahun = $param['tahun'];
$bln = $param['bln'];
$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 = $param['bln'];
$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;
}
1 year ago
function getPiePen($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
$bln = $param['bln'];
$query = $this->db->query("SELECT NM_PAJAK,TOTALN PENERIMAAN, TOTALP PENL,
(SELECT ROUND(SUM(TOTAL)) FROM PERJENIS_MV WHERE THNBYR = '" . $tahun . "' AND BLNBYR <= '" . $bln . "') PENERIMAAN_TOT,
(SELECT ROUND(SUM(TOTAL)) FROM PERJENIS_MV WHERE THNBYR = '" . $tahunl . "' AND BLNBYR <= '" . $bln . "') PENERIMAAN_TOTL
1 year ago
FROM (
SELECT NM_PAJAK,ROUND(SUM(CASE WHEN THNBYR= '" . $tahun . "' AND BLNBYR <= '" . $bln . "' THEN TOTAL ELSE 0 END)) TOTALN,
ROUND(SUM(CASE WHEN THNBYR= '" . $tahunl . "' AND BLNBYR <= '" . $bln . "' THEN TOTAL ELSE 0 END)) TOTALP
FROM PERJENIS_MV
GROUP BY NM_PAJAK ORDER BY TOTALN DESC) WHERE ROWNUM < = 7
1 year ago
");
return $query;
}
function paycompNas($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
$bln = $param['bln'];
$query = $this->db->query("SELECT A.JMLBULAN, A.JUMLAHWP,B.JUMLAHWP JUMLAHWPP FROM
(SELECT TO_NUMBER(BLNBYR) JMLBULAN,JUMLAHWP FROM PAYCOMPNAS
WHERE THNBYR = '" . $tahun . "') A,
(SELECT TO_NUMBER(BLNBYR) JMLBULAN,JUMLAHWP FROM PAYCOMPNAS
WHERE THNBYR = '" . $tahunl . "') B
WHERE A.JMLBULAN =B.JMLBULAN
ORDER BY A.JMLBULAN ASC");
return $query;
}
function sofNas($param)
{
$tahun = $param['tahun'];
$bln = $param['bln'];
$query = $this->db->query("SELECT NO,LAPISAN,WPBYR,TOTAL,
1 year ago
(SELECT SUM(ROUND(WPBYR/2)) FROM SOFNAS WHERE THNBYR = '" . $tahun . "' AND BLNBYR < = '" . $bln . "') TOTWPBYR,
(SELECT SUM(TOTAL) FROM SOFNAS WHERE THNBYR = '" . $tahun . "' AND BLNBYR < = '" . $bln . "') TOTALL
1 year ago
FROM (
1 year ago
SELECT NO,LAPISAN,SUM(ROUND(WPBYR/2)) WPBYR,SUM(ROUND(TOTAL)) TOTAL FROM SOFNAS WHERE THNBYR = '" . $tahun . "' AND BLNBYR < = '" . $bln . "'
GROUP BY NO,LAPISAN) ORDER BY NO ASC ");
return $query;
}
function getBln()
{
$builder = $this->db->table('BULAN');
$builder->select('*');
return $builder->get()->getResult();
}
function getWpsk()
{
1 year ago
$query = $this->db->query("SELECT SUM(CASE WHEN FLAG_WPS_WPK = 'WPK' THEN JUMLAHWP ELSE 0 END) WPK,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPS' THEN JUMLAHWP ELSE 0 END) WPS
FROM WPSK_MV");
return $query;
}
function getBreakdownPen($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
$bln = $param['bln'];
1 year ago
$query = $this->db->query("SELECT
SUM(CASE WHEN FLAG_WPS_WPK = 'WPS' AND THNBYR = '" . $tahun . "' AND BLNBYR <= '" . $bln . "' THEN WPBYR ELSE 0 END) WPSWP,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPS' AND THNBYR = '" . $tahunl . "' AND BLNBYR <= '" . $bln . "' THEN WPBYR ELSE 0 END) WPSWPL,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPS' AND THNBYR = '" . $tahun . "' AND BLNBYR <= '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) WPSBYRN,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPS' AND THNBYR = '" . $tahunl . "' AND BLNBYR <= '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) WPSBYRP,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPK' AND THNBYR = '" . $tahun . "' AND BLNBYR <= '" . $bln . "' THEN WPBYR ELSE 0 END) WPKWP,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPK' AND THNBYR = '" . $tahunl . "' AND BLNBYR <= '" . $bln . "' THEN WPBYR ELSE 0 END) WPKWPL,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPK' AND THNBYR = '" . $tahun . "' AND BLNBYR <= '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) WPKBYRN,
SUM(CASE WHEN FLAG_WPS_WPK = 'WPK' AND THNBYR = '" . $tahunl . "' AND BLNBYR <= '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) WPKBYRP
FROM BREAKDOWN_PEN");
return $query;
}
function getWPterdaftar($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
1 year ago
$query = $this->db->query("SELECT
1 year ago
SUM(CASE WHEN TAHUN <= '" . $tahun . "' THEN JUMLAHWP ELSE 0 END) WPADMNOW,
SUM(CASE WHEN TAHUN <= '" . $tahunl . "' THEN JUMLAHWP ELSE 0 END) WPADMPAST
FROM WP_TERDAFTAR");
return $query;
1 year ago
}
function laporTahunan($param)
{
$tahun = $param['tahun'];
$tahunl = $tahun - 1;
$query = $this->db->query("SELECT SUM(CASE WHEN TAHUN = '" . $tahun . "' THEN JMLLAPOR ELSE 0 END) LAPORNOW,
SUM(CASE WHEN TAHUN = '" . $tahunl . "' THEN JMLLAPOR ELSE 0 END) LAPORPAST
FROM DASH_SPTTAHUNAN");
return $query;
}
}