|
|
|
<?php
|
|
|
|
namespace App\Controllers\Kewilayahan\Sebaran;
|
|
|
|
|
|
|
|
use App\Libraries\AldLibrary;
|
|
|
|
|
|
|
|
class Pengampu extends \App\Controllers\Kewilayahan\Kytp
|
|
|
|
|
|
|
|
{
|
|
|
|
protected function data($request, $jenis)
|
|
|
|
{
|
|
|
|
ini_set('max_input_vars', 3000);
|
|
|
|
$Ald = new AldLibrary;
|
|
|
|
$username = session('nip');
|
|
|
|
|
|
|
|
$opsiWilZona = $Ald->decryptMe($request->getPost('opsiWilZona'), $username);
|
|
|
|
$adm4_pcode = [];
|
|
|
|
foreach ($request->getPost('adm4_pcode') ?? [] as $key => $value) {
|
|
|
|
$adm4_pcode[] = $Ald->decryptKpdl($value, $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
$id_poly_zona = [];
|
|
|
|
foreach ($request->getPost('id_poly_zona') ?? [] as $key => $value) {
|
|
|
|
$id_poly_zona[] = $Ald->decryptMe($value, $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
$nip_ar_perekam = [];
|
|
|
|
foreach ($request->getPost('nip_ar_perekam') ?? [] as $key => $value) {
|
|
|
|
$nip_ar_perekam[] = $Ald->decryptMe($value, $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
$nip_ar_pengampu = [];
|
|
|
|
foreach ($request->getPost('nip_ar_pengampu') ?? [] as $key => $value) {
|
|
|
|
$nip_ar_pengampu[] = $Ald->decryptMe($value, $username);
|
|
|
|
}
|
|
|
|
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
|
|
|
|
$npwp = $db->table('KPDL_MV_LOKASI_SUBJEK')->select("NM_KANTOR_PENGAMPU, count(DISTINCT NPWP) JML", false)
|
|
|
|
->groupBy("NM_KANTOR_PENGAMPU")->orderBy("JML", 'desc');
|
|
|
|
|
|
|
|
switch ($jenis) {
|
|
|
|
case 'assign':
|
|
|
|
$npwp = $npwp->where("NPWP IS NOT NULL");
|
|
|
|
break;
|
|
|
|
case 'unassign':
|
|
|
|
$npwp = $npwp->where("NPWP IS NOT NULL")
|
|
|
|
->where("NIP_AR_PENGAMPU IS NULL");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($opsiWilZona == 'wilayah') {
|
|
|
|
$npwp->whereIn('ADM4_PCODE', $adm4_pcode);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($opsiWilZona == 'zona') {
|
|
|
|
$npwp->whereIn('ID_POLY_ZONA', $id_poly_zona);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($opsiWilZona == 'perekam') {
|
|
|
|
$npwp = $npwp->whereIn('CREATED_BY', $nip_ar_perekam);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($opsiWilZona == 'pengampu') {
|
|
|
|
$npwp = $npwp->whereIn('NIP_AR_PENGAMPU', $nip_ar_pengampu);
|
|
|
|
}
|
|
|
|
|
|
|
|
$data = $npwp->get()->getResult();
|
|
|
|
|
|
|
|
$ret = [];
|
|
|
|
|
|
|
|
foreach ($data as $b) {
|
|
|
|
|
|
|
|
array_push($ret, ['name' => $b->NM_KANTOR_PENGAMPU,
|
|
|
|
// 'color' => ,
|
|
|
|
'y' => floatval($b->JML),
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
}
|