示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Poroda::find();
     $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(['id' => $this->id, 'kod' => $this->kod, 'masa_max' => $this->masa_max, 'masa_min' => $this->masa_min, 'masa_sered' => $this->masa_sered, 'masa_chist' => $this->masa_chist, 'masa_volog' => $this->masa_volog, 'fitoanaliz' => $this->fitoanaliz]);
     $query->andFilterWhere(['like', 'nazva_ukr', $this->nazva_ukr])->andFilterWhere(['like', 'nazva_lat', $this->nazva_lat])->andFilterWhere(['like', 'nazva_short', $this->nazva_short]);
     return $dataProvider;
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $filter)
 {
     $query = Journal::find();
     $query->joinWith(['company', 'kind', 'type']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['N_year' => SORT_ASC]]]);
     // Add extended sorts for related tables
     $dataProvider->sort->attributes['company.nazva'] = ['asc' => [Leshoz::tableName() . '.nazva' => SORT_ASC], 'desc' => [Leshoz::tableName() . '.nazva' => SORT_DESC]];
     $dataProvider->sort->attributes['kind.nazva_short'] = ['asc' => [Poroda::tableName() . '.nazva_short' => SORT_ASC], 'desc' => [Poroda::tableName() . '.nazva_short' => SORT_DESC]];
     $dataProvider->sort->attributes['type.type'] = ['asc' => [TestType::tableName() . '.type' => SORT_ASC], 'desc' => [TestType::tableName() . '.type' => SORT_DESC]];
     $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(['id' => $this->id, 'N_total' => $this->N_total, 'N_year' => $this->N_year, 'id_leshoz' => $this->id_leshoz, 'id_poroda' => $this->id_poroda, 'date_start' => $this->date_start, 'date_end' => $this->date_end, 'date_pasport' => $this->date_pasport, 'masa' => $this->masa, 'masa_zrazka' => $this->masa_zrazka, 'energy' => $this->energy, 'shozh' => $this->shozh, 'chistota' => $this->chistota, 'masa_1000' => $this->masa_1000, 'klass' => $this->klass, 'date_doc' => $this->date_doc, 'id_type' => $this->id_type, 'N_prev' => $this->N_prev, 'v_rahunok' => $this->v_rahunok, 'id_bill' => $this->id_bill, 'id_koef' => $this->id_koef]);
     $query->andFilterWhere(['like', 'N_pasport', $this->N_pasport])->andFilterWhere(['like', 'zagotiv', $this->zagotiv]);
     if (empty($params['date_start']) && isset($filter['year'])) {
         $query->andFilterWhere(['between', 'date_start', $filter['year'] . '-01-01', $filter['year'] . '-12-31']);
     }
     return $dataProvider;
 }
示例#3
0
?>

    <?php 
echo $form->field($model, 'N_total')->textInput();
?>

    <?php 
echo $form->field($model, 'N_year')->textInput();
?>

    <?php 
echo $form->field($model, 'id_leshoz')->dropDownList(ArrayHelper::map(Leshoz::find()->all(), 'id', 'nazva'))->label(Yii::t('company', 'Nazva'));
?>

    <?php 
echo $form->field($model, 'id_poroda')->dropDownList(ArrayHelper::map(Poroda::find()->all(), 'id', 'nazva_short'))->label(Yii::t('kind', 'Nazva Short'));
?>

    <?php 
echo $form->field($model, 'date_start')->widget(DatePicker::classname(), ['value' => $model->date_start ? $model->date_start : (new DateTime())->format('Y-m-d'), 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']]);
?>

    <?php 
echo $form->field($model, 'date_end')->widget(DatePicker::classname(), ['value' => $model->date_end ? $model->date_end : (new DateTime())->format('Y-m-d'), 'dateFormat' => 'php:Y-m-d', 'options' => ['class' => 'form-control']]);
?>

    <?php 
echo $form->field($model, 'N_pasport')->textInput(['maxlength' => true]);
?>

    <?php 
 /**
  * Finds the Poroda model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Poroda the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Poroda::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#5
0
 /**
  * Speciment-to-Kind relation
  */
 public function getKind()
 {
     return $this->hasOne(Poroda::className(), ['id' => 'id_poroda']);
 }