<?php

/**
 * This is the model class for table "contable.datos_migrar".
 *
 * The followings are the available columns in table 'contable.datos_migrar':
 * @property integer $id
 * @property integer $cedula
 * @property string $n_ref
 * @property string $monto
 * @property integer $clvbanco
 * @property string $nro_cuenta
 * @property string $fecha_ref
 * @property string $tipo_op
 * @property integer $ejecutado
 * @property string $ref_registro
 */
class DatosMigrar extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'contable.datos_migrar';
	}

	/**
	 * @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('cedula, clvbanco, ejecutado', 'numerical', 'integerOnly'=>true),
			array('n_ref, monto, nro_cuenta, fecha_ref, tipo_op, ref_registro', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id, cedula, n_ref, monto, clvbanco, nro_cuenta, fecha_ref, tipo_op, ejecutado, ref_registro', '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(
			'id' => 'ID',
			'cedula' => 'Cedula',
			'n_ref' => 'N Ref',
			'monto' => 'Monto',
			'clvbanco' => 'Clvbanco',
			'nro_cuenta' => 'Nro Cuenta',
			'fecha_ref' => 'Fecha Ref',
			'tipo_op' => 'Tipo Op',
			'ejecutado' => 'Ejecutado',
			'ref_registro' => 'Ref Registro',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('cedula',$this->cedula);
		$criteria->compare('n_ref',$this->n_ref,true);
		$criteria->compare('monto',$this->monto,true);
		$criteria->compare('clvbanco',$this->clvbanco);
		$criteria->compare('nro_cuenta',$this->nro_cuenta,true);
		$criteria->compare('fecha_ref',$this->fecha_ref,true);
		$criteria->compare('tipo_op',$this->tipo_op,true);
		$criteria->compare('ejecutado',$this->ejecutado);
		$criteria->compare('ref_registro',$this->ref_registro,true);

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

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return DatosMigrar the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
