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.
 
 
 
 
 
 

403 lines
12 KiB

<?php
namespace App\Controllers;
use App\Models\Mpemby;
use App\Models\Mref;
class Home extends BaseController
{
public function index()
{
if (session('isLogin') && session('tpkantor') == 'KPDJP') {
$model = new Mpemby();
$modelref = new Mref();
$ptahun = $this->request->getPost('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);
$p['tahunx'] = $tahun;
$p['bulanx'] = $bulan;
$p['updatex'] = $modelref->getUpd()->getFirstRow('array');
$p['refbulan'] = $modelref->getBln();
$p['ren'] = $model->getRenpen($param)->getFirstRow('array');
$p['penb'] = $model->getPen($param)->getFirstRow('array');
$p['penl'] = $model->getPenl($param)->getFirstRow('array');
$p['perkategori'] = $model->getKat($param)->getResult();
$p['pie_penerimaan'] = $model->getPiePen($param)->getResult();
$p['paycomp'] = $model->paycompNas($param)->getResult();
$p['parsesof'] = $model->sofNas($param)->getResult();
$p['wp_terdaftar'] = $model->getWpsk()->getFirstRow('array');
$p['wp_sk'] = $model->getBreakdownPen($param)->getFirstRow('array');
$p['wpadm'] = $model->getWPterdaftar($param)->getFirstRow('array');
$p['laporThn'] = $model->laporTahunan($param)->getFirstRow('array');
$p['sektordom'] = $model->getSektdom($param)->getResult();
$p['dashwp'] = $model->Wpbyrlpr($param)->getFirstRow('array');
$p['ppmpkm'] = $model->getPPMPKM($param)->getFirstRow('array');
$p['grafwpt'] = $model->grafWPTerdaftar($param)->getResult();
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('ppm/dashboard', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
public function getWPBYR()
{
if (session('isLogin')) {
$uri = service('uri');
$tahun = $uri->getSegment(3);
$tahunl = $tahun - 1;
$param = array('tahun' => $tahun);
$model = new Mpemby();
$getmod = $model->getWPBYR($param)->getResult();
$series1 = array();
$series1['name'] = 'Jumlah WP ' . $tahun . '';
$series1['type'] = 'spline';
$series2 = array();
$series2['name'] = 'Jumlah WP ' . $tahunl . '';
$series2['type'] = 'spline';
$series3 = array();
$series3['name'] = 'Bayar ' . $tahun . '';
$series3['type'] = 'spline';
$series4 = array();
$series4['name'] = 'Bayar ' . $tahunl . '';
$series4['type'] = 'spline';
$series5 = array();
$series5['name'] = 'Growth WP Bayar(%)';
$series5['type'] = 'spline';
$series6 = array();
$series6['name'] = 'Growth Pembayaran(%)';
$series6['type'] = 'spline';
$category = 0;
foreach ($getmod as $row) {
$growthwp = (($row->WPBYRNOW - $row->WPBYRPAST) / $row->WPBYRPAST) * 100;
$growthbayar = (($row->JMLBYRNOW - $row->JMLBYRPAST) / $row->JMLBYRPAST) * 100;
$series1['data'][] = (float) $row->WPBYRNOW;
// $series1['color'] = '#006400';
$series2['data'][] = (float) $row->WPBYRPAST;
// $series2['color'] = '#FD658E';
$series3['data'][] = (float) $row->JMLBYRNOW;
// $series3['color'] = '#4B0082';
$series4['data'][] = (float) $row->JMLBYRPAST;
//$series4['color'] = '#FA5407';
$series5['data'][] = number_format((float) $growthwp, 2);
//$series5['color'] = '#c31aff';
$series6['data'][] = number_format((float) $growthbayar, 2);
// $series6['color'] = '#ab1970';
}
$hasil = array();
array_push($hasil, $category);
array_push($hasil, $series1);
array_push($hasil, $series2);
array_push($hasil, $series3);
array_push($hasil, $series4);
array_push($hasil, $series5);
array_push($hasil, $series6);
echo json_encode($hasil, JSON_NUMERIC_CHECK);
} else {
return redirect()->to('auth');
}
}
function gmapkjs()
{
if (session('isLogin')) {
$model = new Mpemby();
$modelref = new Mref();
if (session('tpkantor') == 'KPDJP') {
$kwl = $this->request->getPost('kwl') ?? '090';
$kpp = $this->request->getPost('kpp') ?? 'SEMUA';
$seksi = $this->request->getPost('seksi') ?? 'SEMUA';
$nip = $this->request->getPost('nip') ?? 'SEMUA';
} else if (session('tpkantor') == 'Kanwil') {
$kwl = session('kwladm');
$kpp = $this->request->getPost('kpp') ?? 'SEMUA';
$seksi = $this->request->getPost('seksi') ?? 'SEMUA';
$nip = $this->request->getPost('nip') ?? 'SEMUA';
} else {
$kwl = session('kwladm');
$kpp = session('kppadm');
$seksi = $this->request->getPost('seksi') ?? 'SEMUA';
$nip = $this->request->getPost('nip') ?? 'SEMUA';
}
$ptahun = $this->request->getPost('tahun');
$pbulan = $this->request->getPost('bulan');
$pbulan2 = $this->request->getPost('bulan2');
$kdmap = $this->request->getPost('kdmap');
$kjs = $this->request->getPost('kjs');
$kategori = $this->request->getPost('kategori');
if (empty($ptahun)) {
$tahun = date('Y');
} else {
$tahun = $ptahun;
}
if (empty($pbulan)) {
$bulan = '01';
} else {
$bulan = $pbulan;
}
if (empty($pbulan2)) {
$bulan2 = date('m');
} else {
$bulan2 = $pbulan2;
}
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'tahun' => $tahun, 'bln' => $bulan, 'seksi' => $seksi, 'nip' => $nip, 'kdmap' => $kdmap, 'kjs' => $kjs, 'kategori' => $kategori);
$p['kwlx'] = $kwl;
$p['kppx'] = $kpp;
$p['seksix'] = $seksi;
$p['nipx'] = $nip;
$p['tahunx'] = $tahun;
$p['bulanx'] = $bulan;
$p['bulan2x'] = $bulan2;
$p['mapx'] = $kdmap;
$p['kjsx'] = $kjs;
$p['kategorix'] = $kategori;
$p['selkwl'] = $modelref->selKwl()->getResult();
$p['selbulan'] = $modelref->selBln()->getResult();
$p['selkpp'] = $modelref->selKpp($kwl)->getResult();
//$p['selseksi'] = $modelref->selSeksi()->getResult();
$p['selklu'] = $modelref->selKLU()->getResult();
$p['selmap'] = $modelref->selMAP()->getResult();
$p['selkjs'] = $modelref->selKJS()->getResult();
$p['PoC'] = $model->getMAPKJSPoC($param)->getResult();
$p['SoF'] = $model->getMAPKJSSoF($param)->getResult();
$p['dtmapkjs'] = $model->gmapkjs($param)->getResult();
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('ppm/gmapkjs', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
public function grafMAPKJS()
{
if (session('isLogin')) {
$uri = service('uri');
$model = new Mpemby();
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$kdmap = $uri->getSegment(8);
$kjs = $uri->getSegment(9);
$kategori = $uri->getSegment(10);
$tahunl = $tahun - 1;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun, 'kdmap' => $kdmap, 'kjs' => $kjs, 'kategori' => $kategori);
$getmod = $model->gmapkjs($param)->getResult();
$series1 = array();
$series1['name'] = 'Jumlah WP ' . $tahun . '';
$series1['type'] = 'spline';
$series2 = array();
$series2['name'] = 'Jumlah WP ' . $tahunl . '';
$series2['type'] = 'spline';
$series3 = array();
$series3['name'] = 'Bayar ' . $tahun . '';
$series3['type'] = 'spline';
$series4 = array();
$series4['name'] = 'Bayar ' . $tahunl . '';
$series4['type'] = 'spline';
$series5 = array();
$series5['name'] = 'Growth WP Bayar(%)';
$series5['type'] = 'spline';
$series6 = array();
$series6['name'] = 'Growth Pembayaran(%)';
$series6['type'] = 'spline';
$series7 = array();
$series7['name'] = 'Populasi';
$series7['type'] = 'spline';
$series8 = array();
$series8['name'] = 'Coverage Ratio(%)';
$series8['type'] = 'spline';
$category = 0;
foreach ($getmod as $row) {
$growthwp = (($row->WPBYRNOW - $row->WPBYRPAST) / ($row->WPBYRPAST ?: 1)) * 100;
$growthbayar = (($row->JMLBYRNOW - $row->JMLBYRPAST) / ($row->JMLBYRPAST ?: 1)) * 100;
$covratio = ($row->WPBYRNOW / ($row->POPULASI ?: 1)) * 100;
$series1['data'][] = (float) $row->WPBYRNOW;
$series1['color'] = 'green';
$series2['data'][] = (float) $row->WPBYRPAST;
$series2['color'] = 'gold';
$series3['data'][] = (float) $row->JMLBYRNOW;
$series3['color'] = 'red';
$series4['data'][] = (float) $row->JMLBYRPAST;
$series4['color'] = 'blue';
$series5['data'][] = number_format((float) $growthwp, 2);
$series5['color'] = 'purple';
$series6['data'][] = number_format((float) $growthbayar, 2);
$series6['color'] = 'pink';
$series7['data'][] = (float) $row->POPULASI;
$series7['color'] = 'yellow';
$series8['data'][] = number_format((float) $covratio, 2);
$series8['color'] = 'magenta';
}
$hasil = array();
array_push($hasil, $category);
array_push($hasil, $series1);
array_push($hasil, $series2);
array_push($hasil, $series3);
array_push($hasil, $series4);
array_push($hasil, $series5);
array_push($hasil, $series6);
array_push($hasil, $series7);
array_push($hasil, $series8);
echo json_encode($hasil, JSON_NUMERIC_CHECK);
} else {
return redirect()->to('auth');
}
}
function ppm()
{
if (session('isLogin')) {
$uri = service('uri');
$pager = service('pager');
$model = new Mpemby();
$modelref = new Mref();
if (session('tpkantor') == 'KPDJP') {
$kwl = $this->request->getGet('kwl') ?? '090';
$kpp = $this->request->getGet('kpp') ?? 'SEMUA';
$seksi = $this->request->getGet('seksi') ?? 'SEMUA';
$nip = $this->request->getGet('nip') ?? 'SEMUA';
} else if (session('tpkantor') == 'Kanwil') {
$kwl = session('kwladm');
$kpp = $this->request->getGet('kpp') ?? 'SEMUA';
$seksi = $this->request->getGet('seksi') ?? 'SEMUA';
$nip = $this->request->getGet('nip') ?? 'SEMUA';
} else {
$kwl = session('kwladm');
$kpp = session('kppadm');
$seksi = $this->request->getGet('seksi') ?? 'SEMUA';
$nip = $this->request->getGet('nip') ?? 'SEMUA';
}
$ptahun = $this->request->getGet('tahun');
$kdmap = $this->request->getGet('kdmap');
$kjs = $this->request->getGet('kjs');
if (empty($ptahun)) {
$tahun = date('Y');
} else {
$tahun = $ptahun;
}
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 20;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'tahun' => $tahun, 'seksi' => $seksi, 'nip' => $nip, 'kdmap' => $kdmap, 'kjs' => $kjs, 'page' => $page, 'perPage' => $perPage);
$total = $model->cgetPPM($param)->getNumRows();
$data = $model->getPPM($param);
$pager_links = $pager->makeLinks($page, $perPage, $total);
$p['pager_links'] = $pager_links;
$p['datppm'] = $data->paginate($perPage, 'ppm');
$p['nomor'] = nomor($this->request->getVar('page_ppm'), $perPage);
$p['pager'] = $data->pager;
$p['kwlx'] = $kwl;
$p['kppx'] = $kpp;
$p['seksix'] = $seksi;
$p['nipx'] = $nip;
$p['tahunx'] = $tahun;
$p['mapx'] = $kdmap;
$p['kjsx'] = $kjs;
$p['selkwl'] = $modelref->selKwl()->getResult();
$p['selbulan'] = $modelref->selBln()->getResult();
$p['selkpp'] = $modelref->selKpp($kwl)->getResult();
//$p['selseksi'] = $modelref->selSeksi()->getResult();
$p['selklu'] = $modelref->selKLU()->getResult();
$p['selmap'] = $modelref->selMAP()->getResult();
$p['selkjs'] = $modelref->selKJS()->getResult();
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('ppm/vppm', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function wpskpoc(){
if (session('isLogin')) {
$uri = service('uri');
$param = array(
'tahun' => $uri->getSegment('3'),
'bulan' => $uri->getSegment('4'),
'kwl' => $uri->getSegment('5'),
'kpp' => $uri->getSegment('6'),
'src' => $uri->getSegment('7')
);
$p['sourcex'] = $uri->getSegment('7');
$model = new Mpemby();
$p['paycomp'] = $model->wpsk_paycompNas($param)->getResult();
echo view('ppm/wpskpoc', $p);
} else {
return redirect()->to('auth');
}
}
function wpsksof(){
if (session('isLogin')) {
$uri = service('uri');
$param = array(
'tahun' => $uri->getSegment('3'),
'bulan' => $uri->getSegment('4'),
'kwl' => $uri->getSegment('5'),
'kpp' => $uri->getSegment('6'),
'src' => $uri->getSegment('7')
);
$p['sourcex'] = $uri->getSegment('7');
$p['tahunx'] = $uri->getSegment('3');
$model = new Mpemby();
$p['SoF'] = $model->wpsk_sofNas($param)->getResult();
echo view('ppm/wpsksof', $p);
} else {
return redirect()->to('auth');
}
}
}