<?php

/**
 * This is the model class for table "sidcai_convenio_pago".
 *
 * The followings are the available columns in table 'sidcai_convenio_pago':
 * @property integer $conv_codigo_pk
 * @property integer $decl_codigo_fk
 * @property string $conv_fecha_registro
 * @property string $conv_fecha_tope
 * @property string $conv_ruta_convenio
 * @property integer $usua_codigo_fk
 * @property boolean $conv_habilitado
 *
 * The followings are the available model relations:
 * @property SidcaiDeclaracioncti $declCodigoFk
 * @property SidcaiUsuario $usuaCodigoFk
 */
class SidcaiConvenioPago extends CActiveRecord{
	public $pdf_convenio;

	/**
	 * @return string the associated database table name
	 */
	public function tableName(){
		return 'sidcai_convenio_pago';
	}

	/**
	 * @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(
				'decl_codigo_fk, conv_fecha_registro, conv_fecha_tope, conv_ruta_convenio, usua_codigo_fk, pdf_convenio', 
				'required',
				'message' => 'Este campo es requerido.'
			),
			array('decl_codigo_fk, usua_codigo_fk', 'numerical', 'integerOnly'=>true),
			array('conv_ruta_convenio', 'length', 'max'=>255),
			array('conv_habilitado', 'safe'),
		);
	}

	/**
	 * @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(
			'declCodigoFk' => array(self::BELONGS_TO, 'SidcaiDeclaracioncti', 'decl_codigo_fk'),
			'usuaCodigoFk' => array(self::BELONGS_TO, 'SidcaiUsuario', 'usua_codigo_fk'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels(){
		return array(
			'conv_codigo_pk' => 'Código',
			'decl_codigo_fk' => 'Declaración',
			'conv_fecha_registro' => 'Fecha Registro',
			'conv_fecha_tope' => 'Fecha Límite',
			'conv_ruta_convenio' => 'Ruta',
			'usua_codigo_fk' => 'Usuario',
			'conv_habilitado' => 'Habilitado',

			'pdf_convenio' => 'Convenio en PDF',
		);
	}

	/**
	 * 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 SidcaiConvenioPago the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
