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.
 
 
 
 
 
 

138 lines
5.2 KiB

<?php
namespace App\Controllers;
use App\Models\MKanwil;
use App\Models\Mref;
class Kanwil extends BaseController
{
public function index()
{
if (session('isLogin')) {
$model = new MKanwil();
$modelref = new Mref;
if (session('tpkantor') == 'KPDJP') {
$kwl = $this->request->getPost('kwl') ?? '170';
$kpp = $this->request->getPost('kpp') ?? 'SEMUA';
} else if (session('tpkantor') == 'Kanwil') {
$kwl = session('kppadm');
$kpp = $this->request->getPost('kpp') ?? 'SEMUA';
} else {
$kwl = session('kwladm');
$kpp = session('kppadm');
}
$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('kwl' => $kwl, 'kpp' => $kpp, 'tahun' => $tahun, 'bln' => $bulan);
$p['kwlx'] = $kwl;
$p['kppx'] = $kpp;
$p['tahunx'] = $tahun;
$p['bulanx'] = $bulan;
$p['selkwl'] = $modelref->selKwl()->getResult();
$p['selkpp'] = $modelref->selKpp($kwl)->getResult();
$p['refbulan'] = $modelref->getBln();
$p['updatex'] = $modelref->getUpd()->getFirstRow('array');
$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($param)->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('kanwil/dashboard', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
public function getWPBYR()
{
$uri = service('uri');
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$tahun = $uri->getSegment(5);
$tahunl = $tahun - 1;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'tahun' => $tahun);
$model = new Mkanwil();
$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);
}
}