/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Kategori::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, 'STATUS' => $this->STATUS]); $query->andFilterWhere(['like', 'KD_KATEGORI', $this->KD_KATEGORI])->andFilterWhere(['like', 'NM_KATEGORI', $this->NM_KATEGORI])->andFilterWhere(['like', 'NOTE', $this->NOTE]); // ->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY]) // ->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]); return $dataProvider; }
?> <?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'); ?> <?php echo $form->field($model, 'KD_UNIT')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --'])->label('Unit'); ?> <?php $drop = ArrayHelper::map(Suplier::find()->where(['STATUS' => 1])->all(), 'KD_SUPPLIER', 'NM_SUPPLIER'); ?>
public function getKategori() { return $this->hasOne(Kategori::className(), ['KD_KATEGORI' => 'KD_KATEGORI']); }
/** * Finds the Kategori model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @param string $kd_kategori * @return Kategori the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($ID, $KD_KATEGORI) { if (($model = Kategori::findOne(['ID' => $ID, 'KD_KATEGORI' => $KD_KATEGORI])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }