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.
311 lines
10 KiB
311 lines
10 KiB
<?php |
|
|
|
namespace App\Controllers; |
|
|
|
use App\Models\Mref; |
|
use App\Models\Mrapor; |
|
|
|
class Rapor extends BaseController |
|
{ |
|
function wpbayar() |
|
{ |
|
ini_set('memory_limit', '2048M'); |
|
|
|
$tahun = $this->request->getVar('tahun'); |
|
$pbulan = $this->request->getPost('bulan'); |
|
|
|
if (empty($ptahun)) { |
|
$tahun = date('Y'); |
|
} else { |
|
$tahun = $ptahun; |
|
} |
|
if (empty($pbulan)) { |
|
$bulan = date('m'); |
|
} else { |
|
$bulan = $pbulan; |
|
} |
|
$param = array('tahun' => $tahun, 'bln' => $bulan); |
|
$model = new Mrapor(); |
|
$modelref = new Mref(); |
|
|
|
$d['tahunx'] = $tahun; |
|
$d['bulanx'] = $bulan; |
|
$d['refbulan'] = $modelref->getBln(); |
|
$d['raporbyr'] = $model->getRatKwl($param)->getResult(); |
|
$d['raporbyrkpp'] = $model->getRatKpp($param)->getResult(); |
|
$d['raporbyrsie'] = $model->getRatSie($param)->getResult(); |
|
$d['raporbyrpeg'] = $model->getRatPeg($param)->getResult(); |
|
|
|
|
|
$drilldownData = [ |
|
'kpp' => [], |
|
'sie' => [], |
|
'peg' => [] |
|
]; |
|
|
|
foreach ($d['raporbyrkpp'] as $row) { |
|
if (!isset($drilldownData['kpp'][(string)$row->KWLADM])) { |
|
$drilldownData['kpp'][(string)$row->KWLADM] = []; |
|
} |
|
$drilldownData['kpp'][(string)$row->KWLADM][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => (string)$row->KPPADM, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
foreach ($d['raporbyrsie'] as $row) { |
|
if (!isset($drilldownData['sie'][(string)$row->KPPADM])) { |
|
$drilldownData['sie'][(string)$row->KPPADM] = []; |
|
} |
|
$drilldownData['sie'][(string)$row->KPPADM][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => (string)$row->KODESIE, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
foreach ($d['raporbyrpeg'] as $row) { |
|
$key = $row->KPPADM . '_' . $row->KODESIE; |
|
if (!isset($drilldownData['peg'][$key])) { |
|
$drilldownData['peg'][$key] = []; |
|
} |
|
$drilldownData['peg'][$key][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => null, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
$d['drilldownData'] = $drilldownData; |
|
|
|
if (session('isLogin')) { |
|
echo view('inc/head'); |
|
echo view('inc/navbar'); |
|
echo view('inc/sidebar'); |
|
echo view('rapor/wpbayar', $d); |
|
echo view('inc/footer'); |
|
} else { |
|
return redirect()->to('auth'); |
|
} |
|
} |
|
|
|
function wpdaftar() |
|
{ |
|
ini_set('memory_limit', '2048M'); |
|
|
|
$tahun = $this->request->getVar('tahun'); |
|
$pbulan = $this->request->getPost('bulan'); |
|
|
|
if (empty($ptahun)) { |
|
$tahun = date('Y'); |
|
} else { |
|
$tahun = $ptahun; |
|
} |
|
if (empty($pbulan)) { |
|
$bulan = date('m'); |
|
} else { |
|
$bulan = $pbulan; |
|
} |
|
$param = array('tahun' => $tahun, 'bln' => $bulan); |
|
$model = new Mrapor(); |
|
$modelref = new Mref(); |
|
|
|
$d['tahunx'] = $tahun; |
|
$d['bulanx'] = $bulan; |
|
$d['refbulan'] = $modelref->getBln(); |
|
$d['raporbyr'] = $model->getDftrKwl($param)->getResult(); |
|
$d['raporbyrkpp'] = $model->getDftrKpp($param)->getResult(); |
|
$d['raporbyrsie'] = $model->getDftrSie($param)->getResult(); |
|
$d['raporbyrpeg'] = $model->getDftrPeg($param)->getResult(); |
|
|
|
|
|
$drilldownData = [ |
|
'kpp' => [], |
|
'sie' => [], |
|
'peg' => [] |
|
]; |
|
|
|
foreach ($d['raporbyrkpp'] as $row) { |
|
if (!isset($drilldownData['kpp'][(string)$row->KWLADM])) { |
|
$drilldownData['kpp'][(string)$row->KWLADM] = []; |
|
} |
|
$drilldownData['kpp'][(string)$row->KWLADM][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => (string)$row->KPPADM, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
foreach ($d['raporbyrsie'] as $row) { |
|
if (!isset($drilldownData['sie'][(string)$row->KPPADM])) { |
|
$drilldownData['sie'][(string)$row->KPPADM] = []; |
|
} |
|
$drilldownData['sie'][(string)$row->KPPADM][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => (string)$row->KODESIE, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
foreach ($d['raporbyrpeg'] as $row) { |
|
$key = $row->KPPADM . '_' . $row->KODESIE; |
|
if (!isset($drilldownData['peg'][$key])) { |
|
$drilldownData['peg'][$key] = []; |
|
} |
|
$drilldownData['peg'][$key][] = [ |
|
'name' => $row->NAMA, |
|
'x' => ($row->WPBYR / ($row->JMLWP ?: 1)) * 100, |
|
'y' => ($row->WPBYRTERATUR / ($row->WPBYR ?: 1)) * 100, |
|
'z' => 1, |
|
'drilldown' => null, |
|
'jmlwp' => $row->JMLWP, |
|
'wpbyr' => $row->WPBYR, |
|
'wpbyrteratur' => $row->WPBYRTERATUR |
|
]; |
|
} |
|
|
|
$d['drilldownData'] = $drilldownData; |
|
|
|
if (session('isLogin')) { |
|
echo view('inc/head'); |
|
echo view('inc/navbar'); |
|
echo view('inc/sidebar'); |
|
echo view('rapor/wpdaftar', $d); |
|
echo view('inc/footer'); |
|
} else { |
|
return redirect()->to('auth'); |
|
} |
|
} |
|
|
|
function wplapor() |
|
{ |
|
ini_set('memory_limit', '2048M'); |
|
|
|
$ptahun = $this->request->getPost('tahun'); |
|
$pbulan = $this->request->getPost('bulan'); |
|
|
|
if (empty($ptahun)) { |
|
$tahun = date('Y') - 1; |
|
} else { |
|
$tahun = $ptahun; |
|
} |
|
if (empty($pbulan)) { |
|
$bulan = date('m'); |
|
} else { |
|
$bulan = $pbulan; |
|
} |
|
$param = array('tahun' => $tahun, 'bln' => $bulan); |
|
$model = new Mrapor(); |
|
$modelref = new Mref(); |
|
|
|
$d['tahunx'] = $tahun; |
|
$d['bulanx'] = $bulan; |
|
$d['refbulan'] = $modelref->getBln(); |
|
$d['raporlpr'] = $model->getLprKwl($param)->getResult(); |
|
$d['raporlprkpp'] = $model->getLprKpp($param)->getResult(); |
|
$d['raporlprsie'] = $model->getLprSie($param)->getResult(); |
|
$d['raporlprpeg'] = $model->getLprPeg($param)->getResult(); |
|
|
|
$drilldownSeries = []; |
|
|
|
// Prepare KPP drilldown |
|
foreach ($d['raporlpr'] as $kanwil) { |
|
$kppData = []; |
|
foreach ($d['raporlprkpp'] as $kpp) { |
|
if ($kpp->KWLADM == $kanwil->KWLADM) { |
|
$kppData[] = [ |
|
'name' => $kpp->NAMA, |
|
'y' => ($kpp->WPLPR / ($kpp->JMLWP ?: 1)) * 100, |
|
'drilldown' => (string)$kpp->KPPADM, |
|
'jmlwp' => $kpp->JMLWP, |
|
'wplpr' => $kpp->WPLPR |
|
]; |
|
} |
|
} |
|
$drilldownSeries[] = [ |
|
'id' => (string)$kanwil->KWLADM, |
|
'name' => "KPP in " . $kanwil->NAMA, |
|
'data' => $kppData |
|
]; |
|
} |
|
|
|
// Prepare Seksi drilldown |
|
foreach ($d['raporlprkpp'] as $kpp) { |
|
$sieData = []; |
|
foreach ($d['raporlprsie'] as $sie) { |
|
if ($sie->KPPADM == $kpp->KPPADM) { |
|
$sieData[] = [ |
|
'name' => $sie->NAMA, |
|
'y' => ($sie->WPLPR / ($sie->JMLWP ?: 1)) * 100, |
|
'drilldown' => (string)($kpp->KPPADM . '_' . $sie->KODESIE), |
|
'jmlwp' => $sie->JMLWP, |
|
'wplpr' => $sie->WPLPR |
|
]; |
|
} |
|
} |
|
$drilldownSeries[] = [ |
|
'id' => (string)$kpp->KPPADM, |
|
'name' => "Seksi in " . $kpp->NAMA, |
|
'data' => $sieData |
|
]; |
|
} |
|
|
|
// Prepare Pegawai drilldown |
|
foreach ($d['raporlprsie'] as $sie) { |
|
$pegData = []; |
|
foreach ($d['raporlprpeg'] as $peg) { |
|
if ($peg->KPPADM == $sie->KPPADM && $peg->KODESIE == $sie->KODESIE) { |
|
$pegData[] = [ |
|
'name' => $peg->NAMA, |
|
'y' => ($peg->WPLPR / ($peg->JMLWP ?: 1)) * 100, |
|
'jmlwp' => $peg->JMLWP, |
|
'wplpr' => $peg->WPLPR |
|
]; |
|
} |
|
} |
|
$drilldownSeries[] = [ |
|
'id' => (string)($sie->KPPADM . '_' . $sie->KODESIE), |
|
'name' => "Pegawai in " . $sie->NAMA, |
|
'data' => $pegData |
|
]; |
|
} |
|
|
|
$d['drilldownSeries'] = $drilldownSeries; |
|
|
|
if (session('isLogin')) { |
|
echo view('inc/head'); |
|
echo view('inc/navbar'); |
|
echo view('inc/sidebar'); |
|
echo view('rapor/wplapor', $d); |
|
echo view('inc/footer'); |
|
} else { |
|
return redirect()->to('auth'); |
|
} |
|
} |
|
}
|
|
|