예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Unitbarang::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(['ID' => $this->ID, 'QTY' => $this->QTY, 'SIZE' => $this->SIZE, 'WEIGHT' => $this->WEIGHT, 'STATUS' => $this->STATUS]);
     $query->andFilterWhere(['like', 'KD_UNIT', $this->KD_UNIT])->andFilterWhere(['like', 'NM_UNIT', $this->NM_UNIT])->andFilterWhere(['like', 'COLOR', $this->COLOR])->andFilterWhere(['like', 'NOTE', $this->NOTE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'CREATED_AT', $this->CREATED_AT])->andFilterWhere(['like', 'UPDATED_AT', $this->UPDATED_AT]);
     return $dataProvider;
 }
예제 #2
0
 public function actionSimpan()
 {
     $model = new Unitbarang();
     $model->load(Yii::$app->request->post());
     $ck = Unitbarang::find()->select('KD_UNIT')->where('STATUS <> 3')->orderBy(['ID' => SORT_DESC])->one();
     if (count($ck) == 0) {
         $nkd = 1;
     } else {
         $nkd = $ck->KD_UNIT + 1;
     }
     $kd = str_pad($nkd, "4", "0", STR_PAD_LEFT);
     $model->KD_UNIT = $kd;
     $model->save();
     return $this->redirect(['view', 'id' => $model->ID]);
 }
예제 #3
0
파일: _form.php 프로젝트: C12D/advanced
$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()->all(), 'KD_UNIT', 'NM_UNIT');
?>
    <?php 
echo $form->field($model, 'KD_UNIT')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --']);
?>
	
	<?php 
$drop = ArrayHelper::map(Distributor::find()->all(), 'KD_DISTRIBUTOR', 'NM_DISTRIBUTOR');
?>
    <?php 
echo $form->field($model, 'KD_DISTRIBUTOR')->dropDownList($drop, ['prompt' => ' -- Pilih Salah Satu --']);
?>

	
	<?php 
echo $form->field($model, 'image')->widget(FileInput::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'gif', 'png']]]);