AnonSec Team
Server IP : 127.0.0.1  /  Your IP : 127.0.0.1
Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586
User : GerbangSIPAD ( 0)
PHP Version : 5.6.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF
Directory (0777) :  C:/xampp5/htdocs/bhumie/protected/models/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : C:/xampp5/htdocs/bhumie/protected/models/DatObjekPajak.php
<?php

/**
 * This is the model class for table "pbb.dat_objek_pajak".
 *
 * The followings are the available columns in table 'pbb.dat_objek_pajak':
 * @property string $kd_propinsi
 * @property string $kd_dati2
 * @property string $kd_kecamatan
 * @property string $kd_kelurahan
 * @property string $kd_blok
 * @property string $no_urut
 * @property string $kd_jns_op
 * @property string $subjek_pajak_id
 * @property string $no_formulir_spop
 * @property string $no_persil
 * @property string $jalan_op
 * @property string $blok_kav_no_op
 * @property string $rw_op
 * @property string $rt_op
 * @property integer $kd_status_cabang
 * @property string $kd_status_wp
 * @property string $total_luas_bumi
 * @property string $total_luas_bng
 * @property string $njop_bumi
 * @property string $njop_bng
 * @property integer $status_peta_op
 * @property string $jns_transaksi_op
 * @property string $tgl_pendataan_op
 * @property string $nip_pendata
 * @property string $tgl_pemeriksaan_op
 * @property string $nip_pemeriksa_op
 * @property string $tgl_perekaman_op
 * @property string $nip_perekam_op
 * @property integer $createdby
 * @property string $createdtime
 * @property integer $updatedby
 * @property string $updatedtime
 */
class DatObjekPajak extends CBhumieRecord
{
	public $nop;
	public $letak_op;
	public $nm_wp;
	public $rt_rw;
	public $kd_znt;
	public $luas_bumi;
	public $luas_bng;
	public $njop_bumi;
	public $njop_bng;
	public $njop;
	public $listData;
	public $listDataSort;
	//public $nmrnop;
	public $kodeblok;
	public $nmrurut;
	public $kdjnsop;
	public $letakop;
	public $namawp;
	public $kdznt;
	public $subid;
	public $handphone;
        public $nop_lama;
        public $alamat_wp;
        public $jml_record;
        public $alamat_op;
        public $status_wp;
        public $alm_wp;
        public $pekerjaan;
        public $npwp;
        public $jns_bumi;
		
		public $nik;
		public $nip_sama;
		public $nm_wp_sama;
                
                public $njop_bumi_perm2;
                public $njop_bng_perm2;
		
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return DatObjekPajak the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'pbb.dat_objek_pajak';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			//array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, subjek_pajak_id, no_formulir_spop, jalan_op, tgl_pendataan_op, nip_pendata, tgl_pemeriksaan_op, nip_pemeriksa_op, nip_perekam_op, createdby, createdtime, updatedby, updatedtime', 'required'),
            //array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, subjek_pajak_id, no_formulir_spop, jalan_op, tgl_pendataan_op, nip_pendata, tgl_pemeriksaan_op, nip_pemeriksa_op, nip_perekam_op, listData, nmrnop, letakop, namawp, kdznt', 'required'),
            array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, subjek_pajak_id, no_formulir_spop, jalan_op, tgl_pendataan_op, nip_pendata, tgl_pemeriksaan_op, nip_pemeriksa_op, nip_perekam_op', 'required'),
			//array('kd_status_cabang, status_peta_op, createdby, updatedby', 'numerical', 'integerOnly'=>true),
            array('kd_status_cabang, status_peta_op', 'numerical', 'integerOnly'=>true),
			array('kd_propinsi, kd_dati2, rw_op, kdznt', 'length', 'max'=>2),
			array('kd_kecamatan, kd_kelurahan, kd_blok, rt_op, kodeblok', 'length', 'max'=>3),
			array('no_urut, nmrurut', 'length', 'max'=>4),
			array('kd_jns_op, kd_status_wp, jns_transaksi_op, kdjnsop', 'length', 'max'=>1),
			array('subjek_pajak_id, jalan_op, nik', 'length', 'max'=>30),
			array('no_formulir_spop', 'length', 'max'=>11),
			array('no_persil', 'length', 'max'=>5),
			array('blok_kav_no_op', 'length', 'max'=>15),
			array('nip_pendata, nip_pemeriksa_op, nip_perekam_op', 'length', 'max'=>18),
			array('nip_sama, nm_wp_sama', 'length', 'max'=>1),
			//array('nmrnop', 'length', 'max'=>10),
			array('total_luas_bumi, total_luas_bng, njop_bumi, njop_bng, tgl_perekaman_op, listData, listDataSort, kodeblok, nmrurut, kdjnsop, letakop, namawp, kdznt, nik, nip_sama, nm_wp_sama', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			//array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, subjek_pajak_id, no_formulir_spop, no_persil, jalan_op, blok_kav_no_op, rw_op, rt_op, kd_status_cabang, kd_status_wp, total_luas_bumi, total_luas_bng, njop_bumi, njop_bng, status_peta_op, jns_transaksi_op, tgl_pendataan_op, nip_pendata, tgl_pemeriksaan_op, nip_pemeriksa_op, tgl_perekaman_op, nip_perekam_op, createdby, createdtime, updatedby, updatedtime', 'safe', 'on'=>'search'),
            array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, subjek_pajak_id, no_formulir_spop, no_persil, jalan_op, blok_kav_no_op, rw_op, rt_op, kd_status_cabang, kd_status_wp, total_luas_bumi, total_luas_bng, njop_bumi, njop_bng, status_peta_op, jns_transaksi_op, tgl_pendataan_op, nip_pendata, tgl_pemeriksaan_op, nip_pemeriksa_op, tgl_perekaman_op, nip_perekam_op, nik, nip_sama, nm_wp_sama', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'kd_propinsi' => 'Kd Propinsi',
			'kd_dati2' => 'Kd Dati2',
			'kd_kecamatan' => 'Kecamatan',
			'kd_kelurahan' => 'Kelurahan',
			'kd_blok' => 'Kd Blok',
			'no_urut' => 'No Urut',
			'kd_jns_op' => 'Kd Jns Op',
			'subjek_pajak_id' => 'Subjek Pajak',
			'no_formulir_spop' => 'No Formulir Spop',
			'no_persil' => 'No Persil',
			'jalan_op' => 'Jalan',
			'blok_kav_no_op' => 'Blok/Kav/No',
			'rw_op' => 'Rw Op',
			'rt_op' => 'Rt Op',
			'kd_status_cabang' => 'Kd Status Cabang',
			'kd_status_wp' => 'Status WP',
			'total_luas_bumi' => 'Total Luas Bumi',
			'total_luas_bng' => 'Total Luas Bng',
			'njop_bumi' => 'Njop Bumi',
			'njop_bng' => 'Njop Bng',
			'status_peta_op' => 'Status Peta Op',
			'jns_transaksi_op' => 'Jns Transaksi Op',
			'tgl_pendataan_op' => 'Tgl Pendataan Op',
			'nip_pendata' => 'Nip Pendata',
			'tgl_pemeriksaan_op' => 'Tgl Pemeriksaan Op',
			'nip_pemeriksa_op' => 'Nip Pemeriksa Op',
			'tgl_perekaman_op' => 'Tgl Perekaman Op',
			'nip_perekam_op' => 'Nip Perekam Op',
			//'createdby' => 'Createdby',
			//'createdtime' => 'Createdtime',
			//'updatedby' => 'Updatedby',
			//'updatedtime' => 'Updatedtime',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
        
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('kd_propinsi',$this->kd_propinsi,true);
		$criteria->compare('kd_dati2',$this->kd_dati2,true);
		$criteria->compare('kd_kecamatan',$this->kd_kecamatan,true);
		$criteria->compare('kd_kelurahan',$this->kd_kelurahan,true);
		$criteria->compare('kd_blok',$this->kd_blok,true);
		$criteria->compare('no_urut',$this->no_urut,true);
		$criteria->compare('kd_jns_op',$this->kd_jns_op,true);
		$criteria->compare('subjek_pajak_id',$this->subjek_pajak_id,true);
		$criteria->compare('no_formulir_spop',$this->no_formulir_spop,true);
		$criteria->compare('no_persil',$this->no_persil,true);
		$criteria->compare('jalan_op',$this->jalan_op,true);
		$criteria->compare('blok_kav_no_op',$this->blok_kav_no_op,true);
		$criteria->compare('rw_op',$this->rw_op,true);
		$criteria->compare('rt_op',$this->rt_op,true);
		$criteria->compare('kd_status_cabang',$this->kd_status_cabang);
		$criteria->compare('kd_status_wp',$this->kd_status_wp,true);
		$criteria->compare('total_luas_bumi',$this->total_luas_bumi,true);
		$criteria->compare('total_luas_bng',$this->total_luas_bng,true);
		$criteria->compare('njop_bumi',$this->njop_bumi,true);
		$criteria->compare('njop_bng',$this->njop_bng,true);
		$criteria->compare('status_peta_op',$this->status_peta_op);
		$criteria->compare('jns_transaksi_op',$this->jns_transaksi_op,true);
		$criteria->compare('tgl_pendataan_op',$this->tgl_pendataan_op,true);
		$criteria->compare('nip_pendata',$this->nip_pendata,true);
		$criteria->compare('tgl_pemeriksaan_op',$this->tgl_pemeriksaan_op,true);
		$criteria->compare('nip_pemeriksa_op',$this->nip_pemeriksa_op,true);
		$criteria->compare('tgl_perekaman_op',$this->tgl_perekaman_op,true);
		$criteria->compare('nip_perekam_op',$this->nip_perekam_op,true);
		//$criteria->compare('createdby',$this->createdby);
		//$criteria->compare('createdtime',$this->createdtime,true);
		//$criteria->compare('updatedby',$this->updatedby);
		//$criteria->compare('updatedtime',$this->updatedtime,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	protected function beforeSave() {
        if (parent::beforeSave()) {

                if ($this->isNewRecord) {

	                 $thn_bundel = date('Y');

	                 $criteria = new CDbCriteria;
	                 $criteria->select = "max(no_formulir_spop) as no_formulir_spop";
	                 $criteria->condition = "substring(no_formulir_spop,1,4) = '" . $thn_bundel . "'";
	                 $findNoFormulir = DatObjekPajak::model()->find($criteria);

	                 $no_formulir = $findNoFormulir['no_formulir_spop'];

	                 //var_dump($this->no_formulir_spop. $no_formulir); exit();
	 
	                if($this->no_formulir_spop <= $no_formulir){
	                	if (substr($no_formulir,9,3) == '999'){
	                		$bundel = str_pad((string)(substr($no_formulir,4,4) + 1), 4, "0", STR_PAD_LEFT);

	                		$criteria2 = new CDbCriteria;
			                $criteria2->select = "max(substring(no_formulir_spop,9,3)) as no_formulir_spop";
			                $criteria2->condition = "substring(no_formulir_spop,1,4) = '" . $thn_bundel . "' and substring(no_formulir_spop,5,4) = '" . $bundel . "'";
			                $findNoUrut = DatObjekPajak::model()->find($criteria2);

	                		$urut = '001';
	                		$this->no_formulir_spop = $thn_bundel.$bundel.$urut;
	                	} else {
	                		$this->no_formulir_spop = $no_formulir + 1;
	                	}
	                 }
                } else {
                    $this->no_formulir_spop;
                }
            return true;
        } else {
            return false;
        }
    }

	public function searchDaftarRingkas()
	{
		$criteria = new CDbCriteria;

		$criteria->alias = 'a';
		$criteria->select = 'c.subjek_pajak_id as subid, c.handphone, a.kd_propinsi, a.kd_dati2, a.kd_kecamatan, a.kd_kelurahan, a.kd_propinsi||\'.\'||a.kd_dati2||\'.\'||a.kd_kecamatan||\'.\'||a.kd_kelurahan||\'.\'||a.kd_blok || \'-\' || a.no_urut || \'-\' || a.kd_jns_op as nop, trim(coalesce(a.jalan_op,\' \') || \' \' || coalesce(a.blok_kav_no_op,\' \')) as letak_op, coalesce(a.rw_op,\' \') || \' / \' || coalesce(a.rt_op, \' \') as rt_rw, coalesce(a.total_luas_bumi,0) as luas_bumi, coalesce(a.total_luas_bng,0) as luas_bng, coalesce(a.njop_bumi,0) as njop_bumi, coalesce(a.njop_bng,0) as njop_bng, coalesce(a.njop_bumi,0)+coalesce(a.njop_bng,0) as njop, b.kd_znt, trim(c.nm_wp) as nm_wp,
		case when coalesce(a.njop_bumi,0) > 0 then 
		coalesce(a.njop_bumi,0)/coalesce(a.total_luas_bumi,0)
		else 0
		end as njop_bumi_perm2,
		case when coalesce(a.njop_bng,0) > 0 then 
		coalesce(a.njop_bng,0)/coalesce(a.total_luas_bng,0)
		else 0
		end as njop_bng_perm2';
		$criteria->join = 'left join pbb.dat_subjek_pajak c on a.subjek_pajak_id = c.subjek_pajak_id left join pbb.dat_op_bumi b on a.kd_propinsi = b.kd_propinsi AND a.kd_dati2 = b.kd_dati2 AND a.kd_kecamatan = b.kd_kecamatan AND a.kd_kelurahan = b.kd_kelurahan AND a.kd_blok = b.kd_blok AND a.no_urut = b.no_urut AND a.kd_jns_op = b.kd_jns_op';

		if(empty($this->kd_kecamatan) or empty($this->kd_kelurahan) and empty($this->listData)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and empty($this->listData)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}

		
		if($this->listData == '1' and empty($this->kodeblok) and empty($this->nmrurut) and empty($this->kdjnsop)) {
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'nop '.$this->listDataSort.'';

		}

		if($this->listData == '1' && !empty($this->kodeblok) && !empty($this->nmrurut) && $this->kdjnsop != '') {

		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_blok=\''.$this->kodeblok.'\' AND a.no_urut=\''.$this->nmrurut.'\' AND a.kd_jns_op=\''.$this->kdjnsop.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND a.kd_blok=\''.$this->kodeblok.'\' AND a.no_urut=\''.$this->nmrurut.'\' AND a.kd_jns_op=\''.$this->kdjnsop.'\'';
		}
		$criteria->order = 'nop '.$this->listDataSort.'';

		}                

		if($this->listData == '2' and empty($this->letakop)) {

		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'letak_op '.$this->listDataSort.'';

		}

		if($this->listData == '2' and !empty($this->letakop)) {

		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND upper(a.jalan_op) LIKE \'%'.strtoupper($this->letakop).'%\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(a.jalan_op) LIKE \'%'.strtoupper($this->letakop).'%\'';
		}
		$criteria->order = 'letak_op '.$this->listDataSort.'';

		}

		if($this->listData == '3' and empty($this->namawp)) {

		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'c.nm_wp '.$this->listDataSort.'';

		}

		if($this->listData == '3' and !empty($this->namawp)) {
		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND upper(c.nm_wp) LIKE \'%'.strtoupper($this->namawp).'%\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(c.nm_wp) LIKE \'%'.strtoupper($this->namawp).'%\'';
		}
		$criteria->order = 'c.nm_wp '.$this->listDataSort.'';
		}

		if($this->listData == '4' and empty($this->kdznt)) {

		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'kd_znt '.$this->listDataSort.'';

		}

		if($this->listData == '4' and !empty($this->kdznt)) {

		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND upper(b.kd_znt) LIKE \'%'.strtoupper($this->kdznt).'%\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(b.kd_znt) LIKE \'%'.strtoupper($this->kdznt).'%\'';
		}
		$criteria->order = 'kd_znt '.$this->listDataSort.'';

		}

		if($this->listData == '5') {
		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'njop '.$this->listDataSort.'';
		}
                
        if($this->listData == '6' && !empty($this->kodeblok)) {
		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'AND a.kd_blok=\''.$this->kodeblok.'\' ';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND a.kd_blok=\''.$this->kodeblok.'\' ';
		}
		$criteria->order = 'nop '.$this->listDataSort.'';
		}
		
		
		
		if($this->listData == '7' and empty($this->nik)) {
		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}
		$criteria->order = 'c.subjek_pajak_id '.$this->listDataSort.'';
		}
		
		if($this->listData == '7' and !empty($this->nik)) {
		
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND trim(c.subjek_pajak_id) = \''.trim($this->nik).'\'';
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND trim(c.subjek_pajak_id) = \''.trim($this->nik).'\'';
		}
		$criteria->order = 'c.subjek_pajak_id '.$this->listDataSort.'';
		}
		

		if(!empty($this->nip_sama)){
		$criteria->addCondition('a.subjek_pajak_id in (select subjek_pajak_id from pbb.dat_objek_pajak group by subjek_pajak_id HAVING count(subjek_pajak_id)>1)');
		//$criteria->order = 'a.subjek_pajak_id '.$this->listDataSort.'';
		}
		
		if(!empty($this->nm_wp_sama)){
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->addCondition('a.subjek_pajak_id in (select x.subjek_pajak_id from pbb.dat_subjek_pajak x join dat_objek_pajak y on x.subjek_pajak_id=y.subjek_pajak_id
		where y.kd_propinsi=\''.$this->kd_propinsi.'\' AND y.kd_dati2=\''.$this->kd_dati2.'\'
		group by x.subjek_pajak_id HAVING count(x.nm_wp)>1)');	
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->addCondition('a.subjek_pajak_id in (select x.subjek_pajak_id from pbb.dat_subjek_pajak x join dat_objek_pajak y on x.subjek_pajak_id=y.subjek_pajak_id
		where y.kd_propinsi=\''.$this->kd_propinsi.'\' AND y.kd_dati2=\''.$this->kd_dati2.'\' AND 
		y.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND y.kd_kelurahan=\''.$this->kd_kelurahan.'\'
		group by x.subjek_pajak_id HAVING count(x.nm_wp)>1)');	
		}	
		
		}
		
		if(!empty($this->nip_sama) && !empty($this->nm_wp_sama)){
		if(empty($this->kd_kecamatan) and empty($this->kd_kelurahan)) {
		$criteria->addCondition('a.subjek_pajak_id in (select subjek_pajak_id from pbb.dat_objek_pajak group by subjek_pajak_id HAVING count(subjek_pajak_id)>1) AND 
		a.subjek_pajak_id in (select x.subjek_pajak_id from pbb.dat_subjek_pajak x join dat_objek_pajak y on x.subjek_pajak_id=y.subjek_pajak_id
		where y.kd_propinsi=\''.$this->kd_propinsi.'\' AND y.kd_dati2=\''.$this->kd_dati2.'\'
		group by x.subjek_pajak_id HAVING count(x.nm_wp)>1)');	
		}
		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) {
		$criteria->addCondition('a.subjek_pajak_id in (select subjek_pajak_id from pbb.dat_objek_pajak group by subjek_pajak_id HAVING count(subjek_pajak_id)>1) AND 
		a.subjek_pajak_id in (select x.subjek_pajak_id from pbb.dat_subjek_pajak x join dat_objek_pajak y on x.subjek_pajak_id=y.subjek_pajak_id
		where y.kd_propinsi=\''.$this->kd_propinsi.'\' AND y.kd_dati2=\''.$this->kd_dati2.'\' AND 
		y.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND y.kd_kelurahan=\''.$this->kd_kelurahan.'\'
		group by x.subjek_pajak_id HAVING count(x.nm_wp)>1)');	
		}
		
		
		}
		
		
		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));

	}
	
	
	public function searchData()
	{
		$criteria = new CDbCriteria;

		$criteria->alias = 'a';
		$criteria->select = 'a.subjek_pajak_id as subid, a.kd_blok || \'-\' || a.no_urut || \'-\' || a.kd_jns_op as nop, c.handphone, trim(c.nm_wp) as nm_wp';
		$criteria->join = 'left join pbb.dat_subjek_pajak c on a.subjek_pajak_id = c.subjek_pajak_id left join pbb.dat_op_bumi b on a.kd_propinsi = b.kd_propinsi AND a.kd_dati2 = b.kd_dati2 AND a.kd_kecamatan = b.kd_kecamatan AND a.kd_kelurahan = b.kd_kelurahan AND a.kd_blok = b.kd_blok AND a.no_urut = b.no_urut AND a.kd_jns_op = b.kd_jns_op';

		if(empty($this->kd_kecamatan) or empty($this->kd_kelurahan)) {

		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';

		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and empty($this->listData)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '1' and empty($this->kodeblok) and empty($this->nmrurut) and empty($this->kdjnsop)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		$criteria->order = 'nop '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) && !empty($this->kd_kelurahan) && $this->listData == '1' && !empty($this->kodeblok) && !empty($this->nmrurut) && $this->kdjnsop != '') {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND a.kd_blok=\''.$this->kodeblok.'\' AND a.no_urut=\''.$this->nmrurut.'\' AND a.kd_jns_op=\''.$this->kdjnsop.'\'';
		$criteria->order = 'nop '.$this->listDataSort.'';
		}

		if((!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) and $this->listData == '2' and empty($this->letakop)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		$criteria->order = 'letak_op '.$this->listDataSort.'';
		}

		if((!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan)) and $this->listData == '2' and !empty($this->letakop)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(a.jalan_op) LIKE \'%'.strtoupper($this->letakop).'%\'';
		$criteria->order = 'letak_op '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '3' and empty($this->namawp)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		$criteria->order = 'nm_wp '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '3' and !empty($this->namawp)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(c.nm_wp) LIKE \'%'.strtoupper($this->namawp).'%\'';
		$criteria->order = 'nm_wp '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '4' and empty($this->kdznt)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		$criteria->order = 'kd_znt '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '4' and !empty($this->kdznt)) {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\' AND upper(b.kd_znt) LIKE \'%'.strtoupper($this->kdznt).'%\'';
		$criteria->order = 'kd_znt '.$this->listDataSort.'';
		}

		if(!empty($this->kd_kecamatan) and !empty($this->kd_kelurahan) and $this->listData == '5') {
		$criteria->condition = 'a.kd_propinsi=\''.$this->kd_propinsi.'\' AND a.kd_dati2=\''.$this->kd_dati2.'\' AND a.kd_kecamatan=\''.$this->kd_kecamatan.'\' AND a.kd_kelurahan=\''.$this->kd_kelurahan.'\'';
		$criteria->order = 'njop '.$this->listDataSort.'';
		}

		return new CActiveDataProvider(get_class($this), array(
			'criteria'=>$criteria,
		));

	}
	
}

AnonSec - 2021