<?php

/**
 * This is the model class for table "v_p_efectivo_tienda".
 *
 * The followings are the available columns in table 'v_p_efectivo_tienda':
 * @property integer $idusuario
 * @property double $total
 * @property double $efectivo
 * @property string $referencia
 * @property integer $idtrabajador
 * @property string $cuenta_destino
 * @property integer $clvcuenta
 * @property integer $cedula
 * @property string $nombre
 * @property string $apellidos
 * @property integer $idunidad
 * @property string $fechapago
 */
class VMigraEfectivoTienda extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'v_p_efectivo_tienda';
	}

	/**
	 * @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('idusuario, idtrabajador, clvcuenta, cedula, idunidad', 'numerical', 'integerOnly'=>true),
			array('total, efectivo', 'numerical'),
			array('nombre, apellidos', 'length', 'max'=>100),
			array('referencia, cuenta_destino, fechapago', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('idusuario, total, efectivo, referencia, idtrabajador, cuenta_destino, clvcuenta, cedula, nombre, apellidos, idunidad, fechapago', '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(
			'idusuario' => 'Idusuario',
			'total' => 'Total',
			'efectivo' => 'Efectivo',
			'referencia' => 'Referencia',
			'idtrabajador' => 'Idtrabajador',
			'cuenta_destino' => 'Cuenta Destino',
			'clvcuenta' => 'Clvcuenta',
			'cedula' => 'Cedula',
			'nombre' => 'Nombre',
			'apellidos' => 'Apellidos',
			'idunidad' => 'Idunidad',
			'fechapago' => 'Fechapago',
		);
	}

	/**
	 * 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('idusuario',$this->idusuario);
		$criteria->compare('total',$this->total);
		$criteria->compare('efectivo',$this->efectivo);
		$criteria->compare('referencia',$this->referencia,true);
		$criteria->compare('idtrabajador',$this->idtrabajador);
		$criteria->compare('cuenta_destino',$this->cuenta_destino,true);
		$criteria->compare('clvcuenta',$this->clvcuenta);
		$criteria->compare('cedula',$this->cedula);
		$criteria->compare('nombre',$this->nombre,true);
		$criteria->compare('apellidos',$this->apellidos,true);
		$criteria->compare('idunidad',$this->idunidad);
		$criteria->compare('fechapago',$this->fechapago,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 VMigraEfectivoTienda the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
