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.
163 lines
8.2 KiB
163 lines
8.2 KiB
5 months ago
|
<?php
|
||
|
|
||
|
namespace App\Models\Bendahara;
|
||
|
|
||
|
use CodeIgniter\Model;
|
||
|
|
||
|
class MApbdes extends Model {
|
||
|
|
||
|
function get_data_apbdes($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, KECAMATAN, KD_SEKSI, NM_SEKSI,
|
||
|
NIP_AR, NM_AR, NPWP, NAMA_DESA, NAMA_WP,
|
||
|
PAGU_DANA_ADD, PAGU_DANA_DESA, PAGU_BAGI_HASIL, PAGU_LAINNYA, PAGU_TOTAL,
|
||
|
ESTI_TOTAL_PAGU,
|
||
|
|
||
|
SUM(REAL_DANA_ADD) REAL_DANA_ADD,
|
||
|
SUM(REAL_DANA_DESA) REAL_DANA_DESA,
|
||
|
SUM(REAL_BAGI_HASIL) REAL_BAGI_HASIL,
|
||
|
SUM(REAL_LAINNYA) REAL_LAINNYA,
|
||
|
SUM(REAL_TOTAL) REAL_TOTAL,
|
||
|
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_TOTAL_PAGU, 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_PAGU,
|
||
|
(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 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 $cari_seksi $cari_ar $cari_kabkot
|
||
|
GROUP BY TAHUN, KD_KANWIL, NM_KANWIL,
|
||
|
KD_KPP, NM_KPP, KABKOTA, KECAMATAN, KD_SEKSI, NM_SEKSI,
|
||
|
NIP_AR, NM_AR, NPWP, NAMA_DESA, NAMA_WP,
|
||
|
PAGU_DANA_ADD, PAGU_DANA_DESA, PAGU_BAGI_HASIL, PAGU_LAINNYA, PAGU_TOTAL,
|
||
|
ESTI_TOTAL_PAGU
|
||
|
ORDER BY KD_KANWIL, KD_KPP, KABKOTA, KECAMATAN, NAMA_DESA
|
||
|
OFFSET $limit_bottom ROWS FETCH NEXT ".$param['cari_limit']." ROWS ONLY";
|
||
|
|
||
|
return $this->db->query($query)->getResult();
|
||
|
}
|
||
|
|
||
|
function get_data_apbdes_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_DANA_ADD) PAGU_DANA_ADD,
|
||
|
SUM(PAGU_DANA_DESA) PAGU_DANA_DESA,
|
||
|
SUM(PAGU_BAGI_HASIL) PAGU_BAGI_HASIL,
|
||
|
SUM(PAGU_LAINNYA) PAGU_LAINNYA,
|
||
|
SUM(PAGU_TOTAL) PAGU_TOTAL,
|
||
|
SUM(ESTI_TOTAL_PAGU) ESTI_TOTAL_PAGU,
|
||
|
SUM(REAL_DANA_ADD) REAL_DANA_ADD,
|
||
|
SUM(REAL_DANA_DESA) REAL_DANA_DESA,
|
||
|
SUM(REAL_BAGI_HASIL) REAL_BAGI_HASIL,
|
||
|
SUM(REAL_LAINNYA) REAL_LAINNYA,
|
||
|
SUM(REAL_TOTAL) REAL_TOTAL,
|
||
|
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_TOTAL_PAGU), 0) - NVL(SUM(BAYAR_TOTAL), 0)) TAXGAP_TOTAL_PAGU,
|
||
|
(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, KECAMATAN, KD_SEKSI, NM_SEKSI,
|
||
|
NIP_AR, NM_AR, NPWP, NAMA_DESA, NAMA_WP,
|
||
|
PAGU_DANA_ADD, PAGU_DANA_DESA, PAGU_BAGI_HASIL, PAGU_LAINNYA, PAGU_TOTAL,
|
||
|
ESTI_TOTAL_PAGU,
|
||
|
|
||
|
SUM(REAL_DANA_ADD) REAL_DANA_ADD,
|
||
|
SUM(REAL_DANA_DESA) REAL_DANA_DESA,
|
||
|
SUM(REAL_BAGI_HASIL) REAL_BAGI_HASIL,
|
||
|
SUM(REAL_LAINNYA) REAL_LAINNYA,
|
||
|
SUM(REAL_TOTAL) REAL_TOTAL,
|
||
|
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 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 $cari_seksi $cari_ar $cari_kabkot
|
||
|
GROUP BY TAHUN, KD_KANWIL, NM_KANWIL,
|
||
|
KD_KPP, NM_KPP, KABKOTA, KECAMATAN, KD_SEKSI, NM_SEKSI,
|
||
|
NIP_AR, NM_AR, NPWP, NAMA_DESA, NAMA_WP,
|
||
|
PAGU_DANA_ADD, PAGU_DANA_DESA, PAGU_BAGI_HASIL, PAGU_LAINNYA, PAGU_TOTAL,
|
||
|
ESTI_TOTAL_PAGU
|
||
|
ORDER BY KD_KANWIL, KD_KPP, KABKOTA, KECAMATAN, NAMA_DESA) A";
|
||
|
|
||
|
return $this->db->query($query)->getRow();
|
||
|
}
|
||
|
|
||
|
function get_data_apbdes_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 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 $cari_seksi $cari_ar $cari_kabkot
|
||
|
GROUP BY KD_BULAN, NM_BULAN
|
||
|
ORDER BY KD_BULAN";
|
||
|
|
||
|
return $this->db->query($query)->getResult();
|
||
|
}
|
||
|
|
||
|
}
|