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.

62 lines
1.7 KiB

11 months ago
<?php
namespace App\Models;
use CodeIgniter\Model;
class Mbyrlpr extends Model
{
protected $table = 'DASHBOARD_BYRLPR';
function cdetKat($param)
{
$tahun = $param['tahun'];
$kwl = $param['kwl'];
$kpp = $param['kpp'];
$seksi = $param['seksi'];
$nip = $param['nip'];
$pilihan = $param['pilihan'];
if ($pilihan == '1') {
$cekpil = "AND JMLBYR IS NOT NULL AND BYRLALU IS NULL";
} else if ($pilihan == '2') {
$cekpil = "AND JMLBYR IS NULL AND BYRLALU IS NOT NULL";
}
$query = $this->db->query("SELECT COUNT(1) NUMROWS FROM DASHBOARD_BYRLPR WHERE TAHUN = '" . $tahun . "' AND KWLADM = '" . $kwl . "' AND KPPADM = '" . $kpp . "' AND KODESIE = '" . $seksi . "' AND NIP_AR = '" . $nip . "' $cekpil ");
return $query;
}
function detKat($param)
{
$tahun = $param['tahun'];
$kwl = $param['kwl'];
$kpp = $param['kpp'];
$seksi = $param['seksi'];
$nip = $param['nip'];
$offset = $param['page'];
$limit = $param['perPage'];
$pilihan = $param['pilihan'];
if ($pilihan == '1') {
$jmlbyrn = "JMLBYR IS NOT NULL";
$jmlbyrp = "BYRLALU IS NULL";
} else if ($pilihan == '2') {
$jmlbyrn = "JMLBYR IS NULL";
$jmlbyrp = "BYRLALU IS NOT NULL";
}
$this->builder()
->where('TAHUN', $tahun)
->where('KWLADM', $kwl)
->where('KPPADM', $kpp)
->where('KODESIE', $seksi)
->where('NIP_AR', $nip)
->where($jmlbyrn)
->where($jmlbyrp)
->limit($limit, $offset);
return $this;
}
}