コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SopSalesDetail::find()->where(['SOP_ID' => $this->SOP_ID]);
     // 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(['ID' => $this->ID, 'TGL' => $this->TGL, 'SOP_ID' => $this->SOP_ID, 'SCORE_RSLT' => $this->SCORE_RSLT, 'SCORE_PERCENT_MIN' => $this->SCORE_PERCENT_MIN, 'SCORE_PERCENT_MAX' => $this->SCORE_PERCENT_MAX, 'CREATE_AT' => $this->CREATE_AT]);
     $query->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Creates a new SopSalesHeader model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreateDetailSop($id)
 {
     $model = new SopSalesDetail();
     if ($model->load(Yii::$app->request->post())) {
         $model->CREATE_BY = Yii::$app->user->identity->username;
         $model->CREATE_AT = date("Y-m-d H:i:s");
         $model->SOP_ID = $id;
         $model->save();
         return $this->redirect(['index']);
     } else {
         return $this->renderAjax('create_sop_detail', ['model' => $model, 'score' => self::ary_scoreresult()]);
     }
 }