Your IP : 216.73.216.79


Current Path : /var/www/html/mtdc/frontend/models/application/
Upload File :
Current File : /var/www/html/mtdc/frontend/models/application/DlsAiApplicationSearch.php

<?php

namespace frontend\models\application;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use frontend\models\application\DlsAiApplication;

/**
 * DlsAiApplicationSearch represents the model behind the search form of `frontend\models\application\DlsAiApplication`.
 */
class DlsAiApplicationSearch extends DlsAiApplication
{
    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['aiap_id', 'aiap_persontype', 'aiap_transportationmode', 'aiap_transportcategory', 'aiap_businessno', 'aiap_estimatepersonasean', 'aiap_estimatepersonnotasean', 'aiap_accounttype', 'aiap_noaccount', 'aiap_icofapplicant'], 'integer'],
            [['aiap_applicantname', 'aiap_operatorname', 'aiap_countryorigin', 'aiap_businessaddress', 'aiap_correspondenceaddress', 'aiap_operatortradename', 'aiap_telno', 'aiap_faxno', 'aiap_email', 'aiap_datecommencement', 'aiap_acchaldername', 'aiap_bankname', 'aiap_bankaddress', 'aiap_contactname', 'aiap_contacttelno', 'aiap_contactfaxno', 'aiap_contactemail', 'aiap_nameofapplicant', 'aiap_memberassociate', 'aiap_incometax', 'aiap_nationalityofapplicant'], 'safe'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = DlsAiApplication::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'aiap_id' => $this->aiap_id,
            'aiap_persontype' => $this->aiap_persontype,
            'aiap_transportationmode' => $this->aiap_transportationmode,
            'aiap_transportcategory' => $this->aiap_transportcategory,
            'aiap_businessno' => $this->aiap_businessno,
            'aiap_datecommencement' => $this->aiap_datecommencement,
            'aiap_estimatepersonasean' => $this->aiap_estimatepersonasean,
            'aiap_estimatepersonnotasean' => $this->aiap_estimatepersonnotasean,
            'aiap_accounttype' => $this->aiap_accounttype,
            'aiap_noaccount' => $this->aiap_noaccount,
            'aiap_icofapplicant' => $this->aiap_icofapplicant,
        ]);

        $query->andFilterWhere(['like', 'aiap_applicantname', $this->aiap_applicantname])
            ->andFilterWhere(['like', 'aiap_operatorname', $this->aiap_operatorname])
            ->andFilterWhere(['like', 'aiap_countryorigin', $this->aiap_countryorigin])
            ->andFilterWhere(['like', 'aiap_businessaddress', $this->aiap_businessaddress])
            ->andFilterWhere(['like', 'aiap_correspondenceaddress', $this->aiap_correspondenceaddress])
            ->andFilterWhere(['like', 'aiap_operatortradename', $this->aiap_operatortradename])
            ->andFilterWhere(['like', 'aiap_telno', $this->aiap_telno])
            ->andFilterWhere(['like', 'aiap_faxno', $this->aiap_faxno])
            ->andFilterWhere(['like', 'aiap_email', $this->aiap_email])
            ->andFilterWhere(['like', 'aiap_acchaldername', $this->aiap_acchaldername])
            ->andFilterWhere(['like', 'aiap_bankname', $this->aiap_bankname])
            ->andFilterWhere(['like', 'aiap_bankaddress', $this->aiap_bankaddress])
            ->andFilterWhere(['like', 'aiap_contactname', $this->aiap_contactname])
            ->andFilterWhere(['like', 'aiap_contacttelno', $this->aiap_contacttelno])
            ->andFilterWhere(['like', 'aiap_contactfaxno', $this->aiap_contactfaxno])
            ->andFilterWhere(['like', 'aiap_contactemail', $this->aiap_contactemail])
            ->andFilterWhere(['like', 'aiap_nameofapplicant', $this->aiap_nameofapplicant])
            ->andFilterWhere(['like', 'aiap_memberassociate', $this->aiap_memberassociate])
            ->andFilterWhere(['like', 'aiap_incometax', $this->aiap_incometax])
            ->andFilterWhere(['like', 'aiap_nationalityofapplicant', $this->aiap_nationalityofapplicant]);

        return $dataProvider;
    }
}