<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report_hakim extends CI_Model{
	
	function get_info_pn(){
		try {
			$this->db->select('*');
			$this->db->where('id >=', 61); 
			return $this->db->get('sys_config');
		} catch (Exception $e) {
			log_message('error', $e);
		}
	}
	function getJenisPerkara($idalurperkara){
		if(empty($idalurperkara)) return '';
		try {
			$this->db->where('id',$idalurperkara);
			return $this->db->get('alur_perkara')->row()->nama;
		} catch (Exception $e) {
			log_message('error', $e);
		}
	}

	function get_rekap($idalurperkara,$year){
		try {
			return $this->db->query("
				select 
				".$year." as tahun
				,h.`hakim_id` as hakim_id
				,UPPER(hpn.nama) AS hakim_nama
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-01' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-01')) and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus01
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-01' ) and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk01
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-01' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-01')) and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) 
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-01' ) and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0))) as Beban01
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-01' and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as Putus01
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-01' and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut01
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-01' and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur01
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-01' and CONCAT('".$year."','-01') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi01

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-02' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-02')) and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus02
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-02' ) and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk02
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-02' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-02')) and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-02' ) and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0))) as Beban02
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-02' and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as Putus02
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-02' and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut02
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-02' and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur02
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-02' and CONCAT('".$year."','-02') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi02

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-03' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-03')) and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus03
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-03') and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk03
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-03' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-03')) and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-03') and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0))) as Beban03
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-03' and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as Putus03
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-03' and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut03
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-03' and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur03
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-03' and CONCAT('".$year."','-03') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi03

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-04' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-04')) and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus04
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-04' ) and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk04
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-04' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-04')) and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-04' ) and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0))) as Beban04
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-04' and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as Putus04
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-04' and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut04
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-04' and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur04
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-04' and CONCAT('".$year."','-04') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi04

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-05' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-05')) and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus05
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-05' ) and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk05
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-05' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-05')) and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-05' ) and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0))) as Beban05
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-05' and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as Putus05
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-05' and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut05
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-05' and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur05
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-05' and CONCAT('".$year."','-05') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi05

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-06' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-06')) and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus06
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-06' ) and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk06
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-06' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-06')) and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-06' ) and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0))) as Beban06
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-06' and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as Putus06
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-06' and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut06
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-06' and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur06
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-06' and CONCAT('".$year."','-06') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi06

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-07' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-07')) and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus07
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-07' ) and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk07
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-07' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-07')) and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) 
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-07' ) and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0))) as Beban07
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-07' and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as Putus07
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-07' and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut07
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-07' and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur07
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-07' and CONCAT('".$year."','-07') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi07

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-08' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-08')) and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus08
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-08' ) and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk08
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-08' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-08')) and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0))  
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-08' ) and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0))) as Beban08
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-08' and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as Putus08
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-08' and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut08
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-08' and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur08
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-08' and CONCAT('".$year."','-08') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi08

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-09' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-09')) and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus09
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-09' ) and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk09
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-09' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-09')) and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) 
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-09' ) and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0))) as Beban09
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-09' and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as Putus09
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-09' and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut09
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-09' and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur09
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-09' and CONCAT('".$year."','-09') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi09

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-10' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-10')) and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus10
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-10' ) and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk10
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-10' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-10')) and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) 
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-10' ) and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0))) as Beban10
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-10' and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as Putus10
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-10' and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut10
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-10' and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur10
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-10' and CONCAT('".$year."','-10') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi10

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-11' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-11')) and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus11
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-11' ) and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk11
				,(SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-11' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-11')) and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0))
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-11' ) and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0))) as Beban11
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-11' and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as Putus11
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-11' and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut11
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-11' and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur11
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-11' and CONCAT('".$year."','-11') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi11

				,SUM(if((LEFT(p.tanggal_pendaftaran,7) < '".$year."-12' AND (putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-12')) and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as BelumPutus12
				,SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-12' ) and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as Masuk12
				,(SUM(if((putus.tanggal_putusan is null  or LEFT(putus.tanggal_putusan,7) >= '".$year."-12') and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) 
				 + SUM(if((LEFT(p.tanggal_pendaftaran,7) = '".$year."-12' ) and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0))) as Beban12
				,SUM(if(LEFT(putus.tanggal_putusan,7) = '".$year."-12' and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as Putus12
				,SUM(if(LEFT(tanggal_cabut,7) = '".$year."-12' and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as Cabut12
				,SUM(if(LEFT(tanggal_gugur,7) = '".$year."-12' and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as Gugur12
				,SUM(if(LEFT(mediasi.mediasi_berhasil,7) = '".$year."-12' and CONCAT('".$year."','-12') <= left(CURRENT_DATE(),7) ,1,0)) as Mediasi12


				,SUM(if((year(p.tanggal_pendaftaran) < ".$year." AND (putus.tanggal_putusan is null  or year(putus.tanggal_putusan) >= ".$year." )),1,0)) as BelumPutusTahunLalu
				,SUM(if((year(p.tanggal_pendaftaran) = ".$year." ),1,0)) as MasukTahunIni
				,(SUM(if((year(p.tanggal_pendaftaran) < ".$year." AND (putus.tanggal_putusan is null  or year(putus.tanggal_putusan) >= ".$year." )),1,0)) 
				 + SUM(if((year(p.tanggal_pendaftaran) = ".$year." ),1,0))) as BebanTahunIni
				,SUM(if(year(putus.tanggal_putusan) =".$year.",1,0)) as PutusTahunIni
				,SUM(if(year(tanggal_cabut)=".$year.",1,0)) as CabutTahunIni
				,SUM(if(year(tanggal_gugur) =".$year.",1,0)) as GugurTahunIni
				,SUM(if(year(mediasi.mediasi_berhasil)=".$year.",1,0)) as MediasiBerhasilTahunIni
				,SUM(if((year(p.tanggal_pendaftaran) <= ".$year." AND (putus.tanggal_putusan is null  or year(putus.tanggal_putusan) > ".$year." )),1,0)) as SisaAkhir

				FROM 
				perkara_hakim_pn AS h 
				LEFT OUTER JOIN hakim_pn AS hpn ON  h.hakim_id= hpn.id 
				JOIN perkara AS p ON  h.`perkara_id`= p.`perkara_id` AND h.`aktif`='Y'
				LEFT OUTER JOIN perkara_mediasi AS mediasi ON  p.`perkara_id`= mediasi.`perkara_id` 
				LEFT OUTER JOIN perkara_putusan AS putus ON  p.`perkara_id`= putus.`perkara_id` 
				WHERE 
				alur_perkara_id in (".$idalurperkara.") and 
				( 
					( year(p.tanggal_pendaftaran) < ".$year." and (year(putus.tanggal_putusan) is null or year(mediasi.mediasi_berhasil) is null )) 
					or 
					(year(p.tanggal_pendaftaran) = ".$year.") 
				)
				GROUP BY 
				h.`hakim_id`,hpn.`nama`
				order by hpn.`nama` ;");
		} catch (Exception $e) {
			
		}
	}
}