= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBN ON D.KD_KANWIL = APBN.KD_KANWIL LEFT JOIN (SELECT KD_KANWIL, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBD ON D.KD_KANWIL = APBD.KD_KANWIL LEFT JOIN (SELECT KD_KANWIL, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL ORDER BY D.KD_KANWIL OFFSET $limit_bottom ROWS FETCH NEXT ".$param['cari_limit']." ROWS ONLY"; //echo $query; //exit; return $this->db->query($query)->getResult(); } function get_data_beranda_index_total($param) { $query = "SELECT SUM(APBN_PAGU_TOTAL) APBN_PAGU_TOTAL, SUM(APBN_REAL_TOTAL) APBN_REAL_TOTAL, SUM(APBN_ESTI_TOTAL_PAGU) APBN_ESTI_TOTAL_PAGU, SUM(APBN_ESTI_TOTAL_REAL) APBN_ESTI_TOTAL_REAL, SUM(APBN_BAYAR_TOTAL) APBN_BAYAR_TOTAL, (NVL(SUM(APBN_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_PAGU, (NVL(SUM(APBN_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_REAL, ROUND(((NVL(SUM(APBN_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBN_PAGU_TOTAL), 0), 0))*100), 2) APBN_TAX_COLLECTION, SUM(APBD_PAGU_TOTAL) APBD_PAGU_TOTAL, SUM(APBD_REAL_TOTAL) APBD_REAL_TOTAL, SUM(APBD_ESTI_TOTAL_PAGU) APBD_ESTI_TOTAL_PAGU, SUM(APBD_ESTI_TOTAL_REAL) APBD_ESTI_TOTAL_REAL, SUM(APBD_BAYAR_TOTAL) APBD_BAYAR_TOTAL, (NVL(SUM(APBD_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_PAGU, (NVL(SUM(APBD_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_REAL, ROUND(((NVL(SUM(APBD_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBD_PAGU_TOTAL), 0), 0))*100), 2) APBD_TAX_COLLECTION, SUM(APBDES_PAGU_TOTAL) APBDES_PAGU_TOTAL, SUM(APBDES_REAL_TOTAL) APBDES_REAL_TOTAL, SUM(APBDES_ESTI_TOTAL_PAGU) APBDES_ESTI_TOTAL_PAGU, SUM(APBDES_ESTI_TOTAL_REAL) APBDES_ESTI_TOTAL_REAL, SUM(APBDES_BAYAR_TOTAL) APBDES_BAYAR_TOTAL, (NVL(SUM(APBDES_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_PAGU, (NVL(SUM(APBDES_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_REAL, ROUND(((NVL(SUM(APBDES_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBDES_PAGU_TOTAL), 0), 0))*100), 2) APBDES_TAX_COLLECTION, SUM(ALL_PAGU_TOTAL) ALL_PAGU_TOTAL, SUM(ALL_REAL_TOTAL) ALL_REAL_TOTAL, SUM(ALL_ESTI_TOTAL_PAGU) ALL_ESTI_TOTAL_PAGU, SUM(ALL_ESTI_TOTAL_REAL) ALL_ESTI_TOTAL_REAL, SUM(ALL_BAYAR_TOTAL) ALL_BAYAR_TOTAL, (NVL(SUM(ALL_ESTI_TOTAL_PAGU), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_PAGU, (NVL(SUM(ALL_ESTI_TOTAL_REAL), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_REAL, ROUND(((NVL(SUM(ALL_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(ALL_PAGU_TOTAL), 0), 0))*100), 2) ALL_TAX_COLLECTION, COUNT(*) KUANTITAS FROM (SELECT D.*, APBN.PAGU_TOTAL APBN_PAGU_TOTAL, APBN.REAL_TOTAL APBN_REAL_TOTAL, APBN.ESTI_TOTAL_PAGU APBN_ESTI_TOTAL_PAGU, APBN.ESTI_TOTAL_REAL APBN_ESTI_TOTAL_REAL, APBN.BAYAR_TOTAL APBN_BAYAR_TOTAL, APBD.PAGU_TOTAL APBD_PAGU_TOTAL, APBD.REAL_TOTAL APBD_REAL_TOTAL, APBD.ESTI_TOTAL_PAGU APBD_ESTI_TOTAL_PAGU, APBD.ESTI_TOTAL_REAL APBD_ESTI_TOTAL_REAL, APBD.BAYAR_TOTAL APBD_BAYAR_TOTAL, APBDES.PAGU_TOTAL APBDES_PAGU_TOTAL, APBDES.REAL_TOTAL APBDES_REAL_TOTAL, APBDES.ESTI_TOTAL_PAGU APBDES_ESTI_TOTAL_PAGU, APBDES.ESTI_TOTAL_REAL APBDES_ESTI_TOTAL_REAL, APBDES.BAYAR_TOTAL APBDES_BAYAR_TOTAL, NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0) ALL_PAGU_TOTAL, NVL(APBN.REAL_TOTAL, 0) + NVL(APBD.REAL_TOTAL, 0) + NVL(APBDES.REAL_TOTAL, 0) ALL_REAL_TOTAL, NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0) ALL_ESTI_TOTAL_PAGU, NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0) ALL_ESTI_TOTAL_REAL, NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0) ALL_BAYAR_TOTAL FROM (SELECT KD_KANWIL, NM_KANWIL FROM REF_MFWP_WILAYAH GROUP BY KD_KANWIL, NM_KANWIL) D LEFT JOIN (SELECT KD_KANWIL, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, 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']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBN ON D.KD_KANWIL = APBN.KD_KANWIL LEFT JOIN (SELECT KD_KANWIL, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBD ON D.KD_KANWIL = APBD.KD_KANWIL LEFT JOIN (SELECT KD_KANWIL, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL)"; //echo $query; //exit; return $this->db->query($query)->getRow(); } function get_data_beranda_index_grafik($param) { if($param['cari_sumber_dana'] == "APBN") { $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']."' GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBD") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBDes") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT KD_BULAN, NM_BULAN, REAL_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']."' UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."') GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } return $this->db->query($query)->getResult(); } function get_data_beranda_kanwil($param) { if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; else $cari_kanwil = ""; $limit_bottom = ($param['cari_page'] * $param['cari_limit']) - $param['cari_limit']; $query = "SELECT D.*, APBN.PAGU_TOTAL APBN_PAGU_TOTAL, APBN.REAL_TOTAL APBN_REAL_TOTAL, APBN.ESTI_TOTAL_PAGU APBN_ESTI_TOTAL_PAGU, APBN.ESTI_TOTAL_REAL APBN_ESTI_TOTAL_REAL, APBN.BAYAR_TOTAL APBN_BAYAR_TOTAL, (NVL(APBN.ESTI_TOTAL_PAGU, 0) - NVL(APBN.BAYAR_TOTAL, 0)) APBN_TAXGAP_PAGU, (NVL(APBN.ESTI_TOTAL_REAL, 0) - NVL(APBN.BAYAR_TOTAL, 0)) APBN_TAXGAP_REAL, ROUND(((NVL(APBN.BAYAR_TOTAL, 0) / NULLIF(NVL(APBN.PAGU_TOTAL, 0), 0))*100), 2) APBN_TAX_COLLECTION, APBD.PAGU_TOTAL APBD_PAGU_TOTAL, APBD.REAL_TOTAL APBD_REAL_TOTAL, APBD.ESTI_TOTAL_PAGU APBD_ESTI_TOTAL_PAGU, APBD.ESTI_TOTAL_REAL APBD_ESTI_TOTAL_REAL, APBD.BAYAR_TOTAL APBD_BAYAR_TOTAL, (NVL(APBD.ESTI_TOTAL_PAGU, 0) - NVL(APBD.BAYAR_TOTAL, 0)) APBD_TAXGAP_PAGU, (NVL(APBD.ESTI_TOTAL_REAL, 0) - NVL(APBD.BAYAR_TOTAL, 0)) APBD_TAXGAP_REAL, ROUND(((NVL(APBD.BAYAR_TOTAL, 0) / NULLIF(NVL(APBD.PAGU_TOTAL, 0), 0))*100), 2) APBD_TAX_COLLECTION, APBDES.PAGU_TOTAL APBDES_PAGU_TOTAL, APBDES.REAL_TOTAL APBDES_REAL_TOTAL, APBDES.ESTI_TOTAL_PAGU APBDES_ESTI_TOTAL_PAGU, APBDES.ESTI_TOTAL_REAL APBDES_ESTI_TOTAL_REAL, APBDES.BAYAR_TOTAL APBDES_BAYAR_TOTAL, (NVL(APBDES.ESTI_TOTAL_PAGU, 0) - NVL(APBDES.BAYAR_TOTAL, 0)) APBDES_TAXGAP_PAGU, (NVL(APBDES.ESTI_TOTAL_REAL, 0) - NVL(APBDES.BAYAR_TOTAL, 0)) APBDES_TAXGAP_REAL, ROUND(((NVL(APBDES.BAYAR_TOTAL, 0) / NULLIF(NVL(APBDES.PAGU_TOTAL, 0), 0))*100), 2) APBDES_TAX_COLLECTION, (NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0)) ALL_PAGU_TOTAL, (NVL(APBN.REAL_TOTAL, 0) + NVL(APBD.REAL_TOTAL, 0) + NVL(APBDES.REAL_TOTAL, 0)) ALL_REAL_TOTAL, (NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0)) ALL_ESTI_TOTAL_PAGU, (NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0)) ALL_ESTI_TOTAL_REAL, (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0)) ALL_BAYAR_TOTAL, ((NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0)) - (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0))) ALL_TAXGAP_PAGU, ((NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0)) - (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0))) ALL_TAXGAP_REAL, ROUND((((NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0)) / NULLIF((NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0)), 0))*100), 2) ALL_TAX_COLLECTION FROM (SELECT KD_KANWIL, NM_KANWIL, KD_KPP, NM_KPP FROM REF_MFWP_WILAYAH WHERE 1 = 1 $cari_kanwil GROUP BY KD_KANWIL, NM_KANWIL, KD_KPP, NM_KPP) D LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, 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 GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBN ON D.KD_KANWIL = APBN.KD_KANWIL AND D.KD_KPP = APBN.KD_KPP LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBD ON D.KD_KANWIL = APBD.KD_KANWIL AND D.KD_KPP = APBD.KD_KPP LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL AND D.KD_KPP = APBDES.KD_KPP ORDER BY D.KD_KANWIL, D.KD_KPP OFFSET $limit_bottom ROWS FETCH NEXT ".$param['cari_limit']." ROWS ONLY"; //echo $query; //exit; return $this->db->query($query)->getResult(); } function get_data_beranda_kanwil_total($param) { if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; else $cari_kanwil = ""; $query = "SELECT SUM(APBN_PAGU_TOTAL) APBN_PAGU_TOTAL, SUM(APBN_REAL_TOTAL) APBN_REAL_TOTAL, SUM(APBN_ESTI_TOTAL_PAGU) APBN_ESTI_TOTAL_PAGU, SUM(APBN_ESTI_TOTAL_REAL) APBN_ESTI_TOTAL_REAL, SUM(APBN_BAYAR_TOTAL) APBN_BAYAR_TOTAL, (NVL(SUM(APBN_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_PAGU, (NVL(SUM(APBN_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_REAL, ROUND(((NVL(SUM(APBN_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBN_PAGU_TOTAL), 0), 0))*100), 2) APBN_TAX_COLLECTION, SUM(APBD_PAGU_TOTAL) APBD_PAGU_TOTAL, SUM(APBD_REAL_TOTAL) APBD_REAL_TOTAL, SUM(APBD_ESTI_TOTAL_PAGU) APBD_ESTI_TOTAL_PAGU, SUM(APBD_ESTI_TOTAL_REAL) APBD_ESTI_TOTAL_REAL, SUM(APBD_BAYAR_TOTAL) APBD_BAYAR_TOTAL, (NVL(SUM(APBD_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_PAGU, (NVL(SUM(APBD_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_REAL, ROUND(((NVL(SUM(APBD_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBD_PAGU_TOTAL), 0), 0))*100), 2) APBD_TAX_COLLECTION, SUM(APBDES_PAGU_TOTAL) APBDES_PAGU_TOTAL, SUM(APBDES_REAL_TOTAL) APBDES_REAL_TOTAL, SUM(APBDES_ESTI_TOTAL_PAGU) APBDES_ESTI_TOTAL_PAGU, SUM(APBDES_ESTI_TOTAL_REAL) APBDES_ESTI_TOTAL_REAL, SUM(APBDES_BAYAR_TOTAL) APBDES_BAYAR_TOTAL, (NVL(SUM(APBDES_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_PAGU, (NVL(SUM(APBDES_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_REAL, ROUND(((NVL(SUM(APBDES_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBDES_PAGU_TOTAL), 0), 0))*100), 2) APBDES_TAX_COLLECTION, SUM(ALL_PAGU_TOTAL) ALL_PAGU_TOTAL, SUM(ALL_REAL_TOTAL) ALL_REAL_TOTAL, SUM(ALL_ESTI_TOTAL_PAGU) ALL_ESTI_TOTAL_PAGU, SUM(ALL_ESTI_TOTAL_REAL) ALL_ESTI_TOTAL_REAL, SUM(ALL_BAYAR_TOTAL) ALL_BAYAR_TOTAL, (NVL(SUM(ALL_ESTI_TOTAL_PAGU), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_PAGU, (NVL(SUM(ALL_ESTI_TOTAL_REAL), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_REAL, ROUND(((NVL(SUM(ALL_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(ALL_PAGU_TOTAL), 0), 0))*100), 2) ALL_TAX_COLLECTION, COUNT(*) KUANTITAS FROM (SELECT D.*, APBN.PAGU_TOTAL APBN_PAGU_TOTAL, APBN.REAL_TOTAL APBN_REAL_TOTAL, APBN.ESTI_TOTAL_PAGU APBN_ESTI_TOTAL_PAGU, APBN.ESTI_TOTAL_REAL APBN_ESTI_TOTAL_REAL, APBN.BAYAR_TOTAL APBN_BAYAR_TOTAL, APBD.PAGU_TOTAL APBD_PAGU_TOTAL, APBD.REAL_TOTAL APBD_REAL_TOTAL, APBD.ESTI_TOTAL_PAGU APBD_ESTI_TOTAL_PAGU, APBD.ESTI_TOTAL_REAL APBD_ESTI_TOTAL_REAL, APBD.BAYAR_TOTAL APBD_BAYAR_TOTAL, APBDES.PAGU_TOTAL APBDES_PAGU_TOTAL, APBDES.REAL_TOTAL APBDES_REAL_TOTAL, APBDES.ESTI_TOTAL_PAGU APBDES_ESTI_TOTAL_PAGU, APBDES.ESTI_TOTAL_REAL APBDES_ESTI_TOTAL_REAL, APBDES.BAYAR_TOTAL APBDES_BAYAR_TOTAL, NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0) ALL_PAGU_TOTAL, NVL(APBN.REAL_TOTAL, 0) + NVL(APBD.REAL_TOTAL, 0) + NVL(APBDES.REAL_TOTAL, 0) ALL_REAL_TOTAL, NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0) ALL_ESTI_TOTAL_PAGU, NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0) ALL_ESTI_TOTAL_REAL, NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0) ALL_BAYAR_TOTAL FROM (SELECT KD_KANWIL, NM_KANWIL, KD_KPP, NM_KPP FROM REF_MFWP_WILAYAH WHERE 1 = 1 $cari_kanwil GROUP BY KD_KANWIL, NM_KANWIL, KD_KPP, NM_KPP) D LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, 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 GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBN ON D.KD_KANWIL = APBN.KD_KANWIL AND D.KD_KPP = APBN.KD_KPP LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBD ON D.KD_KANWIL = APBD.KD_KANWIL AND D.KD_KPP = APBD.KD_KPP LEFT JOIN (SELECT KD_KANWIL, KD_KPP, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL AND D.KD_KPP = APBDES.KD_KPP)"; //echo $query; //exit; return $this->db->query($query)->getRow(); } function get_data_beranda_kanwil_grafik($param) { if($param['cari_kanwil'] <> "") $cari_kanwil = " AND KD_KANWIL = '".$param['cari_kanwil']."' "; else $cari_kanwil = ""; if($param['cari_sumber_dana'] == "APBN") { $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 GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBD") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBDes") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT KD_BULAN, NM_BULAN, REAL_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 UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil) GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } return $this->db->query($query)->getResult(); } function get_data_beranda_kpp($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 = ""; $limit_bottom = ($param['cari_page'] * $param['cari_limit']) - $param['cari_limit']; $query = "SELECT D.*, APBN.PAGU_TOTAL APBN_PAGU_TOTAL, APBN.REAL_TOTAL APBN_REAL_TOTAL, APBN.ESTI_TOTAL_PAGU APBN_ESTI_TOTAL_PAGU, APBN.ESTI_TOTAL_REAL APBN_ESTI_TOTAL_REAL, APBN.BAYAR_TOTAL APBN_BAYAR_TOTAL, (NVL(APBN.ESTI_TOTAL_PAGU, 0) - NVL(APBN.BAYAR_TOTAL, 0)) APBN_TAXGAP_PAGU, (NVL(APBN.ESTI_TOTAL_REAL, 0) - NVL(APBN.BAYAR_TOTAL, 0)) APBN_TAXGAP_REAL, ROUND(((NVL(APBN.BAYAR_TOTAL, 0) / NULLIF(NVL(APBN.PAGU_TOTAL, 0), 0))*100), 2) APBN_TAX_COLLECTION, APBD.PAGU_TOTAL APBD_PAGU_TOTAL, APBD.REAL_TOTAL APBD_REAL_TOTAL, APBD.ESTI_TOTAL_PAGU APBD_ESTI_TOTAL_PAGU, APBD.ESTI_TOTAL_REAL APBD_ESTI_TOTAL_REAL, APBD.BAYAR_TOTAL APBD_BAYAR_TOTAL, (NVL(APBD.ESTI_TOTAL_PAGU, 0) - NVL(APBD.BAYAR_TOTAL, 0)) APBD_TAXGAP_PAGU, (NVL(APBD.ESTI_TOTAL_REAL, 0) - NVL(APBD.BAYAR_TOTAL, 0)) APBD_TAXGAP_REAL, ROUND(((NVL(APBD.BAYAR_TOTAL, 0) / NULLIF(NVL(APBD.PAGU_TOTAL, 0), 0))*100), 2) APBD_TAX_COLLECTION, APBDES.PAGU_TOTAL APBDES_PAGU_TOTAL, APBDES.REAL_TOTAL APBDES_REAL_TOTAL, APBDES.ESTI_TOTAL_PAGU APBDES_ESTI_TOTAL_PAGU, APBDES.ESTI_TOTAL_REAL APBDES_ESTI_TOTAL_REAL, APBDES.BAYAR_TOTAL APBDES_BAYAR_TOTAL, (NVL(APBDES.ESTI_TOTAL_PAGU, 0) - NVL(APBDES.BAYAR_TOTAL, 0)) APBDES_TAXGAP_PAGU, (NVL(APBDES.ESTI_TOTAL_REAL, 0) - NVL(APBDES.BAYAR_TOTAL, 0)) APBDES_TAXGAP_REAL, ROUND(((NVL(APBDES.BAYAR_TOTAL, 0) / NULLIF(NVL(APBDES.PAGU_TOTAL, 0), 0))*100), 2) APBDES_TAX_COLLECTION, (NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0)) ALL_PAGU_TOTAL, (NVL(APBN.REAL_TOTAL, 0) + NVL(APBD.REAL_TOTAL, 0) + NVL(APBDES.REAL_TOTAL, 0)) ALL_REAL_TOTAL, (NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0)) ALL_ESTI_TOTAL_PAGU, (NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0)) ALL_ESTI_TOTAL_REAL, (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0)) ALL_BAYAR_TOTAL, ((NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0)) - (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0))) ALL_TAXGAP_PAGU, ((NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0)) - (NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0))) ALL_TAXGAP_REAL, ROUND((((NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0)) / NULLIF((NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0)), 0))*100), 2) ALL_TAX_COLLECTION FROM (SELECT * FROM REF_MFWP_WILAYAH WHERE 1 = 1 $cari_kanwil $cari_kpp) D LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, 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 GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBN ON D.KD_KANWIL = APBN.KD_KANWIL AND D.KD_KPP = APBN.KD_KPP AND D.KABKOTA = APBN.KABKOTA LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBD ON D.KD_KANWIL = APBD.KD_KANWIL AND D.KD_KPP = APBD.KD_KPP AND D.KABKOTA = APBD.KABKOTA LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL AND D.KD_KPP = APBDES.KD_KPP AND D.KABKOTA = APBDES.KABKOTA ORDER BY D.KD_KANWIL, D.KD_KPP, D.KABKOTA OFFSET $limit_bottom ROWS FETCH NEXT ".$param['cari_limit']." ROWS ONLY"; //echo $query; //exit; return $this->db->query($query)->getResult(); } function get_data_beranda_kpp_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 = ""; $query = "SELECT SUM(APBN_PAGU_TOTAL) APBN_PAGU_TOTAL, SUM(APBN_REAL_TOTAL) APBN_REAL_TOTAL, SUM(APBN_ESTI_TOTAL_PAGU) APBN_ESTI_TOTAL_PAGU, SUM(APBN_ESTI_TOTAL_REAL) APBN_ESTI_TOTAL_REAL, SUM(APBN_BAYAR_TOTAL) APBN_BAYAR_TOTAL, (NVL(SUM(APBN_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_PAGU, (NVL(SUM(APBN_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBN_BAYAR_TOTAL), 0)) APBN_TAXGAP_REAL, ROUND(((NVL(SUM(APBN_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBN_PAGU_TOTAL), 0), 0))*100), 2) APBN_TAX_COLLECTION, SUM(APBD_PAGU_TOTAL) APBD_PAGU_TOTAL, SUM(APBD_REAL_TOTAL) APBD_REAL_TOTAL, SUM(APBD_ESTI_TOTAL_PAGU) APBD_ESTI_TOTAL_PAGU, SUM(APBD_ESTI_TOTAL_REAL) APBD_ESTI_TOTAL_REAL, SUM(APBD_BAYAR_TOTAL) APBD_BAYAR_TOTAL, (NVL(SUM(APBD_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_PAGU, (NVL(SUM(APBD_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBD_BAYAR_TOTAL), 0)) APBD_TAXGAP_REAL, ROUND(((NVL(SUM(APBD_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBD_PAGU_TOTAL), 0), 0))*100), 2) APBD_TAX_COLLECTION, SUM(APBDES_PAGU_TOTAL) APBDES_PAGU_TOTAL, SUM(APBDES_REAL_TOTAL) APBDES_REAL_TOTAL, SUM(APBDES_ESTI_TOTAL_PAGU) APBDES_ESTI_TOTAL_PAGU, SUM(APBDES_ESTI_TOTAL_REAL) APBDES_ESTI_TOTAL_REAL, SUM(APBDES_BAYAR_TOTAL) APBDES_BAYAR_TOTAL, (NVL(SUM(APBDES_ESTI_TOTAL_PAGU), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_PAGU, (NVL(SUM(APBDES_ESTI_TOTAL_REAL), 0) - NVL(SUM(APBDES_BAYAR_TOTAL), 0)) APBDES_TAXGAP_REAL, ROUND(((NVL(SUM(APBDES_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(APBDES_PAGU_TOTAL), 0), 0))*100), 2) APBDES_TAX_COLLECTION, SUM(ALL_PAGU_TOTAL) ALL_PAGU_TOTAL, SUM(ALL_REAL_TOTAL) ALL_REAL_TOTAL, SUM(ALL_ESTI_TOTAL_PAGU) ALL_ESTI_TOTAL_PAGU, SUM(ALL_ESTI_TOTAL_REAL) ALL_ESTI_TOTAL_REAL, SUM(ALL_BAYAR_TOTAL) ALL_BAYAR_TOTAL, (NVL(SUM(ALL_ESTI_TOTAL_PAGU), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_PAGU, (NVL(SUM(ALL_ESTI_TOTAL_REAL), 0) - NVL(SUM(ALL_BAYAR_TOTAL), 0)) ALL_TAXGAP_REAL, ROUND(((NVL(SUM(ALL_BAYAR_TOTAL), 0) / NULLIF(NVL(SUM(ALL_PAGU_TOTAL), 0), 0))*100), 2) ALL_TAX_COLLECTION, COUNT(*) KUANTITAS FROM (SELECT D.*, APBN.PAGU_TOTAL APBN_PAGU_TOTAL, APBN.REAL_TOTAL APBN_REAL_TOTAL, APBN.ESTI_TOTAL_PAGU APBN_ESTI_TOTAL_PAGU, APBN.ESTI_TOTAL_REAL APBN_ESTI_TOTAL_REAL, APBN.BAYAR_TOTAL APBN_BAYAR_TOTAL, APBD.PAGU_TOTAL APBD_PAGU_TOTAL, APBD.REAL_TOTAL APBD_REAL_TOTAL, APBD.ESTI_TOTAL_PAGU APBD_ESTI_TOTAL_PAGU, APBD.ESTI_TOTAL_REAL APBD_ESTI_TOTAL_REAL, APBD.BAYAR_TOTAL APBD_BAYAR_TOTAL, APBDES.PAGU_TOTAL APBDES_PAGU_TOTAL, APBDES.REAL_TOTAL APBDES_REAL_TOTAL, APBDES.ESTI_TOTAL_PAGU APBDES_ESTI_TOTAL_PAGU, APBDES.ESTI_TOTAL_REAL APBDES_ESTI_TOTAL_REAL, APBDES.BAYAR_TOTAL APBDES_BAYAR_TOTAL, NVL(APBN.PAGU_TOTAL, 0) + NVL(APBD.PAGU_TOTAL, 0) + NVL(APBDES.PAGU_TOTAL, 0) ALL_PAGU_TOTAL, NVL(APBN.REAL_TOTAL, 0) + NVL(APBD.REAL_TOTAL, 0) + NVL(APBDES.REAL_TOTAL, 0) ALL_REAL_TOTAL, NVL(APBN.ESTI_TOTAL_PAGU, 0) + NVL(APBD.ESTI_TOTAL_PAGU, 0) + NVL(APBDES.ESTI_TOTAL_PAGU, 0) ALL_ESTI_TOTAL_PAGU, NVL(APBN.ESTI_TOTAL_REAL, 0) + NVL(APBD.ESTI_TOTAL_REAL, 0) + NVL(APBDES.ESTI_TOTAL_REAL, 0) ALL_ESTI_TOTAL_REAL, NVL(APBN.BAYAR_TOTAL, 0) + NVL(APBD.BAYAR_TOTAL, 0) + NVL(APBDES.BAYAR_TOTAL, 0) ALL_BAYAR_TOTAL FROM (SELECT * FROM REF_MFWP_WILAYAH WHERE 1 = 1 $cari_kanwil $cari_kpp) D LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, 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 GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBN ON D.KD_KANWIL = APBN.KD_KANWIL AND D.KD_KPP = APBN.KD_KPP AND D.KABKOTA = APBN.KABKOTA LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, KODE_SATKER, NAMA_SATKER, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBD ON D.KD_KANWIL = APBD.KD_KANWIL AND D.KD_KPP = APBD.KD_KPP AND D.KABKOTA = APBD.KABKOTA LEFT JOIN (SELECT KD_KANWIL, KD_KPP, KABKOTA, SUM(PAGU_TOTAL) PAGU_TOTAL, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU, SUM(REAL_TOTAL) REAL_TOTAL, SUM(ESTI_TOTAL_REAL) ESTI_TOTAL_REAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY TAHUN, KD_KANWIL, KD_KPP, KABKOTA, NPWP, NAMA_DESA, PAGU_TOTAL, ESTI_TOTAL_PAGU) GROUP BY KD_KANWIL, KD_KPP, KABKOTA) APBDES ON D.KD_KANWIL = APBDES.KD_KANWIL AND D.KD_KPP = APBDES.KD_KPP AND D.KABKOTA = APBDES.KABKOTA)"; //echo $query; //exit; return $this->db->query($query)->getRow(); } function get_data_beranda_kpp_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_sumber_dana'] == "APBN") { $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 GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBD") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else if($param['cari_sumber_dana'] == "APBDes") { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } else { $query = "SELECT KD_BULAN, NM_BULAN, SUM(REAL_TOTAL) REAL_TOTAL, SUM(BAYAR_TOTAL) BAYAR_TOTAL FROM (SELECT KD_BULAN, NM_BULAN, REAL_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 UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBD_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp UNION SELECT KD_BULAN, NM_BULAN, REAL_TOTAL, BAYAR_TOTAL FROM APBDES_REKAP WHERE TAHUN = '".$param['cari_tahun']."' AND KD_BULAN >= '".$param['cari_bulan_awal']."' AND KD_BULAN <= '".$param['cari_bulan_akhir']."' $cari_kanwil $cari_kpp) GROUP BY KD_BULAN, NM_BULAN ORDER BY KD_BULAN"; } return $this->db->query($query)->getResult(); } }