db->query("SELECT COUNT(1) NUMROWS FROM DASHBOARD_BYRLPR WHERE TAHUN = '" . $tahun . "' AND KWLADM = '" . $kwl . "' $cekpil $cekkpp $cekseksi $ceknip"); return $query; } function detKat($param) { $tahun = $param['tahun']; $kwl = $param['kwl']; $kpp = $param['kpp']; $seksi = $param['seksi']; $nip = $param['nip']; $offset = $param['page']; $limit = $param['perPage']; $pilihan = $param['pilihan']; if ($pilihan == '1') { $jmlbyrn = "JMLBYR IS NOT NULL"; $jmlbyrp = "BYRLALU IS NULL"; } else if ($pilihan == '2') { $jmlbyrn = "JMLBYR IS NULL"; $jmlbyrp = "BYRLALU IS NOT NULL"; } if ($kpp == "SEMUA" && $seksi == "SEMUA" && $nip == "SEMUA") { $array = ['KWLADM' => $kwl ]; } else if($kpp != "SEMUA" && $seksi == "SEMUA" && $nip == "SEMUA") { $array = [ 'KWLADM' => $kwl, 'KPPADM' => $kpp]; }else if ($kpp != "SEMUA" && $seksi != "SEMUA" && $nip == "SEMUA"){ $array = [ 'KWLADM' => $kwl, 'KPPADM' => $kpp, 'KODESIE' => $seksi]; } else if ($kpp != "SEMUA" && $seksi != "SEMUA" && $nip != "SEMUA") { $array = [ 'KWLADM' => $kwl, 'KODESIE' => $seksi, 'NIP_AR' => $nip]; } $this->builder() ->where('TAHUN', $tahun) ->where($array) ->where($jmlbyrn) ->where($jmlbyrp) ->limit($limit, $offset); return $this; } }