/**
  * Updates an existing Chitiethoadon model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $list1 = Sanpham::find()->all();
     $list2 = Hoadon::find()->all();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect('index.php?r=chitiethoadon%2Findex');
     } else {
         return $this->render('update', ['model' => $model, 'list1' => $list1, 'list2' => $list2]);
     }
 }
Exemple #2
0
 public function actionIndex()
 {
     $lst = Hoadon::find()->where(['status' => 1])->all();
     $result = [];
     if (count($lst) > 0) {
         foreach ($lst as $item) {
             $line = Khachhang::findOne($item->id_kh);
             array_push($result, ['station' => $item, 'line' => $line]);
         }
     }
     return $this->render('index', ['listLine' => $result]);
 }
Exemple #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Hoadon::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_hoadon' => $this->id_hoadon, 'id_khachhang' => $this->id_khachhang, 'ngaymua' => $this->ngaymua, 'record_status' => $this->record_status]);
     return $dataProvider;
 }
Exemple #4
0
 /**
  * Finds the Hoadon model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Hoadon the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Hoadon::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getHoadon()
 {
     return $this->hasOne(Hoadon::className(), ['hoadon_id' => 'hoadon_id']);
 }
Exemple #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdHoadon()
 {
     return $this->hasOne(Hoadon::className(), ['id_hoadon' => 'id_hoadon']);
 }
Exemple #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getHoadons()
 {
     return $this->hasMany(Hoadon::className(), ['khachhang_id' => 'khachhang_id']);
 }