|
|
|
<?php
|
|
|
|
namespace App\Controllers\Kewilayahan;
|
|
|
|
|
|
|
|
use App\Controllers\Kewilayahan\IdentAktifitasHasil\IdentifikasiLapangan;
|
|
|
|
use App\Controllers\Kewilayahan\IdentAktifitasHasil\PerubahanPerilaku\Perubahan;
|
|
|
|
use App\Controllers\Kewilayahan\PoiGoogleMatoa\PoiGoogleMatoa;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\Identifikasi;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\JenisStatus;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\KLU;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\PayComp;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\Pembayaran;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\Pengampu;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\Sof;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\SPTTAhunan;
|
|
|
|
use App\Controllers\Kewilayahan\Sebaran\ZonaPengawasan;
|
|
|
|
use App\Libraries\AldLibrary;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
use CodeIgniter\Controller;
|
|
|
|
|
|
|
|
class Kytp extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
use ResponseTrait;
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
|
|
|
|
$kppadm = session('kppadm');
|
|
|
|
if (!in_array($kppadm, ['000'])) {
|
|
|
|
// exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
$db = \Config\Database::connect();
|
|
|
|
$data = [];
|
|
|
|
if (session('isLogin')) {
|
|
|
|
echo view('inc/head');
|
|
|
|
echo view('inc/navbar');
|
|
|
|
echo view('inc/sidebar');
|
|
|
|
echo view('kewilayahan/kytp/kpdl', $data);
|
|
|
|
echo view('inc/footer');
|
|
|
|
} else {
|
|
|
|
return redirect()->to('auth');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function graph_matoa()
|
|
|
|
{
|
|
|
|
// $opsiWilZona = $this->request->getPost('opsiWilZona') ?? null;
|
|
|
|
$Ald = new AldLibrary();
|
|
|
|
$username = session('nip');
|
|
|
|
|
|
|
|
$opsiWilZona = $Ald->decryptMe($this->request->getPost('opsiWilZona'), $username) ?? null;
|
|
|
|
|
|
|
|
if (!in_array($opsiWilZona, ['wilayah', 'zona', ''])) {
|
|
|
|
$dataReturn['poi_agg'] = [];
|
|
|
|
$dataReturn['kpdl_agg'] = [];
|
|
|
|
} else {
|
|
|
|
$poi = new PoiGoogleMatoa;
|
|
|
|
$dataReturn['poi_agg'] = $poi->get_poi_agg($this->request);
|
|
|
|
$dataReturn['kpdl_agg'] = $poi->get_kpdl_agg($this->request);
|
|
|
|
}
|
|
|
|
return json_encode($dataReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranPembayaran()
|
|
|
|
{
|
|
|
|
$Ald = new AldLibrary;
|
|
|
|
$username = session('nip');
|
|
|
|
|
|
|
|
$tahun = $Ald->decryptMe($this->request->getPost('tahun'), $username) ?? date('Y');
|
|
|
|
$bulan = $Ald->decryptMe($this->request->getPost('bulan'), $username) ?? date('m');
|
|
|
|
$sebaranPembayaran = new Pembayaran;
|
|
|
|
|
|
|
|
$dataReturn['dataC'] = $sebaranPembayaran->dataC($this->request, $tahun, $bulan);
|
|
|
|
$dataReturn['dataMin1'] = $sebaranPembayaran->dataC($this->request, $tahun, $bulan - 1);
|
|
|
|
$dataReturn['dataMin2'] = $sebaranPembayaran->dataC($this->request, $tahun, $bulan - 2);
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranIdentifikasi()
|
|
|
|
{
|
|
|
|
|
|
|
|
$sebaran = new Identifikasi;
|
|
|
|
|
|
|
|
$dataReturn['data'] = $sebaran->data($this->request);
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranPayComp()
|
|
|
|
{
|
|
|
|
$Ald = new AldLibrary;
|
|
|
|
$username = session('nip');
|
|
|
|
$tahun = $Ald->decryptMe($this->request->getPost('tahun'), $username) ?? date('Y');
|
|
|
|
$bulan = $Ald->decryptMe($this->request->getPost('bulan'), $username) ?? date('m');
|
|
|
|
|
|
|
|
$sebaran = new PayComp;
|
|
|
|
|
|
|
|
$dataReturn['dataC'] = $sebaran->dataC($this->request, $tahun, $bulan);
|
|
|
|
$dataReturn['dataMin1'] = $sebaran->dataC($this->request, $tahun, $bulan - 1);
|
|
|
|
$dataReturn['dataMin2'] = $sebaran->dataC($this->request, $tahun, $bulan - 2);
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranSof()
|
|
|
|
{
|
|
|
|
$Ald = new AldLibrary;
|
|
|
|
$username = session('nip');
|
|
|
|
|
|
|
|
$tahun = $Ald->decryptMe($this->request->getPost('tahun'), $username) ?? date('Y');
|
|
|
|
$bulan = $Ald->decryptMe($this->request->getPost('bulan'), $username) ?? date('m');
|
|
|
|
|
|
|
|
$sebaran = new Sof;
|
|
|
|
$dataReturn['data'] = $sebaran->dataC($this->request, $tahun, $bulan);
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranJenisStatusWp()
|
|
|
|
{
|
|
|
|
|
|
|
|
$sebaran = new JenisStatus;
|
|
|
|
$dataReturn['dataJenis'] = $sebaran->data($this->request, 'jenis');
|
|
|
|
$dataReturn['dataStatus'] = $sebaran->data($this->request, 'status');
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranPengampu()
|
|
|
|
{
|
|
|
|
ini_set('max_input_vars', 3000);
|
|
|
|
$sebaran = new Pengampu;
|
|
|
|
$dataReturn['assign'] = $sebaran->data($this->request, 'assign');
|
|
|
|
$dataReturn['unassign'] = $sebaran->data($this->request, 'unassign');
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranZonaPengawasan()
|
|
|
|
{
|
|
|
|
ini_set('max_input_vars', 3000);
|
|
|
|
$sebaran = new ZonaPengawasan;
|
|
|
|
$dataReturn['all'] = $sebaran->data($this->request);
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranSPTTahunan()
|
|
|
|
{
|
|
|
|
|
|
|
|
$sebaran = new SPTTAhunan;
|
|
|
|
$tahun = $this->request->getGet('tahun') ?? date('Y');
|
|
|
|
$dataReturn['data'] = $sebaran->data($this->request, $tahun);
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function sebaranKLU()
|
|
|
|
{
|
|
|
|
|
|
|
|
$sebaran = new KLU;
|
|
|
|
$tahun = $this->request->getGet('tahun') ?? date('Y');
|
|
|
|
$dataReturn['dataKluTerdaftar'] = $sebaran->data($this->request, 'dataKluTerdaftar');
|
|
|
|
$dataReturn['dataKluYgBayar'] = $sebaran->data($this->request, 'dataKluYgBayar');
|
|
|
|
$dataReturn['dataKluYgTidakBayar'] = $sebaran->data($this->request, 'dataKluYgTidakBayar');
|
|
|
|
$dataReturn['dataRupiahBayar'] = $sebaran->data($this->request, 'dataRupiahBayar');
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function identifikasiLapangan()
|
|
|
|
{
|
|
|
|
$Ald = new AldLibrary();
|
|
|
|
$username = session('nip');
|
|
|
|
if (!$this->validate([
|
|
|
|
'bulan' => 'required|max_length[10]',
|
|
|
|
])) {
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$sebaran = new IdentifikasiLapangan;
|
|
|
|
$bulan = $Ald->decryptMe($this->request->getPost('bulan'), $username) ?? 'semua';
|
|
|
|
$dataReturn['kpdl'] = $sebaran->dataKpdl($this->request, $bulan);
|
|
|
|
|
|
|
|
$dataReturn['categories'] = ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"];
|
|
|
|
if ($bulan == 'semua') {
|
|
|
|
$dataReturn['categories'] = ["Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des"];
|
|
|
|
} else {
|
|
|
|
$dataReturn['categories'] = $sebaran->generateSeries($bulan);
|
|
|
|
}
|
|
|
|
|
|
|
|
$arr_data_akum_dikenali = array();
|
|
|
|
$nilai_akum = 0;
|
|
|
|
foreach ($dataReturn['kpdl'] as $data) {
|
|
|
|
$nilai_akum += $data;
|
|
|
|
array_push($arr_data_akum_dikenali, $nilai_akum);
|
|
|
|
}
|
|
|
|
$c_arr = count($arr_data_akum_dikenali) - 1;
|
|
|
|
$arr_data_akum_dikenali_temp = $arr_data_akum_dikenali;
|
|
|
|
for ($i = $c_arr; $i > 0; $i--) {
|
|
|
|
if ($arr_data_akum_dikenali[$i] == $arr_data_akum_dikenali[$i - 1]) {
|
|
|
|
$arr_data_akum_dikenali_temp[$i] = 0;
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$dataReturn['akum'] = $arr_data_akum_dikenali_temp;
|
|
|
|
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
public function perubahanPerilaku()
|
|
|
|
{
|
|
|
|
$sebaran = new Perubahan;
|
|
|
|
$sebaranPembayaran = new Pembayaran;
|
|
|
|
|
|
|
|
$dataReturn['dataC'] = $sebaranPembayaran->dataC($this->request, date('Y'), date('m'));
|
|
|
|
$dataReturn['pembayaran'] = $sebaran->dataPerilakuPembayaran($this->request);
|
|
|
|
$dataReturn['pembayaranRupiah'] = $sebaran->dataPerilakuPembayaranRupiah($this->request);
|
|
|
|
$dataReturn['pelaporan'] = $sebaran->dataPerilakuPelaporan($this->request);
|
|
|
|
$dataReturn['pendaftaran'] = $sebaran->dataPerilakuPendaftaran($this->request);
|
|
|
|
return $this->respond($dataReturn, 200);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getBulan()
|
|
|
|
{
|
|
|
|
$Ald = new AldLibrary();
|
|
|
|
$username = session('nip');
|
|
|
|
|
|
|
|
$bulan = ['semua', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
|
|
$bulanEnc = [];
|
|
|
|
foreach ($bulan as $key => $value) {
|
|
|
|
$bulanEnc[] = [
|
|
|
|
'label' => $value,
|
|
|
|
'value' => $Ald->encryptMe($value, $username),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
return $this->respond($bulanEnc, 200);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private function single_array($a, $key)
|
|
|
|
{
|
|
|
|
$ret = [];
|
|
|
|
foreach ($a as $b) {
|
|
|
|
array_push($ret, floatval($b->$key));
|
|
|
|
}
|
|
|
|
for ($i = 0; $i < 12; $i++) {
|
|
|
|
if (!isset($ret[$i])) {
|
|
|
|
array_push($ret, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
}
|