|
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 ] |
|---|
<?php
/**
* This is the model class for table "pbb.dat_op_bangunan".
*
* The followings are the available columns in table 'pbb.dat_op_bangunan':
* @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 integer $no_bng
* @property string $kd_jpb
* @property string $no_formulir_lspop
* @property string $thn_dibangun_bng
* @property string $thn_renovasi_bng
* @property string $luas_bng
* @property integer $jml_lantai_bng
* @property string $kondisi_bng
* @property string $jns_konstruksi_bng
* @property string $jns_atap_bng
* @property string $kd_dinding
* @property string $kd_lantai
* @property string $kd_langit_langit
* @property string $nilai_sistem_bng
* @property string $jns_transaksi_bng
* @property string $tgl_pendataan_bng
* @property string $nip_pendata_bng
* @property string $tgl_pemeriksaan_bng
* @property string $nip_pemeriksa_bng
* @property string $tgl_perekaman_bng
* @property string $nip_perekam_bng
* @property integer $createdby
* @property string $createdtime
* @property integer $updatedby
* @property string $updatedtime
*/
class DatOpBangunan extends CBhumieRecord
{
public $no_bangunan_akhir;
public $nop;
public $nm_jpb;
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return DatOpBangunan 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_op_bangunan';
}
/**
* @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, no_bng, kd_jpb, no_formulir_lspop, kondisi_bng, nilai_sistem_bng, tgl_pendataan_bng, nip_pendata_bng, tgl_pemeriksaan_bng, nip_pemeriksa_bng, nip_perekam_bng, createdby, createdtime, updatedby, updatedtime', 'required'),
array('kd_propinsi, kd_dati2, kd_kecamatan, kd_kelurahan, kd_blok, no_urut, kd_jns_op, no_bng, kd_jpb, no_formulir_lspop, kondisi_bng, nilai_sistem_bng, tgl_pendataan_bng, nip_pendata_bng, tgl_pemeriksaan_bng, nip_pemeriksa_bng, nip_perekam_bng', 'required'),
array('no_bng, jml_lantai_bng,', 'numerical', 'integerOnly'=>true),
array('kd_propinsi, kd_dati2, kd_jpb', 'length', 'max'=>2),
array('kd_kecamatan, kd_kelurahan, kd_blok', 'length', 'max'=>3),
array('no_urut, thn_dibangun_bng, thn_renovasi_bng', 'length', 'max'=>4),
array('kd_jns_op, kondisi_bng, jns_konstruksi_bng, jns_atap_bng, kd_dinding, kd_lantai, kd_langit_langit, jns_transaksi_bng', 'length', 'max'=>1),
array('no_formulir_lspop', 'length', 'max'=>11),
array('nip_pendata_bng, nip_pemeriksa_bng, nip_perekam_bng', 'length', 'max'=>18),
array('luas_bng, tgl_perekaman_bng', '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, no_bng, kd_jpb, no_formulir_lspop, thn_dibangun_bng, thn_renovasi_bng, luas_bng, jml_lantai_bng, kondisi_bng, jns_konstruksi_bng, jns_atap_bng, kd_dinding, kd_lantai, kd_langit_langit, nilai_sistem_bng, jns_transaksi_bng, tgl_pendataan_bng, nip_pendata_bng, tgl_pemeriksaan_bng, nip_pemeriksa_bng, tgl_perekaman_bng, nip_perekam_bng, createdby, createdtime, updatedby, updatedtime', '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' => 'Kd Kecamatan',
'kd_kelurahan' => 'Kd Kelurahan',
'kd_blok' => 'Kd Blok',
'no_urut' => 'No Urut',
'kd_jns_op' => 'Kd Jns Op',
'no_bng' => 'No Bangunan',
'kd_jpb' => 'Jenis bangunan',
'no_formulir_lspop' => 'No Formulir',
'thn_dibangun_bng' => 'Tahun Dibangun',
'thn_renovasi_bng' => 'Tahun Renovasi',
'luas_bng' => 'Luas Bangunan',
'jml_lantai_bng' => 'Jumlah Lantai',
'kondisi_bng' => 'Kondisi Bangunan',
'jns_konstruksi_bng' => 'Konstruksi',
'jns_atap_bng' => 'Atap',
'kd_dinding' => 'Dinding',
'kd_lantai' => 'Lantai',
'kd_langit_langit' => 'Langit-Langit',
'nilai_sistem_bng' => 'Nilai Sistem Bng',
'jns_transaksi_bng' => 'Jns Transaksi Bng',
'tgl_pendataan_bng' => 'Tgl Pendataan Bng',
'nip_pendata_bng' => 'Nip Pendata Bng',
'tgl_pemeriksaan_bng' => 'Tgl Pemeriksaan Bng',
'nip_pemeriksa_bng' => 'Nip Pemeriksa Bng',
'tgl_perekaman_bng' => 'Tgl Perekaman Bng',
'nip_perekam_bng' => 'Nip Perekam Bng',
'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('no_bng',$this->no_bng);
$criteria->compare('kd_jpb',$this->kd_jpb,true);
$criteria->compare('no_formulir_lspop',$this->no_formulir_lspop,true);
$criteria->compare('thn_dibangun_bng',$this->thn_dibangun_bng,true);
$criteria->compare('thn_renovasi_bng',$this->thn_renovasi_bng,true);
$criteria->compare('luas_bng',$this->luas_bng,true);
$criteria->compare('jml_lantai_bng',$this->jml_lantai_bng);
$criteria->compare('kondisi_bng',$this->kondisi_bng,true);
$criteria->compare('jns_konstruksi_bng',$this->jns_konstruksi_bng,true);
$criteria->compare('jns_atap_bng',$this->jns_atap_bng,true);
$criteria->compare('kd_dinding',$this->kd_dinding,true);
$criteria->compare('kd_lantai',$this->kd_lantai,true);
$criteria->compare('kd_langit_langit',$this->kd_langit_langit,true);
$criteria->compare('nilai_sistem_bng',$this->nilai_sistem_bng,true);
$criteria->compare('jns_transaksi_bng',$this->jns_transaksi_bng,true);
$criteria->compare('tgl_pendataan_bng',$this->tgl_pendataan_bng,true);
$criteria->compare('nip_pendata_bng',$this->nip_pendata_bng,true);
$criteria->compare('tgl_pemeriksaan_bng',$this->tgl_pemeriksaan_bng,true);
$criteria->compare('nip_pemeriksa_bng',$this->nip_pemeriksa_bng,true);
$criteria->compare('tgl_perekaman_bng',$this->tgl_perekaman_bng,true);
$criteria->compare('nip_perekam_bng',$this->nip_perekam_bng,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_lspop) as no_formulir_lspop";
$criteria->condition = "substring(no_formulir_lspop,1,4) = '" . $thn_bundel . "'";
$findNoFormulir = DatOpBangunan::model()->find($criteria);
$no_formulir = $findNoFormulir['no_formulir_lspop'];
if($this->no_formulir_lspop <= $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_lspop,9,3)) as no_formulir_lspop";
$criteria2->condition = "substring(no_formulir_lspop,1,4) = '" . $thn_bundel . "' and substring(no_formulir_lspop,5,4) = '" . $bundel . "'";
$findNoUrut = DatOpBangunan::model()->find($criteria2);
$urut = '001';
$this->no_formulir_lspop = $thn_bundel.$bundel.$urut;
} else {
$this->no_formulir_lspop = $no_formulir + 1;
}
}
} else {
$this->no_formulir_lspop;
}
return true;
} else {
return false;
}
}
}