/** * 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');
public function getType() { return $this->hasOne(Tipebarang::className(), ['KD_TYPE' => 'KD_TYPE']); }
/** * Finds the Tipebarang 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_type * @return Tipebarang the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($ID, $KD_TYPE) { if (($model = Tipebarang::findOne(['ID' => $ID, 'KD_TYPE' => $KD_TYPE])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }