@ -51,6 +51,80 @@ class Sof extends \App\Controllers\Kewilayahan\Kytp
if ($opsiWilZona == 'pengampu') {
if ($opsiWilZona == 'pengampu') {
$npwp = $npwp->whereIn('NIP_AR_PENGAMPU', $nip_ar_pengampu);
$npwp = $npwp->whereIn('NIP_AR_PENGAMPU', $nip_ar_pengampu);
}
}
//opsiWilZona = '' (Default)
if (session('kppadm') != '000') {
$npwp->groupStart();
if (session('tpkantor') == 'Kanwil') { // kanwil
$npwp->join('KPDL_ZP_NAS_DIFF B', 'ID_POLY_ZONA = B.OGC_FID');
$npwp->orGroupStart();
$npwp->where('B.KD_KANWIL', session('kwladm'));
$npwp->groupEnd();
}
if (session('tpkantor') == 'KPP') { //KPP
$npwp->join('KPDL_ZP_NAS_DIFF B', 'ID_POLY_ZONA = B.OGC_FID');
$currentPegawai = currentPegawai();
if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['602'])) { //AR
//zona
$npwp->orGroupStart()
->where('B.KD_UNIT_OR', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_ZONA', session('kppadm'))
->where('A.NIP_AR_ZONA', session('nip'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KODE_PEG_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI . '-' . session('nip')) //direkam saat di seksi aktif saat ini
->groupEnd();
//pengampu
$npwp->orGroupStart()
->where('A.NIP_AR_PENGAMPU', session('nip'))
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['401'])) { //kasi
//zona
$npwp->orGroupStart()
->where('B.KD_UNIT_OR', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_ZONA', session('kppadm'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KODE_SEKSI_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI)
->groupEnd();
//pengampu
$npwp->join('PEGAWAI C', 'A.NIP_AR_PENGAMPU=C.NIP9', 'left');
$npwp->orGroupStart()
->where('C.KD_UNIT_ORGANISASI', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['304'])) { //Kepala Kantor
//zona
$npwp->orGroupStart()
->where('A.KPPADM_ZONA', session('kppadm'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KPP_ADM_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI)
->groupEnd();
//pengampu
$npwp->join('PEGAWAI C', 'A.NIP_AR_PENGAMPU=C.NIP9', 'left');
$npwp->orGroupStart()
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else {
return [];
}
}
$npwp->groupEnd();
}
$sqlBulanIni = $db->newQuery()
$sqlBulanIni = $db->newQuery()
->select("'" . $tahun . '-' . $bulan . "' AS THN_BLN, B.LAPISAN, count(1) JML", false)
->select("'" . $tahun . '-' . $bulan . "' AS THN_BLN, B.LAPISAN, count(1) JML", false)
@ -159,7 +233,82 @@ class Sof extends \App\Controllers\Kewilayahan\Kytp
if ($opsiWilZona == 'pengampu') {
if ($opsiWilZona == 'pengampu') {
$data->whereIn('NIP_AR_PENGAMPU', $nip_ar_pengampu);
$data->whereIn('NIP_AR_PENGAMPU', $nip_ar_pengampu);
}
}
$npwp = $data;
$npwp = $data;
//opsiWilZona = '' (Default)
if (session('kppadm') != '000') {
$npwp->groupStart();
if (session('tpkantor') == 'Kanwil') { // kanwil
$npwp->join('KPDL_ZP_NAS_DIFF B', 'ID_POLY_ZONA = B.OGC_FID');
$npwp->orGroupStart();
$npwp->where('B.KD_KANWIL', session('kwladm'));
$npwp->groupEnd();
}
if (session('tpkantor') == 'KPP') { //KPP
$npwp->join('KPDL_ZP_NAS_DIFF B', 'ID_POLY_ZONA = B.OGC_FID');
$currentPegawai = currentPegawai();
if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['602'])) { //AR
//zona
$npwp->orGroupStart()
->where('B.KD_UNIT_OR', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_ZONA', session('kppadm'))
->where('A.NIP_AR_ZONA', session('nip'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KODE_PEG_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI . '-' . session('nip')) //direkam saat di seksi aktif saat ini
->groupEnd();
//pengampu
$npwp->orGroupStart()
->where('A.NIP_AR_PENGAMPU', session('nip'))
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['401'])) { //kasi
//zona
$npwp->orGroupStart()
->where('B.KD_UNIT_OR', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_ZONA', session('kppadm'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KODE_SEKSI_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI)
->groupEnd();
//pengampu
$npwp->join('PEGAWAI C', 'A.NIP_AR_PENGAMPU=C.NIP9', 'left');
$npwp->orGroupStart()
->where('C.KD_UNIT_ORGANISASI', $currentPegawai->KD_UNIT_ORGANISASI)
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else if (in_array($currentPegawai->KD_JAB_STRUKTURAL, ['304'])) { //Kepala Kantor
//zona
$npwp->orGroupStart()
->where('A.KPPADM_ZONA', session('kppadm'))
->groupEnd();
//perekam
$npwp->orGroupStart()
->where('A.KPP_ADM_PEREKAM', session('kppadm') . '-' . $currentPegawai->KD_UNIT_ORGANISASI)
->groupEnd();
//pengampu
$npwp->join('PEGAWAI C', 'A.NIP_AR_PENGAMPU=C.NIP9', 'left');
$npwp->orGroupStart()
->where('A.KPPADM_PENGAMPU', session('kppadm'))
->groupEnd();
} else {
return [];
}
}
$npwp->groupEnd();
}
$tahunBulan = $Ald->decryptMe($request->tahunBulan ?? '', $username) ?? "2024-09";
$tahunBulan = $Ald->decryptMe($request->tahunBulan ?? '', $username) ?? "2024-09";
$tahunBulanArr = explode("-", $tahunBulan);
$tahunBulanArr = explode("-", $tahunBulan);