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.
91 lines
2.6 KiB
91 lines
2.6 KiB
<?php |
|
|
|
namespace App\Models; |
|
|
|
use CodeIgniter\Model; |
|
|
|
class Mdetkat extends Model |
|
{ |
|
|
|
|
|
protected $table = 'DASHBOARD_BESAR_MAPKJS'; |
|
|
|
function cdetKat($param) |
|
{ |
|
$tahun = $param['tahun']; |
|
$bln = $param['bln']; |
|
$kwl = $param['kwl']; |
|
$kpp = $param['kpp']; |
|
$seksi = $param['seksi']; |
|
$nip = $param['nip']; |
|
$kategori = $param['kategori']; |
|
|
|
if ($kpp == "SEMUA") { |
|
$cekkpp = ""; |
|
} else { |
|
$cekkpp = "AND KPPADM = '" . $kpp . "'"; |
|
} |
|
|
|
if ($seksi == "SEMUA") { |
|
$cekseksi = ""; |
|
} else { |
|
$cekseksi = |
|
"AND KODESIE = '" . $seksi . "'"; |
|
} |
|
if ($nip == "SEMUA") { |
|
$ceknip = ""; |
|
} else { |
|
$ceknip = "AND NIP = '" . $nip . "'"; |
|
} |
|
$query = $this->db->query("SELECT NPWP,NAMA,KATEGORI,TOTAL |
|
FROM DASHBOARD_BESAR_MAPKJS |
|
WHERE THNBYR = '" . $tahun . "' |
|
AND KWLADM = '" . $kwl . "' |
|
AND BLNBYR <= '" . $bln . "' |
|
AND KATEGORI='" . $kategori . "' $cekkpp $cekseksi $ceknip"); |
|
return $query; |
|
} |
|
|
|
function detKat($param) |
|
{ |
|
|
|
$tahun = $param['tahun']; |
|
$bln = $param['bln']; |
|
$kwl = $param['kwl']; |
|
$kpp = $param['kpp']; |
|
$seksi = $param['seksi']; |
|
$nip = $param['nip']; |
|
$offset = $param['page']; |
|
$limit = $param['perPage']; |
|
$kategori = $param['kategori']; |
|
|
|
|
|
if ($kpp == "SEMUA" && $seksi == "SEMUA" && $nip == "SEMUA") { |
|
$array |
|
= ['KWLADM' => $kwl ]; |
|
} else if($kpp != "SEMUA" && $seksi == "SEMUA" && $nip == "SEMUA") { |
|
$array |
|
= [ 'KWLADM' => $kwl, 'KPPADM' => $kpp]; |
|
}else if ($kpp != "SEMUA" && $seksi != "SEMUA" && $nip == "SEMUA"){ |
|
$array |
|
= [ 'KWLADM' => $kwl, 'KPPADM' => $kpp, 'KODESIE' => $seksi]; |
|
} |
|
|
|
else if ($kpp != "SEMUA" && $seksi != "SEMUA" && $nip != "SEMUA") { |
|
$array |
|
= [ 'KWLADM' => $kwl, 'KODESIE' => $seksi, 'NIP' => $nip]; |
|
} |
|
|
|
$this->builder() |
|
->select('NPWP,NAMA') |
|
->selectSum('TOTAL') |
|
->where('THNBYR' ,$tahun) |
|
->where('KATEGORI', $kategori) |
|
->where('BLNBYR <=', $bln) |
|
->where($array) |
|
->groupBy('NPWP,NAMA') |
|
->limit($limit, $offset); |
|
|
|
return $this; |
|
} |
|
}
|
|
|