Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Card::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         return false;
     }
     $query->andFilterWhere(['number' => $this->number, 'issue_date' => $this->issue_date, 'expiration_date' => $this->expiration_date, 'use_date' => $this->use_date, 'amount' => $this->amount, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'serial', $this->serial]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Card::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, 'seriesId' => $this->seriesId, 'number' => $this->number, 'issueDateTime' => $this->issueDateTime, 'endingDateTime' => $this->endingDateTime, 'lastDateOfUse' => $this->lastDateOfUse, 'currentSumm' => $this->currentSumm, 'statusId' => $this->statusId]);
     return $dataProvider;
 }
Example #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Card::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(['number' => $this->number, 'expires_date' => $this->expires_date, 'release_date' => $this->release_date, 'using_date' => $this->using_date, 'cash' => $this->cash]);
     $query->andFilterWhere(['like', 'serial', $this->serial]);
     return $dataProvider;
 }
Example #4
0
 public function actionSearch()
 {
     $card = Card::find();
     if (isset($_POST['no']) && !empty($_POST['no'])) {
         $no = $_POST['no'];
         $card->where(['no' => $no]);
     }
     $cnt = clone $card;
     $pages = new Pagination(['totalCount' => $cnt->count()]);
     $pg = isset($_GET['page']) ? $_GET['page'] : 1;
     \Yii::$app->session->set('pg', $pg);
     $pages->pageSize = 10;
     $cards = $card->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('search', ['cards' => $cards, 'pages' => $pages]);
 }
Example #5
0
 public function search($params)
 {
     $query = Card::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         //            $query->joinWith('cardStatus');
         return $dataProvider;
     }
     $sort = $dataProvider->getSort();
     $sort->attributes['attributes']['status'] = ['asc' => ['card.status' => SORT_ASC], 'desc' => ['card.status' => SORT_DESC], 'label' => 'Статус', 'default' => SORT_ASC];
     $dataProvider->setSort($sort);
     $query->andFilterWhere(['no' => $this->no, 'creation_date' => $this->creation_date, 'deactivation_date' => $this->deactivation_date, 'activity_date' => $this->activity_date, 'sum' => $this->sum, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'sn', $this->sn]);
     return $dataProvider;
 }
Example #6
0
 public function search($params)
 {
     $query = Card::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['attributes' => ['id', 'number', 'begin_date', 'end_date', 'status', 'serialDuration' => ['asc' => ['serial.duration' => SORT_ASC], 'desc' => ['serial.duration' => SORT_DESC]], 'serialReleaseDate' => ['asc' => ['serial.release_date' => SORT_ASC], 'desc' => ['serial.release_date' => SORT_DESC]], 'serialSerial' => ['asc' => ['serial.serial' => SORT_ASC], 'desc' => ['serial.serial' => SORT_DESC]]]], 'pagination' => ['pageSize' => 10]]);
     if (!($this->load($params) && $this->validate())) {
         $query->joinWith(['serial']);
         return $dataProvider;
     }
     $query->andFilterWhere(['card.id' => $this->id]);
     $query->andFilterWhere(['card.number' => $this->number]);
     $query->andFilterWhere(['card.status' => $this->status]);
     $this->filterDate($query, 'begin_date', $this->begin_date);
     $this->filterDate($query, 'end_date', $this->end_date);
     $query->joinWith(['serial' => function ($q) {
         $q->andFilterWhere(['like', 'serial.serial', $this->serialSerial]);
         $q->andFilterWhere(['serial.duration' => $this->serialDuration]);
         $this->filterDate($q, 'serial.release_date', $this->serialReleaseDate);
     }]);
     return $dataProvider;
 }
 protected function getCardOptions()
 {
     $card_options_tmp = Card::find()->where(['is not', 'cost', null])->all();
     foreach ($card_options_tmp as $card) {
         $card_options[$card['id']] = $card['name'];
     }
     return $card_options;
 }
Example #8
0
 public function addNewCommentMoveBack($id)
 {
     if (!Auth::check()) {
         return redirect("/");
     }
     $newComment = new Comment();
     $newComment->detail = "(แก้ไข)(" . Input::get('before') . "  To  " . Input::get('after') . ") " . Input::get('detail');
     $newComment->edit_status = 1;
     $newComment->Card_id = $id;
     $newComment->User_id = Auth::user()->id;
     $newComment->save();
     $card = Card::find($id);
     $card->type_id = 2;
     $card->status_complete = 0;
     $card->save();
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $card = Card::find($id);
     if ($card) {
         $card->delete();
         Session::flash('success', Lang::get('ruban.card.deleted'));
         return Redirect::route('ruban.cards.index');
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }
 /**
  * Lists all Card models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Card::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }