/**
  * 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]);
     }
 }
Example #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]);
 }
Example #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;
 }
Example #4
0
 /**
  * Lists all Hoadon models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Hoadon::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }