getPost('opsiWilZona'); $adm4_pcode = $request->getPost('adm4_pcode') ?? []; $id_poly_zona = $request->getPost('id_poly_zona') ?? []; $db = \Config\Database::connect(); if ($bulan == 'semua') { $npwp = $db->table('KPDL_MV_JML_KPDL_AGG A') ->select('BULAN, SUM(JML) JML') ->where("TAHUN =" . date('Y')) ->where('BULAN <=', date('m')) ->groupBy('BULAN'); if ($opsiWilZona == 'wilayah') { $npwp = $npwp->whereIn('ADM4_PCODE', $adm4_pcode); } if ($opsiWilZona == 'zona') { $npwp = $npwp->whereIn('ID_POLY_ZONA', $id_poly_zona); } $npwp = $npwp->getCompiledSelect(); $data = $db->table('BULAN A') ->select("A.KODE AS BULAN, C.JML") ->join("(" . $npwp . ") C", 'A.KODE = C.BULAN', 'left') ->orderBy('BULAN'); $KpdlLibrary = new KpdlLibrary; return $KpdlLibrary->single_array($data->get()->getResult(), 'JML'); } } protected function dataKpdl($request, $bulan) { $opsiWilZona = $request->getPost('opsiWilZona'); $adm4_pcode = $request->getPost('adm4_pcode') ?? []; $id_poly_zona = $request->getPost('id_poly_zona') ?? []; $db = \Config\Database::connect(); if ($bulan == 'semua') { $npwp = $db->table('KPDL_MV_JML_KPDL A') ->select('BULAN, SUM(JML) JML') ->where("TAHUN =" . date('Y')) ->where('BULAN <=', date('m')) ->groupBy('BULAN'); if ($opsiWilZona == 'wilayah') { $npwp = $npwp->whereIn('ADM4_PCODE', $adm4_pcode); } if ($opsiWilZona == 'zona') { $npwp = $npwp->whereIn('ID_POLY_ZONA', $id_poly_zona); } $npwp = $npwp->getCompiledSelect(); $data = $db->table('BULAN A') ->select("A.KODE as BULAN, C.JML") ->join("(" . $npwp . ") C", 'A.KODE = C.BULAN', 'left') ->orderBy('BULAN'); $KpdlLibrary = new KpdlLibrary; return $KpdlLibrary->single_array($data->get()->getResult(), 'JML'); } } }