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.
 
 
 
 
 
 

303 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->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/wpdaftar', $d);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function wplapor()
{
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/wplapor', $d);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
}