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.
210 lines
12 KiB
210 lines
12 KiB
<?php |
|
|
|
namespace App\Models\Bendahara; |
|
|
|
use CodeIgniter\Model; |
|
|
|
class MApbn extends Model { |
|
|
|
function get_data_apbn($param) { |
|
if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; |
|
else $cari_kanwil = ""; |
|
|
|
if($param['cari_kpp'] <> "") $cari_kpp = " AND KD_KPP = '".$param['cari_kpp']."' "; |
|
else $cari_kpp = ""; |
|
|
|
if($param['cari_seksi'] <> "") $cari_seksi = " AND KD_SEKSI = '".$param['cari_seksi']."' "; |
|
else $cari_seksi = ""; |
|
|
|
if($param['cari_ar'] <> "") $cari_ar = " AND NIP_AR = '".$param['cari_ar']."' "; |
|
else $cari_ar = ""; |
|
|
|
if($param['cari_kabkot'] <> "") $cari_kabkot = " AND KABKOTA = '".$param['cari_kabkot']."' "; |
|
else $cari_kabkot = ""; |
|
|
|
$limit_bottom = ($param['cari_page'] * $param['cari_limit']) - $param['cari_limit']; |
|
|
|
$query = "SELECT |
|
TAHUN, KD_KANWIL, NM_KANWIL, |
|
KD_KPP, NM_KPP, KABKOTA, KD_SEKSI, NM_SEKSI, |
|
NIP_AR, NM_AR, NPWP, KODE_SATKER, NAMA_SATKER, |
|
PAGU_PEGAWAI, PAGU_BARANG, PAGU_MODAL, PAGU_SOSIAL, PAGU_LAINNYA, PAGU_TOTAL, |
|
ESTI_PPH21_PAGU, ESTI_PPH22_PAGU, ESTI_PPH23_PAGU, ESTI_PPH42_PAGU, ESTI_PPN_PAGU, ESTI_TOTAL_PAGU, |
|
|
|
SUM(REAL_PEGAWAI) REAL_PEGAWAI, |
|
SUM(REAL_BARANG) REAL_BARANG, |
|
SUM(REAL_MODAL) REAL_MODAL, |
|
SUM(REAL_SOSIAL) REAL_SOSIAL, |
|
SUM(REAL_LAINNYA) REAL_LAINNYA, |
|
SUM(REAL_TOTAL) REAL_TOTAL, |
|
SUM(ESTI_PPH21_REAL) ESTI_PPH21_REAL, |
|
SUM(ESTI_PPH22_REAL) ESTI_PPH22_REAL, |
|
SUM(ESTI_PPH23_REAL) ESTI_PPH23_REAL, |
|
SUM(ESTI_PPH42_REAL) ESTI_PPH42_REAL, |
|
SUM(ESTI_PPN_REAL) ESTI_PPN_REAL, |
|
SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, |
|
SUM(BAYAR_PPH21) BAYAR_PPH21, |
|
SUM(BAYAR_PPH22) BAYAR_PPH22, |
|
SUM(BAYAR_PPH23) BAYAR_PPH23, |
|
SUM(BAYAR_PPH42) BAYAR_PPH42, |
|
SUM(BAYAR_PPN) BAYAR_PPN, |
|
SUM(BAYAR_LAINNYA) BAYAR_LAINNYA, |
|
SUM(BAYAR_TOTAL) BAYAR_TOTAL, |
|
(NVL(ESTI_PPH21_PAGU, 0) - NVL(SUM(BAYAR_PPH21), 0)) TAXGAP_PPH21_PAGU, |
|
(NVL(ESTI_PPH22_PAGU, 0) - NVL(SUM(BAYAR_PPH22), 0)) TAXGAP_PPH22_PAGU, |
|
(NVL(ESTI_PPH23_PAGU, 0) - NVL(SUM(BAYAR_PPH23), 0)) TAXGAP_PPH23_PAGU, |
|
(NVL(ESTI_PPH42_PAGU, 0) - NVL(SUM(BAYAR_PPH42), 0)) TAXGAP_PPH42_PAGU, |
|
(NVL(ESTI_PPN_PAGU, 0) - NVL(SUM(BAYAR_PPN), 0)) TAXGAP_PPN_PAGU, |
|
(NVL(ESTI_TOTAL_PAGU, 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_PAGU, |
|
(NVL(SUM(ESTI_PPH21_REAL), 0) - NVL(SUM(BAYAR_PPH21), 0)) TAXGAP_PPH21_REAL, |
|
(NVL(SUM(ESTI_PPH22_REAL), 0) - NVL(SUM(BAYAR_PPH22), 0)) TAXGAP_PPH22_REAL, |
|
(NVL(SUM(ESTI_PPH23_REAL), 0) - NVL(SUM(BAYAR_PPH23), 0)) TAXGAP_PPH23_REAL, |
|
(NVL(SUM(ESTI_PPH42_REAL), 0) - NVL(SUM(BAYAR_PPH42), 0)) TAXGAP_PPH42_REAL, |
|
(NVL(SUM(ESTI_PPN_REAL), 0) - NVL(SUM(BAYAR_PPN), 0)) TAXGAP_PPN_REAL, |
|
(NVL(SUM(ESTI_TOTAL_REAL), 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_REAL, |
|
ROUND(((NVL(SUM(BAYAR_TOTAL), 0) / NULLIF(NVL(PAGU_TOTAL, 0), 0))*100), 2) TAX_COLLECTION |
|
FROM APBN_REKAP |
|
WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp $cari_seksi $cari_ar $cari_kabkot |
|
GROUP BY TAHUN, KD_KANWIL, NM_KANWIL, |
|
KD_KPP, NM_KPP, KABKOTA, KD_SEKSI, NM_SEKSI, |
|
NIP_AR, NM_AR, NPWP, KODE_SATKER, NAMA_SATKER, |
|
PAGU_PEGAWAI, PAGU_BARANG, PAGU_MODAL, PAGU_SOSIAL, PAGU_LAINNYA, PAGU_TOTAL, |
|
ESTI_PPH21_PAGU, ESTI_PPH22_PAGU, ESTI_PPH23_PAGU,ESTI_PPH42_PAGU, ESTI_PPN_PAGU, ESTI_TOTAL_PAGU |
|
ORDER BY KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER |
|
OFFSET $limit_bottom ROWS FETCH NEXT ".$param['cari_limit']." ROWS ONLY"; |
|
//echo $query; |
|
//exit; |
|
|
|
return $this->db->query($query)->getResult(); |
|
} |
|
|
|
function get_data_apbn_total($param) { |
|
if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; |
|
else $cari_kanwil = ""; |
|
|
|
if($param['cari_kpp'] <> "") $cari_kpp = " AND KD_KPP = '".$param['cari_kpp']."' "; |
|
else $cari_kpp = ""; |
|
|
|
if($param['cari_seksi'] <> "") $cari_seksi = " AND KD_SEKSI = '".$param['cari_seksi']."' "; |
|
else $cari_seksi = ""; |
|
|
|
if($param['cari_ar'] <> "") $cari_ar = " AND NIP_AR = '".$param['cari_ar']."' "; |
|
else $cari_ar = ""; |
|
|
|
if($param['cari_kabkot'] <> "") $cari_kabkot = " AND KABKOTA = '".$param['cari_kabkot']."' "; |
|
else $cari_kabkot = ""; |
|
|
|
$query = "SELECT |
|
SUM(PAGU_PEGAWAI) PAGU_PEGAWAI, |
|
SUM(PAGU_BARANG) PAGU_BARANG, |
|
SUM(PAGU_MODAL) PAGU_MODAL, |
|
SUM(PAGU_SOSIAL) PAGU_SOSIAL, |
|
SUM(PAGU_LAINNYA) PAGU_LAINNYA, |
|
SUM(PAGU_TOTAL) PAGU_TOTAL, |
|
SUM(ESTI_PPH21_PAGU) ESTI_PPH21_PAGU, |
|
SUM(ESTI_PPH22_PAGU) ESTI_PPH22_PAGU, |
|
SUM(ESTI_PPH23_PAGU) ESTI_PPH23_PAGU, |
|
SUM(ESTI_PPH42_PAGU) ESTI_PPH42_PAGU, |
|
SUM(ESTI_PPN_PAGU) ESTI_PPN_PAGU, |
|
SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, |
|
SUM(REAL_PEGAWAI) REAL_PEGAWAI, |
|
SUM(REAL_BARANG) REAL_BARANG, |
|
SUM(REAL_MODAL) REAL_MODAL, |
|
SUM(REAL_SOSIAL) REAL_SOSIAL, |
|
SUM(REAL_LAINNYA) REAL_LAINNYA, |
|
SUM(REAL_TOTAL) REAL_TOTAL, |
|
SUM(ESTI_PPH21_REAL) ESTI_PPH21_REAL, |
|
SUM(ESTI_PPH22_REAL) ESTI_PPH22_REAL, |
|
SUM(ESTI_PPH23_REAL) ESTI_PPH23_REAL, |
|
SUM(ESTI_PPH42_REAL) ESTI_PPH42_REAL, |
|
SUM(ESTI_PPN_REAL) ESTI_PPN_REAL, |
|
SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, |
|
SUM(BAYAR_PPH21) BAYAR_PPH21, |
|
SUM(BAYAR_PPH22) BAYAR_PPH22, |
|
SUM(BAYAR_PPH23) BAYAR_PPH23, |
|
SUM(BAYAR_PPH42) BAYAR_PPH42, |
|
SUM(BAYAR_PPN) BAYAR_PPN, |
|
SUM(BAYAR_LAINNYA) BAYAR_LAINNYA, |
|
SUM(BAYAR_TOTAL) BAYAR_TOTAL, |
|
(NVL(SUM(ESTI_PPH21_PAGU), 0) - NVL(SUM(BAYAR_PPH21), 0)) TAXGAP_PPH21_PAGU, |
|
(NVL(SUM(ESTI_PPH22_PAGU), 0) - NVL(SUM(BAYAR_PPH22), 0)) TAXGAP_PPH22_PAGU, |
|
(NVL(SUM(ESTI_PPH23_PAGU), 0) - NVL(SUM(BAYAR_PPH23), 0)) TAXGAP_PPH23_PAGU, |
|
(NVL(SUM(ESTI_PPH42_PAGU), 0) - NVL(SUM(BAYAR_PPH42), 0)) TAXGAP_PPH42_PAGU, |
|
(NVL(SUM(ESTI_PPN_PAGU), 0) - NVL(SUM(BAYAR_PPN), 0)) TAXGAP_PPN_PAGU, |
|
(NVL(SUM(ESTI_TOTAL_PAGU), 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_PAGU, |
|
(NVL(SUM(ESTI_PPH21_REAL), 0) - NVL(SUM(BAYAR_PPH21), 0)) TAXGAP_PPH21_REAL, |
|
(NVL(SUM(ESTI_PPH22_REAL), 0) - NVL(SUM(BAYAR_PPH22), 0)) TAXGAP_PPH22_REAL, |
|
(NVL(SUM(ESTI_PPH23_REAL), 0) - NVL(SUM(BAYAR_PPH23), 0)) TAXGAP_PPH23_REAL, |
|
(NVL(SUM(ESTI_PPH42_REAL), 0) - NVL(SUM(BAYAR_PPH42), 0)) TAXGAP_PPH42_REAL, |
|
(NVL(SUM(ESTI_PPN_REAL), 0) - NVL(SUM(BAYAR_PPN), 0)) TAXGAP_PPN_REAL, |
|
(NVL(SUM(ESTI_TOTAL_REAL), 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_REAL, |
|
ROUND(((NVL(SUM(BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(PAGU_TOTAL), 0), 0))*100), 2) TAX_COLLECTION, |
|
COUNT(*) KUANTITAS |
|
FROM |
|
(SELECT |
|
TAHUN, KD_KANWIL, NM_KANWIL, |
|
KD_KPP, NM_KPP, KABKOTA, KD_SEKSI, NM_SEKSI, |
|
NIP_AR, NM_AR, NPWP, NAMA_SATKER, |
|
PAGU_PEGAWAI, PAGU_BARANG, PAGU_MODAL, PAGU_SOSIAL, PAGU_LAINNYA, PAGU_TOTAL, |
|
ESTI_PPH21_PAGU, ESTI_PPH22_PAGU, ESTI_PPH23_PAGU, ESTI_PPH42_PAGU, ESTI_PPN_PAGU, ESTI_TOTAL_PAGU, |
|
|
|
SUM(REAL_PEGAWAI) REAL_PEGAWAI, |
|
SUM(REAL_BARANG) REAL_BARANG, |
|
SUM(REAL_MODAL) REAL_MODAL, |
|
SUM(REAL_SOSIAL) REAL_SOSIAL, |
|
SUM(REAL_LAINNYA) REAL_LAINNYA, |
|
SUM(REAL_TOTAL) REAL_TOTAL, |
|
SUM(ESTI_PPH21_REAL) ESTI_PPH21_REAL, |
|
SUM(ESTI_PPH22_REAL) ESTI_PPH22_REAL, |
|
SUM(ESTI_PPH23_REAL) ESTI_PPH23_REAL, |
|
SUM(ESTI_PPH42_REAL) ESTI_PPH42_REAL, |
|
SUM(ESTI_PPN_REAL) ESTI_PPN_REAL, |
|
SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, |
|
SUM(BAYAR_PPH21) BAYAR_PPH21, |
|
SUM(BAYAR_PPH22) BAYAR_PPH22, |
|
SUM(BAYAR_PPH23) BAYAR_PPH23, |
|
SUM(BAYAR_PPH42) BAYAR_PPH42, |
|
SUM(BAYAR_PPN) BAYAR_PPN, |
|
SUM(BAYAR_LAINNYA) BAYAR_LAINNYA, |
|
SUM(BAYAR_TOTAL) BAYAR_TOTAL |
|
FROM APBN_REKAP |
|
WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp $cari_seksi $cari_ar $cari_kabkot |
|
GROUP BY TAHUN, KD_KANWIL, NM_KANWIL, |
|
KD_KPP, NM_KPP, KABKOTA, KD_SEKSI, NM_SEKSI, |
|
NIP_AR, NM_AR, NPWP, NAMA_SATKER, |
|
PAGU_PEGAWAI, PAGU_BARANG, PAGU_MODAL, PAGU_SOSIAL, PAGU_LAINNYA, PAGU_TOTAL, |
|
ESTI_PPH21_PAGU, ESTI_PPH22_PAGU, ESTI_PPH23_PAGU, ESTI_PPH42_PAGU, ESTI_PPN_PAGU, ESTI_TOTAL_PAGU |
|
ORDER BY KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_SATKER) A"; |
|
//echo $query; |
|
//exit; |
|
|
|
return $this->db->query($query)->getRow(); |
|
} |
|
|
|
function get_data_apbn_grafik($param) { |
|
if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; |
|
else $cari_kanwil = ""; |
|
|
|
if($param['cari_kpp'] <> "") $cari_kpp = " AND KD_KPP = '".$param['cari_kpp']."' "; |
|
else $cari_kpp = ""; |
|
|
|
if($param['cari_seksi'] <> "") $cari_seksi = " AND KD_SEKSI = '".$param['cari_seksi']."' "; |
|
else $cari_seksi = ""; |
|
|
|
if($param['cari_ar'] <> "") $cari_ar = " AND NIP_AR = '".$param['cari_ar']."' "; |
|
else $cari_ar = ""; |
|
|
|
if($param['cari_kabkot'] <> "") $cari_kabkot = " AND KABKOTA = '".$param['cari_kabkot']."' "; |
|
else $cari_kabkot = ""; |
|
|
|
$query = "SELECT KD_BULAN, NM_BULAN, |
|
SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL |
|
FROM APBN_REKAP |
|
WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp $cari_seksi $cari_ar $cari_kabkot |
|
GROUP BY KD_BULAN, NM_BULAN |
|
ORDER BY KD_BULAN"; |
|
|
|
return $this->db->query($query)->getResult(); |
|
} |
|
|
|
}
|
|
|