|
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/upload/../protected/models/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* This is the model class for table "pbb.dbkb_jpb2".
*
* The followings are the available columns in table 'pbb.dbkb_jpb2':
* @property string $kd_propinsi
* @property string $kd_dati2
* @property string $thn_dbkb_jpb2
* @property string $kls_dbkb_jpb2
* @property integer $lantai_min_jpb2
* @property integer $lantai_max_jpb2
* @property integer $nilai_dbkb_jpb2
* @property integer $createdby
* @property string $createdtime
* @property integer $updatedby
* @property string $updatedtime
*/
class DbkbJpb2 extends CBhumieRecord
{
/**
* Returns the static model of the specified AR class.
* @param string $className active record class name.
* @return DbkbJpb2 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.dbkb_jpb2';
}
/**
* @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, thn_dbkb_jpb2, kls_dbkb_jpb2, lantai_min_jpb2, lantai_max_jpb2, nilai_dbkb_jpb2, createdby, createdtime, updatedby, updatedtime', 'required'),
array('lantai_min_jpb2, lantai_max_jpb2, nilai_dbkb_jpb2, createdby, updatedby', 'numerical', 'integerOnly'=>true, 'message'=>'{attribute} harus angka'),
array('kd_propinsi, kd_dati2', 'length', 'max'=>2),
array('thn_dbkb_jpb2', 'length', 'max'=>4),
array('kls_dbkb_jpb2', 'length', 'max'=>1),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('kd_propinsi, kd_dati2, thn_dbkb_jpb2, kls_dbkb_jpb2, lantai_min_jpb2, lantai_max_jpb2, nilai_dbkb_jpb2, 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',
'thn_dbkb_jpb2' => 'Thn Dbkb Jpb2',
'kls_dbkb_jpb2' => 'Kls Dbkb Jpb2',
'lantai_min_jpb2' => 'Lantai Min Jpb2',
'lantai_max_jpb2' => 'Lantai Max Jpb2',
'nilai_dbkb_jpb2' => 'Nilai Dbkb Jpb2',
'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('thn_dbkb_jpb2',$this->thn_dbkb_jpb2,true);
$criteria->compare('kls_dbkb_jpb2',$this->kls_dbkb_jpb2,true);
$criteria->compare('lantai_min_jpb2',$this->lantai_min_jpb2);
$criteria->compare('lantai_max_jpb2',$this->lantai_max_jpb2);
$criteria->compare('nilai_dbkb_jpb2',$this->nilai_dbkb_jpb2);
$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,
));
}
public function searchDbkbJpb2($previousYear, $kelas)
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
if($previousYear == "" AND $kelas == "" ){
$previousYear = date('Y')-1;
$kelas = 1;
} else if ($previousYear == "") {
$previousYear = date('Y')-1;
} else if ($kelas == "") {
$kelas = 1;
}
$kd_propinsi = Yii::app()->globalvar->getKodePropinsi();
$kd_dati2 = Yii::app()->globalvar->getKodeDati2();
$criteria=new CDbCriteria;
$criteria->alias = 'a';
$criteria->select = 'a.thn_dbkb_jpb2, a.kls_dbkb_jpb2, a.lantai_min_jpb2, a.lantai_max_jpb2, a.nilai_dbkb_jpb2, a.kd_propinsi, a.kd_dati2, a.createdby, a.createdtime, a.updatedby, a.updatedtime';
$criteria->condition='a.kd_propinsi=\''.$kd_propinsi.'\' AND a.kd_dati2=\''.$kd_dati2.'\' AND a.thn_dbkb_jpb2=\''.$previousYear.'\' AND a.kls_dbkb_jpb2=\''.$kelas.'\'';
$criteria->order='a.lantai_min_jpb2';
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
public function searchDbkbJpb21($previousYear, $kelas)
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
if($previousYear == "" AND $kelas == "" ){
$previousYear = date('Y')-1;
$kelas = 1;
} else if ($previousYear == "") {
$previousYear = date('Y')-1;
} else if ($kelas == "") {
$kelas = 1;
}
//$kd_propinsi = Yii::app()->globalvar->getKodePropinsi();
//$kd_dati2 = Yii::app()->globalvar->getKodeDati2();
$criteria=new CDbCriteria;
$criteria->alias = 'a';
$criteria->select = 'a.kls_dbkb_jpb2, a.nilai_dbkb_jpb2 ';
$criteria->condition='a.thn_dbkb_jpb2=\''.$previousYear.'\' AND a.kls_dbkb_jpb2=\''.$kelas.'\'';
$criteria->order='a.lantai_min_jpb2';
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
//$arrayProvider = new CArrayDataProvider($result);
// return $arrayProvider;
}
public function ambilKelasDBKB() {
$qryAmbilKelas = 'SELECT DISTINCT kls_dbkb_jpb2 FROM pbb.dbkb_jpb2 ORDER BY kls_dbkb_jpb2 ASC';
$datakelas = Yii::app()->db->createCommand($qryAmbilKelas)->queryAll();
//return new CActiveArrayProvider($this, array(
// 'criteria'=>$datakelas,
//));
//$arrayProvider = new CArrayDataProvider($datakelas);
return $datakelas;
}
public function ambilMaxTahun($namaTable, $kolomTahun) {
$kd_propinsi = Yii::app()->globalvar->getKodePropinsi();
$kd_dati2 = Yii::app()->globalvar->getKodeDati2();
$qryAmbilMaxTahun= 'SELECT max('.$kolomTahun.') FROM '.$namaTable.' WHERE kd_propinsi = \''.$kd_propinsi.'\' AND kd_dati2 = \''.$kd_dati2.'\';';
$tahunMax = Yii::app()->db->createCommand($qryAmbilMaxTahun)->queryAll();
return $tahunMax[0]['max'];
}
}