<?php

/**
 * This is the model class for table "contable.vsw_mayor_analitico_detalle".
 *
 * The followings are the available columns in table 'contable.vsw_mayor_analitico_detalle':
 * @property string $fecha
 * @property string $nro_comprobante
 * @property string $descripcion
 * @property string $monto_debe
 * @property string $monto_haber
 * @property string $fecha_creado
 * @property integer $id_cuenta
 * @property string $cuenta
 * @property string $denom_cuenta
 */
class MayorAnaliticoDetalle extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'contable.vsw_mayor_analitico_detalle';
	}

	/**
	 * @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('id_cuenta', 'numerical', 'integerOnly'=>true),
			array('fecha, nro_comprobante, descripcion, monto_debe, monto_haber, fecha_creado, cuenta, denom_cuenta,refencia', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('fecha,fecha_comprobante, nro_comprobante, descripcion, monto_debe, monto_haber, fecha_creado, id_cuenta, cuenta, denom_cuenta,referencia', '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(
			'fecha' => 'Fecha',
			'nro_comprobante' => 'Nro comprobante',
			'descripcion' => 'Descripcion',
			'monto_debe' => 'Monto debe',
			'monto_haber' => 'Monto haber',
			'fecha_creado' => 'Fecha creado',
			'id_cuenta' => 'Id cuenta',
			'cuenta' => 'Cuenta',
			'denom_cuenta' => 'Denom. cuenta',
			'referencia' => 'Ref.',
		);
	}

	/**
	 * 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('fecha',$this->fecha,true);
		$criteria->compare('nro_comprobante',$this->nro_comprobante,true);
		$criteria->compare('descripcion',$this->descripcion,true);
		$criteria->compare('monto_debe',$this->monto_debe,true);
		$criteria->compare('monto_haber',$this->monto_haber,true);
		$criteria->compare('fecha_creado',$this->fecha_creado,true);
		$criteria->compare('id_cuenta',$this->id_cuenta);
		$criteria->compare('cuenta',$this->cuenta,true);
		$criteria->compare('denom_cuenta',$this->denom_cuenta,true);
		$criteria->compare('referencia',$this->referencia,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 MayorAnaliticoDetalle the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
