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.
238 lines
7.2 KiB
238 lines
7.2 KiB
<?php |
|
namespace App\Controllers\Kewilayahan; |
|
|
|
use CodeIgniter\Controller; |
|
|
|
class Ref extends Controller |
|
{ |
|
|
|
public function propinsi() |
|
{ |
|
|
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_V_BATAS_DESA')->where('ADM1_PCODE IS NOT NULL')->select('ADM1_PCODE as value, ADM1_EN as label')->distinct()->orderBy('ADM1_EN')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function kota() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_V_BATAS_DESA') |
|
->select('ADM2_PCODE as value, ADM2_EN as label') |
|
->distinct() |
|
->where('ADM2_PCODE IS NOT NULL') |
|
->where('ADM1_PCODE', $this->request->getGet('prop')) |
|
->orderBy('ADM2_EN')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
|
|
public function kecamatan() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_V_BATAS_DESA') |
|
->select('ADM3_PCODE as value, ADM3_EN as label') |
|
->distinct() |
|
->where('ADM3_PCODE IS NOT NULL') |
|
->where('ADM2_PCODE', $this->request->getGet('kota')) |
|
->orderBy('ADM3_EN')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
|
|
public function kelurahan() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_V_BATAS_DESA') |
|
->select('ADM4_PCODE as value, ADM4_EN as label') |
|
->distinct() |
|
->where('ADM4_PCODE IS NOT NULL') |
|
->whereIn('ADM3_PCODE', $this->request->getGet('kec')) |
|
->orderBy('ADM4_EN')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
|
|
public function zpkanwil() |
|
{ |
|
|
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_ZP_NAS_DIFF') |
|
->select('KD_KANWIL as value, NM_KANWIL as label') |
|
->distinct() |
|
->orderBy('NM_KANWIL')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function zpkpp() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_ZP_NAS_DIFF') |
|
->select('KD_KPP as value, NM_KPP as label') |
|
->distinct() |
|
->where('KD_KANWIL', $this->request->getGet('kanwil')) |
|
->orderBy('NM_KPP')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
|
|
public function zpseksi() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('KPDL_ZP_NAS_DIFF') |
|
->select('KD_UNIT_OR as value, SEKSI as label') |
|
->distinct() |
|
->whereIn('KD_KPP', $this->request->getGet('kpp')) |
|
->orderBy('SEKSI')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
|
|
public function zpar() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$kpp = $this->request->getGet('kpp'); |
|
$seksi = $this->request->getGet('seksi'); |
|
|
|
$data = $db->table('KPDL_ZP_NAS_DIFF') |
|
->select('NIP_AR as value, NM_AR as label') |
|
->distinct() |
|
->whereIn('KD_KPP', $kpp) |
|
->whereIn('KD_UNIT_OR', $seksi) |
|
->orderBy('NM_AR')->get()->getResult(); |
|
return json_encode($data); |
|
} |
|
public function zpzp() |
|
{ |
|
$db = \Config\Database::connect(); |
|
$kpp = $this->request->getPost('kpp'); |
|
$seksi = $this->request->getPost('seksi'); |
|
$ar = $this->request->getPost('ar'); |
|
$data = $db->table('KPDL_ZP_NAS_DIFF') |
|
->select("OGC_FID as value, NO_URUT || '-' || ATTRIBUTE1 as label") |
|
->distinct() |
|
->where('KD_KPP', $kpp) |
|
->whereIn('KD_UNIT_OR', $seksi) |
|
->whereIn('NIP_AR', $ar) |
|
->orderBy('LABEL')->get()->getResult(); |
|
foreach ($data as $key => $value) { |
|
$value->label = $value->LABEL; |
|
unset($value->LABEL); |
|
|
|
} |
|
return json_encode(($data)); |
|
} |
|
|
|
public function kanwilPratama() |
|
{ |
|
|
|
$db = \Config\Database::connect(); |
|
$data = $db->table('DIM_KANTOR') |
|
->select('KD_KANWIL as value, NM_KANTOR as label') |
|
->where('ID_JNS_KANTOR', 23) |
|
->orderBy('NM_KANTOR')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function kppPratama() |
|
{ |
|
$kanwil = $this->request->getGet('kanwil'); |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('DIM_KANTOR') |
|
->select('KD_KPP as value, NM_KANTOR as label') |
|
->where('KD_KANWIL', $kanwil) |
|
->where('ID_JNS_KANTOR', 24) |
|
->orderBy('NM_KANTOR')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function kanwil() |
|
{ |
|
|
|
$db = \Config\Database::connect(); |
|
$data = $db->table('DIM_KANTOR') |
|
->select('KD_KANWIL as value, NM_KANTOR as label') |
|
->whereIn('ID_JNS_KANTOR', [21, 23]) |
|
->orderBy('NM_KANTOR')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function kpp() |
|
{ |
|
$kanwil = $this->request->getGet('kanwil'); |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('DIM_KANTOR') |
|
->select('KD_KPP as value, NM_KANTOR as label') |
|
->where('KD_KANWIL', $kanwil) |
|
->whereIn('ID_JNS_KANTOR', [22, 24]) |
|
->orderBy('NM_KANTOR')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function seksi() |
|
{ |
|
$kpp = $this->request->getGet('kpp'); |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('PEGAWAI')->distinct() |
|
->select('KD_UNIT_ORGANISASI as value, NAMA_UNIT_ES4 as label') |
|
->where('KPPADM', $kpp) |
|
->where('NAMA_JABATAN', "Account Representative") |
|
->orderBy('NAMA_UNIT_ES4')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
|
|
public function ar() |
|
{ |
|
$kpp = $this->request->getPost('kpp'); |
|
$kd_unit_organisasi = $this->request->getPost('seksi'); |
|
$db = \Config\Database::connect(); |
|
$data = $db->table('PEGAWAI')->distinct() |
|
|
|
->select('NIP9 as value, NAMA as label') |
|
->where('KPPADM', $kpp) |
|
->whereIn('KD_UNIT_ORGANISASI', $kd_unit_organisasi) |
|
->where('NAMA_JABATAN', "Account Representative") |
|
->orderBy('NAMA')->get()->getResult(); |
|
|
|
foreach ($data as $key => $val) { |
|
$val->value = $val->value; |
|
} |
|
|
|
return json_encode($data); |
|
} |
|
public function change_case($arr) |
|
{ |
|
return array_change_key_case($arr, CASE_LOWER); |
|
} |
|
|
|
}
|
|
|