Your IP : 216.73.216.79


Current Path : /var/www/html/crm/models/
Upload File :
Current File : /var/www/html/crm/models/SalesTarget.php

<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "sales_target".
 *
 * @property int $id
 * @property string $uuid
 * @property string $year
 * @property int $dept_id
 * @property string $target_year
 * @property string $target_half1
 * @property string $target_half2
 * @property string $target_q1
 * @property string $target_q2
 * @property string $target_q3
 * @property string $target_q4
 * @property string $target_month1
 * @property string $target_month2
 * @property string $target_month3
 * @property string $target_month4
 * @property string $target_month5
 * @property string $target_month6
 * @property string $target_month7
 * @property string $target_month8
 * @property string $target_month9
 * @property string $target_month10
 * @property string $target_month11
 * @property string $target_month12
 * @property string $created_dt
 * @property int $created_by
 * @property string $updated_dt
 * @property int $updated_by
 */
class SalesTarget extends \yii\db\ActiveRecord {

    /**
     * {@inheritdoc}
     */
    public static function tableName() {
        return 'sales_target';
    }

    /**
     * {@inheritdoc}
     */
    public function rules() {
        return [
            [['year', 'dept_id', 'target_year'], 'required'],
            [['created_by', 'updated_by'], 'integer'],
            [['target_month3', 'created_dt', 'updated_dt', 'uuid'], 'safe'],
            [['year', 'target_year', 'target_half1', 'target_half2', 'target_q1', 'target_q2', 'target_q3', 'target_q4', 'target_month1', 'target_month2', 'target_month4', 'target_month5', 'target_month6', 'target_month7', 'target_month8', 'target_month9', 'target_month10', 'target_month11', 'target_month12'], 'string', 'max' => 255],
            [['target_year', 'target_half1', 'target_half2', 'target_q1', 'target_q2', 'target_q3', 'target_q4', 'target_month1', 'target_month2', 'target_month3', 'target_month4', 'target_month5',
            'target_month6', 'target_month7', 'target_month8', 'target_month9', 'target_month10', 'target_month11', 'target_month12'], 'number'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels() {
        return [
            'id' => 'ID',
            'uuid' => 'Uuid',
            'year' => 'Year',
            'dept_id' => 'Department',
            'target_year' => 'Target Year',
            'target_half1' => 'Target 1st Half Year',
            'target_half2' => 'Target 2nd Half Year',
            'target_q1' => 'Target Q1',
            'target_q2' => 'Target Q2',
            'target_q3' => 'Target Q3',
            'target_q4' => 'Target Q4',
            'target_month1' => 'Target January',
            'target_month2' => 'Target February',
            'target_month3' => 'Target March',
            'target_month4' => 'Target April',
            'target_month5' => 'Target May',
            'target_month6' => 'Target June',
            'target_month7' => 'Target July',
            'target_month8' => 'Target August',
            'target_month9' => 'Target September',
            'target_month10' => 'Target October',
            'target_month11' => 'Target November',
            'target_month12' => 'Target December',
            'created_dt' => 'Created Dt',
            'created_by' => 'Created By',
            'updated_dt' => 'Updated Dt',
            'updated_by' => 'Updated By',
        ];
    }

    public function yearlist() {
        $output = [];
        for ($y = date('Y'); $y >= 2020; $y--) {
            $output[$y] = $y;
        }
        return $output;
    }

}