/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     // print_r($_GET);
     if (isset($_GET['CallSummary'])) {
         $query = CallSummary::find()->where(['between', 'trans_date', $_GET['CallSummary']['start_time'] . ' 00:00:00', $_GET['CallSummary']['end_time'] . ' 23:59:59']);
     } else {
         $query = CallSummary::find()->where(['between', 'trans_date', '1989-01-01', '1989-01-01']);
     }
     $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;
     }
     $query->andFilterWhere(['trans_date' => $this->trans_date, 'duration' => $this->duration, 'counter' => $this->counter, 'id' => $this->id]);
     $query->andFilterWhere(['like', 'zone', $this->zone])->andFilterWhere(['like', 'trunk1', $this->trunk1])->andFilterWhere(['like', 'trunk2', $this->trunk2])->andFilterWhere(['like', 'setup_time', $this->setup_time]);
     return $dataProvider;
 }
 /**
  * Finds the CallSummary model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CallSummary the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CallSummary::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }