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.
 
 
 
 
 
 

349 lines
12 KiB

<?php
namespace App\Controllers;
use App\Models\Mseksi;
use App\Models\Mref;
use App\Models\Mdetkat;
use App\Models\Mdetpaycomp;
use App\Models\Mbyrlpr;
class Seksiar extends BaseController
{
function index()
{
if (session('isLogin')) {
$model = new Mseksi();
$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');
if (empty($ptahun)) {
$tahun = date('Y');
} else {
$tahun = $ptahun;
}
if (empty($pbulan)) {
$bulan = date('m');
} else {
$bulan = $pbulan;
}
$tahunl = $tahun - 1;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'tahun' => $tahun, 'bln' => $bulan, 'seksi' => $seksi, 'nip' => $nip);
$p['kwlx'] = $kwl;
$p['kppx'] = $kpp;
$p['seksix'] = $seksi;
$p['nipx'] = $nip;
$p['tahunx'] = $tahun;
$p['tahunlx'] = $tahunl;
$p['bulanx'] = $bulan;
$p['selkwl'] = $modelref->selKwl('')->getResult();
$p['selkpp'] = $modelref->selKpp($kwl)->getResult();
$p['selseksi'] = $modelref->selSeksi($kpp)->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['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/vseksiar', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function getWPBYR()
{
$uri = service('uri');
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$tahunl = $tahun - 1;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun);
$model = new Mseksi();
$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 ?: 1)) * 100;
$growthbayar = (($row->JMLBYRNOW - $row->JMLBYRPAST) / ($row->JMLBYRPAST ?: 1)) * 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);
}
public function detSOF()
{
if (session('isLogin')) {
$uri = service('uri');
$pager = service('pager');
$model = new Mseksi();
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$lapisan = $uri->getSegment(8);
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 20;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun, 'lapisan' => $lapisan, 'page' => $page, 'perPage' => $perPage);
$total = $model->cdetSOF($param)->getNumRows();
$data = $model->detSOF($param);
//$total = $model->detSOF($param)->get()->getNumRows();
$pager_links = $pager->makeLinks($page, $perPage, $total);
$p['pager_links'] = $pager_links;
$p = [
'detsof' => $data->paginate($perPage, 'detsof'),
'nomor' => nomor($this->request->getVar('page_detsof'), $perPage),
'pager' => $data->pager,
];
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('kanwil/vdetsof', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function detKAT()
{
if (session('isLogin')) {
$uri = service('uri');
$pager = service('pager');
$model = new Mdetkat();
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$bln = $uri->getSegment(8);
$kategori = $uri->getSegment(9);
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 20;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun, 'bln' => $bln, 'kategori' => $kategori, 'page' => $page, 'perPage' => $perPage);
$total = $model->cdetKat($param)->getNumRows();
$data = $model->detKat($param);
$pager_links = $pager->makeLinks($page, $perPage, $total);
$p['pager_links'] = $pager_links;
$p = [
'detkat' => $data->paginate($perPage, 'detkat'),
'nomor' => nomor($this->request->getVar('page_detkat'), $perPage),
'pager' => $data->pager,
];
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('kanwil/vdetkat', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function detpaycomp()
{
if (session('isLogin')) {
$uri = service('uri');
$pager = service('pager');
$model = new Mdetpaycomp();
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$jmlbln = $uri->getSegment(8);
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 20;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun, 'jmlbln' => $jmlbln, 'page' => $page, 'perPage' => $perPage);
$total = $model->cdetKat($param)->getNumRows();
$data = $model->detKat($param);
$pager_links = $pager->makeLinks($page, $perPage, $total);
$p['pager_links'] = $pager_links;
$p = [
'detkat' => $data->paginate($perPage, 'detkat'),
'nomor' => nomor($this->request->getVar('page_detkat'), $perPage),
'pager' => $data->pager,
];
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('kanwil/vdetkat', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
function detbyrlpr()
{
if (session('isLogin')) {
$uri = service('uri');
$pager = service('pager');
$model = new Mbyrlpr();
$kwl = $uri->getSegment(3);
$kpp = $uri->getSegment(4);
$seksi = $uri->getSegment(5);
$nip = $uri->getSegment(6);
$tahun = $uri->getSegment(7);
$pilihan = $uri->getSegment(8);
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 20;
$param = array('kwl' => $kwl, 'kpp' => $kpp, 'seksi' => $seksi, 'nip' => $nip, 'tahun' => $tahun, 'pilihan' => $pilihan, 'page' => $page, 'perPage' => $perPage);
$qtotal = $model->cdetKat($param)->getFirstRow('array');
$total = $qtotal['NUMROWS'];
$data = $model->detKat($param);
$pager_links = $pager->makeLinks($page, $perPage, $total);
$p['pager_links'] = $pager_links;
$p = [
'detbyrlpr' => $data->paginate($perPage, 'byrlpr'),
'nomor' => nomor($this->request->getVar('page_byrlpr'), $perPage),
'pager' => $data->pager,
];
echo view('inc/head');
echo view('inc/navbar');
echo view('inc/sidebar');
echo view('kanwil/vbyrlpr', $p);
echo view('inc/footer');
} else {
return redirect()->to('auth');
}
}
}