diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php index a868447a..37dafdc0 100644 --- a/app/Config/Boot/development.php +++ b/app/Config/Boot/development.php @@ -21,7 +21,7 @@ ini_set('display_errors', '1'); | backtraces along with the other error information. If you would | prefer to not see this, set this value to false. */ -defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true); +defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', false); /* |-------------------------------------------------------------------------- diff --git a/app/Controllers/Auth.php b/app/Controllers/Auth.php index c50ab538..aa0609f9 100644 --- a/app/Controllers/Auth.php +++ b/app/Controllers/Auth.php @@ -16,11 +16,11 @@ class Auth extends Controller { $session = session(); $model = new Mauth(); - $uname = $this->request->getVar('username'); - $password = $this->request->getVar('password'); + $username = $this->request->getVar('username'); + //$password = $this->request->getVar('password'); + - $param = array('name' => $uname, 'passwd' => $password); - $data = $model->cekuser($param)->getRowArray(); + $data = $model->cekuser($username)->getRowArray(); // var_dump($data); //exit(); if ($data) { @@ -45,6 +45,94 @@ class Auth extends Controller } } + + function ldap_auth() + { + $username = $this->request->getVar('username'); + $password = $this->request->getVar('password'); + $session = session(); + if ($password == "") return redirect()->to(base_url('auth')); + else { + $model = new Mauth(); + $ldaprdn = 'INTRANET' . "\\" . $username; + $adServer = "ldap://10.254.28.141"; + $ldap = ldap_connect($adServer); + ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + $bind = @ldap_bind($ldap, $ldaprdn, $password); + + if ($bind) { + $filter = "(&(objectCategory=person)(objectClass=user)(cn={$username}*) )"; + $ldap_base_dn = "OU=Pegawai DJP,DC=intranet,DC=pajak,DC=go,DC=id"; + $result = ldap_search($ldap, $ldap_base_dn, $filter); + $info = ldap_get_entries($ldap, $result); + for ($i = 0; $i < $info["count"]; $i++) { + if ($info['count'] > 1) break; + $_SESSION['usr'] = $username; + $_SESSION['nama'] = $info[$i]["displayname"][0]; + $_SESSION['nip'] = $info[$i]["employeenumber"][0]; + } + @ldap_close($ldap); + + $data = $model->cekuser($username)->getRowArray(); + $ses_data = [ + 'nip' => $data['NIP9'], + 'nipp' => $data['NIP18'], + 'nama' => $data['NAMA'], + 'kppadm' => $data['KPPADM'], + 'jabatan' => $data['NAMA_JABATAN'], + 'kantor' => $data['NAMA_KANTOR'], + 'seksi' => $data['NAMA_UNIT_ES3'], + 'isLogin' => true + ]; + $session->set($ses_data); + return redirect()->to(base_url('Home')); + } else { + $ldaprdn = 'INTRANET' . "\\" . $username; + $adServer = "ldap://10.254.28.142"; + $ldap = ldap_connect($adServer); + ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + $bind = @ldap_bind($ldap, $ldaprdn, $password); + + if ($bind) { + $filter = "(&(objectCategory=person)(objectClass=user)(cn={$username}*) )"; + $ldap_base_dn = "OU=Pegawai DJP,DC=intranet,DC=pajak,DC=go,DC=id"; + $result = ldap_search($ldap, $ldap_base_dn, $filter); + $info = ldap_get_entries($ldap, $result); + for ($i = 0; $i < $info["count"]; $i++) { + if ($info['count'] > 1) break; + $_SESSION['usr'] = $username; + $_SESSION['nama'] = $info[$i]["displayname"][0]; + $_SESSION['nip'] = $info[$i]["employeenumber"][0]; + } + @ldap_close($ldap); + + $data = $model->cekuser($username)->getRowArray(); + $ses_data = [ + 'nip' => $data['NIP9'], + 'nipp' => $data['NIP18'], + 'nama' => $data['NAMA'], + 'kppadm' => $data['KPPADM'], + 'jabatan' => $data['NAMA_JABATAN'], + 'kantor' => $data['NAMA_KANTOR'], + 'seksi' => $data['NAMA_UNIT_ES3'], + 'isLogin' => true + ]; + $session->set($ses_data); + return redirect()->to(base_url('Home')); + + // return true; + } else { + return redirect()->to(base_url('auth')); + } + } + } + } + + public function logout() { $session = session(); diff --git a/app/Models/Mauth.php b/app/Models/Mauth.php index 40d2553b..740234ed 100644 --- a/app/Models/Mauth.php +++ b/app/Models/Mauth.php @@ -7,11 +7,10 @@ use CodeIgniter\Model; class Mauth extends Model { - function cekuser($param) + function cekuser($username) { - $uname = $param['name']; $builder = $this->db->table('PEGAWAI'); - $builder->where('NIP9', $uname); + $builder->where('NIP9', $username); return $builder->get(); } } diff --git a/app/Models/Mpemby.php b/app/Models/Mpemby.php index c1cd5e97..4311e030 100644 --- a/app/Models/Mpemby.php +++ b/app/Models/Mpemby.php @@ -37,6 +37,8 @@ class Mpemby extends Model $bln = date('m'); $query = $this->db->query("SELECT CASE WHEN KD_KATEGORI IS NULL THEN '-' ELSE KD_KATEGORI END KODE, CASE WHEN KD_KATEGORI IS NULL THEN 'UNKNOWN' ELSE NM_KATEGORI END NMKAT, + SUM(CASE WHEN THNBYR = '" . $tahun . "' AND BLNBYR = '" . $bln . "' THEN WPBAYAR ELSE 0 END)WPBYRN, + SUM(CASE WHEN THNBYR = '" . $tahunl . "' AND BLNBYR = '" . $bln . "' THEN WPBAYAR ELSE 0 END)WPBYRP, SUM(CASE WHEN THNBYR = '" . $tahun . "' AND BLNBYR = '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) KPENN, SUM(CASE WHEN THNBYR = '" . $tahunl . "' AND BLNBYR = '" . $bln . "' THEN ROUND(TOTAL) ELSE 0 END) KPENP FROM PERKATEGORI_MV diff --git a/app/Views/pages/loginv.php b/app/Views/pages/loginv.php index f5e42ea7..aa2ead28 100644 --- a/app/Views/pages/loginv.php +++ b/app/Views/pages/loginv.php @@ -28,7 +28,7 @@ <?php if (session()->getFlashdata('msg')) : ?> <div class="alert alert-danger"><?= session()->getFlashdata('msg') ?></div> <?php endif; ?> - <form action="<?php base_url() ?>auth/login" method="post"> + <form action="<?php base_url() ?>auth/ldap_auth" method="post"> <div class="form-floating mb-3"> <input class="form-control" name="username" id="username" type="text" placeholder="NIP 9 Digit" /> diff --git a/app/Views/ppm/dashboard.php b/app/Views/ppm/dashboard.php index d5aa40d3..7e00064b 100644 --- a/app/Views/ppm/dashboard.php +++ b/app/Views/ppm/dashboard.php @@ -107,7 +107,9 @@ foreach ($penerimaan as $row) { </div> <div class="col-lg-6 col-md-12"> - <div class="col text-center"><b>Strategis</b></div> + <div class="col text-center"> + <h5>Strategis</h5> + </div> <div class="row mb-15"> <div class="col-9">Penerimaan</div> <div class="col-3 text-right">28%</div> @@ -168,7 +170,9 @@ foreach ($penerimaan as $row) { </div> </div> <div class=" col-lg-6 col-md-12"> - <div class="col text-center"><b>Kewilayahan</b></div> + <div class="col text-center"> + <h5>Kewilayahan</h5> + </div> <div class="row mb-15"> <div class="col-9">Penerimaan</div> <div class="col-3 text-right">28%</div> @@ -528,20 +532,39 @@ foreach ($penerimaan as $row) { <tr class="table-active"> <th class="text-center">Kode</th> <th class="text-center">Kategori</th> - <th class="text-center">Penerimaan <?= $tahunx ?></th> - <th class="text-center">Penerimaan <?= $tahunx - 1 ?></th> - <th class="text-center">Growth (%)</th> + <th class="text-center">Wp Bayar <?= $tahunx ?></th> + <th class="text-center">Wp Bayar <?= $tahunx - 1 ?></th> + <th class="text-center">gw WP Bayar (%)</th> + <th class="text-center">Realisasi <?= $tahunx ?></th> + <th class="text-center">Realisasi <?= $tahunx - 1 ?></th> + <th class="text-center">gw Penerimaan (%)</th> </tr> </thead> <?php foreach ($perkategori as $row) { + $gwwp = (($row->WPBYRN - $row->WPBYRP) / $row->WPBYRP) * 100; $gwkat = (($row->KPENN - $row->KPENP) / $row->KPENP) * 100; + + if ($gwwp < 0) { + $markgww = "text-danger"; + } else { + $markgww = "text-success"; + } + + if ($gwkat < 0) { + $markgwk = "text-danger"; + } else { + $markgwk = "text-success"; + } ?> <tbody> <td><?= $row->KODE ?></td> <td><?= $row->NMKAT ?></td> + <td class="text-right"><?= number_format($row->WPBYRN, 0, ',', '.') ?></td> + <td class="text-right"><?= number_format($row->WPBYRP, 0, ',', '.') ?></td> + <td class="text-center <?= $markgww ?>"><?= number_format($gwwp, 2) ?></td> <td class="text-right"><?= number_format($row->KPENN, 0, ',', '.') ?></td> <td class="text-right"><?= number_format($row->KPENP, 0, ',', '.') ?></td> - <td class="text-center"><?= number_format($gwkat, 2) ?></td> + <td class="text-center <?= $markgwk ?>"><?= number_format($gwkat, 2) ?></td> </tbody> <?php } ?> </table>