コード例 #1
0
ファイル: Customer.php プロジェクト: jimminababan/sangkilbiz3
 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_customer', $this->cd_customer])->andFilterWhere(['like', 'nm_customer', $this->nm_customer])->andFilterWhere(['like', 'contact_name', $this->contact_name])->andFilterWhere(['like', 'contact_number', $this->contact_number])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'update_at', $this->update_at])->andFilterWhere(['like', 'create_at', $this->create_at]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: Sales.php プロジェクト: advance100/sangkilbiz3
 public function setNmCustomer($value)
 {
     $this->_nm_customer = $value;
     $cust = Customer::findOne(['nm_customer' => $value]);
     if ($cust) {
         $this->id_customer = $cust->id_customer;
     } else {
         $this->id_customer = null;
     }
 }
コード例 #3
0
 /**
  * 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.');
     }
 }
コード例 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCustomer()
 {
     return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
 }