コード例 #1
0
ファイル: Tax2Search.php プロジェクト: KokLip/GST
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search_purchase($params)
 {
     $query = Tax2::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(['tax_id' => $this->tax_id, 'tax_rate' => $this->tax_rate]);
     $query->andFilterWhere(['like', 'tax_code', $this->tax_code])->andFilterWhere(['like', 'tax_description', $this->tax_description]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: ProductController.php プロジェクト: KokLip/GST
 /**
  * Updates an existing Product model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $categories = Category::find()->orderBy('category_id')->all();
     $tax = Tax::find()->orderBy('tax_id')->all();
     $tax2 = Tax2::find()->orderBy('tax_id')->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->product_id]);
     } else {
         return $this->render('update', ['model' => $model, 'categories' => $categories, 'tax' => $tax, 'tax2' => $tax2]);
     }
 }