Example #1
0
 public function search($params)
 {
     $query = CustomerModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_customer' => $this->id_customer, 'update_by' => $this->update_by, 'create_by' => $this->create_by]);
     $query->andFilterWhere(['like', 'cd_cust', $this->cd_cust])->andFilterWhere(['like', 'nm_cust', $this->nm_cust])->andFilterWhere(['like', 'contact_name', $this->contact_name])->andFilterWhere(['like', 'contact_number', $this->contact_number])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'update_date', $this->update_date])->andFilterWhere(['like', 'create_date', $this->create_date]);
     return $dataProvider;
 }
Example #2
0
?>

            <?php 
echo $form->field($model, 'nm_cust')->textInput(['maxlength' => 64]);
?>

            <?php 
echo $form->field($model, 'contact_name')->textInput(['maxlength' => 64]);
?>

            <?php 
echo $form->field($model, 'contact_number')->textInput(['maxlength' => 64]);
?>

            <?php 
echo $form->field($model, 'status')->dropDownList(StatusBehavior::statusList(Customer::className()), ['style' => 'width:200px;']);
?>

        </div>
    </div>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCustomer()
 {
     return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
 }
 /**
  * Finds the Customer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Customer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Customer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }