/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tipebarang::find()->where('STATUS <> 3'); $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(['CREATED_AT' => $this->CREATED_AT, 'UPDATED_AT' => $this->UPDATED_AT]); $query->andFilterWhere(['like', 'KD_TYPE', $this->KD_TYPE])->andFilterWhere(['like', 'NM_TYPE', $this->NM_TYPE])->andFilterWhere(['like', 'NOTE', $this->NOTE]); // ->andFilterWhere(['like', 'CREATED_BY', $this->created_by]) // ->andFilterWhere(['like', 'UPDATED_BY', $this->updated_by]); return $dataProvider; }
$drop = ArrayHelper::map(Corp::find()->all(), 'CORP_ID', 'CORP_NM'); ?> <?php echo $form->field($model, 'KD_CORP')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --', 'disabled' => true])->label('Group Perusahaan'); ?> <?php echo $form->field($model, 'KD_BARANG')->textInput(['maxlength' => true, 'readonly' => true]); ?> <?php echo $form->field($model, 'NM_BARANG')->textInput(['maxlength' => true]); ?> <?php $drop = ArrayHelper::map(Tipebarang::find()->where(['STATUS' => 1])->all(), 'KD_TYPE', 'NM_TYPE'); ?> <?php echo $form->field($model, 'KD_TYPE')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Type Barang'); ?> <?php $drop = ArrayHelper::map(Kategori::find()->where(['STATUS' => 1])->all(), 'KD_KATEGORI', 'NM_KATEGORI'); ?> <?php echo $form->field($model, 'KD_KATEGORI')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Kategori'); ?> <?php $drop = ArrayHelper::map(Unitbarang::find()->where(['STATUS' => 1])->all(), 'KD_UNIT', 'NM_UNIT');
/** * Deletes an existing Tipebarang model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param string $id * @param string $kd_type * @return mixed */ public function actionDelete($ID, $KD_TYPE) { $model = Tipebarang::find()->where(['ID' => $ID, 'KD_TYPE' => $KD_TYPE])->one(); $model->STATUS = 3; $model->UPDATED_BY = Yii::$app->user->identity->username; $model->save(); // equivalent to $model->update(); // $this->findModel($ID, $KD_TYPE)->delete(); return $this->redirect(['index']); }